View Javadoc
1   package org.eclipse.aether.internal.impl;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   * 
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.ArrayList;
23  import java.util.Collections;
24  import java.util.List;
25  
26  import org.eclipse.aether.RepositoryEvent;
27  import org.eclipse.aether.RepositoryListener;
28  
29  /**
30   * Collects observed repository events for later inspection.
31   */
32  class RecordingRepositoryListener
33      implements RepositoryListener
34  {
35  
36      private List<RepositoryEvent> events = Collections.synchronizedList( new ArrayList<RepositoryEvent>() );
37  
38      public List<RepositoryEvent> getEvents()
39      {
40          return events;
41      }
42  
43      public void clear()
44      {
45          events.clear();
46      }
47  
48      public void artifactDescriptorInvalid( RepositoryEvent event )
49      {
50          events.add( event );
51      }
52  
53      public void artifactDescriptorMissing( RepositoryEvent event )
54      {
55          events.add( event );
56      }
57  
58      public void metadataInvalid( RepositoryEvent event )
59      {
60          events.add( event );
61      }
62  
63      public void artifactResolving( RepositoryEvent event )
64      {
65          events.add( event );
66      }
67  
68      public void artifactResolved( RepositoryEvent event )
69      {
70          events.add( event );
71      }
72  
73      public void artifactDownloading( RepositoryEvent event )
74      {
75          events.add( event );
76      }
77  
78      public void artifactDownloaded( RepositoryEvent event )
79      {
80          events.add( event );
81      }
82  
83      public void metadataDownloaded( RepositoryEvent event )
84      {
85          events.add( event );
86      }
87  
88      public void metadataDownloading( RepositoryEvent event )
89      {
90          events.add( event );
91      }
92  
93      public void metadataResolving( RepositoryEvent event )
94      {
95          events.add( event );
96      }
97  
98      public void metadataResolved( RepositoryEvent event )
99      {
100         events.add( event );
101     }
102 
103     public void artifactInstalling( RepositoryEvent event )
104     {
105         events.add( event );
106     }
107 
108     public void artifactInstalled( RepositoryEvent event )
109     {
110         events.add( event );
111     }
112 
113     public void metadataInstalling( RepositoryEvent event )
114     {
115         events.add( event );
116     }
117 
118     public void metadataInstalled( RepositoryEvent event )
119     {
120         events.add( event );
121     }
122 
123     public void artifactDeploying( RepositoryEvent event )
124     {
125         events.add( event );
126     }
127 
128     public void artifactDeployed( RepositoryEvent event )
129     {
130         events.add( event );
131     }
132 
133     public void metadataDeploying( RepositoryEvent event )
134     {
135         events.add( event );
136     }
137 
138     public void metadataDeployed( RepositoryEvent event )
139     {
140         events.add( event );
141     }
142 
143 }