You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Ryan Shaw <ry...@silveregg.co.jp> on 2002/02/01 04:31:59 UTC

ContainerManager

Hello,

I have been looking at Berin's ContainerManager stuff
in the Excalibur scratchpad. It looks pretty cool but
I want to make sure I understand how it is intended to
be used.

Say I want to use Framework/Excalibur from a servlet.
So I create a subclass of AbstractContainer called
ServletContextContainer. Then my initialization servlet
creates a new ContainerManager, with all the parameters
specified (including the classname of my new 
ServletContextContainer) and places the Container
Manager in the ServletContext.

Then my other servlets can get the ContainerManager
out of the ServletContext and use it...but how? It 
doesn't seem to expose any methods that would give
my servlets access to, say, the container's component
manager...

Can anyone enlighten me?

Thanks,

Ryan

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


Re: ContainerManager

Posted by Peter Donald <pe...@apache.org>.
On Tue, 5 Feb 2002 14:12, Berin Loritsch wrote:
> > Okay, I see what you had in mind now. However, it seems that the
> > Container implementation (Processor in this example) still needs
> > access to the child ComponentManager. So am I correct that the
> > visibility of m_childManager in AbstractContainer needs to be
> > changed from private to protected?
> >
> :/
>
> Possibly, or maybe better a protected getter for the ComponentManager.

Maybe even a protected final getter ;)

-- 
Cheers,

Pete

------------------------------------
The two secrets to success:
   1- Don't tell anyone everything.
------------------------------------

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


Re: ContainerManager

Posted by Berin Loritsch <bl...@apache.org>.
Ryan Shaw wrote:

> Berin wrote:
> 
> ||| When designing it, I had in mind that the Container would
> ||| have a special interface that you would call to handle whatever
> ||| request you needed.
> 
> <snip>
> 
> ||| This would allow you to use it like this:
> ||| 
> ||| void service( ServletRequest request, ServletResponse response )
> ||| {
> |||      Environment env = new Environment( m_servletContext, request, response );
> |||      Processor proc = (Processor) m_containerManager.getContainer();
> ||| 
> |||      proc.process( env, request.getRequestURI() );
> ||| }
> 
> Okay, I see what you had in mind now. However, it seems that the 
> Container implementation (Processor in this example) still needs
> access to the child ComponentManager. So am I correct that the
> visibility of m_childManager in AbstractContainer needs to be
> changed from private to protected?


:/

Possibly, or maybe better a protected getter for the ComponentManager.




----------------------------------------------------
Sign Up for NetZero Platinum Today
Only $9.95 per month!
http://my.netzero.net/s/signup?r=platinum&refcd=PT97

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


Re: ContainerManager

Posted by Ryan Shaw <ry...@silveregg.co.jp>.
Berin wrote:

||| When designing it, I had in mind that the Container would
||| have a special interface that you would call to handle whatever
||| request you needed.

<snip>

||| This would allow you to use it like this:
||| 
||| void service( ServletRequest request, ServletResponse response )
||| {
|||      Environment env = new Environment( m_servletContext, request, response );
|||      Processor proc = (Processor) m_containerManager.getContainer();
||| 
|||      proc.process( env, request.getRequestURI() );
||| }

Okay, I see what you had in mind now. However, it seems that the 
Container implementation (Processor in this example) still needs
access to the child ComponentManager. So am I correct that the
visibility of m_childManager in AbstractContainer needs to be
changed from private to protected?

Ryan

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


Re: ContainerManager

Posted by Berin Loritsch <bl...@apache.org>.
Ryan Shaw wrote:

> Hello,
> 
> I have been looking at Berin's ContainerManager stuff
> in the Excalibur scratchpad. It looks pretty cool but
> I want to make sure I understand how it is intended to
> be used.
> 
> Say I want to use Framework/Excalibur from a servlet.
> So I create a subclass of AbstractContainer called
> ServletContextContainer. Then my initialization servlet
> creates a new ContainerManager, with all the parameters
> specified (including the classname of my new 
> ServletContextContainer) and places the Container
> Manager in the ServletContext.


So far so good!


> 
> Then my other servlets can get the ContainerManager
> out of the ServletContext and use it...but how? It 
> doesn't seem to expose any methods that would give
> my servlets access to, say, the container's component
> manager...
> 
> Can anyone enlighten me?


When designing it, I had in mind that the Container would
have a special interface that you would call to handle whatever
request you needed.  For instance, In Cocoon, they have an inteface
which the Cocoon Component and all Sitemaps implement called
Processor:

interface Processor
{
     process( Environment env, String uri ); // an external request, delegates to the full method
     process( Environment env, String uri, boolean isRequestInternal );
}

This would allow you to use it like this:


void service( ServletRequest request, ServletResponse response )
{
     Environment env = new Environment( m_servletContext, request, response );
     Processor proc = (Processor) m_containerManager.getContainer();

     proc.process( env, request.getRequestURI() );
}

As you can see, this greatly simplifies the code that is currently in
CocoonServlet's service method.  I left out the code used for determining
the length of time a request took to process, ensuring that the ContextClassLoader
is set, and other Environment management code.


I did consider making the Container's ComponentManager available, but that is
a clear cut example of Subversion of Control.  The Container's ComponentManager
is for that level of abstraction and below.  The parent ComponentManager (that
of the ContainerManager) is at a peer level with the Servlet, so is able to
be made available to the Servlet.





-- 

"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>