On Sat, 2003-07-12 at 22:03, Geoff Howard wrote:
>
> Follow up:
>
> Is the order of component initialization a reliable contract with the
> Container? If component A is defined before component B, can it be
> relied on that they are initialize()-ed first A then B?
>
> Geoff
Are you asking how to know what order components are initialized by the
container? This depends on the lifestyle of the component and on the
container itself.
However in terms of component assembly (which is what I think you're
asking about), if you access _any_ component via the ServiceManager, it
goes through the proper lifecycle methods before it is returned. In
other words:
public class ComponentA
implements Serviceable, Initializable, MyService {
...
public void initialize(){
ComponentB b = (ComponentB)
m_serviceManager.lookup(ComponentB.ROLE);
}
...
The 'b' instance of ComponentB will be properly initialized before it is
returned. In this case you don't need to worry about component
initialization order. You only need to worry about cyclic dependency
loops.
I'm not sure how well ECM handled all of this, but all the newer
containers should handle this without any trouble.
jaaron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]