Matt, Thanks for the note - appreciate the pragmatic comment.
Are there any other changes or new capabilities you'd find useful in a data resource loader? Best, WILL ----- Original Message ----- From: "Matt Raible" <[EMAIL PROTECTED]> To: "Velocity Developers List" <[EMAIL PROTECTED]> Sent: Thursday, April 29, 2004 7:10 PM Subject: Re: Create a DataSourceResourceLoader that can be wired to the datasource with IoC > I don't care how things are done, but Will's patch (and a subsequent > modification in Spring) made this DataSource-use-outside-of-JNDI work > quite nicely. I don't car as much about architecture as you guys - I > just want to get something that works. > > Matt > > On Apr 29, 2004, at 5:30 PM, Will Glass-Husain wrote: > > > Hi Geir, > > > > Not sure what your specific objection is. My proposed patch adds some > > flexibility to the resource loaders by allowing an instance to be > > passed in > > instead of just the class name. There's already a precedent for this > > (the > > loggers). And it's entirely backwards compatible. With the addition > > of a > > setter to the DataSourceResourceLoader it solves the problem. (Matt's > > tested and applied the patch:, although I warned him it was at his own > > risk). > > > > I'm open to your suggested alternative (have the Spring developer use > > the > > Application attributes to pass the DataSource to a custom loader) but > > I'm > > not familiar enough with Spring to know if this is feasible. As we'd > > framed > > it earlier, the request is to configure the resource loader and > > Velocity > > with a live DataSource by using with either Property settings or > > bean-type > > setters. This would be a different route. Matt, can you weigh in on > > Geir's idea? > > > > Best, > > > > WILL > > > > ----- Original Message ----- > > From: "Geir Magnusson Jr" <[EMAIL PROTECTED]> > > To: "Velocity Developers List" <[EMAIL PROTECTED]> > > Sent: Thursday, April 29, 2004 4:12 PM > > Subject: Re: Create a DataSourceResourceLoader that can be wired to the > > datasource with IoC > > > > > >> I'm a little suspicious, as we have a facility for an application to > >> pass whatever they want to down into components - application > >> attributes. The original driving case was (I think) to send something > >> to a loader. > >> > >> For example, it's how the webapp resource loader gets and uses the > >> servlet context. > >> > >> So I'd rather see us fix the DatasourceResourceLoader.... > >> > >> On Apr 27, 2004, at 2:38 PM, Will Glass-Husain wrote: > >> > >>> Hi, > >>> > >>> I'd like to address this issue. Any comments on my suggested > >>> approach? > >>> Specifically, I thought we could allow RuntimeInstance to take a live > >>> instance of a resource loader as a property as an alternative to a > >>> class > >>> name. I've recently discovered that Velocity accepts loggers passed > >>> in this > >>> way. > >>> > >>> from: EventHandlingTestCase.java > >>> > >>> Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, this ); > >>> Velocity.init(); > >>> > >>> The basic idea is that the developer instantiates a resource loader, > >>> configures it with a JNDI name and then passes it to Velocity. > >>> > >>> Inversion of Control and Spring are hot topics now in the Java / open > >>> source > >>> community, I think it'd be nice to modify the tool to be compatible. > >>> Matt > >>> Raible's an ardent Spring user, so we can get immediate feedback. > >>> > >>> Any comments or suggestions before I write this patch? > >>> > >>> WILLL > >>> > >>> > >>> > >>> > >>> ----- Original Message ----- > >>> From: <[EMAIL PROTECTED]> > >>> To: <[EMAIL PROTECTED]> > >>> Sent: Monday, April 26, 2004 8:54 PM > >>> Subject: DO NOT REPLY [Bug 28611] New: - Create a > >>> DataSourceResourceLoader > >>> that can be wired to the datasource with IoC > >>> > >>> > >>>> DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG > >>>> RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT > >>>> <http://issues.apache.org/bugzilla/show_bug.cgi?id=28611>. > >>>> ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND > >>>> INSERTED IN THE BUG DATABASE. > >>>> > >>>> http://issues.apache.org/bugzilla/show_bug.cgi?id=28611 > >>>> > >>>> Create a DataSourceResourceLoader that can be wired to the > >>>> datasource > >>>> with > >>> IoC > >>>> > >>>> Summary: Create a DataSourceResourceLoader that can be > >>>> wired to > >>>> the datasource with IoC > >>>> Product: Velocity > >>>> Version: 1.4 > >>>> Platform: Other > >>>> OS/Version: Other > >>>> Status: NEW > >>>> Severity: Enhancement > >>>> Priority: Other > >>>> Component: Source > >>>> AssignedTo: [EMAIL PROTECTED] > >>>> ReportedBy: [EMAIL PROTECTED] > >>>> > >>>> > >>>> 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> > >>>> > >>>> -------------------------------------------------------------------- > >>>> - > >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>>> For additional commands, e-mail: > >>>> [EMAIL PROTECTED] > >>>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> > >> -- > >> Geir Magnusson Jr 203-247-1713(m) > >> [EMAIL PROTECTED] > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
