org.apache.maven.wagon.events

Class TransferEventSupport

public final class TransferEventSupport extends 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

Field Summary
Listlisteners
registred listeners
Method Summary
voidaddTransferListener(TransferListener listener)
Adds the listener to the collection of listeners who will be notifed when any transfer event occurs in this Wagon object.
voidfireDebug(String message)
Dispatches the given debug message to all registred listeners (calls method debug on all of them.
voidfireTransferCompleted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method transferCompleted on all of them}.
voidfireTransferError(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method transferError on all of them.
voidfireTransferInitiated(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method transferInitiated on all of them.
voidfireTransferProgress(TransferEvent transferEvent, byte[] buffer, int length)
Dispatches the given TransferEvent to all registred listeners (calls method (TransferEvent, byte[], int) on all of them).
voidfireTransferStarted(TransferEvent transferEvent)
Dispatches the given TransferEvent to all registred listeners (calls method transferStarted on all of them}.
booleanhasTransferListener(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
voidremoveTransferListener(TransferListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.

Field Detail

listeners

private final List listeners
registred listeners

Method Detail

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

See Also: removeTransferListener TransferListener

fireDebug

public void fireDebug(String message)
Dispatches the given debug message to all registred listeners (calls method debug on all of them.

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 transferCompleted on all of them}. The Event should be of type 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 transferError on all of them. The Event should be of type TRANSFER_ERROR and it is expected that 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 transferInitiated on all of them. The Event should be of type 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 (TransferEvent, byte[], int) on all of them). The Event should be of type 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 transferStarted on all of them}. The Event should be of type 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

See Also: TransferEvent addTransferListener

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

See Also: addTransferListener