org.apache.servicemix.components.util
Interface FileMarshaler

All Known Implementing Classes:
BinaryFileMarshaler, DefaultFileMarshaler, SimpleFlatFileMarshaler

public interface FileMarshaler

A pluggable strategy for turning a file or URL input source into a normalized message.

Version:
$Revision: 673769 $

Method Summary
 java.lang.String getOutputName(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
          Creates a output file name for the given exchange when reading an inbound message.
 java.lang.String getTempOutputName(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
          creates a temporary file name for the given exchange when reading an inbound message.
 void readMessage(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message, java.io.InputStream in, java.lang.String path)
          Converts the file stream to a normalized message.
 void writeMessage(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message, java.io.OutputStream out, java.lang.String path)
          Writes the inbound message to the destination stream of the given name
 

Method Detail

readMessage

void readMessage(javax.jbi.messaging.MessageExchange exchange,
                 javax.jbi.messaging.NormalizedMessage message,
                 java.io.InputStream in,
                 java.lang.String path)
                 throws java.io.IOException,
                        javax.jbi.JBIException
Converts the file stream to a normalized message.

Parameters:
exchange - the message exchange
message - the message to populate
in - the input stream
path - the name of the file, URI or URL
Throws:
java.io.IOException
javax.jbi.JBIException

getOutputName

java.lang.String getOutputName(javax.jbi.messaging.MessageExchange exchange,
                               javax.jbi.messaging.NormalizedMessage message)
                               throws javax.jbi.messaging.MessagingException
Creates a output file name for the given exchange when reading an inbound message.

Parameters:
exchange - the inbound message exchange
message - the inbound message
Returns:
the file name or null if a file name could not be found or calculated
Throws:
javax.jbi.messaging.MessagingException

getTempOutputName

java.lang.String getTempOutputName(javax.jbi.messaging.MessageExchange exchange,
                                   javax.jbi.messaging.NormalizedMessage message)
                                   throws javax.jbi.messaging.MessagingException
creates a temporary file name for the given exchange when reading an inbound message. This name is a (hopefully) unique name used for doing a first writing. It will be renamed to the real output name after successfully finished transmission.

Parameters:
exchange - the inbound message exchange
message - the inbound message
Returns:
the file name or null if a file name could not be found or calculated
Throws:
javax.jbi.messaging.MessagingException

writeMessage

void writeMessage(javax.jbi.messaging.MessageExchange exchange,
                  javax.jbi.messaging.NormalizedMessage message,
                  java.io.OutputStream out,
                  java.lang.String path)
                  throws java.io.IOException,
                         javax.jbi.JBIException
Writes the inbound message to the destination stream of the given name

Parameters:
exchange - the inbound message exchange
message - the inbound message
out - the output stream to write to
path -
Throws:
java.io.IOException
javax.jbi.JBIException


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