org.drools.jsr94.rules
Class RuleRuntimeImpl

java.lang.Object
  extended byorg.drools.jsr94.rules.RuleRuntimeImpl
All Implemented Interfaces:
RuleRuntime, Serializable

public class RuleRuntimeImpl
extends Object
implements RuleRuntime

The Drools implementation of the RuleRuntime interface which is the access point for runtime execution of RuleExecutionSets. It provides methods to create RuleSession implementation as well as methods to retrieve RuleExecutionSets that have been previously registered using the RuleAdministrator.

The RuleRuntime should be accessed through the RuleServiceProvider. An instance of the RuleRuntime can be retrieved by calling:

RuleServiceProvider ruleServiceProvider = RuleServiceProvider.newInstance();
RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime();

Note: the release method must be called on the RuleSession to clean up all resources used by the RuleSession.

Author:
N. Alex Rupp (n_alex codehaus.org)
See Also:
RuleRuntime, Serialized Form

Field Summary
 
Fields inherited from interface javax.rules.RuleRuntime
STATEFUL_SESSION_TYPE, STATELESS_SESSION_TYPE
 
Constructor Summary
RuleRuntimeImpl()
          Create a new RuleRuntimeImpl.
 
Method Summary
 RuleSession createRuleSession(String uri, Map properties, int ruleSessionType)
          Creates a RuleSession implementation using the supplied Drools-specific rule execution set registration URI.
 List getRegistrations()
          Retrieves a List of the URIs that currently have RuleExecutionSets associated with them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleRuntimeImpl

public RuleRuntimeImpl()
Create a new RuleRuntimeImpl.

Method Detail

createRuleSession

public RuleSession createRuleSession(String uri,
                                     Map properties,
                                     int ruleSessionType)
                              throws RuleSessionTypeUnsupportedException,
                                     RuleExecutionSetNotFoundException
Creates a RuleSession implementation using the supplied Drools-specific rule execution set registration URI.

Specified by:
createRuleSession in interface RuleRuntime
Parameters:
uri - the URI for the RuleExecutionSet
properties - additional properties used to create the RuleSession implementation.
ruleSessionType - the type of rule session to create.
Returns:
The created RuleSession.
Throws:
RuleSessionTypeUnsupportedException - if the ruleSessionType is not supported by Drools or the RuleExecutionSet
RuleExecutionSetNotFoundException - if the URI could not be resolved into a RuleExecutionSet

getRegistrations

public List getRegistrations()
Retrieves a List of the URIs that currently have RuleExecutionSets associated with them. An empty list is returned is there are no associations.

Specified by:
getRegistrations in interface RuleRuntime
Returns:
a List of Strings (URIs)


Copyright © 2001-2004 The Codehaus. All Rights Reserved.