org.osesb.msgrouting.test.deployabletestpackage1
Class SumCDElementPricesPipelineStage

java.lang.Object
  extended by org.osesb.messagepipeline.PipelineStage
      extended by org.osesb.messagepipeline.builtinstages.XMLNodeExtractorPipelineStage
          extended by org.osesb.msgrouting.test.deployabletestpackage1.SumCDElementPricesPipelineStage

public class SumCDElementPricesPipelineStage
extends XMLNodeExtractorPipelineStage

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

Since:
Version .9
See Also:

SumCDElementPricesPipelineStage 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 the sum of all {@code } elements.


Field Summary
 
Fields inherited from class org.osesb.messagepipeline.PipelineStage
log, messagePipelineContext, nextStage, parentMessagePipeline, pipelineStageConfiguration, previousStage, thisClassName
 
Constructor Summary
SumCDElementPricesPipelineStage(MessagePipeline parentMessagePipeline, PipelineStageConfiguration pipelineStageConfiguration)
          Creates a new instance of SumCDElementPricesPipelineStage.
 
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.XMLNodeExtractorPipelineStage
getExtractedNodes, getExtractedNodes
 
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

SumCDElementPricesPipelineStage

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

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.

runStage() 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 the sum of all <price> elements.

Overrides:
runStage in class XMLNodeExtractorPipelineStage
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.