com.echomine.net
Class BaseFileHandler

java.lang.Object
  extended by com.echomine.net.BaseFileHandler
All Implemented Interfaces:
FileHandler, SocketHandler
Direct Known Subclasses:
AbstractFileHandler

public abstract class BaseFileHandler
extends java.lang.Object
implements FileHandler

This class simply contains methods to fire off events that other subclasses can just extend and use.


Field Summary
protected  javax.swing.event.EventListenerList listenerList
           
 
Constructor Summary
BaseFileHandler()
           
 
Method Summary
 void addFileListener(FileListener l)
          Add to listen for file transfer events for this specific file transfer
protected  void fireFileInfoChanged(FileEvent event)
          The method can be called to fire event whenever the file info (other than the file size) has changed.
protected  void fireFilesizeChanged(FileEvent event)
           
protected  void fireFileTransferFinished(FileEvent event)
          The method can be called to fire event whenever the file transfer is finished successfully.
protected  void fireFileTransferStarting(FileEvent event, FileEvent vetoEvent)
          Fired before the transfer begins.
protected  void fireFileTransferStartingWithoutVeto(FileEvent event)
          Fired before the transfer begins.
 void removeFileListener(FileListener l)
          remove from listening to file transfer events for this specific file transfer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.echomine.net.FileHandler
getModel, getTransferRateThrottler
 
Methods inherited from interface com.echomine.net.SocketHandler
handle, shutdown, start
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

BaseFileHandler

public BaseFileHandler()
Method Detail

addFileListener

public void addFileListener(FileListener l)
Add to listen for file transfer events for this specific file transfer

Specified by:
addFileListener in interface FileHandler

removeFileListener

public void removeFileListener(FileListener l)
remove from listening to file transfer events for this specific file transfer

Specified by:
removeFileListener in interface FileHandler

fireFilesizeChanged

protected void fireFilesizeChanged(FileEvent event)

fireFileInfoChanged

protected void fireFileInfoChanged(FileEvent event)
The method can be called to fire event whenever the file info (other than the file size) has changed. This will notify the listeners to change the info accordingly.


fireFileTransferFinished

protected void fireFileTransferFinished(FileEvent event)
The method can be called to fire event whenever the file transfer is finished successfully.


fireFileTransferStarting

protected void fireFileTransferStarting(FileEvent event,
                                        FileEvent vetoEvent)
                                 throws TransferVetoException
Fired before the transfer begins. This gives the listener a chance to set things up for a transfer or any preliminary processing. The listener also has a chance to "veto" the transfer. This means that if the listener finds that the transfer should not start, it can throw a veto exception which essentially signals the file handler to abort this transfer. If the transfer is vetoed, whoever was notified before the veto will get notified again that the transfer is "finished". Thus, there is no need to send another file finished event.

Throws:
TransferVetoException

fireFileTransferStartingWithoutVeto

protected void fireFileTransferStartingWithoutVeto(FileEvent event)
                                            throws TransferVetoException
Fired before the transfer begins. This gives the listener a chance to set things up for a transfer or any preliminary processing. The listener also has a chance to "veto" the transfer. This means that if the listener finds that the transfer should not start, it can throw a veto exception which essentially signals the file handler to abort this transfer. This method will not catch the veto exception and notify listeners that already processed the event to end the transfer. This method is normally used when you need to propogate the file event and will fire a transfer finished event later.

Throws:
TransferVetoException


Copyright © 2001-2005 Echomine. All Rights Reserved.