Hi Paul:
Paul Fremantle wrote:
Since I added the Startup model we now have 4 different uses of the
J2SE ServiceProvider code.
[...]
However, I'm also wondering if there is a way we can simplify all
these examples into one. Obviously if we had Java1.5 we could use
Generics for this, but we dont!
Any ideas?
One idea would be to use a single "Provider" marker interface for any
class that's a Synapse plugin of any kind. Then your
Service.providers() call looks up that interface, and all we do when we
find one is ensure that the class is loaded (this may already happen
inside sun.misc.Service in fact, I'm not sure). Then you leave it up to
each plugin to handle registration by doing something like:
class MyMediator implements Mediator, Provider {
static {
MediatorFactory.register(MyMediator.class);
}
}
Pro: unifies interface, simplifies our code, static initializers don't
strictly require service provider pattern.
Con: requires plugin authors to call the correct registration API.
I don't know if this kind of approach is worth it, but it did pop to mind.
Thanks,
--Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]