]>
git.argeo.org Git - gpl/argeo-jcr.git/blob - org.argeo.slc.repo/src/org/argeo/slc/repo/ArtifactDistribution.java
1 package org
.argeo
.slc
.repo
;
3 import org
.argeo
.slc
.CategoryNameVersion
;
4 import org
.argeo
.slc
.build
.Distribution
;
5 import org
.eclipse
.aether
.artifact
.Artifact
;
6 import org
.eclipse
.aether
.artifact
.DefaultArtifact
;
8 /** A {@link Distribution} based on an Aether {@link Artifact} */
9 public class ArtifactDistribution
implements Distribution
,
11 private final Artifact artifact
;
13 public ArtifactDistribution(Artifact artifact
) {
14 this.artifact
= artifact
;
17 public ArtifactDistribution(String coords
) {
18 this(new DefaultArtifact(coords
));
21 /** Aether coordinates of the underlying artifact. */
22 public String
getDistributionId() {
23 return artifact
.toString();
26 public Artifact
getArtifact() {
30 public String
getName() {
31 return getArtifact().getArtifactId();
34 public String
getVersion() {
35 return getArtifact().getVersion();
38 public String
getCategory() {
39 return getArtifact().getGroupId();
43 public int hashCode() {
44 return artifact
.hashCode();
48 public boolean equals(Object obj
) {
49 if (obj
instanceof CategoryNameVersion
) {
50 CategoryNameVersion cnv
= (CategoryNameVersion
) obj
;
51 return getCategory().equals(cnv
.getCategory())
52 && getName().equals(cnv
.getName())
53 && getVersion().equals(cnv
.getVersion());
55 return artifact
.equals(obj
);
59 public String
toString() {
60 return getDistributionId();