Jason van Zyl wrote:

> # Specify the resource loaders you wish to use. If you
> # are debugging resource loaders, simply comment out
> # the line for a resource loader to prevent its use in the
> # Runtime. The search order to find a resource is
> # the order you list your resource loaders here. If you
> # wish to change the search order, simply move the
> # lines around to suit your situation.
> 
> resource.loader = file
> resource.loader = classpath

Can we add a tag to make it meaningful, such as 

resource.loader.id = file

 
> # Configuration for the 'file' resource loader
> 
> file.resource.loader.class = o.a.v.r.r.l.FileResourceLoader
> file.resource.loader.description = File Resource Loader
> file.resource.loader.cache = true
> file.resource.loader.modificationIntervalCheck = 2
> file.resource.loader.path = path1
> file.resource.loader.path = path2
> 
> # Configuration for the 'classpath' resource loader
> 
> classpath.resource.loader.class = o.a.v.r.r.l.ClasspathResourceLoader
> classpath.resource.loader.description = Classpath Resource Loader
> classpath.resource.loader.cache = true
> 

Fundamentally, I think this is a great idea, as it will be easier to
human-read the properties file and will help us work on eliminating the
'hail mary' associated with FILE_LOADER_PATH.

I do agree 100% with Jon regarding changing the order to be

  resource.loader.<name>.<property>

So with the change that jon suggested, I think this is a good idea.
(It's also as trivial to parse as the previous too...)

However, I don't think we should add to the misery of the 'repeated
identical property' problem.  I would like to see, for definition of the
individual loaders-by-name

 resource.loader.1 = file
 resource.loader.2 = classpath

which will

 - provide explicit ordering of loader check order. A result of that
would be you can put everything into jars, but if you need to replace a
template file that is in a jar, you can just drop it in to be picked up
by the file loader (given the ordering above)  Similar to how in a
servlet container you can 'override' a class in a jar by dropping it
into WEB-INF/classes.  Very convenient feature, I think.

 - provide safety in that the properties parser can check to see if
someone 'overwrote' a resource.loader definition

And further, repeat the same arguments for 

 file.resource.loader.path.1 = path1
 file.resource.loader.path.2 = path2

Lastly,  irrespective of the conclusion of the 'do we keep the init(
Properties )' discussion, it will allow our users to manage their
Velocity properties in a Properties, something I am convinced is a
common pattern.

So, yep - good thing.

geir

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Developing for the web?  See http://jakarta.apache.org/velocity/

Reply via email to