net.sf.xbus.technical.file
Class FileStreamSender

java.lang.Object
  extended by net.sf.xbus.technical.file.FileBase
      extended by net.sf.xbus.technical.file.FileSender
          extended by net.sf.xbus.technical.file.FileStreamSender
All Implemented Interfaces:
TAResource, ObjectSender, Sender, TextSender

public class FileStreamSender
extends FileSender
implements Sender, ObjectSender

FileStreamSender gets an InputStream and writes it into a file.


Field Summary
 
Fields inherited from class net.sf.xbus.technical.file.FileSender
mBackupFilename, mConfiguration, mTempFilename, senderExecuted
 
Constructor Summary
FileStreamSender(XBUSSystem system)
          Stores the given system.
 
Method Summary
 java.lang.Object execute(java.lang.String function, java.lang.Object source)
          The given object will be send to the neighbor system.
 java.lang.String getType()
          A Sender can send data either as a String or as an Object to the neighboring system.
protected  java.io.BufferedOutputStream prepareOutputStream()
          Opens a stream later used to write the incoming data into the file.
 
Methods inherited from class net.sf.xbus.technical.file.FileSender
close, commit, execute, open, prepareWriteFile, prepareWriter, rollback
 
Methods inherited from class net.sf.xbus.technical.file.FileBase
copyFile, deleteFile, getEncoding, getFileLength, getLastByteOfFile, renameFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileStreamSender

public FileStreamSender(XBUSSystem system)
                 throws XException
Stores the given system.

Parameters:
system - where the data shall be send to
Throws:
XException
Method Detail

execute

public java.lang.Object execute(java.lang.String function,
                                java.lang.Object source)
                         throws XException
Description copied from interface: ObjectSender
The given object will be send to the neighbor system. The response of the neighbor system is the return value of this method.

Optionally a function can be specified. It can be used for calling different methods of the neighbor-system.

Specified by:
execute in interface ObjectSender
Parameters:
function - used by some senders
source - the data that shall be send to the neighbor system
Returns:
the response of the neighbor system
Throws:
XException - if something goes wrong

prepareOutputStream

protected java.io.BufferedOutputStream prepareOutputStream()
                                                    throws XException
Opens a stream later used to write the incoming data into the file.

Returns:
a BufferedOutputStream for the temporary file
Throws:
XException - if something goes wrong

getType

public java.lang.String getType()
Description copied from interface: Sender
A Sender can send data either as a String or as an Object to the neighboring system.
When working with Strings the Sender must fulfill two preconditions: When working with Objects the Sender must also fulfill two preconditions:

Specified by:
getType in interface Sender
Overrides:
getType in class FileSender