You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2005/10/11 20:30:10 UTC

[jira] Updated: (VELOCITY-267) Create a DataSourceResourceLoader that can be wired to the datasource with IoC

     [ http://issues.apache.org/jira/browse/VELOCITY-267?page=all ]

Will Glass-Husain updated VELOCITY-267:
---------------------------------------

    Bugzilla Id:   (was: 28611)
    Fix Version: 1.5
    Description: 
I'd like to create a ResourceLoader similar to DataSourceResourceLoader, except that I'd like to set 
the DataSource via IoC (in Spring).  The main reason for this is so my database-loading of templates 
does not depend on a JNDI connection.  

The main problem is how to manage a ResourceLoader with Spring and then set it declaratively on its 
VelocityEngine - rather than via properties.

<suggested patch from Will Glass-Husain>
Does this mean that you'd need to pass in an instance of a resource manager
(initialized with the datasource) to VelocityEngine, rather than just set
the class name as a property? (MR - Yes)

As I understand the source code, this doesn't seem possible.  But I think a
patch wouldn't be difficult.  (a change to
RuntimeInstance.initializeResourceManager) to look for an instance of the
class as well as the class name.  Something similar to
LogManager.createLogSystem which accepts as a property the class name of a
class that implements LogSystem, or an instance of the class itself.
</suggested patch>

  was:
I'd like to create a ResourceLoader similar to DataSourceResourceLoader, except that I'd like to set 
the DataSource via IoC (in Spring).  The main reason for this is so my database-loading of templates 
does not depend on a JNDI connection.  

The main problem is how to manage a ResourceLoader with Spring and then set it declaratively on its 
VelocityEngine - rather than via properties.

<suggested patch from Will Glass-Husain>
Does this mean that you'd need to pass in an instance of a resource manager
(initialized with the datasource) to VelocityEngine, rather than just set
the class name as a property? (MR - Yes)

As I understand the source code, this doesn't seem possible.  But I think a
patch wouldn't be difficult.  (a change to
RuntimeInstance.initializeResourceManager) to look for an instance of the
class as well as the class name.  Something similar to
LogManager.createLogSystem which accepts as a property the class name of a
class that implements LogSystem, or an instance of the class itself.
</suggested patch>

    Environment: 
Operating System: other
Platform: Other

  was:
Operating System: other
Platform: Other


> Create a DataSourceResourceLoader that can be wired to the datasource with IoC
> ------------------------------------------------------------------------------
>
>          Key: VELOCITY-267
>          URL: http://issues.apache.org/jira/browse/VELOCITY-267
>      Project: Velocity
>         Type: Improvement
>   Components: Source
>     Versions: 1.5
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Matt Raible
>     Priority: Minor
>      Fix For: 1.5
>  Attachments: DatabaseResourceLoader.java, resource_ioc.patch, resourceinstance.zip
>
> I'd like to create a ResourceLoader similar to DataSourceResourceLoader, except that I'd like to set 
> the DataSource via IoC (in Spring).  The main reason for this is so my database-loading of templates 
> does not depend on a JNDI connection.  
> The main problem is how to manage a ResourceLoader with Spring and then set it declaratively on its 
> VelocityEngine - rather than via properties.
> <suggested patch from Will Glass-Husain>
> Does this mean that you'd need to pass in an instance of a resource manager
> (initialized with the datasource) to VelocityEngine, rather than just set
> the class name as a property? (MR - Yes)
> As I understand the source code, this doesn't seem possible.  But I think a
> patch wouldn't be difficult.  (a change to
> RuntimeInstance.initializeResourceManager) to look for an instance of the
> class as well as the class name.  Something similar to
> LogManager.createLogSystem which accepts as a property the class name of a
> class that implements LogSystem, or an instance of the class itself.
> </suggested patch>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org