|
From: <jue...@we...> - 2004-04-28 08:00:08
|
Seems like you took your snapshot in the middle of my committing =
session... Please retry, everything should be consistent now.
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Matt Raible
Gesendet: Mi 28.04.2004 09:53
An: spr...@li...
Betreff: RE: [Springframework-developer] Wiring VelocityEngine with a =
DataSourceResourceLoader
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...
> [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
> VelocityEngine with a DataSourceResourceLoader
>
>
> Matt,
>=20
> VelocityEngineFactoryBean's "resourceLoader" property is
> meant to take an implementation of Spring's
> org.springframework.core.io.ResourceLoader interface. When
> setting this, VelocityEngineFactoryBean will auto-configure
> the Velocity resource loader to load file-based templates via
> the Spring ResourceLoader. When running in an
> ApplicationContext, the context will set itself as the
> ResourceLoader, through the ResourceLoaderAware interface
> (implemented by VelocityEngineFactoryBean).
>=20
> What you need to do in your scenario is to set Velocity's
> "ds.resource.loader.instance" property accordingly.
> Unfortunately, VelocityEngineFactoryBean's
> "velocityProperties" property takes a java.util.Properties
> instance, just intended for String values. So I've just added
> a "velocityPropertiesMap" property that takes a
> java.util.Map, allowing for non-String values:
>=20
> <bean id=3D"velocityEngine"
> class=3D"org.springframework.ui.velocity.VelocityEngineFactoryBean"
> singleton=3D"true">
> <property name=3D"velocityProperties">
> <props>
> <prop key=3D"resource.loader">ds</prop>
> <prop
> key=3D"ds.resource.loader.resource.table">template</prop>
> <prop
> key=3D"ds.resource.loader.resource.keycolumn">name</prop>
> <prop
> key=3D"ds.resource.loader.resource.templatecolumn">content</prop>
> <prop
> =
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
> bean=3D"dataSource"/></prop>
> </map>
> </property>
> </bean>
>
> Of course, you can also define all your Velocity properties
> via "velocityPropertiesMap": You need to use the
> <map>/<entry> syntax for all properties then, though,
> wrapping all your String values with <value> tags.
>=20
> Juergen
>=20
>
> ________________________________
>
> Von: spr...@li... im
> Auftrag von Matt Raible
> Gesendet: Mi 28.04.2004 05:20
> An: spr...@li...
> Betreff: [Springframework-developer] Wiring VelocityEngine
> with a DataSourceResourceLoader
>
>
>
> I've been talking with some Velocity folks about modifying their
> DataSourceResourceLoader to allow setting the DataSource
> (currently it
> makes you specify a JNDI string in your properties). They have done
> this and provided a patch:
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=3D28611
>
> This is my idea of how it would be configured in Spring:
>
> <!-- Configure Velocity for sending e-mail -->
> <bean id=3D"velocityEngine"
> class=3D"org.springframework.ui.velocity.VelocityEngineFactoryBean"
> singleton=3D"true">
> <property name=3D"velocityProperties">
> <props>
> <prop key=3D"resource.loader">ds</prop>
> <prop
> key=3D"ds.resource.loader.resource.table">template</prop>
> <prop
> key=3D"ds.resource.loader.resource.keycolumn">name</prop>
> <prop
> key=3D"ds.resource.loader.resource.templatecolumn">content</prop>
> <prop
> =
key=3D"ds.resource.loader.resource.timestampcolumn">last_modified</prop>
> </props>
> </property>
> <property name=3D"resourceLoader"><ref
> local=3D"templateLoader"/></property>
> </bean>
>
> <bean id=3D"templateLoader" singleton=3D"true"
> =20
> class=3D"org.apache.velocity.runtime.resource.loader.DataSourceR
> esourceLoa
> der">
> <property name=3D"dataSource"><ref
> local=3D"dataSource"/></property> </bean>
>
> However, I get the following error:
>
> [junit] Caused by:
> org.springframework.beans.factory.BeanCreationException:
> Error creating
> bean with name 'velocityEngine' defined in class path resource
> [applicationContext.xml]: Error setting property values; nested
> exception is
> org.springframework.beans.PropertyAccessExceptionsException:
> PropertyAccessExceptionsException (1 errors); nested
> propertyAccessExceptions are:
> [org.springframework.beans.TypeMismatchException: Failed to convert
> property value of type
> [org.apache.velocity.runtime.resource.loader.DataSourceResourc
> eLoader]
> to required type [org.springframework.core.io.ResourceLoader] for
> property 'resourceLoader'; nested exception is
> java.lang.IllegalArgumentException: argument type mismatch]
>
> Is it possible to allow this, or some other way of initializing this
> ResourceLoader and putting it in the Engine? Here's the code you can
> use if you were programming this:
>
> DataSourceResourceLoader ds =3D new DataSourceResourceLoader();
> ds.setDataSource(DATASOURCE);
> Velocity.setProperty("ds.resource.loader.instance",ds);
> Velocity.init();
>
> Thanks,
>
> Matt
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market...
> Oracle 10g. Take an Oracle 10g class now, and we'll give you
> the exam FREE. =
http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market...
> Oracle 10g.
> Take an Oracle 10g class now, and we'll give you the exam FREE.
> http://ads.osdn.com/?ad_id149&alloc_id=8166&op=CCk
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id=8166&op=3Dick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|