Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Profile |
|
| 1.7333333333333334;1.733 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.settings; | |
6 | ||
7 | //---------------------------------/ | |
8 | //- Imported classes and packages -/ | |
9 | //---------------------------------/ | |
10 | ||
11 | import java.util.Date; | |
12 | ||
13 | /** | |
14 | * | |
15 | * | |
16 | * Modifications to the build process which is keyed on | |
17 | * some | |
18 | * sort of environmental parameter. | |
19 | * | |
20 | * | |
21 | * | |
22 | * @version $Revision$ $Date$ | |
23 | */ | |
24 | 0 | public class Profile extends IdentifiableBase |
25 | implements java.io.Serializable | |
26 | { | |
27 | ||
28 | ||
29 | //--------------------------/ | |
30 | //- Class/Member Variables -/ | |
31 | //--------------------------/ | |
32 | ||
33 | /** | |
34 | * | |
35 | * | |
36 | * The conditional logic which will automatically | |
37 | * trigger the inclusion of this profile. | |
38 | * | |
39 | * | |
40 | */ | |
41 | private Activation activation; | |
42 | ||
43 | /** | |
44 | * Field properties. | |
45 | */ | |
46 | private java.util.Properties properties; | |
47 | ||
48 | /** | |
49 | * Field repositories. | |
50 | */ | |
51 | private java.util.List repositories; | |
52 | ||
53 | /** | |
54 | * | |
55 | * | |
56 | * This may be removed or relocated in the near | |
57 | * future. It is undecided whether plugins really | |
58 | * need a remote | |
59 | * repository set of their own. | |
60 | * | |
61 | * | |
62 | */ | |
63 | private java.util.List pluginRepositories; | |
64 | ||
65 | ||
66 | //-----------/ | |
67 | //- Methods -/ | |
68 | //-----------/ | |
69 | ||
70 | /** | |
71 | * Method addPluginRepository. | |
72 | * | |
73 | * @param repository | |
74 | */ | |
75 | public void addPluginRepository( Repository repository ) | |
76 | { | |
77 | 0 | if ( !(repository instanceof Repository) ) |
78 | { | |
79 | 0 | throw new ClassCastException( "Profile.addPluginRepositories(repository) parameter must be instanceof " + Repository.class.getName() ); |
80 | } | |
81 | 0 | getPluginRepositories().add( repository ); |
82 | 0 | } //-- void addPluginRepository( Repository ) |
83 | ||
84 | /** | |
85 | * Method addProperty. | |
86 | * | |
87 | * @param key | |
88 | * @param value | |
89 | */ | |
90 | public void addProperty( String key, String value ) | |
91 | { | |
92 | 0 | getProperties().put( key, value ); |
93 | 0 | } //-- void addProperty( String, String ) |
94 | ||
95 | /** | |
96 | * Method addRepository. | |
97 | * | |
98 | * @param repository | |
99 | */ | |
100 | public void addRepository( Repository repository ) | |
101 | { | |
102 | 0 | if ( !(repository instanceof Repository) ) |
103 | { | |
104 | 0 | throw new ClassCastException( "Profile.addRepositories(repository) parameter must be instanceof " + Repository.class.getName() ); |
105 | } | |
106 | 0 | getRepositories().add( repository ); |
107 | 0 | } //-- void addRepository( Repository ) |
108 | ||
109 | /** | |
110 | * Get | |
111 | * | |
112 | * The conditional logic which will automatically | |
113 | * trigger the inclusion of this profile. | |
114 | * | |
115 | * | |
116 | * | |
117 | * @return Activation | |
118 | */ | |
119 | public Activation getActivation() | |
120 | { | |
121 | 0 | return this.activation; |
122 | } //-- Activation getActivation() | |
123 | ||
124 | /** | |
125 | * Method getPluginRepositories. | |
126 | * | |
127 | * @return java.util.List | |
128 | */ | |
129 | public java.util.List getPluginRepositories() | |
130 | { | |
131 | 0 | if ( this.pluginRepositories == null ) |
132 | { | |
133 | 0 | this.pluginRepositories = new java.util.ArrayList(); |
134 | } | |
135 | ||
136 | 0 | return this.pluginRepositories; |
137 | } //-- java.util.List getPluginRepositories() | |
138 | ||
139 | /** | |
140 | * Method getProperties. | |
141 | * | |
142 | * @return java.util.Properties | |
143 | */ | |
144 | public java.util.Properties getProperties() | |
145 | { | |
146 | 0 | if ( this.properties == null ) |
147 | { | |
148 | 0 | this.properties = new java.util.Properties(); |
149 | } | |
150 | ||
151 | 0 | return this.properties; |
152 | } //-- java.util.Properties getProperties() | |
153 | ||
154 | /** | |
155 | * Method getRepositories. | |
156 | * | |
157 | * @return java.util.List | |
158 | */ | |
159 | public java.util.List getRepositories() | |
160 | { | |
161 | 0 | if ( this.repositories == null ) |
162 | { | |
163 | 0 | this.repositories = new java.util.ArrayList(); |
164 | } | |
165 | ||
166 | 0 | return this.repositories; |
167 | } //-- java.util.List getRepositories() | |
168 | ||
169 | /** | |
170 | * Method removePluginRepository. | |
171 | * | |
172 | * @param repository | |
173 | */ | |
174 | public void removePluginRepository( Repository repository ) | |
175 | { | |
176 | 0 | if ( !(repository instanceof Repository) ) |
177 | { | |
178 | 0 | throw new ClassCastException( "Profile.removePluginRepositories(repository) parameter must be instanceof " + Repository.class.getName() ); |
179 | } | |
180 | 0 | getPluginRepositories().remove( repository ); |
181 | 0 | } //-- void removePluginRepository( Repository ) |
182 | ||
183 | /** | |
184 | * Method removeRepository. | |
185 | * | |
186 | * @param repository | |
187 | */ | |
188 | public void removeRepository( Repository repository ) | |
189 | { | |
190 | 0 | if ( !(repository instanceof Repository) ) |
191 | { | |
192 | 0 | throw new ClassCastException( "Profile.removeRepositories(repository) parameter must be instanceof " + Repository.class.getName() ); |
193 | } | |
194 | 0 | getRepositories().remove( repository ); |
195 | 0 | } //-- void removeRepository( Repository ) |
196 | ||
197 | /** | |
198 | * Set | |
199 | * | |
200 | * The conditional logic which will automatically | |
201 | * trigger the inclusion of this profile. | |
202 | * | |
203 | * | |
204 | * | |
205 | * @param activation | |
206 | */ | |
207 | public void setActivation( Activation activation ) | |
208 | { | |
209 | 0 | this.activation = activation; |
210 | 0 | } //-- void setActivation( Activation ) |
211 | ||
212 | /** | |
213 | * Set | |
214 | * | |
215 | * The lists of the remote repositories for | |
216 | * discovering plugins. | |
217 | * | |
218 | * | |
219 | * | |
220 | * @param pluginRepositories | |
221 | */ | |
222 | public void setPluginRepositories( java.util.List pluginRepositories ) | |
223 | { | |
224 | 0 | this.pluginRepositories = pluginRepositories; |
225 | 0 | } //-- void setPluginRepositories( java.util.List ) |
226 | ||
227 | /** | |
228 | * Set | |
229 | * Extended configuration specific to this profile | |
230 | * goes here. | |
231 | * Contents take the form of | |
232 | * <property.name>property.value</property.name> | |
233 | * | |
234 | * | |
235 | * @param properties | |
236 | */ | |
237 | public void setProperties( java.util.Properties properties ) | |
238 | { | |
239 | 0 | this.properties = properties; |
240 | 0 | } //-- void setProperties( java.util.Properties ) |
241 | ||
242 | /** | |
243 | * Set | |
244 | * | |
245 | * The lists of the remote repositories. | |
246 | * | |
247 | * | |
248 | * | |
249 | * @param repositories | |
250 | */ | |
251 | public void setRepositories( java.util.List repositories ) | |
252 | { | |
253 | 0 | this.repositories = repositories; |
254 | 0 | } //-- void setRepositories( java.util.List ) |
255 | ||
256 | ||
257 | 0 | private String modelEncoding = "UTF-8"; |
258 | ||
259 | /** | |
260 | * Set an encoding used for reading/writing the model. | |
261 | * | |
262 | * @param modelEncoding the encoding used when reading/writing the model. | |
263 | */ | |
264 | public void setModelEncoding( String modelEncoding ) | |
265 | { | |
266 | 0 | this.modelEncoding = modelEncoding; |
267 | 0 | } |
268 | ||
269 | /** | |
270 | * @return the current encoding used when reading/writing this model. | |
271 | */ | |
272 | public String getModelEncoding() | |
273 | { | |
274 | 0 | return modelEncoding; |
275 | } | |
276 | } |