1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.apache.maven.archetype.common; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | 0 | public class ArchetypeConfiguration |
16 | |
implements java.io.Serializable |
17 | |
{ |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
private String GroupId; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
private String ArtifactId; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
private String Version; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
private String Name; |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
private String goals; |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
private java.util.List RequiredProperties; |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
public void addRequiredProperty( String string ) |
64 | |
{ |
65 | 0 | getRequiredProperties().add( string ); |
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
public String getArtifactId() |
74 | |
{ |
75 | 0 | return this.ArtifactId; |
76 | |
} |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
public String getGoals() |
84 | |
{ |
85 | 0 | return this.goals; |
86 | |
} |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public String getGroupId() |
94 | |
{ |
95 | 0 | return this.GroupId; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
public String getName() |
104 | |
{ |
105 | 0 | return this.Name; |
106 | |
} |
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
|
113 | |
public java.util.List getRequiredProperties() |
114 | |
{ |
115 | 0 | if ( this.RequiredProperties == null ) |
116 | |
{ |
117 | 0 | this.RequiredProperties = new java.util.ArrayList(); |
118 | |
} |
119 | |
|
120 | 0 | return this.RequiredProperties; |
121 | |
} |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
public String getVersion() |
129 | |
{ |
130 | 0 | return this.Version; |
131 | |
} |
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
public void removeRequiredProperty( String string ) |
139 | |
{ |
140 | 0 | getRequiredProperties().remove( string ); |
141 | 0 | } |
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
public void setArtifactId( String ArtifactId ) |
149 | |
{ |
150 | 0 | this.ArtifactId = ArtifactId; |
151 | 0 | } |
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
public void setGoals( String goals ) |
159 | |
{ |
160 | 0 | this.goals = goals; |
161 | 0 | } |
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
public void setGroupId( String GroupId ) |
169 | |
{ |
170 | 0 | this.GroupId = GroupId; |
171 | 0 | } |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
public void setName( String Name ) |
179 | |
{ |
180 | 0 | this.Name = Name; |
181 | 0 | } |
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
public void setRequiredProperties( java.util.List RequiredProperties ) |
189 | |
{ |
190 | 0 | this.RequiredProperties = RequiredProperties; |
191 | 0 | } |
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
public void setVersion( String Version ) |
199 | |
{ |
200 | 0 | this.Version = Version; |
201 | 0 | } |
202 | |
|
203 | |
|
204 | |
public void reset () |
205 | |
{ |
206 | 0 | properties.clear (); |
207 | 0 | } |
208 | |
|
209 | 0 | private java.util.Properties properties = new java.util.Properties (); |
210 | |
|
211 | |
public void setProperty ( String requiredProperty, String propertyValue ) |
212 | |
{ |
213 | 0 | properties.setProperty ( requiredProperty, propertyValue ); |
214 | 0 | } |
215 | |
|
216 | |
public String getProperty (String property) |
217 | |
{ |
218 | 0 | return properties.getProperty ( property, null ); |
219 | |
} |
220 | |
|
221 | |
public java.util.Properties getProperties () |
222 | |
{ |
223 | 0 | return properties; |
224 | |
} |
225 | |
|
226 | |
public java.util.Properties toProperties () |
227 | |
{ |
228 | 0 | java.util.Properties result = new java.util.Properties (); |
229 | 0 | result.putAll ( properties ); |
230 | 0 | result.setProperty ( |
231 | |
Constants.ARCHETYPE_GROUP_ID, |
232 | |
(org.codehaus.plexus.util.StringUtils.isNotEmpty( getGroupId () ) ? getGroupId () : "" ) |
233 | |
); |
234 | 0 | result.setProperty ( |
235 | |
Constants.ARCHETYPE_ARTIFACT_ID, |
236 | |
(org.codehaus.plexus.util.StringUtils.isNotEmpty( getArtifactId () ) ? getArtifactId () : "" ) |
237 | |
); |
238 | 0 | result.setProperty ( |
239 | |
Constants.ARCHETYPE_VERSION, |
240 | |
(org.codehaus.plexus.util.StringUtils.isNotEmpty( getVersion () ) ? getVersion () : "" ) |
241 | |
); |
242 | |
|
243 | 0 | properties.setProperty ( |
244 | |
Constants.ARCHETYPE_POST_GENERATION_GOALS, |
245 | |
(org.codehaus.plexus.util.StringUtils.isNotEmpty( getGoals() ) ? getGoals() : "" ) |
246 | |
); |
247 | |
|
248 | 0 | return result; |
249 | |
} |
250 | |
|
251 | |
public boolean isConfigured () |
252 | |
{ |
253 | 0 | boolean configured = true; |
254 | |
|
255 | 0 | java.util.Iterator requiredProperties = getRequiredProperties().iterator(); |
256 | 0 | while ( configured && requiredProperties.hasNext () ) |
257 | |
{ |
258 | 0 | String requiredProperty = (String) requiredProperties.next (); |
259 | |
|
260 | 0 | configured = configured && |
261 | |
org.codehaus.plexus.util.StringUtils.isNotEmpty( |
262 | |
properties.getProperty ( requiredProperty ) |
263 | |
); |
264 | 0 | } |
265 | |
|
266 | 0 | return configured; |
267 | |
} |
268 | |
|
269 | |
public boolean isConfigured ( String requiredProperties ) |
270 | |
{ |
271 | 0 | return org.codehaus.plexus.util.StringUtils.isNotEmpty ( |
272 | |
properties.getProperty ( requiredProperties ) |
273 | |
); |
274 | |
} |
275 | |
|
276 | 0 | private java.util.Properties defaultProperties = new java.util.Properties (); |
277 | |
|
278 | |
public void setDefaultProperty ( String requiredProperty, String propertyValue ) |
279 | |
{ |
280 | 0 | defaultProperties.setProperty ( requiredProperty, propertyValue ); |
281 | 0 | } |
282 | |
|
283 | |
public String getDefaultValue (String requiredProperty) |
284 | |
{ |
285 | 0 | return defaultProperties.getProperty ( requiredProperty, null ); |
286 | |
} |
287 | |
|
288 | |
public java.util.Properties getDefaultValues () |
289 | |
{ |
290 | 0 | return defaultProperties; |
291 | |
} |
292 | |
|
293 | |
} |