> From: Konstantin Priblouda [mailto:[EMAIL PROTECTED]
==////==
> 
> 
> --- "Pilgrim, Peter" <[EMAIL PROTECTED]> wrote:
> > > -----Original Message-----
> > > From: Konstantin Priblouda
> > [mailto:[EMAIL PROTECTED]
> > > 
> > > 
> > > --- Joe Germuska <[EMAIL PROTECTED]> wrote:
> > > 
> > > > 
> > > > What is your antecedent for "this"?  Having an
> > > > ActionCommand 
> > > > interface?  Using an IoC container as an
> > > > ActionFactory?  Having a 
> > > > ThreadLocal store the current ActionContext?
> > > 
> > > action factory going to IoC container for actions 
> > > exists already. ( Pico/Nanocontainer ) 
> > > 
> > > I even looked at the possibility to obtain tuile
> > > controllers from IoC, but it's  really
> > difficult...
> > > 
> > > regards,
> > > 
> > 
> > What is the use-case of obtaining TilesController
> > from IoC container?
> > 
> > It does not make sense to me. If Struts or other MVC
> > container
> > keeps a record of the TilesController (or Actions,
> > ActionForm etc)
> > then the component can be retrieved from Struts
> > through the API
> > at the correct invocation time.
> 
> 
> It is the same use case as obtaining action from IoC
> container. Advantages are clear - action/controller
> does not need to know:
>  - what IoC we are using
>  - how ( and where ) business logic objects are
> obtained
> 
> 
> A lot of things can be made really simple and easy to
> test if they do not know about MVC framework. And they
> can be reused.
> ( for example menu structures, access counters,
> declarative security... )
> 

I think we are singing from the same hymnsheet, but
obviously different styles. You are talking about
abstracting away dependencies from MVC frameworks.
You have a use-case for wanting to switch at
a moments notice from Struts to Webwork and back
again.

I think I was talking about separating tiers,
as in not involving presentation layer code (e.g
Struts / Shale / JSF whatever ) from your
business layer. 

> > 
> > Usually I think it is the other way around.
> > 
> > Inside your TilesController (or Action, ActionForm)
> > you want
> > to look up a service bean from a IoC assembler.
> 
> This is usually considered antipattern in IoC world. 
> 

My wordings has tied me in knots. The whole point of IoC,
of course, is not to look up dependences and set
them in against object yourself, but to "retrieve" the 
object with the depedencies of that object 
already fixed, available and ready-to-go.

If I understand you correctly, then, you would want
insert intermediate construct between the MVC Framework
and the invocation element (TilesController). In Struts
the only chance to do this is in (Composable) 
Request Processor. So if you want to do this in Struts 1.3
you need to write a `Command' that calls your IoC Assembler.
(In my own IoC framework an assembler is a type of interface 
called `IApplicationAssembler'. In Spring 
`ListableBeanFactory' (?). BTW this term ``assembler'' comes from 
Martin Fowler seminal paper.) 

With the reference IoC Assembler you can retrieve the bean 
from the assembler configuration. You just make sure 
your bean implements the interface you require at the 
time of invocation: TilesController. Bugger, code is a lot 
better for explanations:

public class ExecuteTilesControllerCommand 
implements org.apache.commons.chain.Command 
{
        public boolean execute( Context ctx ) {
                IApplicationAssembler assembler = getAssemblerFromSomewhere();
                String controllerName = retrieveNameFromContext( ctx );
                TilesController tilesController = (TilesController)
                        assembler( "fredsApplication", controllerName );

                tilesController.performAction( .... );

                return false or true;           // Terminate the chain?
        }
}

Then configure this Command as part of the Struts 1.3 CRP
and "Bob's your uncle" as they say. Assuming the TilesRequestProcessor
and decompose into similar chain/commands already. Has this work
been done?

> 
> I put a smal demo to show to my pimps - compiled
> deployable .war:
>   http://www.pribluda.de/jobdemo.war
> 

BTW: Do you have this `jobdemo.war' with the source code
available. I can unwinzip the war but all I see are Java classes.
Consider providing a `jobdemo-src.war' with the Java source
code so other people can study it, if you dont mind.

> And sources are donated to picocontainer:
> http://cvs.picocontainer.codehaus.org/viewrep/picocontainer/java/jobdemo

> It's webwork, but the same technique works with struts
> actions ( but not with tile controlers. yet :) ) 

--
Peter Pilgrim
Operations/IT - Credit Suisse First Boston, 
Floor 15, 5 Canada Square, London E14 4QJ, United Kingdom
Tel: +44-(0)207-883-4497


==============================================================================
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to