1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.artifact.repository.metadata;
20
21 import org.apache.maven.artifact.Artifact;
22 import org.apache.maven.artifact.ArtifactUtils;
23 import org.apache.maven.artifact.repository.ArtifactRepository;
24 import org.apache.maven.artifact.versioning.ArtifactVersion;
25 import org.apache.maven.artifact.versioning.Restriction;
26 import org.apache.maven.artifact.versioning.VersionRange;
27
28
29
30
31
32 @Deprecated
33 public class ArtifactRepositoryMetadata extends AbstractRepositoryMetadata {
34 private Artifact artifact;
35
36 public ArtifactRepositoryMetadata(Artifact artifact) {
37 this(artifact, null);
38 }
39
40 public ArtifactRepositoryMetadata(Artifact artifact, Versioning versioning) {
41 super(createMetadata(artifact, versioning));
42 this.artifact = artifact;
43 }
44
45 public boolean storedInGroupDirectory() {
46 return false;
47 }
48
49 public boolean storedInArtifactVersionDirectory() {
50 return false;
51 }
52
53 public String getGroupId() {
54 return artifact.getGroupId();
55 }
56
57 public String getArtifactId() {
58 return artifact.getArtifactId();
59 }
60
61 public String getBaseVersion() {
62
63 return null;
64 }
65
66 public Object getKey() {
67 return "artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId();
68 }
69
70 public boolean isSnapshot() {
71
72 return false;
73 }
74
75 public int getNature() {
76 if (artifact.getVersion() != null) {
77 return artifact.isSnapshot() ? SNAPSHOT : RELEASE;
78 }
79
80 VersionRange range = artifact.getVersionRange();
81 if (range != null) {
82 for (Restriction restriction : range.getRestrictions()) {
83 if (isSnapshot(restriction.getLowerBound()) || isSnapshot(restriction.getUpperBound())) {
84 return RELEASE_OR_SNAPSHOT;
85 }
86 }
87 }
88
89 return RELEASE;
90 }
91
92 private boolean isSnapshot(ArtifactVersion version) {
93 return version != null && ArtifactUtils.isSnapshot(version.getQualifier());
94 }
95
96 public ArtifactRepository getRepository() {
97 return null;
98 }
99
100 public void setRepository(ArtifactRepository remoteRepository) {
101
102
103
104
105
106 }
107 }