org.neociclo.odetteftp.oftplet
Class OftpletListenerAdapter

java.lang.Object
  extended by org.neociclo.odetteftp.oftplet.OftpletListenerAdapter
All Implemented Interfaces:
OftpletListener

public class OftpletListenerAdapter
extends Object
implements OftpletListener

Version:
$Rev: 725 $ $Date: 2010-09-27 13:07:49 -0300 (Mon, 27 Sep 2010) $
Author:
Rafael Marins

Field Summary
protected  Oftplet oftplet
           
 
Constructor Summary
OftpletListenerAdapter()
           
OftpletListenerAdapter(Oftplet oftplet)
           
 
Method Summary
 StartFileResponse acceptStartFile(VirtualFile virtualFile)
          Callback method indicating a receive file request, used to construct and return the VirtualFile instance.
 void onDataReceived(VirtualFile virtualFile, long totalOctetsReceived)
           
 void onNotificationReceived(DeliveryNotification notif)
          Callback method to indicate the Oftplet about the receive of a delivery notification.
 EndFileResponse onReceiveFileEnd(VirtualFile virtualFile, long recordCount, long unitCount)
          Callback method indicating the file receive end request with given parameters information used to check the integrity of the received file.
 void onReceiveFileError(VirtualFile virtualFile, AnswerReasonInfo reason)
           
 void onReceiveFileStart(VirtualFile virtualFile, long answerCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oftplet

protected Oftplet oftplet
Constructor Detail

OftpletListenerAdapter

public OftpletListenerAdapter()

OftpletListenerAdapter

public OftpletListenerAdapter(Oftplet oftplet)
Method Detail

acceptStartFile

public StartFileResponse acceptStartFile(VirtualFile virtualFile)
Description copied from interface: OftpletListener
Callback method indicating a receive file request, used to construct and return the VirtualFile instance. Returning null corresponds to refuse the file receiving - reply with Start File Negative Answer (SFNA) with AnswerReason.UNSPECIFIED reason.

The given parameters provide required information to map the transferring VirtualFile into the Oftplet implementation's local system.

Specified by:
acceptStartFile in interface OftpletListener
Parameters:
virtualFile - holder of file receive indication parameters.
Returns:
the VirtualFile instance ready to start the file receiving.

onDataReceived

public void onDataReceived(VirtualFile virtualFile,
                           long totalOctetsReceived)
Specified by:
onDataReceived in interface OftpletListener

onNotificationReceived

public void onNotificationReceived(DeliveryNotification notif)
Description copied from interface: OftpletListener
Callback method to indicate the Oftplet about the receive of a delivery notification. Called when processing the receive of the End-to-End Response (EERP) or Negative End Response (NERP) command while in the Listener state.

Specified by:
onNotificationReceived in interface OftpletListener
Parameters:
notif - holder of the received delivery notification parameters.

onReceiveFileEnd

public EndFileResponse onReceiveFileEnd(VirtualFile virtualFile,
                                        long recordCount,
                                        long unitCount)
Description copied from interface: OftpletListener
Callback method indicating the file receive end request with given parameters information used to check the integrity of the received file. When an inconsistency is found this method should throw a FileTransferException with the proper reason code.

The returning boolean value indicates whether the other peer, operating in the Speaker state, should issue a Change Direction (CD) command and revert this Oftplet implementation ODETTE-FTP entity state.

Specified by:
onReceiveFileEnd in interface OftpletListener
recordCount - number of records the other ODETTE-FTP peer sent in the VirtualFile.
unitCount - exact number of units (octets) transmitted.
Returns:
whether to change direction after complete the file receiving.

onReceiveFileError

public void onReceiveFileError(VirtualFile virtualFile,
                               AnswerReasonInfo reason)
Specified by:
onReceiveFileError in interface OftpletListener

onReceiveFileStart

public void onReceiveFileStart(VirtualFile virtualFile,
                               long answerCount)
Specified by:
onReceiveFileStart in interface OftpletListener


ACCORD