KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > artifact > repository > metadata > SnapshotArtifactRepositoryMetadata


1 package org.apache.maven.artifact.repository.metadata;
2
3 /*
4  * Copyright 2001-2005 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.maven.artifact.Artifact;
20 import org.apache.maven.artifact.repository.ArtifactRepository;
21
22 /**
23  * Metadata for the artifact version directory of the repository.
24  *
25  * @author <a HREF="mailto:brett@apache.org">Brett Porter</a>
26  * @version $Id: SnapshotArtifactRepositoryMetadata.java 292139 2005-09-28 08:08:45Z brett $
27  * @todo split instantiation (versioning, plugin mappings) from definition
28  */

29 public class SnapshotArtifactRepositoryMetadata
30     extends AbstractRepositoryMetadata
31 {
32     private Artifact artifact;
33
34     public SnapshotArtifactRepositoryMetadata( Artifact artifact )
35     {
36         super( createMetadata( artifact, null ) );
37         this.artifact = artifact;
38     }
39
40     public SnapshotArtifactRepositoryMetadata( Artifact artifact, Snapshot snapshot )
41     {
42         super( createMetadata( artifact, createVersioning( snapshot ) ) );
43         this.artifact = artifact;
44     }
45
46     public boolean storedInGroupDirectory()
47     {
48         return false;
49     }
50
51     public boolean storedInArtifactVersionDirectory()
52     {
53         return true;
54     }
55
56     public String JavaDoc getGroupId()
57     {
58         return artifact.getGroupId();
59     }
60
61     public String JavaDoc getArtifactId()
62     {
63         return artifact.getArtifactId();
64     }
65
66     public String JavaDoc getBaseVersion()
67     {
68         return artifact.getBaseVersion();
69     }
70
71     public Object JavaDoc getKey()
72     {
73         return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion();
74     }
75
76     public boolean isSnapshot()
77     {
78         return artifact.isSnapshot();
79     }
80
81     public void setRepository( ArtifactRepository remoteRepository )
82     {
83         artifact.setRepository( remoteRepository );
84     }
85 }
86
Popular Tags