|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectes.rediris.aarr.rules.RuleProcessor
public class RuleProcessor
This class is used for processing all rules in a ruleset, by checking that all conditions
are satisfied and then, performing the actions in every rule.
| Field Summary | |
|---|---|
(package private) static java.lang.Object |
lastInput
The last received request |
(package private) static ProfileManager |
profileManager
A ProfileManager |
(package private) static java.lang.String |
requestName
|
(package private) static int |
requestStatus
|
(package private) static java.lang.String[] |
requestValues
|
static int |
RP_ENDED
|
static int |
RP_RECEIVED
|
static int |
RP_STARTING
Request status values |
static int |
RP_WAIT_TIMEOUT
|
static int |
RP_WAITING
|
protected Ruleset |
ruleSet
An internal Ruleset object for storing rules |
(package private) RuleProcessor |
self
|
(package private) java.lang.Thread |
thread
A thread |
private long |
timeout
A boolean token to control if the thread is suspended while waiting for a request |
| Constructor Summary | |
|---|---|
RuleProcessor(org.w3c.dom.Element ruleset)
The main constructor receives a Ruleset object previously loaded |
|
| Method Summary | |
|---|---|
protected static void |
dropQuery()
Removes last query from the input queue |
protected static void |
endExecution()
Sets the end execution token to true |
protected static java.lang.String |
getInputQuery()
Returns a String with the name of the last input element
(the first in the input query) |
protected static java.lang.String[] |
getParam(java.lang.String name)
Gets the value of a param (defined by data) for the protocol adaptor in use |
void |
init(ProfileManager pm)
Init the ruler processor by creating a ProfileManager, input and
output queues, and starting a new Thread |
protected static boolean |
isFinished()
Checks if the rule processor has finished its execution. |
private void |
parseRuleset(org.w3c.dom.Element ruleset)
Parses a document (or XML Element) that defines a rule set, loading all the states, rules, conditions and actions inside it |
protected static void |
putOutput(java.lang.String[] ids,
java.lang.String[] values)
Send a response back to the ProtocolAdaptor |
void |
run()
Executes actual states and sends information about the current status to the diagnostics module |
private Action |
searchAction(org.w3c.dom.Element actionElem)
Similar to searchCondition() but for Actions. |
private Condition |
searchCondition(org.w3c.dom.Element condElem)
Match the kind of condition being processed at the moment and returns a condition defined in element ( org.w3c.dom.Element Object)
of the document. |
void |
setTimeout(long millisecs)
Sets the timemout for the rule processor |
void |
update(java.util.Observable obs,
java.lang.Object data)
Adds a new query to the input queue |
void |
waitInput(long millisecs)
Wait for a request the amount of time provided as a param |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static java.lang.Object lastInput
static java.lang.String requestName
static java.lang.String[] requestValues
static int requestStatus
public static final int RP_STARTING
public static final int RP_WAITING
public static final int RP_RECEIVED
public static final int RP_WAIT_TIMEOUT
public static final int RP_ENDED
static ProfileManager profileManager
ProfileManager
private long timeout
java.lang.Thread thread
RuleProcessor self
protected Ruleset ruleSet
Ruleset object for storing rules
| Constructor Detail |
|---|
public RuleProcessor(org.w3c.dom.Element ruleset)
Ruleset object previously loaded
ruleset - A Ruleset already loaded| Method Detail |
|---|
public void init(ProfileManager pm)
ProfileManager, input and
output queues, and starting a new Thread
pm - A ProfileManager Objectprivate void parseRuleset(org.w3c.dom.Element ruleset)
ruleset - An (XML) ruleset element previously loadedprivate Condition searchCondition(org.w3c.dom.Element condElem)
org.w3c.dom.Element Object)
of the document.
condElem - An element (org.w3c.dom.Element) defining a condition
Condition object: one of ConditionDefault,
ConditionField, or ConditionReceive.
public void update(java.util.Observable obs,
java.lang.Object data)
update in interface java.util.Observerobs - An ObservableVector with queriesdata - @deprecated Not usedprotected static void dropQuery()
protected static void putOutput(java.lang.String[] ids,
java.lang.String[] values)
ProtocolAdaptor
ids - An array of idsvalues - The corresponding array of values for the idsprivate Action searchAction(org.w3c.dom.Element actionElem)
searchCondition() but for Actions.
Matches the kind of action being processed at the moment returning the action defined
in an element (org.w3c.dom.Element Object) of the ruleset being processed.
actionElem - An element (org.w3c.dom.Element) defining an action
Action object: one of ActionSend, ActionNext,
or ActionFinish protected static java.lang.String getInputQuery()
String with the name of the last input element
(the first in the input query)
protected static java.lang.String[] getParam(java.lang.String name)
name - The param to ask for
protected static void endExecution()
protected static boolean isFinished()
public void setTimeout(long millisecs)
millisecs - Time in millisecondspublic void run()
diagnostics module
run in interface java.lang.Runnablepublic void waitInput(long millisecs)
millisecs - Time in milliseconds to wait until a request is received or a timeout condition is reached
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||