View Javadoc
1   package org.apache.maven.repository.internal.util;
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.io.PrintStream;
23  
24  import org.eclipse.aether.AbstractRepositoryListener;
25  import org.eclipse.aether.RepositoryEvent;
26  
27  public class ConsoleRepositoryListener
28      extends AbstractRepositoryListener
29  {
30  
31      private PrintStream out;
32  
33      public ConsoleRepositoryListener()
34      {
35          this( null );
36      }
37  
38      public ConsoleRepositoryListener( PrintStream out )
39      {
40          this.out = ( out != null ) ? out : System.out;
41      }
42  
43      public void artifactDeployed( RepositoryEvent event )
44      {
45          println( "artifactDeployed", event.getArtifact() + " to " + event.getRepository() );
46      }
47  
48      public void artifactDeploying( RepositoryEvent event )
49      {
50          println( "artifactDeploying", event.getArtifact() + " to " + event.getRepository() );
51      }
52  
53      public void artifactDescriptorInvalid( RepositoryEvent event )
54      {
55          println( "artifactDescriptorInvalid", "for " + event.getArtifact() + ": " + event.getException().getMessage() );
56      }
57  
58      public void artifactDescriptorMissing( RepositoryEvent event )
59      {
60          println( "artifactDescriptorMissing", "for " + event.getArtifact() );
61      }
62  
63      public void artifactInstalled( RepositoryEvent event )
64      {
65          println( "artifactInstalled", event.getArtifact() + " to " + event.getFile() );
66      }
67  
68      public void artifactInstalling( RepositoryEvent event )
69      {
70          println( "artifactInstalling", event.getArtifact() + " to " + event.getFile() );
71      }
72  
73      public void artifactResolved( RepositoryEvent event )
74      {
75          println( "artifactResolved", event.getArtifact() + " from " + event.getRepository() );
76      }
77  
78      public void artifactDownloading( RepositoryEvent event )
79      {
80          println( "artifactDownloading", event.getArtifact() + " from " + event.getRepository() );
81      }
82  
83      public void artifactDownloaded( RepositoryEvent event )
84      {
85          println( "artifactDownloaded", event.getArtifact() + " from " + event.getRepository() );
86      }
87  
88      public void artifactResolving( RepositoryEvent event )
89      {
90          println( "artifactResolving", event.getArtifact().toString() );
91      }
92  
93      public void metadataDeployed( RepositoryEvent event )
94      {
95          println( "metadataDeployed", event.getMetadata() + " to " + event.getRepository() );
96      }
97  
98      public void metadataDeploying( RepositoryEvent event )
99      {
100         println( "metadataDeploying", event.getMetadata() + " to " + event.getRepository() );
101     }
102 
103     public void metadataInstalled( RepositoryEvent event )
104     {
105         println( "metadataInstalled", event.getMetadata() + " to " + event.getFile() );
106     }
107 
108     public void metadataInstalling( RepositoryEvent event )
109     {
110         println( "metadataInstalling", event.getMetadata() + " to " + event.getFile() );
111     }
112 
113     public void metadataInvalid( RepositoryEvent event )
114     {
115         println( "metadataInvalid", event.getMetadata().toString() );
116     }
117 
118     public void metadataResolved( RepositoryEvent event )
119     {
120         println( "metadataResolved", event.getMetadata() + " from " + event.getRepository() );
121     }
122 
123     public void metadataResolving( RepositoryEvent event )
124     {
125         println( "metadataResolving", event.getMetadata() + " from " + event.getRepository() );
126     }
127 
128     private void println( String event, String message )
129     {
130         out.println( "Aether Repository - " + event + ": " + message );
131     }
132 }