17.2. Javax.rules Interfaces

  • Handle
    The Handle is used to retrieve an Object back from the WorkingMemory which was added in a StatefulRuleSession . With the Handle you can modify or remove an Object from the WorkingMemory. To modify an Object call updateObject() from the StatefulRuleSession. To remove it, call removeObject() with the Handle as the Parameter. Inside of the implementation of the Java Rule Engine API will be called the modifyObject() and retractObject() methods of the encapsulated Knowledge (Drools and jBPM) API.
  • ObjectFilter
    This interface is used to filter objects for RuleSession.
  • RuleExecutionSetMetadata
    The RuleExecutionSetMetadata is used to store name, description and URI for a RuleExecutionSet.
  • RuleRuntime
    The RuleRuntime is the key to a RuleSession. The RuleRuntime obtained from the RuleServiceProvider.
    If you retrieve a RuleRuntime call createRuleSession() to open a RuleSession.
    Through the RuleRuntime you can retrieve a list of URIs of all RuleExecutionSets, which were registered by a RuleAdministrator. You need the URI as a String to open a RuleSession to the rule engine. The rule engine will use the rules of the RuleExecutionSet inside of the RuleSession.
    The Map is used for Globals. Globals were formerly called ApplicationData (in Drools 2.x). The key needs to be the identifier of the Global and the Value the object you want to use as a Global.
  • RuleSession
    The RuleSession is the object you are working with if you want to contact the rule engine.
    If you are getting a RuleSession from the RuleRuntime, then it will be either a StatefulRuleSession or a StatelessRuleSession.
    Call the release()-method so that all resources will be freed.
  • StatefulRuleSession
    If you need to run the rule engine more than once, run a StatefulRuleSession. You can assert objects, execute rules and so on.
    You will get a Handle for every object which you are asserting to the Rule Session. Do not lose it, you will need it, to retract or modify objects in the Working Memory. You are having no direct contact to Drools´ Working Memory which is used inside the implementation, for this you got the RuleSession.
  • StatelessRuleSession
    A StatelessRuleSession means that you are having only one contact to the rule engine. You are giving a list of objects to the rule engine and the rule engine asserts them all and starts execution immediately. The result is a list of objects. The content of the result list depends on your rules. If your rules are not modifying or retracting any objects from the Working Memory, you should get all objects you re-added.
    You can use the ObjectFilter which will filter the resulting list of objects before you get it.