Hi Unico, that is exactly what I tried. But I do not know how to set the context to my ChildContainer. Furthermore, the constructor "new ContextManager( config.getContext());" does not exist in Fortress. So any ideas how to work arround ?
Regards, Marco -----Ursprungliche Nachricht----- Von: Unico Hommes [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 27. Juni 2003 09:32 An: Avalon framework users Betreff: RE: [Fortress] Snipplet how to nest container ? > > Hi, > > does anyone have some snipplets how to nest containers ? > I am trying to build a "GeneralContainer" which has a > subcontainer that handles other components. > (like this structure : > > Fortress > ------------- ... > GeneralContainer > | > ------------------------------------------------- .... > | | | > SpecialContainer maybe ServeltContainer... ComGC1 > | | | > ComSC1 ComSC2 ComSC3... > > The GeneralContainer and SpecialContainer are similar > (DefaultContainer), they just should have different > role/config-files, so that a component from the > SpecialContainer can lookup a component from the GeneralContainer. > Only the ServletContainer may override the DefaultContainer) > > Have any ideas how to build this with fortress ? I am not 100% sure about this because I haven't tried this yet. Let me know if this worked out for you. Probably two things need to be done. 1) set GeneralContainer's ServiceManager as SpecialContainer's ServiceManager's parent. 2) set GeneralContainer's child Context as SpecialContainer's Context's parent. <snippet> FortressConfig config = new FortressConfig(); // general configuration... config.setContextDirectory( generalContextDirectory ); config.setContainerConfiguration( "./general.xconf" ); ContextManager contextManager = new ContextManager( config.getContext() ); ContainerUtil.initialize( contextManager ); DefaultContainerManager containerManager = new DefaultContainerManager( contextManager ); ContainerUtil.initialize( containerManager ); final DefaultContainer generalContainer = containerManager.getContainer(); // see 2) config = new FortressConfig( contextManager.getChildContext() ); // see 1) config.setServiceManager( generalContainer.getServiceManager() ); // special configuration ... config.setContextDirectory( specialContextDirectory ); config.setContainerConfiguration( "./special.xconf" ); containerManager = new DefaultContainerManager( config.getContext() ); ContainerUtil.initialize( containerManager ); final DefaultContainer specialContainer = containerManager.getContainer(); </snipped> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
