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 640549 2008-03-24 20:05:11Z 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      /**
48       * @deprecated
49       */
50      int MANAGE_ARTIFACT = 7;
51  
52      int OMIT_FOR_CYCLE = 8;
53  
54      /**
55       * this event means that the scope has NOT been updated to a farther node scope because current
56       * node is in the first level pom
57       */
58      int UPDATE_SCOPE_CURRENT_POM = 9;
59  
60      int SELECT_VERSION_FROM_RANGE = 10;
61  
62      int RESTRICT_RANGE = 11;
63      
64      int MANAGE_ARTIFACT_VERSION = 12;
65      
66      int MANAGE_ARTIFACT_SCOPE = 13;
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, Artifact kept );
77  
78      void updateScope( Artifact artifact, String scope );
79  
80      /**
81       * @deprecated
82       */
83      void manageArtifact( Artifact artifact, Artifact replacement );
84      
85      // TODO Use the following two instead of manageArtifact
86      // TODO Remove ResolutionListenerDM interface
87  
88      //void manageArtifactVersion( Artifact artifact, Artifact replacement );
89      
90      //void manageArtifactScope( Artifact artifact, Artifact replacement );
91  
92      void omitForCycle( Artifact artifact );
93  
94      /**
95       * This event means that the scope has NOT been updated to a farther node scope because current
96       * node is in the first level pom
97       * 
98       * @param artifact current node artifact, the one in the first level pom
99       * @param ignoredScope scope that was ignored because artifact was in first level pom
100      */
101     void updateScopeCurrentPom( Artifact artifact, String ignoredScope );
102 
103     void selectVersionFromRange( Artifact artifact );
104 
105     void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange );
106 }