org.osesb.msgrouting.test.deployabletestpackage1
Class EchoMessageWithAttachmentCompressionPipelineStage

java.lang.Object
  extended by org.osesb.messagepipeline.PipelineStage
      extended by org.osesb.msgrouting.test.deployabletestpackage1.EchoMessageWithAttachmentCompressionPipelineStage

public class EchoMessageWithAttachmentCompressionPipelineStage
extends PipelineStage

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

See Also:

EchoMessageWithAttachmentCompressionPipelineStage is a custom PipelineStage with a runStage() method that expects a org.osesb.eaimessage.EAIXMLMessageWithAttachments with XML content that looks like:

{@code
      
          
              Apas-Track2.mp3
              
          
          
              Dry Ice Video.wmv
              
          
      
 }

runStage() expects the number of attachments to equal the number of {@code } elements.

runStage() compresses the attachments, changes the value of the {@code } element to 'application/zip'. runStage() sets the MessagePipeline result message to a EAIXMLMessageWithAttachments with the modified XML and compressed attachments.


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

EchoMessageWithAttachmentCompressionPipelineStage

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

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.

EchoMessageWithAttachmentCompressionPipelineStage is a custom PipelineStage with a runStage() method that expects a org.osesb.eaimessage.EAIXMLMessageWithAttachments with XML content that looks like:

<testFiles xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
          <testFile>
              <fileName>Apas-Track2.mp3</fileName>
              <mimeType xmime:contentType="audio/mpeg" />
          </testFile>
          <testFile>
              <fileName>Dry Ice Video.wmv</fileName>
              <mimeType xmime:contentType="video/x-ms-wmv" />
          </testFile>
      </testFiles>
 

runStage() expects the number of attachments to equal the number of <testFile> elements.

runStage() compresses the attachments, changes the value of the <mimeType> element to 'application/zip'. runStage() sets the Pipeline result message to a EAIXMLMessageWithAttachments with the modified XML and compressed attachments.

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