You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Dave Bryson <da...@miceda-data.com> on 2001/03/03 06:21:41 UTC
Loading multiple jars
Hey guys,
Looking at the ResourceManager from our earlier chat about loading multi jars...
I tried :
resource.loader.1.resource.path = jar:file:test.jar!/
resource.loader.1.resource.path = jar:file:template.jar!/
That doesn't work. it'll only see one.
What I'd like to do is this:
resource.loader.1.resource.path = jar:file:test.jar!/,jar:file:template.jar!/
But this means i need to change the ResourceManager ( see line: 166 )
to look for "resource.path" and use:
VelocityResources.getVector(property); - instead of getString()
This should also be beneficial to loading multi paths in FileResourceLoader.
Any objections to this? Or is there a better way that i'm missing?
--
Dave Bryson
daveb@miceda-data.com
----------------------
Re: Loading multiple jars
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jason van Zyl wrote:
>
> > > 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.
This sounds great, actually :)
>
> 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.
+1
> > 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.
This sounds great.
--
Geir Magnusson Jr. geirm@optonline.com
Developing for the web? See http://jakarta.apache.org/velocity/
Re: Loading multiple jars
Posted by Jason van Zyl <jv...@periapt.com>.
> > 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.
Re: Loading multiple jars
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jason van Zyl wrote:
>
> On Fri, 2 Mar 2001, Dave Bryson wrote:
>
>
> > What I'd like to do is this:
> >
> > resource.loader.1.resource.path = jar:file:test.jar!/,jar:file:template.jar!/
> >
> > But this means i need to change the ResourceManager ( see line: 166 )
> > to look for "resource.path" and use:
> >
> > VelocityResources.getVector(property); - instead of getString()
> >
> > This should also be beneficial to loading multi paths in FileResourceLoader.
> > Any objections to this? Or is there a better way that i'm missing?
>
> I am just changing that code now, I was trying to
> have it ready for you by the time you got it :-)
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.
If a loader can support multiple 'nodes' (jars, files, datasources,
hamsters...), then it deals with that itself in its own init().
geir
--
Geir Magnusson Jr. geirm@optonline.com
Developing for the web? See http://jakarta.apache.org/velocity/
Re: Loading multiple jars
Posted by Jason van Zyl <jv...@periapt.com>.
On Fri, 2 Mar 2001, Dave Bryson wrote:
> Hey guys,
>
> Looking at the ResourceManager from our earlier chat about loading multi jars...
>
> I tried :
>
> resource.loader.1.resource.path = jar:file:test.jar!/
> resource.loader.1.resource.path = jar:file:template.jar!/
>
> That doesn't work. it'll only see one.
>
> What I'd like to do is this:
>
> resource.loader.1.resource.path = jar:file:test.jar!/,jar:file:template.jar!/
>
> But this means i need to change the ResourceManager ( see line: 166 )
> to look for "resource.path" and use:
>
> VelocityResources.getVector(property); - instead of getString()
>
> This should also be beneficial to loading multi paths in FileResourceLoader.
> Any objections to this? Or is there a better way that i'm missing?
I am just changing that code now, I was trying to
have it ready for you by the time you got it :-)
I'm in the chat room if you want to go over it.
jvz.