public class RequireOS extends AbstractStandardEnforcerRule
Modifier and Type | Field and Description |
---|---|
String |
arch
The OS architecture desired.
|
boolean |
display
Display detected OS information.
|
String |
family
The OS family type desired
Possible values: dos mac netware os/2 tandem unix windows win9x z/os os/400 |
String |
message
Specify an optional message to the user if the rule fails.
|
String |
name
The OS name desired.
|
String |
version
The OS version desired.
|
Constructor and Description |
---|
RequireOS()
Instantiates a new RequireOS.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allParamsEmpty()
Helper method to check that at least one of family, name, version or arch is set.
|
void |
displayOSInfo(org.apache.maven.plugin.logging.Log log,
boolean info)
Log the current OS information.
|
void |
execute(EnforcerRuleHelper helper)
This is the interface into the rule.
|
String |
getArch()
Gets the arch.
|
String |
getCacheId()
If the rule is to be cached, this id is used as part of the key.
|
String |
getFamily()
Gets the family.
|
String |
getName()
Gets the name.
|
String |
getVersion()
Gets the version.
|
boolean |
isAllowed()
Helper method to determine if the current OS is allowed based on the injected values for family, name, version
and arch.
|
boolean |
isCacheable()
This method tells the enforcer if the rule results may be cached.
|
boolean |
isResultValid(EnforcerRule theCachedRule)
Checks if cached result is valid.
|
boolean |
isValidFamily(String theFamily)
Helper method to check if the given family is in the following list:
dos
mac
netware
os/2
tandem
unix
windows
win9x
z/os
os/400
Note: '!' is allowed at the beginning of the string and still considered valid.
|
void |
setArch(String theArch)
Sets the arch.
|
void |
setFamily(String theFamily)
Sets the family.
|
void |
setName(String theName)
Sets the name.
|
void |
setVersion(String theVersion)
Sets the version.
|
public String family
public String name
public String version
public String arch
public String message
public boolean display
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
EnforcerRule
helper
- The helper provides access to the log, MavenSession and has
helpers to get common components. It is also able to lookup components
by class name.EnforcerRuleException
- the enforcer rule exceptionpublic void displayOSInfo(org.apache.maven.plugin.logging.Log log, boolean info)
log
- the loginfo
- the infopublic boolean isAllowed()
public boolean allParamsEmpty()
public boolean isValidFamily(String theFamily)
theFamily
- the family to check.public String getArch()
public void setArch(String theArch)
theArch
- the arch to setpublic String getFamily()
public void setFamily(String theFamily)
theFamily
- the family to setpublic String getName()
public void setName(String theName)
theName
- the name to setpublic String getVersion()
public void setVersion(String theVersion)
theVersion
- the version to setpublic String getCacheId()
EnforcerRule
public boolean isCacheable()
EnforcerRule
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule theCachedRule)
EnforcerRule
theCachedRule
- the last cached instance of the rule. This is to be used by the rule to
potentially determine if the results are still valid (ie if the configuration has been overridden)true
if the stored results are valid for the same id.Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.