org.apache.servicemix.jbi.transformer
Class CopyTransformer

java.lang.Object
  extended by org.apache.servicemix.jbi.transformer.CopyTransformer
All Implemented Interfaces:
MessageTransformer
Direct Known Subclasses:
PropertyAddTransformer

public class CopyTransformer
extends java.lang.Object
implements MessageTransformer

A simple transformer which copies the properties and content from the source message to the destination message.

Version:
$Revision: 564374 $

Constructor Summary
CopyTransformer()
           
CopyTransformer(boolean copySecuritySubject, boolean copyContent, boolean copyProperties, boolean copyAttachments)
           
 
Method Summary
static void copyAttachments(javax.jbi.messaging.NormalizedMessage from, javax.jbi.messaging.NormalizedMessage to)
          Copies the attachments from a message to another message
static void copyProperties(javax.jbi.messaging.NormalizedMessage from, javax.jbi.messaging.NormalizedMessage to)
          Copies all of the properties from one message to another
static void copySecuritySubject(javax.jbi.messaging.NormalizedMessage from, javax.jbi.messaging.NormalizedMessage to)
          Copies the subject from a message to another message
static CopyTransformer getInstance()
          Returns the singleton instance
 boolean isCopyAttachments()
           
 boolean isCopyProperties()
           
 boolean isCopySecuritySubject()
           
 void setCopyAttachments(boolean copyAttachments)
           
 void setCopyProperties(boolean copyProperties)
           
 void setCopySecuritySubject(boolean copySecuritySubject)
           
 javax.jbi.messaging.NormalizedMessage transform(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in)
          Transforms an input message into the returned output message
 boolean transform(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage from, javax.jbi.messaging.NormalizedMessage to)
          Transfers the state in the input message into the output message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyTransformer

public CopyTransformer()

CopyTransformer

public CopyTransformer(boolean copySecuritySubject,
                       boolean copyContent,
                       boolean copyProperties,
                       boolean copyAttachments)
Method Detail

isCopyAttachments

public boolean isCopyAttachments()
Returns:
the copyAttachments

setCopyAttachments

public void setCopyAttachments(boolean copyAttachments)
Parameters:
copyAttachments - the copyAttachments to set

isCopyProperties

public boolean isCopyProperties()
Returns:
the copyProperties

setCopyProperties

public void setCopyProperties(boolean copyProperties)
Parameters:
copyProperties - the copyProperties to set

isCopySecuritySubject

public boolean isCopySecuritySubject()
Returns:
the copySecuritySubject

setCopySecuritySubject

public void setCopySecuritySubject(boolean copySecuritySubject)
Parameters:
copySecuritySubject - the copySecuritySubject to set

getInstance

public static CopyTransformer getInstance()
Returns the singleton instance

Returns:
the singleton instance

transform

public boolean transform(javax.jbi.messaging.MessageExchange exchange,
                         javax.jbi.messaging.NormalizedMessage from,
                         javax.jbi.messaging.NormalizedMessage to)
                  throws javax.jbi.messaging.MessagingException
Description copied from interface: MessageTransformer
Transfers the state in the input message into the output message

Specified by:
transform in interface MessageTransformer
Parameters:
exchange - the exchange on which the messages are flowing
from - the input message
to - an empty out message ready to contain the result of the transformation
Throws:
javax.jbi.messaging.MessagingException

transform

public javax.jbi.messaging.NormalizedMessage transform(javax.jbi.messaging.MessageExchange exchange,
                                                       javax.jbi.messaging.NormalizedMessage in)
                                                throws javax.jbi.messaging.MessagingException
Description copied from interface: MessageTransformer
Transforms an input message into the returned output message

Specified by:
transform in interface MessageTransformer
Parameters:
exchange - the exchange fon which the messages are flowing
in - the input message
Returns:
the output message or null if the output message co
Throws:
javax.jbi.messaging.MessagingException - when an error occurs while transforming the message

copyProperties

public static void copyProperties(javax.jbi.messaging.NormalizedMessage from,
                                  javax.jbi.messaging.NormalizedMessage to)
Copies all of the properties from one message to another

Parameters:
from - the message containing the properties
to - the destination messages where the properties are set

copyAttachments

public static void copyAttachments(javax.jbi.messaging.NormalizedMessage from,
                                   javax.jbi.messaging.NormalizedMessage to)
                            throws javax.jbi.messaging.MessagingException
Copies the attachments from a message to another message

Parameters:
from - the message with the attachments
to - the message to which attachments are added
Throws:
javax.jbi.messaging.MessagingException - if an attachment could not be added

copySecuritySubject

public static void copySecuritySubject(javax.jbi.messaging.NormalizedMessage from,
                                       javax.jbi.messaging.NormalizedMessage to)
                                throws javax.jbi.messaging.MessagingException
Copies the subject from a message to another message

Parameters:
from - the message with the subject
to - the message to which the subject is added
Throws:
javax.jbi.messaging.MessagingException - if an attachment could not be added


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.