I was thinking about Dan's proposal to add path support to the classpath
loader as well as David Warnock's questions about i18n auto-magic and
realized they were related.

Re Dan's, I was uncomfortable with the classpath loader acquiring 'memory' -
once it found something, it stuck it there for good until a restart, which I
didn't think supported the usual expectations of a classpath-ish loader -
although I saw that he had a valid need.

Re David's, it's also a valid requirement, but I am not a big fan of magic
stuff in the core.

So here is what I cooked up -  adapters for any resource loader.

The idea is that you make one of these, which extends ResourceLoader, and as
part of it's configuration, you supply the class and properties for a 'real'
loader, like File- or Classpath-.

So then you make an adapter for whatever purpose you want - I tried to make
one copying from Dan's proposed modifications so he can test it to see if it
works.

For David, same thing - you can make an adapter to go on a journey of
discovery, but modifying the template name rather than the path.

I'm not sure this is the best approach in terms of structure. Certainly if
this approach seems useful, we should refactor the resource system to make
this a formal thing - that the concept of a 'ResourceAdapter' is a first
class citizen, rather than this sneaky approach.

Anyhow, attached is the code and a velocity.properties to show how it can be
configured.  This is nowhere near tested...


geir


-- 
Geir Magnusson Jr.                                     [EMAIL PROTECTED]
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert

Attachment: PathMapAdapter.java
Description: Binary data

Attachment: velocity.properties
Description: Binary data

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to