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 import org.codehaus.plexus.component.annotations.Component;
032 import org.codehaus.plexus.component.annotations.Requirement;
033
034 /**
035 * @author Jason van Zyl
036 */
037 @Component( role = ArtifactTransformationManager.class )
038 public class DefaultArtifactTransformationManager
039 implements ArtifactTransformationManager
040 {
041 @Requirement( role = ArtifactTransformation.class, hints = { "release", "latest", "snapshot" } )
042 private List<ArtifactTransformation> artifactTransformations;
043
044 public void transformForResolve( Artifact artifact, RepositoryRequest request )
045 throws ArtifactResolutionException, ArtifactNotFoundException
046 {
047 for ( ArtifactTransformation transform : artifactTransformations )
048 {
049 transform.transformForResolve( artifact, request );
050 }
051 }
052
053 public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
054 ArtifactRepository localRepository )
055 throws ArtifactResolutionException, ArtifactNotFoundException
056 {
057 for ( ArtifactTransformation transform : artifactTransformations )
058 {
059 transform.transformForResolve( artifact, remoteRepositories, localRepository );
060 }
061 }
062
063 public void transformForInstall( Artifact artifact, ArtifactRepository localRepository )
064 throws ArtifactInstallationException
065 {
066 for ( ArtifactTransformation transform : artifactTransformations )
067 {
068 transform.transformForInstall( artifact, localRepository );
069 }
070 }
071
072 public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
073 ArtifactRepository localRepository )
074 throws ArtifactDeploymentException
075 {
076 for ( ArtifactTransformation transform : artifactTransformations )
077 {
078 transform.transformForDeployment( artifact, remoteRepository, localRepository );
079 }
080 }
081
082 public List getArtifactTransformations()
083 {
084 return artifactTransformations;
085 }
086 }