1 | |
package org.apache.maven.artifact.transform; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.artifact.Artifact; |
23 | |
import org.apache.maven.artifact.deployer.ArtifactDeploymentException; |
24 | |
import org.apache.maven.artifact.installer.ArtifactInstallationException; |
25 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
26 | |
import org.apache.maven.artifact.resolver.ArtifactNotFoundException; |
27 | |
import org.apache.maven.artifact.resolver.ArtifactResolutionException; |
28 | |
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; |
29 | |
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; |
30 | |
|
31 | |
import java.util.Iterator; |
32 | |
import java.util.List; |
33 | |
|
34 | 9 | public class DefaultArtifactTransformationManager |
35 | |
implements ArtifactTransformationManager, Initializable |
36 | |
{ |
37 | |
private List artifactTransformations; |
38 | |
|
39 | |
public void initialize() throws InitializationException { |
40 | |
|
41 | 9 | Object obj[] = artifactTransformations.toArray(); |
42 | 36 | for (int x = 0; x < obj.length; x++) |
43 | |
{ |
44 | 27 | if (obj[x].getClass().getName().indexOf("Snapshot") != -1) { |
45 | 9 | artifactTransformations.remove(obj[x]); |
46 | 9 | artifactTransformations.add(obj[x]); |
47 | |
} |
48 | |
} |
49 | 9 | } |
50 | |
|
51 | |
public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) |
52 | |
throws ArtifactResolutionException, ArtifactNotFoundException |
53 | |
{ |
54 | 9 | for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); ) |
55 | |
{ |
56 | 27 | ArtifactTransformation transform = (ArtifactTransformation) i.next(); |
57 | 27 | transform.transformForResolve( artifact, remoteRepositories, localRepository ); |
58 | 27 | } |
59 | 9 | } |
60 | |
|
61 | |
public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) |
62 | |
throws ArtifactInstallationException |
63 | |
{ |
64 | 1 | for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); ) |
65 | |
{ |
66 | 3 | ArtifactTransformation transform = (ArtifactTransformation) i.next(); |
67 | 3 | transform.transformForInstall( artifact, localRepository ); |
68 | 3 | } |
69 | 1 | } |
70 | |
|
71 | |
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, |
72 | |
ArtifactRepository localRepository ) |
73 | |
throws ArtifactDeploymentException |
74 | |
{ |
75 | 1 | for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); ) |
76 | |
{ |
77 | 3 | ArtifactTransformation transform = (ArtifactTransformation) i.next(); |
78 | 3 | transform.transformForDeployment( artifact, remoteRepository, localRepository ); |
79 | 3 | } |
80 | 1 | } |
81 | |
|
82 | |
|
83 | |
|
84 | |
} |