KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.maven.artifact.repository.metadata;
2
3 /*
4  * Copyright 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.repository.ArtifactRepository;
20
21 import java.util.Iterator JavaDoc;
22 import java.util.List JavaDoc;
23
24 /**
25  * Metadata for the group directory of the repository.
26  *
27  * @author <a HREF="mailto:brett@apache.org">Brett Porter</a>
28  * @version $Id: GroupRepositoryMetadata.java 292431 2005-09-29 13:43:15Z brett $
29  */

30 public class GroupRepositoryMetadata
31     extends AbstractRepositoryMetadata
32 {
33     private final String JavaDoc groupId;
34
35     public GroupRepositoryMetadata( String JavaDoc groupId )
36     {
37         super( new Metadata() );
38         this.groupId = groupId;
39     }
40
41     public boolean storedInGroupDirectory()
42     {
43         return true;
44     }
45
46     public boolean storedInArtifactVersionDirectory()
47     {
48         return false;
49     }
50
51     public String JavaDoc getGroupId()
52     {
53         return groupId;
54     }
55
56     public String JavaDoc getArtifactId()
57     {
58         return null;
59     }
60
61     public String JavaDoc getBaseVersion()
62     {
63         return null;
64     }
65
66     public void addPluginMapping( String JavaDoc goalPrefix, String JavaDoc artifactId )
67     {
68         addPluginMapping( goalPrefix, artifactId, artifactId );
69     }
70
71     public void addPluginMapping( String JavaDoc goalPrefix, String JavaDoc artifactId, String JavaDoc name )
72     {
73         List JavaDoc plugins = getMetadata().getPlugins();
74         boolean found = false;
75         for ( Iterator JavaDoc i = plugins.iterator(); i.hasNext() && !found; )
76         {
77             Plugin plugin = (Plugin) i.next();
78             if ( plugin.getPrefix().equals( goalPrefix ) )
79             {
80                 found = true;
81             }
82         }
83         if ( !found )
84         {
85             Plugin plugin = new Plugin();
86             plugin.setPrefix( goalPrefix );
87             plugin.setArtifactId( artifactId );
88             plugin.setName( name );
89
90
91             getMetadata().addPlugin( plugin );
92         }
93     }
94
95     public Object JavaDoc getKey()
96     {
97         return groupId;
98     }
99
100     public boolean isSnapshot()
101     {
102         return false;
103     }
104
105     public void setRepository( ArtifactRepository remoteRepository )
106     {
107         // intentionally blank
108
}
109 }
110
Popular Tags