> From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]] 
>
> Would work, but if that's the case, I have to implement a 
> "factory", the parser itself (including the "factory" 
> interface, the parser interface) etc. and I don't see the 
> great advantage in using a component framework anymore as I 
> code most part myself.
> 
> Am I wrong? 

Carsten,

you got it right. Those are exactly the implications of the
proposal.

Now for the good parts: The factory can be generic.
So I code up a PooledFactory that takes your component class
as a parameter, and bam there we go.

The only change is that you'll have to grab the factories
out of the ComponentManager in the compose() method:

<component role="org.ziegeler.CarstensComponent"
           class="Avalon4Factory"
           avalon-4-class="org.ziegeler.CarstensA4Component"
           pool-min="2"
           pool-max="4"/>

...

public class CarstensComposer {

    A4Factory carstenFactory;

    public void compose (ComponentManager manager) {
        carstenFactory = (A4Factory) manager.lookup
(org.ziegeler.CarstensComponent.ROLE);
    }

    public void doStuff () {
        CarstensComponent comp = (CarstensComponent)
carstenFactory.getInstance ();
        try {
            comp.doStuff ();
        } finally {
            carstenFactory.release (comp);
        }
    }
}

Look at the configuration snippet, and replace "class" with 
"handler-class" and "avalon-4-class" with "class" and you get 
the idea.

..or am I trying to do the impossible here?

/LS


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

Reply via email to