001package 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
022import java.util.List;
023
024import org.apache.maven.artifact.Artifact;
025import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
026import org.apache.maven.artifact.installer.ArtifactInstallationException;
027import org.apache.maven.artifact.repository.ArtifactRepository;
028import org.apache.maven.artifact.repository.RepositoryRequest;
029import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
030import org.apache.maven.artifact.resolver.ArtifactResolutionException;
031
032/**
033 * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
034 */
035public 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 occurred the original artifact is returned.
042     *
043     * @param artifact           Artifact to be transformed.
044     * @param request the repositories to check
045     */
046    void transformForResolve( Artifact artifact, RepositoryRequest request )
047        throws ArtifactResolutionException, ArtifactNotFoundException;
048
049    /**
050     * Take in a artifact and return the transformed artifact for locating in the remote repository. If no
051     * transformation has occurred the original artifact is returned.
052     *
053     * @param artifact           Artifact to be transformed.
054     * @param remoteRepositories the repositories to check
055     * @param localRepository    the local repository
056     */
057    void transformForResolve( Artifact artifact,
058                              List<ArtifactRepository> remoteRepositories,
059                              ArtifactRepository localRepository )
060        throws ArtifactResolutionException, ArtifactNotFoundException;
061
062    /**
063     * Take in a artifact and return the transformed artifact for locating in the local repository. If no
064     * transformation has occurred the original artifact is returned.
065     *
066     * @param artifact        Artifact to be transformed.
067     * @param localRepository the local repository it will be stored in
068     */
069    void transformForInstall( Artifact artifact,
070                              ArtifactRepository localRepository )
071        throws ArtifactInstallationException;
072
073    /**
074     * Take in a artifact and return the transformed artifact for distributing to remote repository. If no
075     * transformation has occurred the original artifact is returned.
076     *
077     * @param artifact         Artifact to be transformed.
078     * @param remoteRepository the repository to deploy to
079     * @param localRepository  the local repository
080     */
081    void transformForDeployment( Artifact artifact,
082                                 ArtifactRepository remoteRepository,
083                                 ArtifactRepository localRepository )
084        throws ArtifactDeploymentException;
085
086}