--- Nathan Bubna <[EMAIL PROTECTED]> wrote: > On 6/1/07, Matt Benson <[EMAIL PROTECTED]> wrote: [SNIP] > > lot of magic involved; I've seen implications that > > only one e.g. "file" ResourceLoader can be active > for > > a VelocityEngine, and similar things that strike > me > > funny. > > You can definitely have as many FileResourceLoaders > as you want, > either per engine or per app, you just can't name > them all "file". > Try "file2" or "otherfile" for latter ones. :) > However, i don't know > of many usecases for having multiple > FileResourceLoaders. Most often > you find people mixing different resource loader > impls. Such as a > FileResourceLoader and a ClasspathResourceLoader. > or a WebappLoader > (from VelocityTools) and a DataSourceResourceLoader. >
My superficial understanding of anakia is that it configures a VelocityEngine to use the "file" resource loader, then uses a basedir and file paths to locate xml files from which it creates DOMs to shove into the velocity context. It seems to me more natural to use another file-based ResourceLoader to locate the XML files, you see? > The StringResourceLoader has some pretty serious > flaws in Velocity > 1.5, so you can currently only use one per JVM. > This has been fixed > for Velocity 1.6, though. Probably immaterial here. :) > > > If there is a current "Resource guru" in > > Velocity-land who could provide an overview, that > > would certainly be welcome. Quick looks at the > > ResourceManagerImpl didn't leave me with a strong > > impression of what level of customization is > intended > > to be supported. > > I dunno if there's a "resource guru", but you'd find > me pretty hard to > stump when it comes to Velocity resource loading. :) > > Typically, most apps using Velocity need little more > than customizing > resource loader settings in their > velocity.properties. We provide > ResourceLoader impls for loading from the file > system, servlet > context, databases, classpaths, and > java.lang.Strings. Most users > just need to configure those a little or a lot. > > The next level is implementing your own > ResourceLoader subclass. I > don't think this happens much outside of frameworks > who are > integrating Velocity into their framework. So far > it sounds like this > is what you'll need to do. For the Ant 1.7-compatible Anakia 2.0 branch, yes. > > The ResourceManagerImpl manages the ResourceLoaders > and the > ResourceCache. Since you can plug in your own > loaders and cache, > implementing your own ResourceManager is something > i've never seen > cause for. I don't recall anyone ever asking about > it either. I > doubt you'd need or want to do this, but who knows? > There's a first > time for everything. I agree, it doesn't look like I'd need this. > > Plugging in your own ResourceCache also seems > somewhat unlikely to be > necessary, but this can be done if you're not happy > merely configuring > the size of the LRU cache used in the default impl. > > The last thing that might be handy to know is that > you can also feed > an already instantiated ResourceLoader into the > system (rather than > have it be loaded and instantiated by class name). > If you want more > details on that, ask away. :) > This is the most interesting thing to me--it seems like a reasonable assertion to say that other APIs intending to use Velocity under the covers would be justified in doing things in as much a Java-centric, and consequently as little a Velocity-centric way, and being able to easily set up the ResourceLoader without having to rely too much on Velocity's internal machinery would seem to significantly decrease the ramp-up time to productivity. IOW, I would definitely like to know more about this subject. :) -Matt > > -Matt > > > > > > > > > Regards, > > > > Matt > > > > > > > > > > > > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > > > Choose the right car based on your needs. > Check > > > out Yahoo! Autos new Car Finder tool. > > > > http://autos.yahoo.com/carfinder/ > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > 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] > > > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > Be a better Globetrotter. Get better travel > answers from someone who knows. Yahoo! Answers - > Check it out. > > > http://answers.yahoo.com/dir/?link=list&sid=396545469 > > > > > --------------------------------------------------------------------- > > 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] > > ____________________________________________________________________________________Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. http://tv.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
