1 package org.apache.maven.repository.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Map;
24
25 import org.eclipse.aether.artifact.AbstractArtifact;
26 import org.eclipse.aether.artifact.Artifact;
27
28
29
30
31 final class RelocatedArtifact
32 extends AbstractArtifact
33 {
34
35 private final Artifact artifact;
36
37 private final String groupId;
38
39 private final String artifactId;
40
41 private final String version;
42
43 public RelocatedArtifact( Artifact artifact, String groupId, String artifactId, String version )
44 {
45 if ( artifact == null )
46 {
47 throw new IllegalArgumentException( "no artifact specified" );
48 }
49 this.artifact = artifact;
50 this.groupId = ( groupId != null && groupId.length() > 0 ) ? groupId : null;
51 this.artifactId = ( artifactId != null && artifactId.length() > 0 ) ? artifactId : null;
52 this.version = ( version != null && version.length() > 0 ) ? version : null;
53 }
54
55 public String getGroupId()
56 {
57 if ( groupId != null )
58 {
59 return groupId;
60 }
61 else
62 {
63 return artifact.getGroupId();
64 }
65 }
66
67 public String getArtifactId()
68 {
69 if ( artifactId != null )
70 {
71 return artifactId;
72 }
73 else
74 {
75 return artifact.getArtifactId();
76 }
77 }
78
79 public String getVersion()
80 {
81 if ( version != null )
82 {
83 return version;
84 }
85 else
86 {
87 return artifact.getVersion();
88 }
89 }
90
91 public String getClassifier()
92 {
93 return artifact.getClassifier();
94 }
95
96 public String getExtension()
97 {
98 return artifact.getExtension();
99 }
100
101 public File getFile()
102 {
103 return artifact.getFile();
104 }
105
106 public String getProperty( String key, String defaultValue )
107 {
108 return artifact.getProperty( key, defaultValue );
109 }
110
111 public Map<String, String> getProperties()
112 {
113 return artifact.getProperties();
114 }
115
116 }