RE: [picocontainer-dev] New Picocontainer-web ... defeating IoC made easier now :-(

"Michael Rimov" <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Organization Centerline Computers, Inc
Message-ID <009701c8ce98$4e420700$eac61500$@com>
> In PicoServletContainerFilter, there is ..
> 
>    public static MutablePicoContainer getRequestContainerForThread()
> { .. }
> 
> .. which makes available a request container for our classes
> 
>    ActionFactory (Struts1)
>    PicoObjectFactory (Struts2)
>    PicoActionFactory (Webwork1)
>    PicoObjectFactory (WebWork2)
> 
> The problem is that actions themselves could call that static method
> to get a container. You could make it policy in a dev team not to, but
> PicoContainer is normally more protected than this.  IoC is normally
> guaranteed.
> 
> I thought about a solution changing the method to ..
> 
>    public static MutablePicoContainer
> getRequestContainerForThread(String magicKey) { .. }

Seems a little complicated for what you're gaining... especially since it
requires additional web.xml/struts.xml configuration.


1/2 hearted solution:

How about making it package protected instead?  Make all factories that grab it
inside the same package. 

StrutsActionFactory (Struts1)
StrutsObjectFactory (Struts2)
WebworkActionFactory (Webwork1)
WebworkObjectFactory (WebWork2)

If somebody is going to break the data hiding then they're at least going to see
a warning sign (non-public method) before attempting it.  

								-Mike


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.