1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.artifact.resolver;
20
21 import org.apache.maven.artifact.Artifact;
22 import org.apache.maven.artifact.versioning.VersionRange;
23
24 /**
25 * Listens to the resolution process and handles events.
26 *
27 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
28 */
29 public interface ResolutionListener {
30 String ROLE = ResolutionListener.class.getName();
31
32 int TEST_ARTIFACT = 1;
33
34 int PROCESS_CHILDREN = 2;
35
36 int FINISH_PROCESSING_CHILDREN = 3;
37
38 int INCLUDE_ARTIFACT = 4;
39
40 int OMIT_FOR_NEARER = 5;
41
42 int UPDATE_SCOPE = 6;
43
44 @Deprecated
45 int MANAGE_ARTIFACT = 7;
46
47 int OMIT_FOR_CYCLE = 8;
48
49 /**
50 * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current
51 * node is in the first level pom
52 */
53 int UPDATE_SCOPE_CURRENT_POM = 9;
54
55 int SELECT_VERSION_FROM_RANGE = 10;
56
57 int RESTRICT_RANGE = 11;
58
59 int MANAGE_ARTIFACT_VERSION = 12;
60
61 int MANAGE_ARTIFACT_SCOPE = 13;
62
63 int MANAGE_ARTIFACT_SYSTEM_PATH = 14;
64
65 void testArtifact(Artifact node);
66
67 void startProcessChildren(Artifact artifact);
68
69 void endProcessChildren(Artifact artifact);
70
71 void includeArtifact(Artifact artifact);
72
73 void omitForNearer(Artifact omitted, Artifact kept);
74
75 void updateScope(Artifact artifact, String scope);
76
77 @Deprecated
78 void manageArtifact(Artifact artifact, Artifact replacement);
79
80 // TODO Use the following two instead of manageArtifact
81 // TODO Remove ResolutionListenerDM interface
82
83 // void manageArtifactVersion( Artifact artifact, Artifact replacement );
84
85 // void manageArtifactScope( Artifact artifact, Artifact replacement );
86
87 void omitForCycle(Artifact artifact);
88
89 /**
90 * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current
91 * node is in the first level pom
92 *
93 * @param artifact current node artifact, the one in the first level pom
94 * @param ignoredScope artifactScope that was ignored because artifact was in first level pom
95 */
96 void updateScopeCurrentPom(Artifact artifact, String ignoredScope);
97
98 void selectVersionFromRange(Artifact artifact);
99
100 void restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange);
101 }