Package org.apache.maven.wagon.events
Class TransferEventSupport
- java.lang.Object
-
- org.apache.maven.wagon.events.TransferEventSupport
-
public final class TransferEventSupport extends java.lang.ObjectThe class allows registration and removal of event listeners of type TransferListener and dispatch of those events to those listeners
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<TransferListener>listenersregistered listeners
-
Constructor Summary
Constructors Constructor Description TransferEventSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTransferListener(TransferListener listener)Adds the listener to the collection of listeners who will be notified when any transfer event occurs in thisWagonobject.voidfireDebug(java.lang.String message)Dispatches the given debug message to all registered listeners (calls methodTransferListener.debug(String)on all of them.voidfireTransferCompleted(TransferEvent transferEvent)Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferCompleted(TransferEvent)on all of them}.voidfireTransferError(TransferEvent transferEvent)Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferError(TransferEvent)on all of them.voidfireTransferInitiated(TransferEvent transferEvent)Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferInitiated(TransferEvent)on all of them.voidfireTransferProgress(TransferEvent transferEvent, byte[] buffer, int length)Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferProgress(TransferEvent, byte[], int)on all of them).voidfireTransferStarted(TransferEvent transferEvent)Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferStarted(TransferEvent)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 notified when an transfer event occursvoidremoveTransferListener(TransferListener listener)Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
-
-
-
Field Detail
-
listeners
private final java.util.List<TransferListener> listeners
registered listeners
-
-
Method Detail
-
addTransferListener
public void addTransferListener(TransferListener listener)
Adds the listener to the collection of listeners who will be notified when any transfer event occurs in thisWagonobject.
If listener isnull, no exception is thrown and no action is performed- Parameters:
listener- the transfer listener- See Also:
removeTransferListener(org.apache.maven.wagon.events.TransferListener),TransferListener
-
removeTransferListener
public void removeTransferListener(TransferListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
If listener isnullor specified listener was not added to thisTransferEventSupportobject no exception is thrown and no action is performed- Parameters:
listener- the transfer listener- See Also:
addTransferListener(TransferListener)
-
hasTransferListener
public boolean hasTransferListener(TransferListener listener)
Returns whether the specified instance of transfer listener was added to the collection of listeners who will be notified when an transfer event occurs- Parameters:
listener- the transfer listener- Returns:
trueif given listener was added to the collection of listenersfalseotherwise- See Also:
TransferEvent,addTransferListener(TransferListener)
-
fireTransferStarted
public void fireTransferStarted(TransferEvent transferEvent)
Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferStarted(TransferEvent)on all of them}. The Event should be of typeTransferEvent.TRANSFER_COMPLETED- Parameters:
transferEvent- the TransferEvent which will be dispatched to listeners
-
fireTransferProgress
public void fireTransferProgress(TransferEvent transferEvent, byte[] buffer, int length)
Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferProgress(TransferEvent, byte[], int)on all of them). The Event should be of typeTransferEvent.TRANSFER_PROGRESS.- Parameters:
transferEvent- the TransferEvent which will be dispatched to listenersbuffer- the buffer containing the additional contentlength- the length of the content in the buffer
-
fireTransferCompleted
public void fireTransferCompleted(TransferEvent transferEvent)
Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferCompleted(TransferEvent)on all of them}. The Event should be of typeTransferEvent.TRANSFER_COMPLETED- Parameters:
transferEvent- the TransferEvent which will be dispatched to listeners
-
fireTransferError
public void fireTransferError(TransferEvent transferEvent)
Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferError(TransferEvent)on all of them. The Event should be of typeTransferEvent.TRANSFER_ERRORand it is expected thatTransferEvent.getException()} method will return not null value- Parameters:
transferEvent- the TransferEvent which will be dispatched to listeners
-
fireDebug
public void fireDebug(java.lang.String message)
Dispatches the given debug message to all registered listeners (calls methodTransferListener.debug(String)on all of them.- Parameters:
message- the debug message which will be dispatched to listeners
-
fireTransferInitiated
public void fireTransferInitiated(TransferEvent transferEvent)
Dispatches the givenTransferEventto all registered listeners (calls methodTransferListener.transferInitiated(TransferEvent)on all of them. The Event should be of typeTransferEvent.TRANSFER_INITIATED.- Parameters:
transferEvent- the TransferEvent which will be dispatched to listeners
-
-