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         * @param localRepository    the local repository
044         */
045        void transformForResolve( Artifact artifact, RepositoryRequest request )
046            throws ArtifactResolutionException, ArtifactNotFoundException;
047    
048        /**
049         * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
050         * transformation has occurred the original artifact is returned.
051         *
052         * @param artifact           Artifact to be transformed.
053         * @param remoteRepositories the repositories to check
054         * @param localRepository    the local repository
055         */
056        void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
057                                  ArtifactRepository localRepository )
058            throws ArtifactResolutionException, ArtifactNotFoundException;
059    
060        /**
061         * Take in a artifact and return the transformed artifact for locating in the local repository. If no
062         * transformation has occurred the original artifact is returned.
063         *
064         * @param artifact        Artifact to be transformed.
065         * @param localRepository the local repository it will be stored in
066         */
067        void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
068            throws ArtifactInstallationException;
069    
070        /**
071         * Take in a artifact and return the transformed artifact for distributing to a remote repository. If no
072         * transformation has occurred the original artifact is returned.
073         *
074         * @param artifact         Artifact to be transformed.
075         * @param remoteRepository the repository to deploy to
076         * @param localRepository  the local repository the metadata is stored in
077         */
078        void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
079                                     ArtifactRepository localRepository )
080            throws ArtifactDeploymentException;
081    
082        List getArtifactTransformations();
083    }