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  /** Manages multiple ArtifactTransformation instances and applies them in succession. */
33  public interface ArtifactTransformationManager
34  {
35      String ROLE = ArtifactTransformationManager.class.getName();
36  
37      /**
38       * Take in a 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       * @param localRepository    the local repository
44       */
45      void transformForResolve( Artifact artifact, RepositoryRequest request )
46          throws ArtifactResolutionException, ArtifactNotFoundException;
47  
48      /**
49       * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
50       * transformation has occurred the original artifact is returned.
51       *
52       * @param artifact           Artifact to be transformed.
53       * @param remoteRepositories the repositories to check
54       * @param localRepository    the local repository
55       */
56      void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
57                                ArtifactRepository localRepository )
58          throws ArtifactResolutionException, ArtifactNotFoundException;
59  
60      /**
61       * Take in a artifact and return the transformed artifact for locating in the local repository. If no
62       * transformation has occurred the original artifact is returned.
63       *
64       * @param artifact        Artifact to be transformed.
65       * @param localRepository the local repository it will be stored in
66       */
67      void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
68          throws ArtifactInstallationException;
69  
70      /**
71       * Take in a artifact and return the transformed artifact for distributing to a remote repository. If no
72       * transformation has occurred the original artifact is returned.
73       *
74       * @param artifact         Artifact to be transformed.
75       * @param remoteRepository the repository to deploy to
76       * @param localRepository  the local repository the metadata is stored in
77       */
78      void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
79                                   ArtifactRepository localRepository )
80          throws ArtifactDeploymentException;
81  
82      List getArtifactTransformations();
83  }