On Tuesday 10 February 2004 16:26, Stephan Coboos wrote:
> thank you for you for your answer but I do not understand. I have to 
> declare something in the comment to get my component working correctly?  
> H�?

This is the modern way of declaring meta-info of components. A Ant/Maven 
plugin will use those and create the meta-info format for the container being 
used, such as .xinfo file.

> PS: I'am using Cocoon, does it work there, too?

Cocoon, ATM, is using Excalibur Component Manager (ECM), which has "poolable" 
as the default and I expect that it is your case.


I think I don't understand your question enough. Reading your initial post;

> What I want to do is to get an new 
> "MyComponent" from the serviceManager like in initialize() but 
> initialize() is only called once at instanciation time.

So, call ServiceManager.lookup() at any other time in AnotherComponent, such 
as;

public interface AnotherInterface
{
   static String ROLE = "org.hedhman.niclas.AnotherService";

   void processSomething();
}

public class AnotherComponent 
   implements Serviceable, AnotherInterface
{
    private ServiceManager m_ServiceManager;

    public void service( ServiceManager man )
    {
        m_ServiceManager = man;
    }

    public void processSomething()
    {
        MyComponent c = (MyComponent) 
           m_ServiceManager.lookup( AnotherInterface.ROLE );

        c.myMethod();

        m_ServiceManager.release( c );
    }
}

(Exception handling removed for clarity.)

And if you have declared MyComponent to provide for the AnotherInterface.ROLE, 
somewhere in Cocoon (I think it is in cocoon.xconf), things should be 
poolable as expected.

I.e. It is not required that components are created, initialized and so on, 
upon application start, but can be deferred indefinately.


Is this what you are looking for?

Niclas

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

Reply via email to