KickJava   Java API By Example, From Geeks To Geeks.

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


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 directory of the repository.
24  *
25  * @author <a HREF="mailto:brett@apache.org">Brett Porter</a>
26  * @version $Id: ArtifactRepositoryMetadata.java 280506 2005-09-13 05:26:06Z brett $
27  */

28 public class ArtifactRepositoryMetadata
29     extends AbstractRepositoryMetadata
30 {
31     private Artifact artifact;
32
33     public ArtifactRepositoryMetadata( Artifact artifact )
34     {
35         this( artifact, null );
36     }
37
38     public ArtifactRepositoryMetadata( Artifact artifact, Versioning versioning )
39     {
40         super( createMetadata( artifact, versioning ) );
41         this.artifact = artifact;
42     }
43
44     public boolean storedInGroupDirectory()
45     {
46         return false;
47     }
48
49     public boolean storedInArtifactVersionDirectory()
50     {
51         return false;
52     }
53
54     public String JavaDoc getGroupId()
55     {
56         return artifact.getGroupId();
57     }
58
59     public String JavaDoc getArtifactId()
60     {
61         return artifact.getArtifactId();
62     }
63
64     public String JavaDoc getBaseVersion()
65     {
66         // Don't want the artifact's version in here, as this is stored in the directory above that
67
return null;
68     }
69
70     public Object JavaDoc getKey()
71     {
72         return "artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId();
73     }
74
75     public boolean isSnapshot()
76     {
77         // Don't consider the artifact's version in here, as this is stored in the directory above that
78
return false;
79     }
80
81     public void setRepository( ArtifactRepository remoteRepository )
82     {
83         artifact.setRepository( remoteRepository );
84     }
85 }
86
Popular Tags