View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2010, 2014 Sonatype, Inc.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *    Sonatype, Inc. - initial API and implementation
10   *******************************************************************************/
11  package org.eclipse.aether;
12  
13  /**
14   * A listener being notified of events from the repository system. In general, the system sends events upon termination
15   * of an operation like {@link #artifactResolved(RepositoryEvent)} regardless whether it succeeded or failed so
16   * listeners need to inspect the event details carefully. Also, the listener may be called from an arbitrary thread.
17   * <em>Note:</em> Implementors are strongly advised to inherit from {@link AbstractRepositoryListener} instead of
18   * directly implementing this interface.
19   * 
20   * @see org.eclipse.aether.RepositorySystemSession#getRepositoryListener()
21   * @see org.eclipse.aether.transfer.TransferListener
22   * @noimplement This interface is not intended to be implemented by clients.
23   * @noextend This interface is not intended to be extended by clients.
24   */
25  public interface RepositoryListener
26  {
27  
28      /**
29       * Notifies the listener of a syntactically or semantically invalid artifact descriptor.
30       * {@link RepositoryEvent#getArtifact()} indicates the artifact whose descriptor is invalid and
31       * {@link RepositoryEvent#getExceptions()} carries the encountered errors. Depending on the session's
32       * {@link org.eclipse.aether.resolution.ArtifactDescriptorPolicy}, the underlying repository operation might abort
33       * with an exception or ignore the invalid descriptor.
34       * 
35       * @param event The event details, must not be {@code null}.
36       */
37      void artifactDescriptorInvalid( RepositoryEvent event );
38  
39      /**
40       * Notifies the listener of a missing artifact descriptor. {@link RepositoryEvent#getArtifact()} indicates the
41       * artifact whose descriptor is missing. Depending on the session's
42       * {@link org.eclipse.aether.resolution.ArtifactDescriptorPolicy}, the underlying repository operation might abort
43       * with an exception or ignore the missing descriptor.
44       * 
45       * @param event The event details, must not be {@code null}.
46       */
47      void artifactDescriptorMissing( RepositoryEvent event );
48  
49      /**
50       * Notifies the listener of syntactically or semantically invalid metadata. {@link RepositoryEvent#getMetadata()}
51       * indicates the invalid metadata and {@link RepositoryEvent#getExceptions()} carries the encountered errors. The
52       * underlying repository operation might still succeed, depending on whether the metadata in question is actually
53       * needed to carry out the resolution process.
54       * 
55       * @param event The event details, must not be {@code null}.
56       */
57      void metadataInvalid( RepositoryEvent event );
58  
59      /**
60       * Notifies the listener of an artifact that is about to be resolved. {@link RepositoryEvent#getArtifact()} denotes
61       * the artifact in question. Unlike the {@link #artifactDownloading(RepositoryEvent)} event, this event is fired
62       * regardless whether the artifact already exists locally or not.
63       * 
64       * @param event The event details, must not be {@code null}.
65       */
66      void artifactResolving( RepositoryEvent event );
67  
68      /**
69       * Notifies the listener of an artifact whose resolution has been completed, either successfully or not.
70       * {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
71       * {@link RepositoryEvent#getExceptions()} indicates whether the resolution succeeded or failed. Unlike the
72       * {@link #artifactDownloaded(RepositoryEvent)} event, this event is fired regardless whether the artifact already
73       * exists locally or not.
74       * 
75       * @param event The event details, must not be {@code null}.
76       */
77      void artifactResolved( RepositoryEvent event );
78  
79      /**
80       * Notifies the listener of some metadata that is about to be resolved. {@link RepositoryEvent#getMetadata()}
81       * denotes the metadata in question. Unlike the {@link #metadataDownloading(RepositoryEvent)} event, this event is
82       * fired regardless whether the metadata already exists locally or not.
83       * 
84       * @param event The event details, must not be {@code null}.
85       */
86      void metadataResolving( RepositoryEvent event );
87  
88      /**
89       * Notifies the listener of some metadata whose resolution has been completed, either successfully or not.
90       * {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
91       * {@link RepositoryEvent#getExceptions()} indicates whether the resolution succeeded or failed. Unlike the
92       * {@link #metadataDownloaded(RepositoryEvent)} event, this event is fired regardless whether the metadata already
93       * exists locally or not.
94       * 
95       * @param event The event details, must not be {@code null}.
96       */
97      void metadataResolved( RepositoryEvent event );
98  
99      /**
100      * Notifies the listener of an artifact that is about to be downloaded from a remote repository.
101      * {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
102      * {@link RepositoryEvent#getRepository()} the source repository. Unlike the
103      * {@link #artifactResolving(RepositoryEvent)} event, this event is only fired when the artifact does not already
104      * exist locally.
105      * 
106      * @param event The event details, must not be {@code null}.
107      */
108     void artifactDownloading( RepositoryEvent event );
109 
110     /**
111      * Notifies the listener of an artifact whose download has been completed, either successfully or not.
112      * {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
113      * {@link RepositoryEvent#getExceptions()} indicates whether the download succeeded or failed. Unlike the
114      * {@link #artifactResolved(RepositoryEvent)} event, this event is only fired when the artifact does not already
115      * exist locally.
116      * 
117      * @param event The event details, must not be {@code null}.
118      */
119     void artifactDownloaded( RepositoryEvent event );
120 
121     /**
122      * Notifies the listener of some metadata that is about to be downloaded from a remote repository.
123      * {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
124      * {@link RepositoryEvent#getRepository()} the source repository. Unlike the
125      * {@link #metadataResolving(RepositoryEvent)} event, this event is only fired when the metadata does not already
126      * exist locally.
127      * 
128      * @param event The event details, must not be {@code null}.
129      */
130     void metadataDownloading( RepositoryEvent event );
131 
132     /**
133      * Notifies the listener of some metadata whose download has been completed, either successfully or not.
134      * {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
135      * {@link RepositoryEvent#getExceptions()} indicates whether the download succeeded or failed. Unlike the
136      * {@link #metadataResolved(RepositoryEvent)} event, this event is only fired when the metadata does not already
137      * exist locally.
138      * 
139      * @param event The event details, must not be {@code null}.
140      */
141     void metadataDownloaded( RepositoryEvent event );
142 
143     /**
144      * Notifies the listener of an artifact that is about to be installed to the local repository.
145      * {@link RepositoryEvent#getArtifact()} denotes the artifact in question.
146      * 
147      * @param event The event details, must not be {@code null}.
148      */
149     void artifactInstalling( RepositoryEvent event );
150 
151     /**
152      * Notifies the listener of an artifact whose installation to the local repository has been completed, either
153      * successfully or not. {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
154      * {@link RepositoryEvent#getExceptions()} indicates whether the installation succeeded or failed.
155      * 
156      * @param event The event details, must not be {@code null}.
157      */
158     void artifactInstalled( RepositoryEvent event );
159 
160     /**
161      * Notifies the listener of some metadata that is about to be installed to the local repository.
162      * {@link RepositoryEvent#getMetadata()} denotes the metadata in question.
163      * 
164      * @param event The event details, must not be {@code null}.
165      */
166     void metadataInstalling( RepositoryEvent event );
167 
168     /**
169      * Notifies the listener of some metadata whose installation to the local repository has been completed, either
170      * successfully or not. {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
171      * {@link RepositoryEvent#getExceptions()} indicates whether the installation succeeded or failed.
172      * 
173      * @param event The event details, must not be {@code null}.
174      */
175     void metadataInstalled( RepositoryEvent event );
176 
177     /**
178      * Notifies the listener of an artifact that is about to be uploaded to a remote repository.
179      * {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
180      * {@link RepositoryEvent#getRepository()} the destination repository.
181      * 
182      * @param event The event details, must not be {@code null}.
183      */
184     void artifactDeploying( RepositoryEvent event );
185 
186     /**
187      * Notifies the listener of an artifact whose upload to a remote repository has been completed, either successfully
188      * or not. {@link RepositoryEvent#getArtifact()} denotes the artifact in question and
189      * {@link RepositoryEvent#getExceptions()} indicates whether the upload succeeded or failed.
190      * 
191      * @param event The event details, must not be {@code null}.
192      */
193     void artifactDeployed( RepositoryEvent event );
194 
195     /**
196      * Notifies the listener of some metadata that is about to be uploaded to a remote repository.
197      * {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
198      * {@link RepositoryEvent#getRepository()} the destination repository.
199      * 
200      * @param event The event details, must not be {@code null}.
201      */
202     void metadataDeploying( RepositoryEvent event );
203 
204     /**
205      * Notifies the listener of some metadata whose upload to a remote repository has been completed, either
206      * successfully or not. {@link RepositoryEvent#getMetadata()} denotes the metadata in question and
207      * {@link RepositoryEvent#getExceptions()} indicates whether the upload succeeded or failed.
208      * 
209      * @param event The event details, must not be {@code null}.
210      */
211     void metadataDeployed( RepositoryEvent event );
212 
213 }