com.ibm.are.xml.rules
Class Rule

java.lang.Object
  extended by com.ibm.are.xml.rules.Rule
Direct Known Subclasses:
AuthorityRule, ConfigurationRule, ExitCodeRule, FileAttributeRule, HostNameRule, PortRestrictionIBMiRule, PortUsageIBMiRule, ProductRule, PtfRule, SearchRule, SystemValueRule, UserProfileRule

public abstract class Rule
extends java.lang.Object

The Rule class represents a rule within the Application Runtime Expert environment. A rule is an entity that is capable of verifying a condition, and is the foundation for much of the verification that is done by the Application Runtime Expert. Typically a rule class is the class that understands how to actually perform a specific check. Because of this, rule classes are very helpful not just internally to the Application Runtime Expert, but also externally as an API to Application Runtime Expert plugins. Rule classes are typically standalone and do not require any additional setup or special logic to use them. This makes them ideal for re-use, especially because they implement potentially complex checks via a standard, easy to use key/value map interface.

Author:
IBM

Field Summary
static java.lang.String COPYRIGHT
          Copyright for class bytecode
static java.lang.String MAP_ITEM_CHECK_CLASS
          The data type (class) of the expected and actual values
static java.lang.String MAP_ITEM_CHECK_OBJECT
          The name of the reference that refers to a Check object
static java.lang.String MAP_ITEM_CHECK_TYPE
          The type of check to perform between the expected and actual values
static java.lang.String MAP_ITEM_ERROR_LEVEL
          Specifies the severity level a problem is reported at for this check.
static java.lang.String MAP_ITEM_EXPECTED_VALUE
          The expected value is the value that is used to compare against, or check, the actual value
static java.lang.String MAP_ITEM_MATCH_CASE
          Specifies whether or not character case is honored when performing string comparisons
 
Method Summary
 com.ibm.are.xml.rules.XmlNodeInfo getNodeInfo()
          Retrieves the XML node information associated with this rule.
 com.ibm.are.report.ProblemContext report(com.ibm.are.plugin.Plugin plugin, java.lang.String str)
          Reports the specified problem and returns a reference to the ProblemContext that represents the reported problem.
 com.ibm.are.report.ProblemContext report(com.ibm.are.plugin.Plugin plugin, java.lang.String str, com.ibm.are.autofix.FixAction fixAction)
          Reports the specified problem, registers the specified fix action for correcting the problem, and returns a reference to the ProblemContext that represents the reported problem.
abstract  boolean run(com.ibm.are.plugin.Plugin plugin)
          Runs the rule, which performs the check/verification implemented by that rule.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Copyright for class bytecode

See Also:
Constant Field Values

MAP_ITEM_CHECK_OBJECT

public static final java.lang.String MAP_ITEM_CHECK_OBJECT
The name of the reference that refers to a Check object

See Also:
Constant Field Values

MAP_ITEM_CHECK_CLASS

public static final java.lang.String MAP_ITEM_CHECK_CLASS
The data type (class) of the expected and actual values

See Also:
Constant Field Values

MAP_ITEM_CHECK_TYPE

public static final java.lang.String MAP_ITEM_CHECK_TYPE
The type of check to perform between the expected and actual values

See Also:
Constant Field Values

MAP_ITEM_MATCH_CASE

public static final java.lang.String MAP_ITEM_MATCH_CASE
Specifies whether or not character case is honored when performing string comparisons

See Also:
Constant Field Values

MAP_ITEM_EXPECTED_VALUE

public static final java.lang.String MAP_ITEM_EXPECTED_VALUE
The expected value is the value that is used to compare against, or check, the actual value

See Also:
Constant Field Values

MAP_ITEM_ERROR_LEVEL

public static final java.lang.String MAP_ITEM_ERROR_LEVEL
Specifies the severity level a problem is reported at for this check. If the comparison between the expected and actual values is not successful, which means the comparison result was false, a problem is reported. The severity of the reported problem is determined by the error level.

See Also:
Constant Field Values
Method Detail

report

public com.ibm.are.report.ProblemContext report(com.ibm.are.plugin.Plugin plugin,
                                                java.lang.String str)
Reports the specified problem and returns a reference to the ProblemContext that represents the reported problem.

Parameters:
plugin - The plugin that is reporting the problem
str - The problem text
Returns:
A reference to the ProblemContext that represents the reported problem.

report

public com.ibm.are.report.ProblemContext report(com.ibm.are.plugin.Plugin plugin,
                                                java.lang.String str,
                                                com.ibm.are.autofix.FixAction fixAction)
Reports the specified problem, registers the specified fix action for correcting the problem, and returns a reference to the ProblemContext that represents the reported problem.

Parameters:
plugin - The plugin that is reporting the problem
str - The problem text
fixAction - The description of an action that can be taken to fix the reported problem
Returns:
A reference to the ProblemContext that represents the reported problem.

getNodeInfo

public com.ibm.are.xml.rules.XmlNodeInfo getNodeInfo()
Retrieves the XML node information associated with this rule. Only applicable if the rule has been created by an XML driven plugin. If the rule was created via the Map API interface, this method returns a reference to a NullNodeInfo object.

Returns:
The XML node information associated with this rule, or a reference to a NullNodeInfo object if the rule was created via the Map API interface.

run

public abstract boolean run(com.ibm.are.plugin.Plugin plugin)
Runs the rule, which performs the check/verification implemented by that rule.

Parameters:
plugin - The plugin for which the rule is being run for.
Returns:
true if the verification was successful and no problems were found. false if the verification resulted in a problem being found and reported.