OK... I've broken everything out into separate pieces. Performance
is about 1/3 where I started (3 times slower) two weeks ago :-(
The basic modules are in o.a.c.discovery.
Real function is in o.a.c.d.resource.*.
I'm not really happy about the resultant names.
Costin - you are gonna hate this: I merged all *Info classes
into ResourceInfo... It was a real nightmare to debug code.
So, in the end I broke everything back out into three and
renamed the whole bunch:
- ResourceClass
extends Resource
extends ResourceName
For better type-checking all around, there are also:
- ResourceClassDicover
extends ResourceDiscover
extends ResourceNameDiscover
- ResourceClassIterator
extends ResourceIterator
extends ResourceNameIterator
[I really despised type-casting everything coming back
out of Enumeration - error prone & confusing. If
someone really wants Enumeration, someone could probably
write ANOTHER wrapper around *Iterator to give back an
Enumeration]
Debugging became a breeze... sorry to do that to you, but I
think it really is more usable.
So, now you can easily string a bunch of ResourceNameDiscover
implementation classes (found in o.a.c.d.resource.names) together
using 'o.a.c.d.resource.names.NameDiscoverers', then hand the
whole bundle to either 'o.a.c.d.resource.DiscoverResources'
or to 'o.a.c.d.resource.classes.DiscoverClasses'.
I mentioned this earlier, and you had some concerns - so one
I'll go into more detail here:
DiscoverClasses is currently obtaining the URL of the class
by using loader.getResource() and stashing both the URL and
the loader in ResourceClass. ResourceClass can later resolve
java.lang.Class using loader.loadClass(). While I don't see
an immediate need for the URL, going through the process
let's me identify the class & loader to be used later
(defered processing) if/when the class is actually loaded.
What I *don't* do is use getResources() - that simply gives
me a lot of classes that I may or may not be able to *load*.
[these are classes, not general resources].
I keep a history of classes found (URL), and only return
the first for duplicate URL's. So, it's *possible* that
you might get back multiple classes found by different
class loaders.. then you have the URL's if you desire.
I'm in tomorrow, then out for the next week.
It all seems to work *SLOW*.
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
|