public final class RulesEngine extends Object
Modifier and Type | Method and Description |
---|---|
void |
disableTestMode()
Deactivates the test mode for avoiding using special configuration
related to the OSGi environment.
|
void |
enableTestMode()
Activates the test mode for avoiding using special configuration related
to the OSGi environment.
|
static Collection<org.drools.FactHandle> |
getElementsInWorkingMemory() |
static RulesEngine |
getInstance()
Instance of the rules engine for using it in non-osgi environments.
|
static RulesEngine |
getInstance(org.osgi.framework.BundleContext context)
Gets an instance of the rules engine for using it in universAAL.
|
static long |
getNumberOfElementsInWorkingMemory() |
static UUID |
getUUID()
Returns an UUID of the rules engine.
|
void |
insertContextEvent(Object event)
Sends a context events to the rules engine and fire the rules to check if
any rule in the working memory fits with the new conditions.
|
void |
insertRule(String ruleIn)
Inserts a rule from a string.
|
void |
insertRuleList(List<RuleModel> rules)
Inserts a list of rules.
|
boolean |
isWellFormed()
Check if the rules engine was created correctly.
|
static void |
publishConsequence(String uri,
String[] keys,
String[] values)
Publishes a consequence in the ContextBus.
|
void |
removeRule(String name)
Removes a rule from the default package.
|
void |
removeRule(String name,
String pckg)
Removes a rule from a a specified package.
|
void |
restartRulesEngine() |
void |
setBundleContext(org.osgi.framework.BundleContext bc)
Setter for the bundle context.
|
void |
shutdown() |
static void |
startRulesEngine() |
static void |
stopRulesEngine() |
public static RulesEngine getInstance(org.osgi.framework.BundleContext context)
context
- The bundle context.public static RulesEngine getInstance()
public static UUID getUUID()
public void insertContextEvent(Object event)
event
- ContextEvent to be inserted.public boolean isWellFormed()
public void setBundleContext(org.osgi.framework.BundleContext bc)
bc
- The new bundle context.public void enableTestMode()
public void disableTestMode()
public static void publishConsequence(String uri, String[] keys, String[] values) throws Exception
uri
- URI for the new consequencekeys
- Array containing all the keys of the properties. Each key must
have a value associated. According to this, keys.lenght() and
values.lenght() must equivalent.values
- Array containing all the values of the properties.Exception
public static long getNumberOfElementsInWorkingMemory()
public static Collection<org.drools.FactHandle> getElementsInWorkingMemory()
public static void startRulesEngine()
public static void stopRulesEngine()
public void restartRulesEngine()
public void insertRule(String ruleIn)
ruleIn
- The rule codification.Exception
public void insertRuleList(List<RuleModel> rules)
rules
- ArrayListDroolsException
- drools exception.public void removeRule(String name, String pckg)
name
- Name of the rulepckg
- Package of the rulepublic void removeRule(String name)
name
- Name of the rulepublic void shutdown()
Copyright © 2018 universAAL Consortium. All rights reserved.