On 2/11/02 8:37 PM, "Daniel Rall" <[EMAIL PROTECTED]> wrote:
> "Geir Magnusson Jr." <[EMAIL PROTECTED]> writes: > >> 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. > > As you noticed, the "memory" is used to keep the resource lookups > quick. FileResourceLoader currently uses this same technique. Yes, but for the classpath, not sure you want that. > >> 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. >> >> 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. > > So the adapter wraps the resource loader. Formalizing the concept of > an adaptive loader is it good idea. It draws on the existing Velocity > configuraiton vocabulary and extends it, which is much better than > introducing an entirely new entity (the new addition won't be as > foreign to developers). I've gone ahead and checked in the code as > two classes, LoaderAdapter and PathMapAdapter, which are two halves of > the code seen below. I'm thinking that LoaderAdapter might be better > named either ResourceLoaderAdapter or AdaptiveResourceLoader. > Thoughts? Well, I kind of liked it in the package I put it, but that's minor. What I really was getting at was to do something completely different that this - but wanted to test the waters to see if this would work for you. -- Geir Magnusson Jr. [EMAIL PROTECTED] System and Software Consulting My inner cowboy needs to yodel. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
