|
From: Matt R. <li...@ra...> - 2004-04-28 07:54:38
|
Looks great Juergen, unfortunately the anonymous CVS gives me a build
error. Maybe the pserver is not synched up with ext?
[javac]
C:\Source\spring\src\org\springframework\jdbc\core\support\AbstractLobSt
reamingResultSet
Extractor.java:24: cannot resolve symbol
[javac] symbol : class LobRetrievalFailureException
[javac] location: package jdbc
[javac] import
org.springframework.jdbc.LobRetrievalFailureException;
[javac] ^
[javac]
C:\Source\spring\src\org\springframework\jdbc\core\support\AbstractLobSt
reamingResultSet
Extractor.java:63: cannot resolve symbol
[javac] symbol : class LobRetrievalFailureException
[javac] location: class
org.springframework.jdbc.core.support.AbstractLobStreamingResultSetExtra
ctor
[javac] throw new
LobRetrievalFailureException("Couldn't stream LOB
content", ex);
[javac] ^
[javac]
C:\Source\spring\src\org\springframework\jdbc\core\support\AbstractLobSt
reamingResultSet
Extractor.java:76: cannot resolve symbol
[javac] symbol : class LobRetrievalFailureException
[javac] location: class
org.springframework.jdbc.core.support.AbstractLobStreamingResultSetExtra
ctor
[javac] throw new LobRetrievalFailureException("No row
found in database");
[javac] ^
[javac]
C:\Source\spring\src\org\springframework\jdbc\core\support\AbstractLobSt
reamingResultSet
Extractor.java:86: cannot resolve symbol
[javac] symbol : class LobRetrievalFailureException
[javac] location: class
org.springframework.jdbc.core.support.AbstractLobStreamingResultSetExtra
ctor
[javac] throw new LobRetrievalFailureException("Multiple
rows found in database");
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -deprecation for details.
[javac] 4 errors
> -----Original Message-----
> From: spr...@li...=20
> [mailto:spr...@li...]
> On Behalf Of j=FCrgen h=F6ller [werk3AT]
> Sent: Wednesday, April 28, 2004 1:23 AM
> To: spr...@li...
> Subject: Re: [Springframework-developer] Wiring=20
> VelocityEngine with a DataSourceResourceLoader
>=20
>=20
> Matt,
> =20
> VelocityEngineFactoryBean's "resourceLoader" property is=20
> meant to take an implementation of Spring's=20
> org.springframework.core.io.ResourceLoader interface. When=20
> setting this, VelocityEngineFactoryBean will auto-configure=20
> the Velocity resource loader to load file-based templates via=20
> the Spring ResourceLoader. When running in an=20
> ApplicationContext, the context will set itself as the=20
> ResourceLoader, through the ResourceLoaderAware interface=20
> (implemented by VelocityEngineFactoryBean).
> =20
> What you need to do in your scenario is to set Velocity's=20
> "ds.resource.loader.instance" property accordingly.=20
> Unfortunately, VelocityEngineFactoryBean's=20
> "velocityProperties" property takes a java.util.Properties=20
> instance, just intended for String values. So I've just added=20
> a "velocityPropertiesMap" property that takes a=20
> java.util.Map, allowing for non-String values:
> =20
> <bean id=3D"velocityEngine"=20
> class=3D"org.springframework.ui.velocity.VelocityEngineFactoryBean"=20
> singleton=3D"true">
> <property name=3D"velocityProperties">
> <props>
> <prop key=3D"resource.loader">ds</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.table">template</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.keycolumn">name</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.templatecolumn">content</prop>
> <prop=20
> =
key=3D"ds.resource.loader.resource.timestampcolumn">last_modified</prop>
> </props>
> </property>
> <property name=3D"velocityPropertiesMap">
> <map>
> <entry key=3D"ds.resource.loader.instance"><ref=20
> bean=3D"dataSource"/></prop>
> </map>
> </property>
> </bean>
>=20
> Of course, you can also define all your Velocity properties=20
> via "velocityPropertiesMap": You need to use the=20
> <map>/<entry> syntax for all properties then, though,=20
> wrapping all your String values with <value> tags.
> =20
> Juergen
> =20
>=20
> ________________________________
>=20
> Von: spr...@li... im=20
> Auftrag von Matt Raible
> Gesendet: Mi 28.04.2004 05:20
> An: spr...@li...
> Betreff: [Springframework-developer] Wiring VelocityEngine=20
> with a DataSourceResourceLoader
>=20
>=20
>=20
> I've been talking with some Velocity folks about modifying their=20
> DataSourceResourceLoader to allow setting the DataSource=20
> (currently it=20
> makes you specify a JNDI string in your properties). They have done=20
> this and provided a patch:
>=20
> http://issues.apache.org/bugzilla/show_bug.cgi?id=3D28611
>=20
> This is my idea of how it would be configured in Spring:
>=20
> <!-- Configure Velocity for sending e-mail -->
> <bean id=3D"velocityEngine"=20
> class=3D"org.springframework.ui.velocity.VelocityEngineFactoryBean"=20
> singleton=3D"true">
> <property name=3D"velocityProperties">
> <props>
> <prop key=3D"resource.loader">ds</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.table">template</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.keycolumn">name</prop>
> <prop=20
> key=3D"ds.resource.loader.resource.templatecolumn">content</prop>
> <prop=20
> =
key=3D"ds.resource.loader.resource.timestampcolumn">last_modified</prop>
> </props>
> </property>
> <property name=3D"resourceLoader"><ref=20
> local=3D"templateLoader"/></property>
> </bean>
>=20
> <bean id=3D"templateLoader" singleton=3D"true"
> =20
> class=3D"org.apache.velocity.runtime.resource.loader.DataSourceR
> esourceLoa
> der">
> <property name=3D"dataSource"><ref=20
> local=3D"dataSource"/></property> </bean>
>=20
> However, I get the following error:
>=20
> [junit] Caused by:=20
> org.springframework.beans.factory.BeanCreationException:=20
> Error creating=20
> bean with name 'velocityEngine' defined in class path resource=20
> [applicationContext.xml]: Error setting property values; nested=20
> exception is=20
> org.springframework.beans.PropertyAccessExceptionsException:=20
> PropertyAccessExceptionsException (1 errors); nested=20
> propertyAccessExceptions are:=20
> [org.springframework.beans.TypeMismatchException: Failed to convert=20
> property value of type=20
> [org.apache.velocity.runtime.resource.loader.DataSourceResourc
> eLoader]=20
> to required type [org.springframework.core.io.ResourceLoader] for=20
> property 'resourceLoader'; nested exception is=20
> java.lang.IllegalArgumentException: argument type mismatch]
>=20
> Is it possible to allow this, or some other way of initializing this=20
> ResourceLoader and putting it in the Engine? Here's the code you can=20
> use if you were programming this:
>=20
> DataSourceResourceLoader ds =3D new DataSourceResourceLoader();
> ds.setDataSource(DATASOURCE);
> Velocity.setProperty("ds.resource.loader.instance",ds);
> Velocity.init();
>=20
> Thanks,
>=20
> Matt
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market...=20
> Oracle 10g. Take an Oracle 10g class now, and we'll give you=20
> the exam FREE. =
http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick
> _______________________________________________
> Springframework-developer mailing list=20
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market...=20
> Oracle 10g.=20
> Take an Oracle 10g class now, and we'll give you the exam FREE.=20
> http://ads.osdn.com/?ad_id149&alloc_id=8166&op=CCk
> _______________________________________________
> Springframework-developer mailing list=20
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
|