You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by da...@bt.com on 2005/05/27 16:26:16 UTC

Commons Chain Alternate Flows

Hi,
 
I'm using Commons Chain to execute a series of commands.  What I'm
trying to ascertain is if it is possible to add alternate flows (e.g.
exception cases) to the chain config XML file.  Currently my chain
contains a serial list of commands to execute with a common context.
I'd like to be able to define alternate chains to execute under
conditions such as exception cases but without the command that threw
the exception (or set a flag) knowing what the chain configuration was
set to - i.e. it should all be defined in the chain config - not in the
code.
 
Has anyone done this?
 
Many thanks.
 
Dave Hallam
 

RE: Commons Chain Alternate Flows

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello,
	There's an article by Bill Siggelkow that explains how to
override a chain of commands with your own chain.. though that is
Struts-related..
Maybe can you reuse it?

I don't remember URL, but I m sure you will find easily with a google
search

Regards
	marco

-----Original Message-----
From: Mattias J [mailto:mattias.jiderhamn@expertsystem.se] 
Sent: 27 May 2005 15:43
To: Jakarta Commons Users List
Subject: Re: Commons Chain Alternate Flows

At 2005-05-27 16:26, you wrote:
>I'm using Commons Chain to execute a series of commands.  What I'm
>trying to ascertain is if it is possible to add alternate flows (e.g.
>exception cases) to the chain config XML file.  Currently my chain
>contains a serial list of commands to execute with a common context.
>I'd like to be able to define alternate chains to execute under
>conditions such as exception cases but without the command that threw
>the exception (or set a flag) knowing what the chain configuration was
>set to - i.e. it should all be defined in the chain config - not in the
>code.

Not really sure I understand the problem, but maybe you could create a 
"conditional" Filter, that handles this for you, and then set the
different 
chains on this Filter (like "normal chain", "chain if exception"). This 
will not be configurable by Chain XML config, but you could use Spring.

>Has anyone done this?

Haven't tried this myself though.

   /Mattias Jiderhamn 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons Chain Alternate Flows

Posted by Mattias J <ma...@expertsystem.se>.
At 2005-05-27 16:26, you wrote:
>I'm using Commons Chain to execute a series of commands.  What I'm
>trying to ascertain is if it is possible to add alternate flows (e.g.
>exception cases) to the chain config XML file.  Currently my chain
>contains a serial list of commands to execute with a common context.
>I'd like to be able to define alternate chains to execute under
>conditions such as exception cases but without the command that threw
>the exception (or set a flag) knowing what the chain configuration was
>set to - i.e. it should all be defined in the chain config - not in the
>code.

Not really sure I understand the problem, but maybe you could create a 
"conditional" Filter, that handles this for you, and then set the different 
chains on this Filter (like "normal chain", "chain if exception"). This 
will not be configurable by Chain XML config, but you could use Spring.

>Has anyone done this?

Haven't tried this myself though.

   /Mattias Jiderhamn 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org