View Javadoc

1   package org.apache.maven.artifact.resolver;
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 org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.versioning.VersionRange;
24  
25  /**
26   * Listens to the resolution process and handles events.
27   *
28   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
29   * @version $Id: ResolutionListener.java 829934 2009-10-26 20:16:00Z bentmann $
30   */
31  public interface ResolutionListener
32  {
33      String ROLE = ResolutionListener.class.getName();
34  
35      int TEST_ARTIFACT = 1;
36  
37      int PROCESS_CHILDREN = 2;
38  
39      int FINISH_PROCESSING_CHILDREN = 3;
40  
41      int INCLUDE_ARTIFACT = 4;
42  
43      int OMIT_FOR_NEARER = 5;
44  
45      int UPDATE_SCOPE = 6;
46  
47      @Deprecated
48      int MANAGE_ARTIFACT = 7;
49  
50      int OMIT_FOR_CYCLE = 8;
51  
52      /**
53       * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current
54       * node is in the first level pom
55       */
56      int UPDATE_SCOPE_CURRENT_POM = 9;
57  
58      int SELECT_VERSION_FROM_RANGE = 10;
59  
60      int RESTRICT_RANGE = 11;
61  
62      int MANAGE_ARTIFACT_VERSION = 12;
63  
64      int MANAGE_ARTIFACT_SCOPE = 13;
65  
66      int MANAGE_ARTIFACT_SYSTEM_PATH = 14;
67  
68      void testArtifact( Artifact node );
69  
70      void startProcessChildren( Artifact artifact );
71  
72      void endProcessChildren( Artifact artifact );
73  
74      void includeArtifact( Artifact artifact );
75  
76      void omitForNearer( Artifact omitted,
77                          Artifact kept );
78  
79      void updateScope( Artifact artifact,
80                        String scope );
81  
82      @Deprecated
83      void manageArtifact( Artifact artifact,
84                           Artifact replacement );
85  
86      // TODO Use the following two instead of manageArtifact
87      // TODO Remove ResolutionListenerDM interface
88  
89      //void manageArtifactVersion( Artifact artifact, Artifact replacement );
90  
91      //void manageArtifactScope( Artifact artifact, Artifact replacement );
92  
93      void omitForCycle( Artifact artifact );
94  
95      /**
96       * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current
97       * node is in the first level pom
98       *
99       * @param artifact     current node artifact, the one in the first level pom
100      * @param ignoredScope artifactScope that was ignored because artifact was in first level pom
101      */
102     void updateScopeCurrentPom( Artifact artifact,
103                                 String ignoredScope );
104 
105     void selectVersionFromRange( Artifact artifact );
106 
107     void restrictRange( Artifact artifact,
108                         Artifact replacement,
109                         VersionRange newRange );
110 }