org.sonatype.aether.util.listener
Class ChainedRepositoryListener

java.lang.Object
  extended by org.sonatype.aether.AbstractRepositoryListener
      extended by org.sonatype.aether.util.listener.ChainedRepositoryListener
All Implemented Interfaces:
RepositoryListener

public 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.

Author:
Benjamin Bentmann

Constructor Summary
ChainedRepositoryListener(Collection<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
 void add(Collection<RepositoryListener> listeners)
          Adds the specified listeners to the end of the multicast chain.
 void add(RepositoryListener listener)
          Adds the specified listener to the end of the multicast chain.
 void artifactDeployed(RepositoryEvent event)
           
 void artifactDeploying(RepositoryEvent event)
           
 void artifactDescriptorInvalid(RepositoryEvent event)
           
 void artifactDescriptorMissing(RepositoryEvent event)
           
 void artifactDownloaded(RepositoryEvent event)
           
 void artifactDownloading(RepositoryEvent event)
           
 void artifactInstalled(RepositoryEvent event)
           
 void artifactInstalling(RepositoryEvent event)
           
 void artifactResolved(RepositoryEvent event)
           
 void artifactResolving(RepositoryEvent event)
           
protected  void handleError(RepositoryEvent event, RepositoryListener listener, RuntimeException error)
           
 void metadataDeployed(RepositoryEvent event)
           
 void metadataDeploying(RepositoryEvent event)
           
 void metadataDownloaded(RepositoryEvent event)
           
 void metadataDownloading(RepositoryEvent event)
           
 void metadataInstalled(RepositoryEvent event)
           
 void metadataInstalling(RepositoryEvent event)
           
 void metadataInvalid(RepositoryEvent event)
           
 void metadataResolved(RepositoryEvent event)
           
 void metadataResolving(RepositoryEvent event)
           
static RepositoryListener newInstance(RepositoryListener listener1, RepositoryListener listener2)
          Creates a new multicast listener that delegates to the specified listeners.
 void remove(RepositoryListener listener)
          Removes the specified listener from the multicast chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 be null or empty.

ChainedRepositoryListener

public ChainedRepositoryListener(Collection<RepositoryListener> listeners)
Creates a new multicast listener that delegates to the specified listeners.

Parameters:
listeners - The listeners to delegate to, may be null or 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 actually null.

Parameters:
listener1 - The first listener, may be null.
listener2 - The second listener, may be null.
Returns:
The chained listener or null if no listener was supplied.

add

public void add(Collection<RepositoryListener> listeners)
Adds the specified listeners to the end of the multicast chain.

Parameters:
listeners - The listeners to add, may be null or 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 be null.

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 be null.

handleError

protected void handleError(RepositoryEvent event,
                           RepositoryListener listener,
                           RuntimeException error)

artifactDeployed

public void artifactDeployed(RepositoryEvent event)
Specified by:
artifactDeployed in interface RepositoryListener
Overrides:
artifactDeployed in class AbstractRepositoryListener

artifactDeploying

public void artifactDeploying(RepositoryEvent event)
Specified by:
artifactDeploying in interface RepositoryListener
Overrides:
artifactDeploying in class AbstractRepositoryListener

artifactDescriptorInvalid

public void artifactDescriptorInvalid(RepositoryEvent event)
Specified by:
artifactDescriptorInvalid in interface RepositoryListener
Overrides:
artifactDescriptorInvalid in class AbstractRepositoryListener

artifactDescriptorMissing

public void artifactDescriptorMissing(RepositoryEvent event)
Specified by:
artifactDescriptorMissing in interface RepositoryListener
Overrides:
artifactDescriptorMissing in class AbstractRepositoryListener

artifactDownloaded

public void artifactDownloaded(RepositoryEvent event)
Specified by:
artifactDownloaded in interface RepositoryListener
Overrides:
artifactDownloaded in class AbstractRepositoryListener

artifactDownloading

public void artifactDownloading(RepositoryEvent event)
Specified by:
artifactDownloading in interface RepositoryListener
Overrides:
artifactDownloading in class AbstractRepositoryListener

artifactInstalled

public void artifactInstalled(RepositoryEvent event)
Specified by:
artifactInstalled in interface RepositoryListener
Overrides:
artifactInstalled in class AbstractRepositoryListener

artifactInstalling

public void artifactInstalling(RepositoryEvent event)
Specified by:
artifactInstalling in interface RepositoryListener
Overrides:
artifactInstalling in class AbstractRepositoryListener

artifactResolved

public void artifactResolved(RepositoryEvent event)
Specified by:
artifactResolved in interface RepositoryListener
Overrides:
artifactResolved in class AbstractRepositoryListener

artifactResolving

public void artifactResolving(RepositoryEvent event)
Specified by:
artifactResolving in interface RepositoryListener
Overrides:
artifactResolving in class AbstractRepositoryListener

metadataDeployed

public void metadataDeployed(RepositoryEvent event)
Specified by:
metadataDeployed in interface RepositoryListener
Overrides:
metadataDeployed in class AbstractRepositoryListener

metadataDeploying

public void metadataDeploying(RepositoryEvent event)
Specified by:
metadataDeploying in interface RepositoryListener
Overrides:
metadataDeploying in class AbstractRepositoryListener

metadataDownloaded

public void metadataDownloaded(RepositoryEvent event)
Specified by:
metadataDownloaded in interface RepositoryListener
Overrides:
metadataDownloaded in class AbstractRepositoryListener

metadataDownloading

public void metadataDownloading(RepositoryEvent event)
Specified by:
metadataDownloading in interface RepositoryListener
Overrides:
metadataDownloading in class AbstractRepositoryListener

metadataInstalled

public void metadataInstalled(RepositoryEvent event)
Specified by:
metadataInstalled in interface RepositoryListener
Overrides:
metadataInstalled in class AbstractRepositoryListener

metadataInstalling

public void metadataInstalling(RepositoryEvent event)
Specified by:
metadataInstalling in interface RepositoryListener
Overrides:
metadataInstalling in class AbstractRepositoryListener

metadataInvalid

public void metadataInvalid(RepositoryEvent event)
Specified by:
metadataInvalid in interface RepositoryListener
Overrides:
metadataInvalid in class AbstractRepositoryListener

metadataResolved

public void metadataResolved(RepositoryEvent event)
Specified by:
metadataResolved in interface RepositoryListener
Overrides:
metadataResolved in class AbstractRepositoryListener

metadataResolving

public void metadataResolving(RepositoryEvent event)
Specified by:
metadataResolving in interface RepositoryListener
Overrides:
metadataResolving in class AbstractRepositoryListener


Copyright © 2010-2013. All Rights Reserved.