Package org.apache.maven.wagon.events
Class TransferEventSupport
- java.lang.Object
-
- org.apache.maven.wagon.events.TransferEventSupport
-
public final class TransferEventSupport extends java.lang.Object
The class allows registration and removal of event listeners of type TransferListener and dispatch of those events to those listeners- Author:
- Michal Maczka
-
-
Constructor Summary
Constructors Constructor Description TransferEventSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransferListener(TransferListener listener)
Adds the listener to the collection of listeners who will be notified when any transfer event occurs in thisWagon
object.void
fireDebug(java.lang.String message)
Dispatches the given debug message to all registered listeners (calls methodTransferListener.debug(String)
on all of them.void
fireTransferCompleted(TransferEvent transferEvent)
Dispatches the givenTransferEvent
to all registered listeners (calls methodTransferListener.transferCompleted(TransferEvent)
on all of them}.void
fireTransferError(TransferEvent transferEvent)
Dispatches the givenTransferEvent
to all registered listeners (calls methodTransferListener.transferError(TransferEvent)
on all of them.void
fireTransferInitiated(TransferEvent transferEvent)
Dispatches the givenTransferEvent
to all registered listeners (calls methodTransferListener.transferInitiated(TransferEvent)
on all of them.void
fireTransferProgress(TransferEvent transferEvent, byte[] buffer, int length)
Dispatches the givenTransferEvent
to all registered listeners (calls methodTransferListener.transferProgress(TransferEvent, byte[], int)
on all of them).void
fireTransferStarted(TransferEvent transferEvent)
Dispatches the givenTransferEvent
to all registered listeners (calls methodTransferListener.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 notified when an transfer event occursvoid
removeTransferListener(TransferListener listener)
Removes the transfer listener from the collection of listeners so it no longer receives transfer events.
-
-
-
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 thisWagon
object.
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 isnull
or specified listener was not added to thisTransferEventSupport
object 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:
true
if given listener was added to the collection of listeners
false
otherwise- See Also:
TransferEvent
,addTransferListener(TransferListener)
-
fireTransferStarted
public void fireTransferStarted(TransferEvent transferEvent)
Dispatches the givenTransferEvent
to 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 givenTransferEvent
to 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 givenTransferEvent
to 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 givenTransferEvent
to all registered listeners (calls methodTransferListener.transferError(TransferEvent)
on all of them. The Event should be of typeTransferEvent.TRANSFER_ERROR
and 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 givenTransferEvent
to 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
-
-