org.apache.maven.wagon.events

Class TransferEventSupport


public final class TransferEventSupport
extends java.lang.Object

The class allows registration and removal of event listners of type TransferListener and dispatch of those events to those listeners
Version:
$Id: TransferEventSupport.java 162476 2005-04-19 02:49:45Z brett $
Author:
Michal Maczka

Method Summary

void
addTransferListener(TransferListener listener)
Adds the listener to the collection of listeners who will be notifed when any transfer event occurs in this Wagon object.
void
fireDebug(String message)
Dispatches the given debug message to all registred listeners (calls method TransferListener.debug(String) on all of them.
void
fireTransferCompleted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferCompleted(TransferEvent) on all of them}.
void
fireTransferError(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferError(TransferEvent) on all of them.
void
fireTransferInitiated(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferInitiated(TransferEvent) on all of them.
void
fireTransferProgress(TransferEvent transferEvent, byte[] buffer, int length)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferProgress(TransferEvent,byte[],int) on all of them).
void
fireTransferStarted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferStarted(TransferEvent) on all of them}.
boolean
hasTransferListener(TransferListener listener)
Returns whether the specified instance of transfer listener was added to the collection of listeners who will be notifed when an transfer event occurs
void
removeTransferListener(TransferListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.

Method Details

addTransferListener

public void addTransferListener(TransferListener listener)
Adds the listener to the collection of listeners who will be notifed when any transfer event occurs in this Wagon object.
If listener is null, no exception is thrown and no action is performed
Parameters:
listener - the transfer listener

fireDebug

public void fireDebug(String message)
Parameters:
message - the debug message which will be dispached to listeners

fireTransferCompleted

public void fireTransferCompleted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferCompleted(TransferEvent) on all of them}. The Event should be of type TransferEvent.TRANSFER_COMPLETED
Parameters:
transferEvent - the TransferEvent which will be dispached to listeners

fireTransferError

public void fireTransferError(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferError(TransferEvent) on all of them. The Event should be of type TransferEvent.TRANSFER_ERROR and it is expected that TransferEvent.getException() } method will return not null value
Parameters:
transferEvent - the TransferEvent which will be dispached to listeners

fireTransferInitiated

public void fireTransferInitiated(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferInitiated(TransferEvent) on all of them. The Event should be of type TransferEvent.TRANSFER_INITIATED.
Parameters:
transferEvent - the TransferEvent which will be dispached to listeners

fireTransferProgress

public void fireTransferProgress(TransferEvent transferEvent,
                                 byte[] buffer,
                                 int length)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferProgress(TransferEvent,byte[],int) on all of them). The Event should be of type TransferEvent.TRANSFER_PROGRESS.
Parameters:
transferEvent - the TransferEvent which will be dispached to listeners
buffer - the buffer containing the additional content
length - the length of the content in the buffer

fireTransferStarted

public void fireTransferStarted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method TransferListener.transferStarted(TransferEvent) on all of them}. The Event should be of type TransferEvent.TRANSFER_COMPLETED
Parameters:
transferEvent - the TransferEvent which will be dispached to listeners

hasTransferListener

public boolean hasTransferListener(TransferListener listener)
Returns whether the specified instance of transfer listener was added to the collection of listeners who will be notifed when an transfer event occurs
Parameters:
listener - the transfer listener
Returns:
true if given listner was added to the collection of listeners false otherwise

removeTransferListener

public void removeTransferListener(TransferListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
If listener is null or specified listener was not added to this TransferEventSupport object no exception is thrown and no action is performed
Parameters:
listener - the transfer listener