1 package org.apache.archiva.converter.artifact;
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.repository.ArtifactRepository;
24 import org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata;
25 import org.apache.maven.artifact.repository.metadata.Snapshot;
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public class SnapshotArtifactRepositoryMetadata
40 extends AbstractRepositoryMetadata
41 {
42 private Artifact artifact;
43
44 public SnapshotArtifactRepositoryMetadata( Artifact artifact )
45 {
46 super( createMetadata( artifact, null ) );
47 this.artifact = artifact;
48 }
49
50 public SnapshotArtifactRepositoryMetadata( Artifact artifact,
51 Snapshot snapshot )
52 {
53 super( createMetadata( artifact, createVersioning( snapshot ) ) );
54 this.artifact = artifact;
55 }
56
57 public boolean storedInGroupDirectory()
58 {
59 return false;
60 }
61
62 public boolean storedInArtifactVersionDirectory()
63 {
64 return true;
65 }
66
67 public String getGroupId()
68 {
69 return artifact.getGroupId();
70 }
71
72 public String getArtifactId()
73 {
74 return artifact.getArtifactId();
75 }
76
77 public String getBaseVersion()
78 {
79 return artifact.getBaseVersion();
80 }
81
82 public Object getKey()
83 {
84 return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion();
85 }
86
87 public boolean isSnapshot()
88 {
89 return artifact.isSnapshot();
90 }
91
92 public int getNature()
93 {
94 return isSnapshot() ? SNAPSHOT : RELEASE;
95 }
96
97 public ArtifactRepository getRepository()
98 {
99 return artifact.getRepository();
100 }
101
102 public void setRepository( ArtifactRepository remoteRepository )
103 {
104 artifact.setRepository( remoteRepository );
105 }
106 }