~ubuntu-branches/ubuntu/utopic/maven-enforcer/utopic

« back to all changes in this revision

Viewing changes to enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireOS.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-12 22:30:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110912223016-e2pk04avoq8bur7t
Tags: 1.0-1
* Team upload
* New upstream release.
* Add more Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.apache.maven.plugins.enforcer;
 
2
 
1
3
/*
2
4
 * Licensed to the Apache Software Foundation (ASF) under one
3
5
 * or more contributor license agreements.  See the NOTICE file
16
18
 * specific language governing permissions and limitations
17
19
 * under the License.
18
20
 */
19
 
package org.apache.maven.plugins.enforcer;
20
21
 
21
22
import java.util.Iterator;
22
23
 
31
32
import org.codehaus.plexus.util.Os;
32
33
import org.codehaus.plexus.util.StringUtils;
33
34
 
34
 
// TODO: Auto-generated Javadoc
35
35
/**
36
36
 * This rule checks that the OS is allowed by combinations of family, name, version and cpu architecture. The behavior
37
37
 * is exactly the same as the Maven Os profile activation so the same values are allowed here.
38
 
 * 
 
38
 *
39
39
 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
40
 
 * @version $Id: RequireOS.java 675992 2008-07-11 15:42:48Z hboutemy $
 
40
 * @version $Id: RequireOS.java 805190 2009-08-17 22:30:49Z hboutemy $
41
41
 */
42
42
public class RequireOS
43
43
    extends AbstractStandardEnforcerRule
86
86
 
87
87
    /*
88
88
     * (non-Javadoc)
89
 
     * 
 
89
     *
90
90
     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
91
91
     */
92
92
    public void execute( EnforcerRuleHelper helper )
131
131
 
132
132
    /**
133
133
     * Log the current OS information.
134
 
     * 
 
134
     *
135
135
     * @param log the log
136
136
     * @param info the info
137
137
     */
154
154
    /**
155
155
     * Helper method to determine if the current OS is allowed based on the injected values for family, name, version
156
156
     * and arch.
157
 
     * 
 
157
     *
158
158
     * @return true if the version is allowed.
159
159
     */
160
160
    public boolean isAllowed()
166
166
 
167
167
    /**
168
168
     * Helper method to check that at least one of family, name, version or arch is set.
169
 
     * 
 
169
     *
170
170
     * @return true if all parameters are empty.
171
171
     */
172
172
    public boolean allParamsEmpty()
177
177
 
178
178
    /**
179
179
     * Creates a Profile object that contains the activation information.
180
 
     * 
 
180
     *
181
181
     * @return a properly populated profile to be used for OS validation.
182
182
     */
183
183
    private Profile createProfile()
189
189
 
190
190
    /**
191
191
     * Creates an Activation object that contains the ActivationOS information.
192
 
     * 
 
192
     *
193
193
     * @return a properly populated Activation object.
194
194
     */
195
195
    private Activation createActivation()
202
202
 
203
203
    /**
204
204
     * Creates an ActivationOS object containing family, name, version and arch.
205
 
     * 
 
205
     *
206
206
     * @return a properly populated ActivationOS object.
207
207
     */
208
208
    private ActivationOS createOsBean()
232
232
     * <li>os/400</li>
233
233
     * </ul>
234
234
     * Note: '!' is allowed at the beginning of the string and still considered valid.
235
 
     * 
 
235
     *
236
236
     * @param theFamily the family to check.
237
237
     * @return true if one of the valid families.
238
238
     */
247
247
 
248
248
    /**
249
249
     * Gets the arch.
250
 
     * 
 
250
     *
251
251
     * @return the arch
252
252
     */
253
253
    public String getArch()
257
257
 
258
258
    /**
259
259
     * Sets the arch.
260
 
     * 
 
260
     *
261
261
     * @param theArch the arch to set
262
262
     */
263
263
    public void setArch( String theArch )
267
267
 
268
268
    /**
269
269
     * Gets the family.
270
 
     * 
 
270
     *
271
271
     * @return the family
272
272
     */
273
273
    public String getFamily()
277
277
 
278
278
    /**
279
279
     * Sets the family.
280
 
     * 
 
280
     *
281
281
     * @param theFamily the family to set
282
282
     */
283
283
    public void setFamily( String theFamily )
287
287
 
288
288
    /**
289
289
     * Gets the name.
290
 
     * 
 
290
     *
291
291
     * @return the name
292
292
     */
293
293
    public String getName()
297
297
 
298
298
    /**
299
299
     * Sets the name.
300
 
     * 
 
300
     *
301
301
     * @param theName the name to set
302
302
     */
303
303
    public void setName( String theName )
307
307
 
308
308
    /**
309
309
     * Gets the version.
310
 
     * 
 
310
     *
311
311
     * @return the version
312
312
     */
313
313
    public String getVersion()
317
317
 
318
318
    /**
319
319
     * Sets the version.
320
 
     * 
 
320
     *
321
321
     * @param theVersion the version to set
322
322
     */
323
323
    public void setVersion( String theVersion )
327
327
 
328
328
    /*
329
329
     * (non-Javadoc)
330
 
     * 
 
330
     *
331
331
     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
332
332
     */
333
333
    public String getCacheId()
355
355
 
356
356
    /*
357
357
     * (non-Javadoc)
358
 
     * 
 
358
     *
359
359
     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
360
360
     */
361
361
    public boolean isCacheable()
366
366
 
367
367
    /*
368
368
     * (non-Javadoc)
369
 
     * 
 
369
     *
370
370
     * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
371
371
     */
372
372
    public boolean isResultValid( EnforcerRule theCachedRule )