You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Marcus Crafter <cr...@fztig938.bank.dresdner.net> on 2002/02/25 16:55:09 UTC

Container.java

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:bloritsch@apache.org">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 ?
	
	Cheers,

	Marcus
-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Container.java

Posted by Robert <rm...@bull-enterprises.com>.
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:bloritsch@apache.org] 
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:bloritsch@apache.org">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:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Container.java

Posted by Berin Loritsch <bl...@apache.org>.
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:bloritsch@apache.org">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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Container.java

Posted by Marcus Crafter <cr...@fztig938.bank.dresdner.net>.
On Mon, Feb 25, 2002 at 11:10:47AM -0500, Berin Loritsch wrote:
> Marcus Crafter wrote:
> >
> >/**
> > * 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:bloritsch@apache.org">Berin Loritsch</a>
> > * @version CVS $Revision: 1.6 $ $Date: 2002/02/05 20:38:17 $
> > */

[snip]..

> >	Should there be a getComponentManager() method here ?
> 
> 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.

	Ok, no problem (I agree). It was written in the javadocs:

"It exposes a protected getComponentManager() method so that the Container's"

	Cheers,

	Marcus

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Container.java

Posted by Berin Loritsch <bl...@apache.org>.
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:bloritsch@apache.org">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.


-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>