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