You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Eric Pugh <ep...@opensourceconnections.com> on 2004/11/09 10:13:06 UTC

[chain] evaluating to use, contrast to pipeline?

Hi all,

Just checking out [chain], was thinking of replacing my own CoR
implementation.  The one thing that I have, that chain doesnt, is a visitor
object.  Now, I may be mixing up my GoF patterns here, but what I have are a
series of steps that are ordered.  I have a visitor who goes from one to the
other.  At each step, there is the option to continue or to stop.  The
visitor provides a place to collect up things like messages back to the
user.

In [chain], instead of a visitor, I would have a well known context property
that would fulfill that role, correct?  I could even subclass Context to
have a typesafe .getVisitor() or .getMessagesHolder() to put my messages in
right?

I was also looking at [pipeline] in sandbox, and was trying to grok the
difference.  What it seemed to boil down to is that in a pipeline you go
from A -> Z without ever stopping.  But, in [chain] you may go from A -> Z,
but if certain conditions occur, you may stop midway at J, correct?

Which brings me to my last question..  Why does returning false from a
command signify continue?  Why wasn't it return "true" means keep going?

Eric Pugh

PS, anyone mind if I update dependencies in the Maven build?


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


RE: [chain] evaluating to use, contrast to pipeline?

Posted by Eric Pugh <ep...@upstate.com>.
Thanks..  I think that for the level of usage I envision, the flexiblity of
[chain] (and relative maturity) solves the problem, even though [pipeline]
may in a larger sense be more appropriate for my use case.

My usecase, processing data, seems to fit into exactly what [pipeline] does.
In fact, I call it a pipeline.  However, in my own implementation, a
specific valve may shut off execution of future valves, similar to how a
command in the [chain] may not pass on control to the next element in the
chain.  So, from that standpoint, [chain] is more appropriate.

I'm looking forward to using [chain] and see what I can help out on.  I'll
be using it triggered from a Quartz process, so I'll be looking at agility a
bit, but it seems like my needs are even simpler then that:  Put context in
at one end.  Get context out at other end.

Eric


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


Re: [chain] evaluating to use, contrast to pipeline?

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
> I was also looking at [pipeline] in sandbox, and was trying to grok the
> difference.  What it seemed to boil down to is that in a pipeline you go
> from A -> Z without ever stopping.  But, in [chain] you may go from A ->
Z,
> but if certain conditions occur, you may stop midway at J, correct?

If you read the bits Kris Nuttycombe's says in the following message he
describes pipeline and compares it to chain:

http://www.mail-archive.com/commons-dev@jakarta.apache.org/msg50034.html


> Which brings me to my last question..  Why does returning false from a
> command signify continue?  Why wasn't it return "true" means keep going?
>
> Eric Pugh

Haven't read the GoF book, but I guess thats how the pattern is defined,
from the docs...

http://jakarta.apache.org/commons/chain/

"The API for a command consists of a single method execute()), which is
passed a "context" parameter containing the dynamic state of the
computation, and whose return value is a boolean that determines whether or
not processing for the current chain has been completed (true), or whether
processing should be delegated to the next command in the chain (false)."

Niall





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