Novell exteNd
Director 5.2 API

com.sssw.re.api
Interface EbiRuleManager


public interface EbiRuleManager

A rule manager gives you access to rules belonging to a particular rule owner. You can find out the rules associated with an owner and you can fire rules.

An owner is an identifier for a group of rules. You can create a group of rules for a specific application by giving them an owner. You can access rules associated with other owners by specifying the owner ID with the rule name, in the form ownerID.rulename.

To instantiate a rule manager, call createRuleManager(), a static method of com.sssw.re.EboFactory. For a rule with no owner:

  EbiRuleManager rm = EboFactory.createRuleManager();
  

For a rule with an owner:

  String owner = "app1rules.rule1";
  EbiRuleManager rm = EboFactory.createRuleManager(owner);
  


Method Summary
 void echo(EbiContext context)
          For rules that return a status of true or false, sets the response phrase in the context object to match the response status.
 EbiContext fireRule(String ruleID, EbiContext context)
          Executes a rule.
 EbiContext fireTemporaryRule(String ruleXML, EbiContext context)
          Executes a rule that you supply in XML format.
 String[] getActionMacroIDs()
          Gets the names of the action macros.
 String[] getConditionMacroIDs()
          Gets the names of the condition macros.
 boolean getLog()
          Checks whether logging for the Rules subsystem is on or off.
 String[] getRuleIDs()
          Gets the names of the rules associated with the rule manager's current owner.
 boolean isFalse(String ruleID, EbiContext context)
          Fires the specified rule and reports whether the rule returned a false value.
 boolean isTrue(String ruleID, EbiContext context)
          Fires the specified rule and reports whether the rule returned a true value.
 boolean ruleExists(String ruleID)
          Returns true if a rule exists with the specified rule name for the rule manager's current owner.
 void setLog(boolean log)
          Turns on runtime logging for the Rules subsystem .
 void setOwnerID(String ownerID)
          Changes the owner associated with the rule manager.
 

Method Detail

setOwnerID

public void setOwnerID(String ownerID)
Changes the owner associated with the rule manager. You can access that owner's rules without specifying a qualifier for the rule name.
Parameters:
ownerID - A String specifying a valid owner ID. To specify the default owner, specify a null value.

getLog

public boolean getLog()
Checks whether logging for the Rules subsystem is on or off.
Returns:
true if logging is on; false if not
See Also:
EbiRuleManager.setLog(boolean log)

setLog

public void setLog(boolean log)
Turns on runtime logging for the Rules subsystem . Status messages are displayed on the server console.
Parameters:
log - True to set logging on; false to set logging off.
See Also:
EbiRuleManager.getLog()

getRuleIDs

public String[] getRuleIDs()
Gets the names of the rules associated with the rule manager's current owner.
Returns:
an array of rule names

getActionMacroIDs

public String[] getActionMacroIDs()
Gets the names of the action macros.
Returns:
an array of actionMacro names

getConditionMacroIDs

public String[] getConditionMacroIDs()
Gets the names of the condition macros.
Returns:
an array of conditionMacro names

ruleExists

public boolean ruleExists(String ruleID)
Returns true if a rule exists with the specified rule name for the rule manager's current owner.
Parameters:
ruleID - the name of a rule. To specify a rule belonging to the rule manager's current owner. For a rule with a different owner, specify ownerID.ruleID.
Returns:
true if the rule exists; false if not

echo

public void echo(EbiContext context)
For rules that return a status of true or false, sets the response phrase in the context object to match the response status. The value of the response phrase is:

Parameters:
context - the context object whose response phrase will be set

isTrue

public boolean isTrue(String ruleID,
                      EbiContext context)
Fires the specified rule and reports whether the rule returned a true value. The rule must have actions that return true or false. In addition to the returned value, the response status and response phrase of the context object are set to correspond to the rule's result.
Rule
result
Response
status (int)
Response
phrase (String)
isTrue
return value
isFalse
return value
true200Status: 200truefalse
false412Status: 412falsetrue

Parameters:
ruleID - the name of a rule. To specify a rule belonging to the rule manager's current owner. For a rule with a different owner, specify ownerID.ruleID.
context - a context object
Returns:
true if the request was successful (EbiResponse.R200) and the rule returned true; returns false if the rule returned false (EbiResponse.R412).

isFalse

public boolean isFalse(String ruleID,
                       EbiContext context)
Fires the specified rule and reports whether the rule returned a false value. The rule must have actions that return true or false. In addition to the returned value, the response status and response phrase of the context object are set to correspond to the rule's result. For information about return values and response settings, see EbiRuleManager.isTrue(String ruleID, com.sssw.re.api.EbiContext context).
Parameters:
ruleID - the name of a rule. To specify a rule belonging to the rule manager's current owner. For a rule with a different owner, specify ownerID.ruleID.
context - a context object
Returns:
false if the request was successful (EbiResponse.R200) and the rule returned true; returns true if the rule returned false (EbiResponse.R412).

fireRule

public EbiContext fireRule(String ruleID,
                           EbiContext context)
Executes a rule. The rules engine evaluates the rule's conditions and performs the specified action.

When firing a rule you need to handle the result of the rule's action. For implementation options see Handling the results of a rule in Director online help.

Parameters:
ruleID - the name of a rule in the portal repository. If the rule was installed with an owner, specify the owner before the rule name like this: owner.rulename.
context - Rule context object.
Returns:
the EbiContext object passed to the method. Since you already have a reference to the context object when you call the method, you can ignore the return value.
See Also:
EbiContext.fireRule(String), EbiRequestContext.getResponsePhrase(), EbiRequestContext.getResponseStatus()

fireTemporaryRule

public EbiContext fireTemporaryRule(String ruleXML,
                                    EbiContext context)
Executes a rule that you supply in XML format.

For more information, see Firing temporary rules in Director online help.

Parameters:
ruleXML - a String whose value is an XML rule definition
context - a context object
Returns:
the EbiContext object passed to the method. Since you already have a reference to the context object when you call the method, you can ignore the return value.
See Also:
EbiContext.fireTemporaryRule(String), EbiRequestContext.getResponsePhrase(), EbiRequestContext.getResponseStatus()

Novell exteNd
Director 5.2 API