View Javadoc
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.repository.legacy.resolver.transform;
20  
21  import java.util.List;
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
24  import org.apache.maven.artifact.installer.ArtifactInstallationException;
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  import org.apache.maven.artifact.repository.RepositoryRequest;
27  import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
28  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
29  
30  /**
31   * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
32   */
33  public interface ArtifactTransformation {
34      String ROLE = ArtifactTransformation.class.getName();
35  
36      /**
37       * Take in an artifact and return the transformed artifact for locating in the remote repository. If no
38       * transformation has occurred the original artifact is returned.
39       *
40       * @param artifact           Artifact to be transformed.
41       * @param request the repositories to check
42       */
43      void transformForResolve(Artifact artifact, RepositoryRequest request)
44              throws ArtifactResolutionException, ArtifactNotFoundException;
45  
46      /**
47       * Take in an artifact and return the transformed artifact for locating in the remote repository. If no
48       * transformation has occurred the original artifact is returned.
49       *
50       * @param artifact           Artifact to be transformed.
51       * @param remoteRepositories the repositories to check
52       * @param localRepository    the local repository
53       */
54      void transformForResolve(
55              Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository)
56              throws ArtifactResolutionException, ArtifactNotFoundException;
57  
58      /**
59       * Take in an artifact and return the transformed artifact for locating in the local repository. If no
60       * transformation has occurred the original artifact is returned.
61       *
62       * @param artifact        Artifact to be transformed.
63       * @param localRepository the local repository it will be stored in
64       */
65      void transformForInstall(Artifact artifact, ArtifactRepository localRepository)
66              throws ArtifactInstallationException;
67  
68      /**
69       * Take in an artifact and return the transformed artifact for distributing to remote repository. If no
70       * transformation has occurred the original artifact is returned.
71       *
72       * @param artifact         Artifact to be transformed.
73       * @param remoteRepository the repository to deploy to
74       * @param localRepository  the local repository
75       */
76      void transformForDeployment(
77              Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository)
78              throws ArtifactDeploymentException;
79  }