I read the javadoc, it tells that the m_componentContext is the context object passed to your service implementation object while looking up it by a ServiceManager of a container,it suggests override provideComponentContext method to change the context passed.
So I did this:


public class MyContainer extends DefaultContainer {
protected org.apache.avalon.framework.context.Context provideComponentContext(org.apache.avalon.framework.context.Context parent)
{
MyContext myContext=new MyContext();
m_componentContext=myContext;/I guess this statement is useless, but I put it anyway
return myContext;
}


}

then I have this code

           FortressConfig fConfig=new FortressConfig();
           ........
           ........
           FortressConfig fConfig.setContainerClass("MyContainer");
           ContainerManager cm = new
                   DefaultContainerManager(fConfig.getContext());
           ContainerUtil.initialize( cm );
           container = (DefaultContainer)cm.getContainer();
           ServiceManager manager = container.getServiceManager();

and then I looked up mySpecialService like this:
mySpecialService=manager.lookup(mySpecialService.role);


yet the context of the mySpecialService object I got is still of org.apache.avalon.framework.context.DefaultContext type, why isnt it a MyContext object?

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com



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



Reply via email to