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