public class DroolsKnowledgeBaseFactory extends Object
KieSession
and/or
KieContainer
.
Several default values were defined to correspond to the default options used by this framework, e.g.
a KieSessionModel.KieSessionType.STATEFUL
session, a pseudo ClockTypeOption
and the event stream options are currently used for this purpose.
For extended documentation of the used classes and default values, please refer to the Drools documentation at
http://drools.jboss.org/documentationModifier and Type | Field and Description |
---|---|
static org.kie.api.runtime.conf.ClockTypeOption |
DEFAULT_CLOCK_TYPE
The default type of the rule engines session clock is a pseudo clock, see
https://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html/DroolsComplexEventProcessingChapter.html#d0e10068
|
static org.kie.api.conf.EqualityBehaviorOption |
DEFAULT_EQUALS_BEHAVIOUR |
static org.kie.api.conf.EventProcessingOption |
DEFAULT_EVENT_PROCESSING
The default processing mode is stream mode, since reasoning over time based events should be enabled
|
static org.kie.api.builder.model.KieSessionModel.KieSessionType |
DEFAULT_KNOWLEDGE_SESSION_TYPE
The default session is a stateful one
|
Constructor and Description |
---|
DroolsKnowledgeBaseFactory() |
Modifier and Type | Method and Description |
---|---|
static org.kie.api.runtime.KieSession |
createDefaultKieSession()
Creates the default
KieSession without changing any default values for the classpath
container. |
static org.kie.api.runtime.KieContainer |
createKieContainer(File knowledgeBaseDir)
Creates a
KieContainer for all the knowledge bases found in the provided
directory. |
static org.kie.api.runtime.KieSession |
createKieSession(org.kie.api.runtime.KieContainer kContainer,
String kBaseName,
String kSessionName)
Creates a new
KieSession without changing any default options, using the
provided container, knowledge base and session name. |
static org.kie.api.runtime.KieSession |
createKieSession(String kBaseName,
String kSessionName)
Creates a
KieSession for the classpath container without
changing any default options, using the knowledge base and session name exactly as they are provided. |
static org.kie.api.runtime.KieSession |
createKieSession(String baseModelName,
String sessionModelName,
File... ruleFiles)
Creates a KieSession using the provided base and session name, as well as a number of arbitrary Drools rule files.
|
public static final org.kie.api.builder.model.KieSessionModel.KieSessionType DEFAULT_KNOWLEDGE_SESSION_TYPE
public static final org.kie.api.runtime.conf.ClockTypeOption DEFAULT_CLOCK_TYPE
public static final org.kie.api.conf.EventProcessingOption DEFAULT_EVENT_PROCESSING
public static final org.kie.api.conf.EqualityBehaviorOption DEFAULT_EQUALS_BEHAVIOUR
public static org.kie.api.runtime.KieContainer createKieContainer(File knowledgeBaseDir)
KieContainer
for all the knowledge bases found in the provided
directory. If the provided argument is null, a default classpath container will be returned.
ENHANCEMENT: This method expects to find a knowledge base descriptor file, 'kmodule.xml' in the provided
directory's sub-directory 'META-INF' among a maven project reference file ('pom.properties' and 'pom.xml', for
Drools ReleaseId
).
This is inconvenient and a better way should exist to define it programmatically?
knowledgeBaseDir
- the directory containing the the Drools knowledge base. When null is passed, the default
classpath container will be returned.public static org.kie.api.runtime.KieSession createKieSession(String baseModelName, String sessionModelName, File... ruleFiles)
baseModelName
- the name of the knowledge basesessionModelName
- the name of the KieSession
ruleFiles
- a number of Drools rule filesKieSession
backed by the provided rule files using default optionspublic static org.kie.api.runtime.KieSession createDefaultKieSession()
KieSession
without changing any default values for the classpath
container.KieSession
using the classpath container (no settings are applied)public static org.kie.api.runtime.KieSession createKieSession(String kBaseName, String kSessionName)
KieSession
for the classpath container without
changing any default options, using the knowledge base and session name exactly as they are provided.kBaseName
- the knowledge base namekSessionName
- the session namepublic static org.kie.api.runtime.KieSession createKieSession(org.kie.api.runtime.KieContainer kContainer, String kBaseName, String kSessionName)
KieSession
without changing any default options, using the
provided container, knowledge base and session name.kContainer
- the container to usekBaseName
- the knowledge base namekSessionName
- the session nameCopyright © 2013–2015 Institute of networks and security. All rights reserved.