This brings up a question for me. If the Container should not expose the ComponentManager, what 'should' the container expose? I have a simple container right now which is just a singleton to access the CM so my components can be looked up. The way mine works at the moment is there is the singleton which has one CM (an ExcaliburCM), which contains sub-CMs, which contain Components. Each sub-CM is a specifc type. i.e. one is for the persistence layer, one is for the scriptengine, etc.
What would be the correct way to do this? Thanks, Robert -----Original Message----- From: Berin Loritsch [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 10:14 AM To: Avalon Developers List Subject: Re: Container.java Berin Loritsch wrote: > Marcus Crafter wrote: > >> Hi All, >> >> Container.java: >> >> /** >> * The Container is an interface used to mark the Containers in your >> system. It >> * exposes a protected getComponentManager() method so that the >> Container's >> * Manager can expose that to the instantiating class. >> * >> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> >> * @version CVS $Revision: 1.6 $ $Date: 2002/02/05 20:38:17 $ >> */ >> public interface Container >> { >> String CONTEXT_CLASSLOADER = "container.classloader"; >> String CONTEXT_DIRECTORY = "context-root"; >> String WORK_DIRECTORY = "container.workDir"; >> String LOGGER_MANAGER = "container.logManager"; >> String COMMAND_QUEUE = "container.commandQueue"; >> String POOL_MANAGER = "container.poolManager"; >> String ROLE_MANAGER = "container.roleManager"; >> } >> >> Should there be a getComponentManager() method here ? > > > > No. > > It is not normal to expose the getComponentManager beyond the Container. > We do it in the test for testing reasons. We have it in > AbstractContainer so that the concrete container classes can easily > reference the component manager. > > It is a violation of IOC (aka subversion of control) to expose the CM > to any class that can get a handle on the Container. We should change the text. -- "They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
