--- "Pilgrim, Peter" <[EMAIL PROTECTED]> wrote: > > > > 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.
The same problem with me :) I was talking about simplifying actions by wiring them to business logic via IoC > 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. I would not call struts action "presentation layer" - it's layer between HTTP request / templating and business logic. > 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.) Not exactly. I like to modify tiles controller creation to obtain controller class from IoC container - this is already done for actions ( and was easy ) , but tiles stuff is more complicated. Creation of object and configuration of tile controller are tied tightly and not configurable. And funny thing is, most of initial commiters of pico/nanocontainer are hired by Martin Fowler. ( and live in London ) > 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? That's my question :) I would like to see a possibility to plug in something like ActionFactory - but in 1.2.4 it seems to be really difficult. > > > > 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. I do not mind. I donated the code to picocontainer project. And you can pull tarball from fisheye : http://cvs.picocontainer.codehaus.org/viewrep/picocontainer/java/jobdemo or checkout just everything if you like to recompile yourself. ( http://www.picocontainer.org ) regards, ----[ Konstantin Pribluda ( ko5tik ) ]---------------- Plugins for xdoclet-2 are released. check it out at: http://www.sourceforge.net/projects/xdoclet-plugins/ ----[ http://www.pribluda.de ]------------------------ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]