001    package org.apache.maven.repository.legacy.resolver.transform;
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    
022    import java.util.List;
023    
024    import org.apache.maven.artifact.Artifact;
025    import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
026    import org.apache.maven.artifact.installer.ArtifactInstallationException;
027    import org.apache.maven.artifact.repository.ArtifactRepository;
028    import org.apache.maven.artifact.repository.RepositoryRequest;
029    import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
030    import org.apache.maven.artifact.resolver.ArtifactResolutionException;
031    
032    /** Manages multiple ArtifactTransformation instances and applies them in succession. */
033    public interface ArtifactTransformationManager
034    {
035        String ROLE = ArtifactTransformationManager.class.getName();
036    
037        /**
038         * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
039         * transformation has occurred the original artifact is returned.
040         *
041         * @param artifact           Artifact to be transformed.
042         * @param request the repositories to check
043         */
044        void transformForResolve( Artifact artifact, RepositoryRequest request )
045            throws ArtifactResolutionException, ArtifactNotFoundException;
046    
047        /**
048         * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
049         * transformation has occurred the original artifact is returned.
050         *
051         * @param artifact           Artifact to be transformed.
052         * @param remoteRepositories the repositories to check
053         * @param localRepository    the local repository
054         */
055        void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
056                                  ArtifactRepository localRepository )
057            throws ArtifactResolutionException, ArtifactNotFoundException;
058    
059        /**
060         * Take in a artifact and return the transformed artifact for locating in the local repository. If no
061         * transformation has occurred the original artifact is returned.
062         *
063         * @param artifact        Artifact to be transformed.
064         * @param localRepository the local repository it will be stored in
065         */
066        void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
067            throws ArtifactInstallationException;
068    
069        /**
070         * Take in a artifact and return the transformed artifact for distributing to a remote repository. If no
071         * transformation has occurred the original artifact is returned.
072         *
073         * @param artifact         Artifact to be transformed.
074         * @param remoteRepository the repository to deploy to
075         * @param localRepository  the local repository the metadata is stored in
076         */
077        void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
078                                     ArtifactRepository localRepository )
079            throws ArtifactDeploymentException;
080    
081        List getArtifactTransformations();
082    }