org.neociclo.odetteftp.protocol.v13
Class CommandBuilderVer13

java.lang.Object
  extended by org.neociclo.odetteftp.protocol.CommandBuilder
      extended by org.neociclo.odetteftp.protocol.v13.CommandBuilderVer13
Direct Known Subclasses:
CommandBuilderVer14

public class CommandBuilderVer13
extends CommandBuilder

Version:
$Rev: 800 $ $Date: 2010-10-19 20:55:25 -0200 (Tue, 19 Oct 2010) $
Author:
Rafael Marins

Field Summary
static String DATE_STAMP_PATTERN
          String formatter pattern for converting a Date value to the Date stamp used on commands.
static String TIME_STAMP_PATTERN
          String formatter pattern for converting a Date value to the Time stamp used on commands.
 
Fields inherited from class org.neociclo.odetteftp.protocol.CommandBuilder
DEFAULT_PROTOCOL_CHARSET, ZERO
 
Constructor Summary
CommandBuilderVer13()
           
 
Method Summary
static CommandExchangeBuffer endFile(long recordCount, long unitCount)
          Create the End File command indicating the count of records and overall octets from the transmitted Virtual File.
The count will express the real size of the file (before compression, header not included).
static CommandExchangeBuffer endFileNegativeAnswer(AnswerReason reason)
          Create the End File Negative Answer command providing the reason for stopping transfer.
static CommandExchangeBuffer endFilePositiveAnswer(boolean changeDirection)
          Create the End File Positive Answer command indicating whether the Listener is requesting or not a Change Direction (CD) command from Speaker or not.
static CommandExchangeBuffer endSession(EndSessionReason reason)
          Create the End Session command indicating the reason code for terminating the session.
static CommandExchangeBuffer endToEndResponse(String dataSetName, Date dateTime, String userData, String destination, String originator)
          Create the End to End Response command with given parameters.
static CommandExchangeBuffer startFile(String datasetName, Date dateTime, String userData, String destination, String originator, RecordFormat recordFormat, int maxRecordSize, long fileSize, long restartOffset)
          Create the Start File command with given parameters.
The Start File command includes a count allowing the restart of an interrupted transmission to be negotiated.
static CommandExchangeBuffer startFileNegativeAnswer(AnswerReason reason, boolean retry)
          Create the Start File Negative Answer command containing the the reason why transmission can not proced.
This retry parameter is used to advise the Speaker if it should retry at a latter point in time due to a temporary condition at the Listener site, such as a lack of storage space.
static CommandExchangeBuffer startFilePositiveAnswer(long answerCount)
          Create the Start File Positive Answer command.
static CommandExchangeBuffer startSession(int protocolLevel, String code, String pswd, int sdeb, TransferMode mode, boolean compression, boolean restart, boolean specialLogic, int credit, String userData)
          Create the Start Session command with given parameters.
 
Methods inherited from class org.neociclo.odetteftp.protocol.CommandBuilder
changeDirection, isEmpty, readyMessage, readyToReceive, setCredit, yesNo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_STAMP_PATTERN

public static final String DATE_STAMP_PATTERN
String formatter pattern for converting a Date value to the Date stamp used on commands.

See Also:
SimpleDateFormat.SimpleDateFormat(java.lang.String), Constant Field Values

TIME_STAMP_PATTERN

public static final String TIME_STAMP_PATTERN
String formatter pattern for converting a Date value to the Time stamp used on commands.

See Also:
SimpleDateFormat.SimpleDateFormat(java.lang.String), Constant Field Values
Constructor Detail

CommandBuilderVer13

public CommandBuilderVer13()
Method Detail

endFile

public static CommandExchangeBuffer endFile(long recordCount,
                                            long unitCount)
Create the End File command indicating the count of records and overall octets from the transmitted Virtual File.
The count will express the real size of the file (before compression, header not included). The total count is always used, even during restart processing.

Parameters:
recordCount - For FIXED or VARIABLE record formats, the exact record count. For UNSTRUCTURED or TEXTFILE, must be zero.
unitCount - Exact number of units (octets) transmitted.
Returns:

endFileNegativeAnswer

public static CommandExchangeBuffer endFileNegativeAnswer(AnswerReason reason)
Create the End File Negative Answer command providing the reason for stopping transfer.

Parameters:
reason - Reason why transmission can not proceed.
Returns:
The End File Negative Answer command with the corresponding values.

endFilePositiveAnswer

public static CommandExchangeBuffer endFilePositiveAnswer(boolean changeDirection)
Create the End File Positive Answer command indicating whether the Listener is requesting or not a Change Direction (CD) command from Speaker or not.

Parameters:
changeDirection - Change Direction Indicator.
Returns:
The End File Positive Answer command with the corresponding values.

endSession

public static CommandExchangeBuffer endSession(EndSessionReason reason)
Create the End Session command indicating the reason code for terminating the session.

Parameters:
reason - End Session Reason.
Returns:
The End Session command with the corresponding values.

endToEndResponse

public static CommandExchangeBuffer endToEndResponse(String dataSetName,
                                                     Date dateTime,
                                                     String userData,
                                                     String destination,
                                                     String originator)
Create the End to End Response command with given parameters.

Parameters:
dataSetName - Dataset name of the Virtual File being transfered.
dateTime - Virtual File date and time indicating when the file was made available for transmission.
userData - May be used by the Odette FTP in any way.
destination - Identification code from the Originator of the Virtual File, which created (mapped) the data for transmission.
originator - Identification code of the Final Recipient of the Virtual File. This is the location that creates the EERP for the received file.
Returns:
The End to End Response command with the corresponding values.

startFile

public static CommandExchangeBuffer startFile(String datasetName,
                                              Date dateTime,
                                              String userData,
                                              String destination,
                                              String originator,
                                              RecordFormat recordFormat,
                                              int maxRecordSize,
                                              long fileSize,
                                              long restartOffset)
Create the Start File command with given parameters.
The Start File command includes a count allowing the restart of an interrupted transmission to be negotiated. If restart facilities are not available the restart count must be set to zero. The sender will start with the lowest record count + 1.

Parameters:
datasetName - Dataset Name of the Virtual File being transferred assigned by bilateral agreement.
dateTime - Specific Date and Time assigned by the Virtual File's Originator indicating when the file was made available for transmission.
userData - May be used by the ODETTE-FTP in any way. If unused it should be initialized to spaces. It is expected that a bilateral agreement exists as to the meaning of the data.
destination - The Identification Code for the final recipient of the Virtual File. This is the location that will look into the Virtual File content and perform mapping functions. It is also the location that creates the End to End Response (EERP) command for the received file.
originator - The Identification Code from the Originator of the Virtual File. It is the location that created (mapped) the data for transmission.
recordFormat - Virtual File format (Fixed, Variable, Unstructured, Text File). Used to calculate the restart position.
maxRecordSize - Length in octets of the longest logical record which may be transferred to a location. Only user data is included. If File format is 'T' or 'U' then this attribute must be set to '00000'
fileSize - File Size, 1K (1024 octets) blocks.
restartOffset - Restart position.
Returns:
The Start File command with the corresponding values.

startFileNegativeAnswer

public static CommandExchangeBuffer startFileNegativeAnswer(AnswerReason reason,
                                                            boolean retry)
Create the Start File Negative Answer command containing the the reason why transmission can not proced.
This retry parameter is used to advise the Speaker if it should retry at a latter point in time due to a temporary condition at the Listener site, such as a lack of storage space. It should be used in conjunction with the Answer Reason code.

Parameters:
reason - Answer Reason.
retry - true if the transmission may be retried latter, or false to don't retry again.
Returns:
The Start File Negative Answer command with the corresponding values.

startFilePositiveAnswer

public static CommandExchangeBuffer startFilePositiveAnswer(long answerCount)
Create the Start File Positive Answer command. The only parameter indicate which position the Listener agree to restart the receive of a previous Virtual File.

Parameters:
answerCount - int lower or equal to restart count specified by the Speaker in the Start File (SFID) command. If restart facilities are not avaiable, a count of zero must be specified.
Returns:
The Start File Positive Answer command with the corresponding values.

startSession

public static CommandExchangeBuffer startSession(int protocolLevel,
                                                 String code,
                                                 String pswd,
                                                 int sdeb,
                                                 TransferMode mode,
                                                 boolean compression,
                                                 boolean restart,
                                                 boolean specialLogic,
                                                 int credit,
                                                 String userData)
Create the Start Session command with given parameters. It belongs to the Start Session Phase, and is performed in both direction to negotiate capabilities and session wide parameters between locations.

Parameters:
protocolLevel - protocolLevel
code - Initiator's Identification Code which uniquely identifies the Initiator (sender) participating in the Odette FTP session.
pswd - Key to authenticate the sender. Assigned by bilateral agreement.
sdeb - The length, in octets, of the largest Exchange Buffer that can be accepted by the location.
compression - Compression indicator. true if the location can handle compressed data. Otherwise it should be false.
restart - Restart indication informing whether the location can handle the restart of a partially transmitted file.
specialLogic - Special logic indication.
credit - Credit.
userData - User Data.
sendReceive - Sender / Receiver capabilities:
Returns:
The Start Session command with the corresponding values.


ACCORD