On 12/20/06, Virender Singh <[EMAIL PROTECTED]> wrote:

Hi,

I am analysing commons-chain for use in our framework. Are there any
frameworks/products that are using commons-chain api? I have heard of
struts-chain. I do not have any idea as to how much is it in use? The list
of products would help in convincing the team to use the api and that it
is
not another framework on which some work was done and then left in
oblivion.


Commons Chain is fundamental to the "ComposableRequestProcessor" part of
Struts 1.3, which lets you customize the behavior of the standard request
processing lifecycle.  This is much more flexible than the extension
approach in Struts 1.0 - 1.2, which required you to subclass a very large
RequestProcessor class and override methods to change behavior.

Chain is also used by the Shale[1] framework in a couple of different places
(all optional, depending on your needs):

* Application Controller lets you use a chain to configure the
 filtering that you want to have on every request (similar in
 spirit to what Struts 1.3 is doing).

* Clay uses chains to configure the template processing for
 the components you define with it.

* Remoting has an option to use a chain to compose the
 response to an asynchronous Ajax request.

In addition to frameworks like this, I've heard of cases where application
architects use chains to define the details of the business logic
(completely independent of how the presentation tier works).  For example,
you could define a Filter command that would add a Hibernate session to your
context on the way in, and clean up the resources on the way back out, and
stick this command in every chain that needs access to a Hibernate session.
The actual business logic can just assume the session is there in the
context (similar to what you can get from an IoC framework, but assembled
somewhat differently).

Chain fits best in a scenario where there is a detailed straight line flow,
and you can define your tasks in finely grained reusable pieces ("Commands"
in the Chain vocabulary) that can be assembled into customized sequences for
each task.  Chain fits worst when you are trying to use it as a control
architecture for a workflow with lots of conditional branches.  For that
case, you might look at a state machine architecture like the one supported
by Commons SCXML[2] instead.

Craig

[1] http://shale.apache.org/
[2] http://jakarta.apache.org/commons/scxml/


Thanks,
Virender


Reply via email to