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