org.osesb.msgrouting.test.deployabletestpackage1
Class DoubleSumCDElementPricesPipelineStage

java.lang.Object
  extended by org.osesb.messagepipeline.PipelineStage
      extended by org.osesb.messagepipeline.builtinstages.FlowControlPipelineStage
          extended by org.osesb.msgrouting.test.deployabletestpackage1.DoubleSumCDElementPricesPipelineStage

public class DoubleSumCDElementPricesPipelineStage
extends FlowControlPipelineStage

Test PipelineStage configured by message-pipeline-3-test-config.xml.

See Also:

DoubleSumCDElementPricesPipelineStage is a FlowControlPipelineStage that configures two branches, each with a single SumCDElementPricesPipelineStage, which extracts all {@code } elements from a 'cdcatalog' XML message and sets the MessagePipeline result as XML that contains a root element named 'totalPrice' with a value that is the sum of all {@code } elements.

DoubleSumCDElementPricesPipelineStage is configured to run the branches in parallel and then set the MessagePipeline result as XML that contains a root element named 'totalPrice' with a value that is the sum of the results returned by each branch. So, the 'totalPrice' returned should be double the sum for the {@code } elements in the original 'cdcatalog' message.


Field Summary
 
Fields inherited from class org.osesb.messagepipeline.builtinstages.FlowControlPipelineStage
branchPipelinesThatWereLastRun, flowControlMessagePipelineBranchConfiguration, threadManager
 
Fields inherited from class org.osesb.messagepipeline.PipelineStage
log, messagePipelineContext, nextStage, parentMessagePipeline, pipelineStageConfiguration, previousStage, thisClassName
 
Constructor Summary
DoubleSumCDElementPricesPipelineStage(MessagePipeline parentMessagePipeline, PipelineStageConfiguration pipelineStageConfiguration)
          Creates a new instance of DoubleSumCDElementPricesPipelineStage.
 
Method Summary
static void main(java.lang.String[] args)
          Main method for testing.
 boolean runStage(EAIMessage eaiMessage)
          Run PipelineStage logic.
 
Methods inherited from class org.osesb.messagepipeline.builtinstages.FlowControlPipelineStage
getBranchPipelinesThatWereLastRun, getFlowControlMessagePipelineBranchConfiguration, loadFlowControlMessagePipelineBranchConfiguration, runBranchPipelines
 
Methods inherited from class org.osesb.messagepipeline.PipelineStage
beingDroppedFromPool, commit, getMessagePipelineContext, getNextStage, getParentMessagePipeline, getPipelineStageConfiguration, getPreviousStage, handlePipelineException, handlePipelineException, logMessage, propagate, rollback, setNextStage, setOutputMessage, setPreviousStage, setResultMessage, stageProcessingComplete, stageProcessingStarting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleSumCDElementPricesPipelineStage

public DoubleSumCDElementPricesPipelineStage(MessagePipeline parentMessagePipeline,
                                             PipelineStageConfiguration pipelineStageConfiguration)
                                      throws java.lang.Exception
Creates a new instance of DoubleSumCDElementPricesPipelineStage.

Parameters:
parentMessagePipeline - The MessagePipeline that constructed this PipelineStage.
pipelineStageConfiguration - A PipelineStageConfiguration for this PipelineStage.
Throws:
java.lang.Exception - if constructed with a null parentMessagePipeline or a null pipelineStageConfiguration.
Method Detail

runStage

public boolean runStage(EAIMessage eaiMessage)
                 throws PipelineStageException
Run PipelineStage logic.

The runStage() method expects an IXMLMessage with XML text as the payload.

DoubleSumCDElementPricesPipelineStage is a FlowControlPipelineStage that configures two branches, each with a single SumCDElementPricesPipelineStage, which extracts all <cd> elements from a 'cdcatalog' XML message and sets the MessagePipeline result as XML that contains a root element named 'totalPrice' with a value that is the sum of all <price> elements.

DoubleSumCDElementPricesPipelineStage is configured to run the branches in parallel and then set the MessagePipeline result as XML that contains a root element named 'totalPrice' with a value that is the sum of the results returned by each branch. So, the 'totalPrice' returned should be double the sum for the <price> elements in the original 'cdcatalog' message.

Overrides:
runStage in class FlowControlPipelineStage
Parameters:
eaiMessage - The EAI message, which is the output of the last PipeLineStage that invoked setOutputMessage(), or, if this is the first PiplelineStage, then this is the EAIMessage that the MessagePipeline was invoked with.
Returns:
true to continue pipeline processing or false to terminate pipeline processing.
Throws:
a - PipelineStageException if any errors occur.
PipelineStageException

main

public static void main(java.lang.String[] args)
Main method for testing.

Parameters:
args - The test data directory.