You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Neeme Praks <ne...@inpoc.com> on 2002/01/02 21:02:56 UTC

component factories...

Question about component management in Excalibur:
When I need to do dynamic class loading with
classloader.loadClass(className).newInstance(), should I do this with my
code or should I just use ComponentManager for this also? What is the "best
practice"?

FYI, I'm trying to find the best way to implement
org.apache.avalon.excalibur.i18n.DefaultBundleFactory (in scratchpad).
Right now it does it like this:

Thread.currentThread().getContextClassLoader().loadClass(bundleClassName).ne
wInstance();
And then manages the lifecycle methods...
However, I would like Excalibur to take care of that and the lifecycle
methods. Is it ok, if I just require the user to declare all the different
bundle implementations and then ask for instances from
ExcaliburComponentSelector? Or is it a bit of abusing the
ExcaliburComponentSelector, if I use it like this (as a factory)?

Rgds,
Neeme


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: component factories...

Posted by Berin Loritsch <bl...@apache.org>.
Neeme Praks wrote:

> Question about component management in Excalibur:
> When I need to do dynamic class loading with
> classloader.loadClass(className).newInstance(), should I do this with my
> code or should I just use ComponentManager for this also? What is the "best
> practice"?
> 
> FYI, I'm trying to find the best way to implement
> org.apache.avalon.excalibur.i18n.DefaultBundleFactory (in scratchpad).
> Right now it does it like this:
> 
> Thread.currentThread().getContextClassLoader().loadClass(bundleClassName).ne
> wInstance();
> And then manages the lifecycle methods...
> However, I would like Excalibur to take care of that and the lifecycle
> methods. Is it ok, if I just require the user to declare all the different
> bundle implementations and then ask for instances from
> ExcaliburComponentSelector? Or is it a bit of abusing the
> ExcaliburComponentSelector, if I use it like this (as a factory)?


I want to get back to working on the container abstraction code.  I want to
separate out the Container code from ExcaliburComponentManager, and have it
as it's own entity.

This includes the ComponentHolder stuff, role management, etc.  It also is the
configuration stuff.  I want to get back to the ComponentManager being strictly
a role to component matching interface.

If the Bundles you are instantiating are not Components (as I suspect is the
case), you may want to adapt the ComponentHolder concept for yourself.  Or,
if you relax the ComponentHolder implementation code so as to work with any
object that uses Lifecycle management, it would work with both Bundles and
Components.




-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>