org.neociclo.odetteftp.support
Class SharedQueueOftpletSpeaker

java.lang.Object
  extended by org.neociclo.odetteftp.support.SharedQueueOftpletSpeaker
All Implemented Interfaces:
OftpletSpeaker

public class SharedQueueOftpletSpeaker
extends Object
implements OftpletSpeaker

Version:
$Rev: 716 $ $Date: 2010-09-23 12:45:55 -0300 (Thu, 23 Sep 2010) $
Author:
Rafael Marins

Constructor Summary
SharedQueueOftpletSpeaker(Queue<OdetteFtpObject> outgoing, Queue<OdetteFtpObject> outgoingDone)
           
 
Method Summary
 OdetteFtpObject nextOftpObjectToSend()
           
 void onDataSent(VirtualFile virtualFile, long totalOctetsSent)
           
 void onNotificationSent(DeliveryNotification notif)
           
 void onSendFileEnd(VirtualFile virtualFile)
          Callback method invoked when the file is fully transmitted.
 void onSendFileError(VirtualFile virtualFile, AnswerReasonInfo reason, boolean retryLater)
          Callback method to indicate the transmitting file is not accepted by the other peer - being in the Speaker state.
 void onSendFileStart(VirtualFile virtualFile, long answerCount)
          Callback method to indicate the given file transfer will begin.
 void setEventListener(OftpletEventListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedQueueOftpletSpeaker

public SharedQueueOftpletSpeaker(Queue<OdetteFtpObject> outgoing,
                                 Queue<OdetteFtpObject> outgoingDone)
Method Detail

nextOftpObjectToSend

public OdetteFtpObject nextOftpObjectToSend()
Specified by:
nextOftpObjectToSend in interface OftpletSpeaker

onSendFileStart

public void onSendFileStart(VirtualFile virtualFile,
                            long answerCount)
Description copied from interface: OftpletSpeaker
Callback method to indicate the given file transfer will begin. Called after the receive of Start File Positive Answer (SFPA) command while in the Speaker state, just before the first DATA command is released.

Specified by:
onSendFileStart in interface OftpletSpeaker
Parameters:
virtualFile - the bundle of transfer info and virtual file being transferred.
answerCount - negotiated restart offset

onDataSent

public void onDataSent(VirtualFile virtualFile,
                       long totalOctetsSent)
Specified by:
onDataSent in interface OftpletSpeaker

onSendFileEnd

public void onSendFileEnd(VirtualFile virtualFile)
Description copied from interface: OftpletSpeaker
Callback method invoked when the file is fully transmitted. It happens after receiving the End File Positive Answer (EFNA) command while in the Speaker state.

Specified by:
onSendFileEnd in interface OftpletSpeaker

onSendFileError

public void onSendFileError(VirtualFile virtualFile,
                            AnswerReasonInfo reason,
                            boolean retryLater)
Description copied from interface: OftpletSpeaker
Callback method to indicate the transmitting file is not accepted by the other peer - being in the Speaker state. It is always the case when receiving a Start File Negative Answer (SFNA) and End File Negative Answer (EFNA) protocol commands.

Any other kind of error, such as IoException or FileTransferException, it should be handled by the Oftplet.onExceptionCaught(Throwable) method.

Specified by:
onSendFileError in interface OftpletSpeaker

onNotificationSent

public void onNotificationSent(DeliveryNotification notif)
Specified by:
onNotificationSent in interface OftpletSpeaker

setEventListener

public void setEventListener(OftpletEventListener listener)


ACCORD