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    /**
033     * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
034     */
035    public interface ArtifactTransformation
036    {
037        String ROLE = ArtifactTransformation.class.getName();
038    
039        /**
040         * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
041         * transformation has occured the original artifact is returned.
042         *
043         * @param artifact           Artifact to be transformed.
044         * @param request the repositories to check
045         * @param localRepository    the local repository
046         */
047        void transformForResolve( Artifact artifact, RepositoryRequest request )
048            throws ArtifactResolutionException, ArtifactNotFoundException;
049    
050        /**
051         * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
052         * transformation has occured the original artifact is returned.
053         *
054         * @param artifact           Artifact to be transformed.
055         * @param remoteRepositories the repositories to check
056         * @param localRepository    the local repository
057         */
058        void transformForResolve( Artifact artifact,
059                                  List<ArtifactRepository> remoteRepositories,
060                                  ArtifactRepository localRepository )
061            throws ArtifactResolutionException, ArtifactNotFoundException;
062    
063        /**
064         * Take in a artifact and return the transformed artifact for locating in the local repository. If no
065         * transformation has occured the original artifact is returned.
066         *
067         * @param artifact        Artifact to be transformed.
068         * @param localRepository the local repository it will be stored in
069         */
070        void transformForInstall( Artifact artifact,
071                                  ArtifactRepository localRepository )
072            throws ArtifactInstallationException;
073    
074        /**
075         * Take in a artifact and return the transformed artifact for distributing toa remote repository. If no
076         * transformation has occured the original artifact is returned.
077         *
078         * @param artifact         Artifact to be transformed.
079         * @param remoteRepository the repository to deploy to
080         * @param localRepository  the local repository
081         */
082        void transformForDeployment( Artifact artifact,
083                                     ArtifactRepository remoteRepository,
084                                     ArtifactRepository localRepository )
085            throws ArtifactDeploymentException;
086    
087    }