Package org.eclipse.aether.util.listener
Class ChainedRepositoryListener
- java.lang.Object
-
- org.eclipse.aether.AbstractRepositoryListener
-
- org.eclipse.aether.util.listener.ChainedRepositoryListener
-
- All Implemented Interfaces:
RepositoryListener
public final class ChainedRepositoryListener extends AbstractRepositoryListener
A repository listener that delegates to zero or more other listeners (multicast). The list of target listeners is thread-safe, i.e. target listeners can be added or removed by any thread at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<RepositoryListener>listeners
-
Constructor Summary
Constructors Constructor Description ChainedRepositoryListener(java.util.Collection<? extends RepositoryListener> listeners)Creates a new multicast listener that delegates to the specified listeners.ChainedRepositoryListener(RepositoryListener... listeners)Creates a new multicast listener that delegates to the specified listeners.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.util.Collection<? extends RepositoryListener> listeners)Adds the specified listeners to the end of the multicast chain.voidadd(RepositoryListener listener)Adds the specified listener to the end of the multicast chain.voidartifactDeployed(RepositoryEvent event)Notifies the listener of an artifact whose upload to a remote repository has been completed, either successfully or not.voidartifactDeploying(RepositoryEvent event)Notifies the listener of an artifact that is about to be uploaded to a remote repository.voidartifactDescriptorInvalid(RepositoryEvent event)Notifies the listener of a syntactically or semantically invalid artifact descriptor.voidartifactDescriptorMissing(RepositoryEvent event)Notifies the listener of a missing artifact descriptor.voidartifactDownloaded(RepositoryEvent event)Notifies the listener of an artifact whose download has been completed, either successfully or not.voidartifactDownloading(RepositoryEvent event)Notifies the listener of an artifact that is about to be downloaded from a remote repository.voidartifactInstalled(RepositoryEvent event)Notifies the listener of an artifact whose installation to the local repository has been completed, either successfully or not.voidartifactInstalling(RepositoryEvent event)Notifies the listener of an artifact that is about to be installed to the local repository.voidartifactResolved(RepositoryEvent event)Notifies the listener of an artifact whose resolution has been completed, either successfully or not.voidartifactResolving(RepositoryEvent event)Notifies the listener of an artifact that is about to be resolved.protected voidhandleError(RepositoryEvent event, RepositoryListener listener, java.lang.RuntimeException error)voidmetadataDeployed(RepositoryEvent event)Notifies the listener of some metadata whose upload to a remote repository has been completed, either successfully or not.voidmetadataDeploying(RepositoryEvent event)Notifies the listener of some metadata that is about to be uploaded to a remote repository.voidmetadataDownloaded(RepositoryEvent event)Notifies the listener of some metadata whose download has been completed, either successfully or not.voidmetadataDownloading(RepositoryEvent event)Notifies the listener of some metadata that is about to be downloaded from a remote repository.voidmetadataInstalled(RepositoryEvent event)Notifies the listener of some metadata whose installation to the local repository has been completed, either successfully or not.voidmetadataInstalling(RepositoryEvent event)Notifies the listener of some metadata that is about to be installed to the local repository.voidmetadataInvalid(RepositoryEvent event)Notifies the listener of syntactically or semantically invalid metadata.voidmetadataResolved(RepositoryEvent event)Notifies the listener of some metadata whose resolution has been completed, either successfully or not.voidmetadataResolving(RepositoryEvent event)Notifies the listener of some metadata that is about to be resolved.static RepositoryListenernewInstance(RepositoryListener listener1, RepositoryListener listener2)Creates a new multicast listener that delegates to the specified listeners.voidremove(RepositoryListener listener)Removes the specified listener from the multicast chain.
-
-
-
Field Detail
-
listeners
private final java.util.List<RepositoryListener> listeners
-
-
Constructor Detail
-
ChainedRepositoryListener
public ChainedRepositoryListener(RepositoryListener... listeners)
Creates a new multicast listener that delegates to the specified listeners.- Parameters:
listeners- The listeners to delegate to, may benullor empty.
-
ChainedRepositoryListener
public ChainedRepositoryListener(java.util.Collection<? extends RepositoryListener> listeners)
Creates a new multicast listener that delegates to the specified listeners.- Parameters:
listeners- The listeners to delegate to, may benullor empty.
-
-
Method Detail
-
newInstance
public static RepositoryListener newInstance(RepositoryListener listener1, RepositoryListener listener2)
Creates a new multicast listener that delegates to the specified listeners. In contrast to the constructor, this factory method will avoid creating an actual chained listener if one of the specified readers is actuallynull.- Parameters:
listener1- The first listener, may benull.listener2- The second listener, may benull.- Returns:
- The chained listener or
nullif no listener was supplied.
-
add
public void add(java.util.Collection<? extends RepositoryListener> listeners)
Adds the specified listeners to the end of the multicast chain.- Parameters:
listeners- The listeners to add, may benullor empty.
-
add
public void add(RepositoryListener listener)
Adds the specified listener to the end of the multicast chain.- Parameters:
listener- The listener to add, may benull.
-
remove
public void remove(RepositoryListener listener)
Removes the specified listener from the multicast chain. Trying to remove a non-existing listener has no effect.- Parameters:
listener- The listener to remove, may benull.
-
handleError
protected void handleError(RepositoryEvent event, RepositoryListener listener, java.lang.RuntimeException error)
-
artifactDeployed
public void artifactDeployed(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact whose upload to a remote repository has been completed, either successfully or not.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getExceptions()indicates whether the upload succeeded or failed.- Specified by:
artifactDeployedin interfaceRepositoryListener- Overrides:
artifactDeployedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactDeploying
public void artifactDeploying(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact that is about to be uploaded to a remote repository.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getRepository()the destination repository.- Specified by:
artifactDeployingin interfaceRepositoryListener- Overrides:
artifactDeployingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactDescriptorInvalid
public void artifactDescriptorInvalid(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of a syntactically or semantically invalid artifact descriptor.RepositoryEvent.getArtifact()indicates the artifact whose descriptor is invalid andRepositoryEvent.getExceptions()carries the encountered errors. Depending on the session'sArtifactDescriptorPolicy, the underlying repository operation might abort with an exception or ignore the invalid descriptor.- Specified by:
artifactDescriptorInvalidin interfaceRepositoryListener- Overrides:
artifactDescriptorInvalidin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactDescriptorMissing
public void artifactDescriptorMissing(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of a missing artifact descriptor.RepositoryEvent.getArtifact()indicates the artifact whose descriptor is missing. Depending on the session'sArtifactDescriptorPolicy, the underlying repository operation might abort with an exception or ignore the missing descriptor.- Specified by:
artifactDescriptorMissingin interfaceRepositoryListener- Overrides:
artifactDescriptorMissingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactDownloaded
public void artifactDownloaded(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact whose download has been completed, either successfully or not.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getExceptions()indicates whether the download succeeded or failed. Unlike theRepositoryListener.artifactResolved(RepositoryEvent)event, this event is only fired when the artifact does not already exist locally.- Specified by:
artifactDownloadedin interfaceRepositoryListener- Overrides:
artifactDownloadedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactDownloading
public void artifactDownloading(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact that is about to be downloaded from a remote repository.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getRepository()the source repository. Unlike theRepositoryListener.artifactResolving(RepositoryEvent)event, this event is only fired when the artifact does not already exist locally.- Specified by:
artifactDownloadingin interfaceRepositoryListener- Overrides:
artifactDownloadingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactInstalled
public void artifactInstalled(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact whose installation to the local repository has been completed, either successfully or not.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getExceptions()indicates whether the installation succeeded or failed.- Specified by:
artifactInstalledin interfaceRepositoryListener- Overrides:
artifactInstalledin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactInstalling
public void artifactInstalling(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact that is about to be installed to the local repository.RepositoryEvent.getArtifact()denotes the artifact in question.- Specified by:
artifactInstallingin interfaceRepositoryListener- Overrides:
artifactInstallingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactResolved
public void artifactResolved(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact whose resolution has been completed, either successfully or not.RepositoryEvent.getArtifact()denotes the artifact in question andRepositoryEvent.getExceptions()indicates whether the resolution succeeded or failed. Unlike theRepositoryListener.artifactDownloaded(RepositoryEvent)event, this event is fired regardless whether the artifact already exists locally or not.- Specified by:
artifactResolvedin interfaceRepositoryListener- Overrides:
artifactResolvedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
artifactResolving
public void artifactResolving(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of an artifact that is about to be resolved.RepositoryEvent.getArtifact()denotes the artifact in question. Unlike theRepositoryListener.artifactDownloading(RepositoryEvent)event, this event is fired regardless whether the artifact already exists locally or not.- Specified by:
artifactResolvingin interfaceRepositoryListener- Overrides:
artifactResolvingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataDeployed
public void metadataDeployed(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata whose upload to a remote repository has been completed, either successfully or not.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getExceptions()indicates whether the upload succeeded or failed.- Specified by:
metadataDeployedin interfaceRepositoryListener- Overrides:
metadataDeployedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataDeploying
public void metadataDeploying(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata that is about to be uploaded to a remote repository.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getRepository()the destination repository.- Specified by:
metadataDeployingin interfaceRepositoryListener- Overrides:
metadataDeployingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataDownloaded
public void metadataDownloaded(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata whose download has been completed, either successfully or not.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getExceptions()indicates whether the download succeeded or failed. Unlike theRepositoryListener.metadataResolved(RepositoryEvent)event, this event is only fired when the metadata does not already exist locally.- Specified by:
metadataDownloadedin interfaceRepositoryListener- Overrides:
metadataDownloadedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataDownloading
public void metadataDownloading(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata that is about to be downloaded from a remote repository.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getRepository()the source repository. Unlike theRepositoryListener.metadataResolving(RepositoryEvent)event, this event is only fired when the metadata does not already exist locally.- Specified by:
metadataDownloadingin interfaceRepositoryListener- Overrides:
metadataDownloadingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataInstalled
public void metadataInstalled(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata whose installation to the local repository has been completed, either successfully or not.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getExceptions()indicates whether the installation succeeded or failed.- Specified by:
metadataInstalledin interfaceRepositoryListener- Overrides:
metadataInstalledin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataInstalling
public void metadataInstalling(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata that is about to be installed to the local repository.RepositoryEvent.getMetadata()denotes the metadata in question.- Specified by:
metadataInstallingin interfaceRepositoryListener- Overrides:
metadataInstallingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataInvalid
public void metadataInvalid(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of syntactically or semantically invalid metadata.RepositoryEvent.getMetadata()indicates the invalid metadata andRepositoryEvent.getExceptions()carries the encountered errors. The underlying repository operation might still succeed, depending on whether the metadata in question is actually needed to carry out the resolution process.- Specified by:
metadataInvalidin interfaceRepositoryListener- Overrides:
metadataInvalidin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataResolved
public void metadataResolved(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata whose resolution has been completed, either successfully or not.RepositoryEvent.getMetadata()denotes the metadata in question andRepositoryEvent.getExceptions()indicates whether the resolution succeeded or failed. Unlike theRepositoryListener.metadataDownloaded(RepositoryEvent)event, this event is fired regardless whether the metadata already exists locally or not.- Specified by:
metadataResolvedin interfaceRepositoryListener- Overrides:
metadataResolvedin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
metadataResolving
public void metadataResolving(RepositoryEvent event)
Description copied from interface:RepositoryListenerNotifies the listener of some metadata that is about to be resolved.RepositoryEvent.getMetadata()denotes the metadata in question. Unlike theRepositoryListener.metadataDownloading(RepositoryEvent)event, this event is fired regardless whether the metadata already exists locally or not.- Specified by:
metadataResolvingin interfaceRepositoryListener- Overrides:
metadataResolvingin classAbstractRepositoryListener- Parameters:
event- The event details, must not benull.
-
-