You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ted Husted <hu...@apache.org> on 2004/06/02 02:00:56 UTC

Re: Shale and Chain

MailReader/Chain is a work-in-progress, which I'll move over to our new Apps subproject as soon as 1.2.6 is ready to roll.  (First things first!)

Agility isn't an application, it's a whiteboard, and there isn't any code to build.

There will probably be more to add to the cookbook (chapter-chain.html) once Mailreader/Chain is complete.

-Ted.

On Fri, 19 Nov 2004 15:07:59 -0700, BaTien Duong wrote:
>�Craig:
>
>�Thanks for a good start. The 2 apps under commons-chain seem to be
>�built by Ted? Ted, do you have further instructions besides chapter-
>�chain.html?
>
>�Thanks.
>
>�BaTien
>�DBGROUPS
>
>
>�Craig McClanahan wrote:
>
>>�On Fri, 19 Nov 2004 13:44:47 -0700, BaTien Duong
>>�<ba...@dbgroups.com>�wrote:
>>
>>
>>>�Greetings:
>>>
>>>�I want to prototype commons-chain in shale. I saw 2 apps:
>>>�agility and mailreader. I was able to build commons-chain.jar
>>>�using ant. I modify maven project.xml of the 2 apps and run
>>>�maven default successfully. But there is no war file of the
>>>�above apps. Look like it has not done anything.
>>>
>>>
>>�I didn't build that part of the commons-chain repository, so I'll
>>�have to take a look ... it'll probably be over the weekend.
>>
>>
>>>�Could someone show me how to build the 2 apps using commons-
>>>�chain? Craig, do you have any preliminary instruction on the
>>>�commons-chain in Shale?
>>>
>>
>>�Let's assume that you have defined the business logic for a
>>�particular form submit as a chain named "foo" in the default
>>�catalog. �JSF will call the action method for your submit button
>>�after validations have been successful, and after all the model
>>�values have been updated into your ViewController bean. �So, what
>>�you need to do for chain is build up a Context object, and either
>>�include the ViewController bean itself (so your business logic
>>�can pull stuff out, but that makes it dependent on the
>>�ViewController APIs), or pass the data on in some other fashion
>>�like a Map. �So, this is only one way to do it:
>>
>>�(1) Create a context to use:
>>
>>�Context context = new
>>�FacesWebContext(FacesContext.getCurrentInstance());
>>
>>�(2) Pass in the input field values from your ViewController (this
>>�is sorta cheating):
>>
>>�context.put("viewController", this);
>>
>>�(3) Get an instance of the command and execute it:
>>
>>�Command command = CatalogFactory.getInstance().getCommand("foo");
>>�command.execute(context);
>>
>>�(4) Pull out the logical outcome to be used for navigation and
>>�return it: (Assumes your business logic stored something under
>>�this attribute)
>>
>>�String outcome = (String) context.get("outcome");
>>�return outcome;
>>
>>�For your business logic, you'll want to model it as either a
>>�single Command, or as a Chain -- if you want to make the business
>>�logic independent of web tier APIs you'd take the input context
>>�argument as a Context and treat it like a Map to get and put
>>�stuff.
>>�Alternatively, you can cast it to FacesWebContext if you wanted
>>�typesafe access to all the extra attributes that defines.
>>
>>�To configure your catalog of available commands and chains, you
>>�can use the org.apache.commons.chain.web.ChainListener class (a
>>�ServletContextListener) to set everything up from XML
>>�descriptions, although this is not required. �That's what my
>>�examples (and the one in struts-chain) use.
>>
>>
>>>�Thanks
>>>
>>>�BaTien
>>>�DBGROUPS
>>>
>>>
>>�Craig
>>
>>�------------------------------------------------------------------
>>�--- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For
>>�additional commands, e-mail: dev-help@struts.apache.org
>>
>>�.
>
>
>�--------------------------------------------------------------------
>�- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>�For additional commands, e-mail: dev-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org