Sun Adapter for Batch/FTP

com.stc.eways.batchext
Interface FtpFileClient

All Known Implementing Classes:
FtpFileClientImpl, FtpFileClientImplUser0

public interface FtpFileClient

This interface represents a node in the ETD structure. You can extend it to provide your own implementation, if desired. This class is used for ETD implementation and e*Way Connection delegation.

Version:
cvs revision: $Revision: 1.9 $ Last Modified: $Date: 2008/02/25 16:56:24 $
Author:
Harry Liu

Field Summary
static java.lang.String ENCODING_BIG5
           
static java.lang.String ENCODING_DEFAULT
           
static java.lang.String ENCODING_EUC_JP
           
static java.lang.String ENCODING_GBK
           
static java.lang.String ENCODING_JIS
           
static java.lang.String ENCODING_SJIS
           
static java.lang.String TC_GET
           
static java.lang.String TC_PUT
           
 
Method Summary
 void allowTransfer()
          Allow transfers in XA mode.
 void cleanupPostTransferGet(TransferNamesAndCommands tncg)
          Cleans up any failures during Post Transfer Command for "get".
 void cleanupPostTransferPut(TransferNamesAndCommands tncp)
          Cleans up any failures during Post Transfer Command for "put".
 void cleanupPreTransferGet(TransferNamesAndCommands tncg)
          Cleans up any failures during Pre Transfer Command for "get".
 void cleanupPreTransferPut(TransferNamesAndCommands tncp)
          Cleans up any failures during Pre Transfer Command for "put".
 void cleanupRawCommands(TransferNamesAndCommands tncr)
          Cleans up any failures during pre/post ftp raw commands.
 void cleanupTransferGet(TransferNamesAndCommands tncg)
          Cleans up any failures during ftp Transfer "get".
 void cleanupTransferPut(TransferNamesAndCommands tncp)
          Cleans up any failures during ftp Transfer "put".
 void close()
          Does the FTP log-out and disconnects.
 void connect()
          Performs the FTP connection, log-in and switch modes, and so on.
 void connect(java.lang.String encoding)
          Performs the FTP connection, log-in and switch modes, and so on.
 void disconnect()
          Does the FTP log-out and disconnects.
 void doPostTransferGet(TransferNamesAndCommands tncg)
          Performs Post Transfer Command for FTP get operation.
 void doPostTransferPut(TransferNamesAndCommands tncp)
          Performs Post Transfer Command for FTP put operation.
 void doPreTransferGet(TransferNamesAndCommands tncg)
          Performs Pre Transfer Command for FTP get operation.
 void doPreTransferPut(TransferNamesAndCommands tncp)
          Performs Pre Transfer Command for FTP put operation.
 void doRawCommands(java.lang.String commands)
          Performs FTP pre and post transfer raw commands, for example: SITE RECFM=FB;SITE LRECL=50;SITE BLOCKSIZE=32750;SITE TRACKS;SITE PRI=5;SITE SEC=5 NOTE: The commands are separated by a semicolon (;), and only FTP raw commands are expected.
 void doTransferGet(TransferNamesAndCommands tncg)
          Performs the real FTP get transfer.
 void doTransferPut(TransferNamesAndCommands tncp)
          Performs the real FTP put transfer.
 void get()
          Retrieves a file from the remote FTP server.
 void getIfExists()
          Same as get but if there is no file found matching the name pattern given in "Target Directory Name" and "Target File Name", just return siliently; Invoking of the method can result in : a) throw Exception ( SoapFault if it is BPEL ), the caller is notified an error b) getIfExists() (readIfExists() for BPEL) successful, payload is NULL, target file does not exists; c) getIfExists() (readIfExists() for BPEL) successful, payload is NOT NULL, target file detected and content is read, if the content is 0 length, this lead to a byte[] of 0 length as payload;
 byte[] getPayload()
          Retrieves the data payload.
 TransferNamesAndCommands getResolvedNamesForGet()
          Resolves names from patterns for the FTP get operation.
 TransferNamesAndCommands getResolvedNamesForPut()
          Resolves names from patterns for the FTP put operation.
 java.util.Properties getUserProperties()
          Retrieves user-defined properties.
 void initialConfigValues(java.util.Properties props)
          Initializes the e*Way Connection's configuration properties from user-specified properties.
 void initialize(FtpETD etd)
          Initializes the FTP ETD object.
 boolean isConnected()
          Verifies that the e*Way Connection to the external system is still available.
 boolean isOpen()
          Verifies that the e*Way Connection to the external system is still available.
 boolean isXA()
          Determines whether an e*Way Connection is in the XA mode.
 void open()
          Performs the FTP connection, log-in and switch modes, and so on.
 void open(java.lang.String encoding)
          Performs the FTP connection, log-in and switch modes, and so on.
 void put()
          Stores a remote FTP file.
 void releaseResources()
          Releases the e*Way Connection's system resources but does not close the connection to the external system.
 boolean reset()
          Resets the data content of an FtpFileClient.
 void restoreConfigValues()
          Restores all the ETD's configuration properties from the related e*Way Connection.
 void setInputStreamAdapter(com.stc.eways.common.eway.standalone.streaming.InputStreamAdapter isa)
          Used to request data streams from another ETD.
 void setOutputStreamAdapter(com.stc.eways.common.eway.standalone.streaming.OutputStreamAdapter osa)
          Used to request data streams from another ETD.
 void setPayload(byte[] newPayload)
          Sets the data payload.
 void terminate()
          Terminates the FtpFileClient object instance.
 void undoPostTransferGet(TransferNamesAndCommands tncg)
          Undoes Post Transfer for FTP get operation.
 void undoPostTransferPut(TransferNamesAndCommands tncp)
          Undoes Post Transfer for FTP put operation.
 void undoPreTransferGet(TransferNamesAndCommands tncg)
          Undoes Pre Transfer for FTP get operation.
 void undoPreTransferPut(TransferNamesAndCommands tncp)
          Undoes Pre Transfer for FTP put operation.
 void undoRawCommands(TransferNamesAndCommands tncr)
          Undo pre/post ftp raw commands.
 void undoTransferGet(TransferNamesAndCommands tncg)
          Undoes ftp get transfer.
 void undoTransferPut(TransferNamesAndCommands tncp)
          Undoes ftp put transfer.
 

Field Detail

TC_GET

static final java.lang.String TC_GET
See Also:
Constant Field Values

TC_PUT

static final java.lang.String TC_PUT
See Also:
Constant Field Values

ENCODING_DEFAULT

static final java.lang.String ENCODING_DEFAULT
See Also:
Constant Field Values

ENCODING_SJIS

static final java.lang.String ENCODING_SJIS
See Also:
Constant Field Values

ENCODING_EUC_JP

static final java.lang.String ENCODING_EUC_JP
See Also:
Constant Field Values

ENCODING_GBK

static final java.lang.String ENCODING_GBK
See Also:
Constant Field Values

ENCODING_BIG5

static final java.lang.String ENCODING_BIG5
See Also:
Constant Field Values

ENCODING_JIS

static final java.lang.String ENCODING_JIS
See Also:
Constant Field Values
Method Detail

initialize

void initialize(FtpETD etd)
                throws FtpFileException
Initializes the FTP ETD object.

Parameters:
etd - The FtpETD instance.
Throws:
FtpFileException - If some error occurs.

close

void close()
Does the FTP log-out and disconnects.


initialConfigValues

void initialConfigValues(java.util.Properties props)
                         throws FtpFileException
Initializes the e*Way Connection's configuration properties from user-specified properties.

Parameters:
props - The specified properties.
Throws:
FtpFileException - If some error occurs.

isOpen

boolean isOpen()
Verifies that the e*Way Connection to the external system is still available.

Returns:
true if the connection is still open and available; false otherwise.

open

void open()
          throws FtpFileException
Performs the FTP connection, log-in and switch modes, and so on.

Throws:
FtpFileException - If some error occurs.

open

void open(java.lang.String encoding)
          throws FtpFileException
Performs the FTP connection, log-in and switch modes, and so on.

Parameters:
encoding - The encoding for the server.
Throws:
FtpFileException - If some error occurs.

allowTransfer

void allowTransfer()
Allow transfers in XA mode.


reset

boolean reset()
              throws FtpFileException
Resets the data content of an FtpFileClient.

Returns:
false if the FtpFileClient doesn't have a meaningful implementation of reset(); so do a new of the FtpFileClient instead. Otherwise, return true if the reset() will clear the data content of the FtpFileClient.
Throws:
FtpFileException - If some error occurs.

restoreConfigValues

void restoreConfigValues()
                         throws FtpFileException
Restores all the ETD's configuration properties from the related e*Way Connection.

Throws:
FtpFileException - If some error occurs.

terminate

void terminate()
               throws FtpFileException
Terminates the FtpFileClient object instance.

Throws:
FtpFileException - If some error occurs.

isXA

boolean isXA()
Determines whether an e*Way Connection is in the XA mode.

Returns:
true or false.

getPayload

byte[] getPayload()
Retrieves the data payload.

The data payload is a blob (byte array) used to store the raw content of a file.

Returns:
The data payload.

getUserProperties

java.util.Properties getUserProperties()
Retrieves user-defined properties.

This method is an advanced setting and is part of the FTP ETD's user-extensibility features.

The properties are retrieved from the user properties file.

Returns:
The user-defined properties.

releaseResources

void releaseResources()
Releases the e*Way Connection's system resources but does not close the connection to the external system.


setPayload

void setPayload(byte[] newPayload)
Sets the data payload.

The data payload is a blob (byte array) used to store the raw content of a file.

Parameters:
newPayload - The data payload.

connect

void connect()
             throws FtpFileException
Performs the FTP connection, log-in and switch modes, and so on.

Throws:
FtpFileException - If some error occurs.

connect

void connect(java.lang.String encoding)
             throws FtpFileException
Performs the FTP connection, log-in and switch modes, and so on.

Parameters:
encoding - The encoding for the server.
Throws:
FtpFileException - If some error occurs.

disconnect

void disconnect()
Does the FTP log-out and disconnects.


isConnected

boolean isConnected()
Verifies that the e*Way Connection to the external system is still available.

Returns:
true If the connection is still open and available; false if otherwise.

setInputStreamAdapter

void setInputStreamAdapter(com.stc.eways.common.eway.standalone.streaming.InputStreamAdapter isa)
Used to request data streams from another ETD.

Parameters:
isa - InputStreamAdapter object.

setOutputStreamAdapter

void setOutputStreamAdapter(com.stc.eways.common.eway.standalone.streaming.OutputStreamAdapter osa)
Used to request data streams from another ETD.

Parameters:
osa - OutputStreamAdapter object.

getResolvedNamesForGet

TransferNamesAndCommands getResolvedNamesForGet()
                                                throws FtpFileException
Resolves names from patterns for the FTP get operation.

Returns:
An object of the TransferNamesAndCommands class.
Throws:
FtpFileException - If some error occurs.

getResolvedNamesForPut

TransferNamesAndCommands getResolvedNamesForPut()
                                                throws FtpFileException
Resolves names from patterns for the FTP put operation.

Returns:
An object of the TransferNamesAndCommands class.
Throws:
FtpFileException - If some error occurs.

put

void put()
         throws FtpFileException
Stores a remote FTP file. This method is exposed in the ETD structure and takes the related e*Way Connection's configuration parameters as its input. The method encapsulates all necessary FTP operations.

Throws:
FtpFileException - If some error occurs.

cleanupPostTransferGet

void cleanupPostTransferGet(TransferNamesAndCommands tncg)
                            throws java.lang.Exception
Cleans up any failures during Post Transfer Command for "get".

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

cleanupPostTransferPut

void cleanupPostTransferPut(TransferNamesAndCommands tncp)
                            throws java.lang.Exception
Cleans up any failures during Post Transfer Command for "put".

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

cleanupPreTransferGet

void cleanupPreTransferGet(TransferNamesAndCommands tncg)
                           throws java.lang.Exception
Cleans up any failures during Pre Transfer Command for "get".

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

cleanupPreTransferPut

void cleanupPreTransferPut(TransferNamesAndCommands tncp)
                           throws java.lang.Exception
Cleans up any failures during Pre Transfer Command for "put".

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

cleanupRawCommands

void cleanupRawCommands(TransferNamesAndCommands tncr)
                        throws FtpFileException
Cleans up any failures during pre/post ftp raw commands.

Parameters:
tncr - An instance of TransferNamesAndCommands class.
Throws:
FtpFileException - If some error occurs.

cleanupTransferGet

void cleanupTransferGet(TransferNamesAndCommands tncg)
                        throws java.lang.Exception
Cleans up any failures during ftp Transfer "get".

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

cleanupTransferPut

void cleanupTransferPut(TransferNamesAndCommands tncp)
                        throws java.lang.Exception
Cleans up any failures during ftp Transfer "put".

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doPostTransferGet

void doPostTransferGet(TransferNamesAndCommands tncg)
                       throws java.lang.Exception
Performs Post Transfer Command for FTP get operation.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doPostTransferPut

void doPostTransferPut(TransferNamesAndCommands tncp)
                       throws java.lang.Exception
Performs Post Transfer Command for FTP put operation.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doPreTransferGet

void doPreTransferGet(TransferNamesAndCommands tncg)
                      throws java.lang.Exception
Performs Pre Transfer Command for FTP get operation.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doPreTransferPut

void doPreTransferPut(TransferNamesAndCommands tncp)
                      throws java.lang.Exception
Performs Pre Transfer Command for FTP put operation.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doRawCommands

void doRawCommands(java.lang.String commands)
                   throws FtpFileException
Performs FTP pre and post transfer raw commands, for example: SITE RECFM=FB;SITE LRECL=50;SITE BLOCKSIZE=32750;SITE TRACKS;SITE PRI=5;SITE SEC=5 NOTE: The commands are separated by a semicolon (;), and only FTP raw commands are expected.

Parameters:
commands - The FTP raw command set.
commands - The raw command set.
Throws:
FtpFileException - If some error occurs.

doTransferGet

void doTransferGet(TransferNamesAndCommands tncg)
                   throws java.lang.Exception
Performs the real FTP get transfer.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

doTransferPut

void doTransferPut(TransferNamesAndCommands tncp)
                   throws java.lang.Exception
Performs the real FTP put transfer.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoPostTransferGet

void undoPostTransferGet(TransferNamesAndCommands tncg)
                         throws java.lang.Exception
Undoes Post Transfer for FTP get operation.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoPostTransferPut

void undoPostTransferPut(TransferNamesAndCommands tncp)
                         throws java.lang.Exception
Undoes Post Transfer for FTP put operation.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoPreTransferGet

void undoPreTransferGet(TransferNamesAndCommands tncg)
                        throws java.lang.Exception
Undoes Pre Transfer for FTP get operation.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoPreTransferPut

void undoPreTransferPut(TransferNamesAndCommands tncp)
                        throws java.lang.Exception
Undoes Pre Transfer for FTP put operation.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoRawCommands

void undoRawCommands(TransferNamesAndCommands tncr)
                     throws FtpFileException
Undo pre/post ftp raw commands.

Parameters:
tncr - An instance of TransferNamesAndCommands.
Throws:
FtpFileException - If some error occurs.

undoTransferGet

void undoTransferGet(TransferNamesAndCommands tncg)
                     throws java.lang.Exception
Undoes ftp get transfer.

Parameters:
tncg - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

undoTransferPut

void undoTransferPut(TransferNamesAndCommands tncp)
                     throws java.lang.Exception
Undoes ftp put transfer.

Parameters:
tncp - An instance of TransferNamesAndCommands class.
Throws:
java.lang.Exception - If some error occurs.

get

void get()
         throws FtpFileException
Retrieves a file from the remote FTP server. This method retrieves the first matching entry under your directory and file name. It is exposed in ETD structure and takes the e*Way Connection's configuration parameters as its input. The method encapsulates all necessary FTP operations. Note: If no qualified file is available for retrieving, you will get the exception containing java.io.FileNotFoundException as a nested exception.

Throws:
FtpFileException - If some error occurs.

getIfExists

void getIfExists()
                 throws FtpFileException
Same as get but if there is no file found matching the name pattern given in "Target Directory Name" and "Target File Name", just return siliently; Invoking of the method can result in : a) throw Exception ( SoapFault if it is BPEL ), the caller is notified an error b) getIfExists() (readIfExists() for BPEL) successful, payload is NULL, target file does not exists; c) getIfExists() (readIfExists() for BPEL) successful, payload is NOT NULL, target file detected and content is read, if the content is 0 length, this lead to a byte[] of 0 length as payload;

Throws:
FtpFileException - If some error occurs.

Sun Adapter for Batch/FTP