001package org.apache.maven.artifact.resolver;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.maven.artifact.Artifact;
023import org.apache.maven.artifact.versioning.VersionRange;
024
025/**
026 * Listens to the resolution process and handles events.
027 *
028 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
029 */
030public interface ResolutionListener
031{
032    String ROLE = ResolutionListener.class.getName();
033
034    int TEST_ARTIFACT = 1;
035
036    int PROCESS_CHILDREN = 2;
037
038    int FINISH_PROCESSING_CHILDREN = 3;
039
040    int INCLUDE_ARTIFACT = 4;
041
042    int OMIT_FOR_NEARER = 5;
043
044    int UPDATE_SCOPE = 6;
045
046    @Deprecated
047    int MANAGE_ARTIFACT = 7;
048
049    int OMIT_FOR_CYCLE = 8;
050
051    /**
052     * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current
053     * node is in the first level pom
054     */
055    int UPDATE_SCOPE_CURRENT_POM = 9;
056
057    int SELECT_VERSION_FROM_RANGE = 10;
058
059    int RESTRICT_RANGE = 11;
060
061    int MANAGE_ARTIFACT_VERSION = 12;
062
063    int MANAGE_ARTIFACT_SCOPE = 13;
064
065    int MANAGE_ARTIFACT_SYSTEM_PATH = 14;
066
067    void testArtifact( Artifact node );
068
069    void startProcessChildren( Artifact artifact );
070
071    void endProcessChildren( Artifact artifact );
072
073    void includeArtifact( Artifact artifact );
074
075    void omitForNearer( Artifact omitted,
076                        Artifact kept );
077
078    void updateScope( Artifact artifact,
079                      String scope );
080
081    @Deprecated
082    void manageArtifact( Artifact artifact,
083                         Artifact replacement );
084
085    // TODO Use the following two instead of manageArtifact
086    // TODO Remove ResolutionListenerDM interface
087
088    //void manageArtifactVersion( Artifact artifact, Artifact replacement );
089
090    //void manageArtifactScope( Artifact artifact, Artifact replacement );
091
092    void omitForCycle( Artifact artifact );
093
094    /**
095     * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current
096     * node is in the first level pom
097     *
098     * @param artifact     current node artifact, the one in the first level pom
099     * @param ignoredScope artifactScope that was ignored because artifact was in first level pom
100     */
101    void updateScopeCurrentPom( Artifact artifact,
102                                String ignoredScope );
103
104    void selectVersionFromRange( Artifact artifact );
105
106    void restrictRange( Artifact artifact,
107                        Artifact replacement,
108                        VersionRange newRange );
109}