Show Table of Contents
17.2. Javax.rules Interfaces
HandleThe Handle is used to retrieve an Object back from theWorkingMemorywhich was added in aStatefulRuleSession. With theHandleyou can modify or remove anObjectfrom theWorkingMemory. To modify an Object callupdateObject()from theStatefulRuleSession. To remove it, callremoveObject()with theHandleas the Parameter. Inside of the implementation of the Java Rule Engine API will be called themodifyObject()andretractObject()methods of the encapsulated Knowledge (Drools and jBPM) API.ObjectFilterThis interface is used to filter objects for RuleSession.RuleExecutionSetMetadataThe RuleExecutionSetMetadata is used to store name, description and URI for a RuleExecutionSet.RuleRuntimeThe 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.RuleSessionThe 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.StatefulRuleSessionIf 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.StatelessRuleSessionA 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.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.