View Javadoc

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