org.neociclo.odetteftp.support
Class SharedQueueOftpletListener

java.lang.Object
  extended by org.neociclo.odetteftp.support.SharedQueueOftpletListener
All Implemented Interfaces:
OftpletListener

public class SharedQueueOftpletListener
extends Object
implements OftpletListener

Version:
$Rev: 788 $ $Date: 2010-10-18 15:13:22 -0200 (Mon, 18 Oct 2010) $
Author:
Rafael Marins

Constructor Summary
SharedQueueOftpletListener(Queue<OdetteFtpObject> incoming)
           
 
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)
           
 void setEventListener(OftpletEventListener eventListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedQueueOftpletListener

public SharedQueueOftpletListener(Queue<OdetteFtpObject> incoming)
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.

onReceiveFileStart

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

onDataReceived

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

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

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.

setEventListener

public void setEventListener(OftpletEventListener eventListener)


ACCORD