> > I am just changing that code now, I was trying to
> > have it ready for you by the time you got it :-)
Actually what ended up being changed is the ResourceManager:
now the ResourceManager passes on a subset of the
velocity.properties to the loaders in the standard
ResourceManager.init(), but it now makes the properties
available as a class like VelocityResources. I actually
took the GenericResources from Turbine. The upshot
is that with the resource loader being initialized with
a GenericResources class you can do things like the
following:
public void init(GenericResources resources)
{
Vector paths = resources.getVector("resource.path");
String whatever = resource.getString("resource.whatever");
}
What I have now is working but I would like to clean
it up some more and try to make a single Resources class
that maybe is not named GenericResources/VelocityResources
as the name is quite confusing given our use of resources
label in other parts of Velocity. I was going to chat
with Jon about it as he co-wrote the Configurations/ExtendedProperties
classes that are the base of the VelocityResources class.
I added, what I think, is a useful method in the VelocityResources
where you can easily grab a subset of resources and have it
returned as a resources class as well. So in the resource
manager I grab the subset of resources that pertain to the
resource loader and initialize with that instead of a Map.
It's confusing because of the nomenclature, but the code
inside the ResourceManager is a lot cleaner now.
> I guess I don't understand why this wouldn't simply be left to the
> loader implementation, since I assume that loaders can have different
> property sets anyway.
It's all done in the ResourceManager, and loaders now get
a subset of properties that pertain to them when they
are initialized.
> If a loader can support multiple 'nodes' (jars, files, datasources,
> hamsters...), then it deals with that itself in its own init().
Yup, that's what's happening. I will clean this up today
and try out multiple paths in the file resource loader.
jvz.