public class RequireOS extends AbstractStandardEnforcerRule
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 |
isDisplay() |
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 |
setDisplay(boolean display) |
void |
setFamily(String theFamily)
Sets the family.
|
void |
setName(String theName)
Sets the name.
|
void |
setVersion(String theVersion)
Sets the version.
|
getLevel, getMessage, setLevel, setMessage
public RequireOS()
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException
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 void setFamily(String theFamily)
theFamily
- the family to setpublic String getVersion()
public void setVersion(String theVersion)
theVersion
- the version to setpublic final void setDisplay(boolean display)
display
- The value for the display.public final boolean isDisplay()
public String getCacheId()
public boolean isCacheable()
true
if rule is cacheablepublic boolean isResultValid(EnforcerRule theCachedRule)
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–2015 The Apache Software Foundation. All rights reserved.