public class KnowledgeBaseImpl extends Object implements InternalKnowledgeBase, Externalizable
| Modifier and Type | Field and Description |
|---|---|
Set<EntryPointNode> |
addedEntryNodeCache |
List<List<String>> |
jaxbClasses |
Set<org.kie.api.event.kiebase.KieBaseEventListener> |
kieBaseListeners |
protected static org.slf4j.Logger |
logger |
protected Map<String,InternalKnowledgePackage> |
pkgs |
Set<EntryPointNode> |
removedEntryNodeCache |
| Constructor and Description |
|---|
KnowledgeBaseImpl() |
KnowledgeBaseImpl(String id,
RuleBaseConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEntryPoint(Package pkg,
String id) |
protected void |
addEntryPoint(String id) |
void |
addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener) |
void |
addGlobal(String identifier,
Class clazz) |
void |
addKnowledgePackages(Collection<org.kie.internal.definition.KnowledgePackage> knowledgePackages) |
void |
addPackage(InternalKnowledgePackage newPkg) |
void |
addPackages(Collection<InternalKnowledgePackage> newPkgs)
Add a
Package to the network. |
void |
addPackages(InternalKnowledgePackage[] pkgs) |
void |
addProcess(org.kie.api.definition.process.Process process) |
void |
addRule(InternalKnowledgePackage pkg,
RuleImpl rule) |
protected void |
addRule(RuleImpl rule) |
void |
addStatefulSession(StatefulKnowledgeSessionImpl wm) |
void |
addWindowDeclaration(InternalKnowledgePackage pkg,
WindowDeclaration window) |
protected void |
addWindowDeclaration(WindowDeclaration window) |
void |
assertObject(org.kie.api.runtime.rule.FactHandle handle,
Object object,
PropagationContext context,
InternalWorkingMemory workingMemory)
Assert a fact object.
|
RuleBasePartitionId |
createNewPartitionId() |
SegmentMemory |
createSegmentFromPrototype(InternalWorkingMemory wm,
LeftTupleSource tupleSource) |
void |
disposeStatefulSession(StatefulKnowledgeSessionImpl statefulSession) |
void |
executeQueuedActions() |
boolean |
flushModifications() |
Set<EntryPointNode> |
getAddedEntryNodeCache() |
StatefulKnowledgeSessionImpl |
getCachedSession(SessionConfiguration config,
org.kie.api.runtime.Environment environment) |
ClassFieldAccessorCache |
getClassFieldAccessorCache() |
RuleBaseConfiguration |
getConfig() |
RuleBaseConfiguration |
getConfiguration() |
Set<String> |
getEntryPointIds() |
FactHandleFactory |
getFactHandleFactory() |
org.kie.api.definition.type.FactType |
getFactType(String name) |
org.kie.api.definition.type.FactType |
getFactType(String packageName,
String typeName) |
Map<String,Class<?>> |
getGlobals() |
String |
getId() |
Collection<org.kie.api.event.kiebase.KieBaseEventListener> |
getKieBaseEventListeners() |
org.kie.api.definition.KiePackage |
getKiePackage(String packageName) |
Collection<org.kie.api.definition.KiePackage> |
getKiePackages() |
Collection<? extends org.kie.api.runtime.KieSession> |
getKieSessions() |
org.kie.internal.definition.KnowledgePackage |
getKnowledgePackage(String packageName) |
Collection<org.kie.internal.definition.KnowledgePackage> |
getKnowledgePackages() |
int |
getNodeCount() |
InternalKnowledgePackage |
getPackage(String name) |
InternalKnowledgePackage[] |
getPackages() |
Map<String,InternalKnowledgePackage> |
getPackagesMap() |
List<RuleBasePartitionId> |
getPartitionIds() |
org.kie.api.definition.process.Process |
getProcess(String id) |
Collection<org.kie.api.definition.process.Process> |
getProcesses() |
org.kie.api.definition.rule.Query |
getQuery(String packageName,
String queryName) |
Set<EntryPointNode> |
getRemovedEntryNodeCache() |
Rete |
getRete()
Retrieve the Rete-OO network for this
RuleBase. |
ReteooBuilder |
getReteooBuilder() |
ClassLoader |
getRootClassLoader() |
org.kie.api.definition.rule.Rule |
getRule(String packageName,
String ruleName) |
SegmentMemory.Prototype |
getSegmentPrototype(SegmentMemory segment) |
Collection<org.kie.internal.runtime.StatefulKnowledgeSession> |
getStatefulKnowledgeSessions() |
StatefulKnowledgeSessionImpl[] |
getStatefulSessions() |
TraitRegistry |
getTraitRegistry() |
TripleStore |
getTripleStore() |
TypeDeclaration |
getTypeDeclaration(Class<?> clazz) |
Collection<TypeDeclaration> |
getTypeDeclarations() |
InternalWorkingMemory[] |
getWorkingMemories() |
int |
getWorkingMemoryCounter() |
void |
invalidateSegmentPrototype(LeftTupleSource tupleSource,
boolean ruleRemoved) |
boolean |
isEvent(Class<?> clazz) |
void |
lock() |
FactHandleFactory |
newFactHandleFactory() |
FactHandleFactory |
newFactHandleFactory(int id,
long counter) |
org.kie.api.runtime.KieSession |
newKieSession() |
org.kie.api.runtime.KieSession |
newKieSession(org.kie.api.runtime.KieSessionConfiguration conf,
org.kie.api.runtime.Environment environment) |
org.kie.internal.runtime.StatefulKnowledgeSession |
newStatefulKnowledgeSession() |
org.kie.internal.runtime.StatefulKnowledgeSession |
newStatefulKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf,
org.kie.api.runtime.Environment environment) |
StatefulKnowledgeSessionImpl |
newStatefulSession() |
StatefulKnowledgeSessionImpl |
newStatefulSession(boolean keepReference) |
StatefulKnowledgeSessionImpl |
newStatefulSession(InputStream stream) |
StatefulKnowledgeSessionImpl |
newStatefulSession(InputStream stream,
boolean keepReference) |
StatefulKnowledgeSessionImpl |
newStatefulSession(InputStream stream,
boolean keepReference,
SessionConfiguration conf) |
StatefulKnowledgeSessionImpl |
newStatefulSession(SessionConfiguration sessionConfig,
org.kie.api.runtime.Environment environment) |
org.kie.api.runtime.StatelessKieSession |
newStatelessKieSession() |
org.kie.api.runtime.StatelessKieSession |
newStatelessKieSession(org.kie.api.runtime.KieSessionConfiguration conf) |
org.kie.internal.runtime.StatelessKnowledgeSession |
newStatelessKnowledgeSession() |
org.kie.internal.runtime.StatelessKnowledgeSession |
newStatelessKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf) |
int |
nextWorkingMemoryCounter() |
protected void |
processTypeDeclaration(TypeDeclaration newDecl,
InternalKnowledgePackage newPkg) |
void |
readExternal(ObjectInput in)
Handles the read serialization of the Package.
|
void |
readLock() |
void |
readUnlock() |
void |
registerAddedEntryNodeCache(EntryPointNode node) |
Class<?> |
registerAndLoadTypeDefinition(String className,
byte[] def) |
void |
registeRremovedEntryNodeCache(EntryPointNode node) |
void |
registerSegmentPrototype(LeftTupleSource tupleSource,
SegmentMemory smem) |
void |
removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener) |
protected void |
removeFunction(String functionName)
Handle function removal.
|
void |
removeFunction(String packageName,
String functionName) |
void |
removeGlobal(String identifier) |
void |
removeKiePackage(String packageName) |
void |
removeKnowledgePackage(String packageName) |
boolean |
removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
removeProcess(String id) |
void |
removeQuery(String packageName,
String ruleName) |
void |
removeRule(InternalKnowledgePackage pkg,
RuleImpl rule)
Notify listeners and sub-classes about imminent removal of a rule from a package.
|
protected void |
removeRule(RuleImpl rule) |
void |
removeRule(String packageName,
String ruleName) |
void |
retractObject(org.kie.api.runtime.rule.FactHandle handle,
PropagationContext context,
StatefulKnowledgeSessionImpl workingMemory)
Retract a fact object.
|
protected void |
setupRete() |
void |
unlock() |
protected void |
updateDependentTypes(InternalKnowledgePackage newPkg,
TypeDeclaration typeDeclaration) |
void |
writeExternal(ObjectOutput out)
Handles the write serialization of the Package.
|
protected static final transient org.slf4j.Logger logger
public Set<EntryPointNode> addedEntryNodeCache
public Set<EntryPointNode> removedEntryNodeCache
protected Map<String,InternalKnowledgePackage> pkgs
public final Set<org.kie.api.event.kiebase.KieBaseEventListener> kieBaseListeners
public KnowledgeBaseImpl()
public KnowledgeBaseImpl(String id, RuleBaseConfiguration config)
public int nextWorkingMemoryCounter()
nextWorkingMemoryCounter in interface InternalKnowledgeBasepublic int getWorkingMemoryCounter()
getWorkingMemoryCounter in interface InternalKnowledgeBasepublic void addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
addEventListener in interface org.kie.api.event.kiebase.KieBaseEventManagerpublic void removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
removeEventListener in interface org.kie.api.event.kiebase.KieBaseEventManagerpublic Collection<org.kie.api.event.kiebase.KieBaseEventListener> getKieBaseEventListeners()
getKieBaseEventListeners in interface org.kie.api.event.kiebase.KieBaseEventManagerpublic void addKnowledgePackages(Collection<org.kie.internal.definition.KnowledgePackage> knowledgePackages)
addKnowledgePackages in interface org.kie.internal.KnowledgeBasepublic Collection<org.kie.internal.definition.KnowledgePackage> getKnowledgePackages()
getKnowledgePackages in interface org.kie.internal.KnowledgeBasepublic org.kie.internal.runtime.StatefulKnowledgeSession newStatefulKnowledgeSession()
newStatefulKnowledgeSession in interface org.kie.internal.KnowledgeBasepublic org.kie.internal.runtime.StatefulKnowledgeSession newStatefulKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf,
org.kie.api.runtime.Environment environment)
newStatefulKnowledgeSession in interface org.kie.internal.KnowledgeBasepublic Collection<org.kie.internal.runtime.StatefulKnowledgeSession> getStatefulKnowledgeSessions()
getStatefulKnowledgeSessions in interface org.kie.internal.KnowledgeBasepublic org.kie.internal.runtime.StatelessKnowledgeSession newStatelessKnowledgeSession()
newStatelessKnowledgeSession in interface org.kie.internal.KnowledgeBasepublic org.kie.internal.runtime.StatelessKnowledgeSession newStatelessKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf)
newStatelessKnowledgeSession in interface org.kie.internal.KnowledgeBasepublic void removeKnowledgePackage(String packageName)
removeKnowledgePackage in interface org.kie.internal.KnowledgeBasepublic org.kie.internal.definition.KnowledgePackage getKnowledgePackage(String packageName)
getKnowledgePackage in interface org.kie.internal.KnowledgeBasepublic org.kie.api.definition.rule.Rule getRule(String packageName, String ruleName)
getRule in interface org.kie.api.KieBasegetRule in interface org.kie.internal.KnowledgeBasepublic org.kie.api.definition.rule.Query getQuery(String packageName, String queryName)
getQuery in interface org.kie.api.KieBasegetQuery in interface org.kie.internal.KnowledgeBasepublic org.kie.api.runtime.KieSession newKieSession(org.kie.api.runtime.KieSessionConfiguration conf,
org.kie.api.runtime.Environment environment)
newKieSession in interface org.kie.api.KieBasepublic org.kie.api.runtime.KieSession newKieSession()
newKieSession in interface org.kie.api.KieBasepublic Collection<? extends org.kie.api.runtime.KieSession> getKieSessions()
getKieSessions in interface org.kie.api.KieBasepublic org.kie.api.runtime.StatelessKieSession newStatelessKieSession(org.kie.api.runtime.KieSessionConfiguration conf)
newStatelessKieSession in interface org.kie.api.KieBasepublic org.kie.api.runtime.StatelessKieSession newStatelessKieSession()
newStatelessKieSession in interface org.kie.api.KieBasepublic Collection<org.kie.api.definition.KiePackage> getKiePackages()
getKiePackages in interface org.kie.api.KieBasepublic org.kie.api.definition.KiePackage getKiePackage(String packageName)
getKiePackage in interface org.kie.api.KieBasepublic void removeKiePackage(String packageName)
removeKiePackage in interface org.kie.api.KieBasepublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic String getId()
getId in interface InternalKnowledgeBasepublic RuleBaseConfiguration getConfig()
public StatefulKnowledgeSessionImpl newStatefulSession()
public void disposeStatefulSession(StatefulKnowledgeSessionImpl statefulSession)
disposeStatefulSession in interface InternalKnowledgeBasepublic StatefulKnowledgeSessionImpl getCachedSession(SessionConfiguration config, org.kie.api.runtime.Environment environment)
getCachedSession in interface InternalKnowledgeBasepublic FactHandleFactory getFactHandleFactory()
public FactHandleFactory newFactHandleFactory()
newFactHandleFactory in interface InternalKnowledgeBasepublic FactHandleFactory newFactHandleFactory(int id, long counter)
newFactHandleFactory in interface InternalKnowledgeBasepublic Collection<org.kie.api.definition.process.Process> getProcesses()
getProcesses in interface org.kie.api.KieBasegetProcesses in interface org.kie.internal.KnowledgeBasepublic InternalKnowledgePackage[] getPackages()
public Map<String,InternalKnowledgePackage> getPackagesMap()
getPackagesMap in interface InternalKnowledgeBasepublic Map<String,Class<?>> getGlobals()
getGlobals in interface InternalKnowledgeBasepublic void lock()
lock in interface InternalKnowledgeBasepublic void unlock()
unlock in interface InternalKnowledgeBasepublic void readLock()
readLock in interface InternalKnowledgeBasepublic void readUnlock()
readUnlock in interface InternalKnowledgeBasepublic void addPackages(Collection<InternalKnowledgePackage> newPkgs)
Package to the network. Iterates through the
Package adding Each individual Rule to the
network. Before update network each referenced WorkingMemory
is locked.addPackages in interface InternalKnowledgeBasenewPkgs - The package to add.public boolean flushModifications()
flushModifications in interface InternalKnowledgeBaseprotected void processTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg) throws ClassNotFoundException
ClassNotFoundExceptionpublic Class<?> registerAndLoadTypeDefinition(String className, byte[] def) throws ClassNotFoundException
registerAndLoadTypeDefinition in interface InternalKnowledgeBaseClassNotFoundExceptionprotected void updateDependentTypes(InternalKnowledgePackage newPkg, TypeDeclaration typeDeclaration)
public void addGlobal(String identifier, Class clazz)
addGlobal in interface InternalKnowledgeBasepublic void removeGlobal(String identifier)
removeGlobal in interface InternalKnowledgeBaseprotected void setupRete()
public void registerAddedEntryNodeCache(EntryPointNode node)
registerAddedEntryNodeCache in interface InternalKnowledgeBasepublic Set<EntryPointNode> getAddedEntryNodeCache()
getAddedEntryNodeCache in interface InternalKnowledgeBasepublic void registeRremovedEntryNodeCache(EntryPointNode node)
registeRremovedEntryNodeCache in interface InternalKnowledgeBasepublic Set<EntryPointNode> getRemovedEntryNodeCache()
getRemovedEntryNodeCache in interface InternalKnowledgeBasepublic Rete getRete()
RuleBase.getRete in interface InternalKnowledgeBasepublic ReteooBuilder getReteooBuilder()
getReteooBuilder in interface InternalKnowledgeBasepublic void assertObject(org.kie.api.runtime.rule.FactHandle handle,
Object object,
PropagationContext context,
InternalWorkingMemory workingMemory)
assertObject in interface InternalKnowledgeBasehandle - The handle.object - The fact.workingMemory - The working-memory.public void retractObject(org.kie.api.runtime.rule.FactHandle handle,
PropagationContext context,
StatefulKnowledgeSessionImpl workingMemory)
retractObject in interface InternalKnowledgeBasehandle - The handle.workingMemory - The working-memory.public StatefulKnowledgeSessionImpl newStatefulSession(boolean keepReference)
public StatefulKnowledgeSessionImpl newStatefulSession(InputStream stream)
public StatefulKnowledgeSessionImpl newStatefulSession(InputStream stream, boolean keepReference)
public StatefulKnowledgeSessionImpl newStatefulSession(InputStream stream, boolean keepReference, SessionConfiguration conf)
public StatefulKnowledgeSessionImpl newStatefulSession(SessionConfiguration sessionConfig, org.kie.api.runtime.Environment environment)
public int getNodeCount()
getNodeCount in interface InternalKnowledgeBasepublic void addPackages(InternalKnowledgePackage[] pkgs)
addPackages in interface InternalKnowledgeBasepublic void addPackage(InternalKnowledgePackage newPkg)
addPackage in interface InternalKnowledgeBasepublic void registerSegmentPrototype(LeftTupleSource tupleSource, SegmentMemory smem)
public void invalidateSegmentPrototype(LeftTupleSource tupleSource, boolean ruleRemoved)
invalidateSegmentPrototype in interface InternalKnowledgeBasepublic SegmentMemory createSegmentFromPrototype(InternalWorkingMemory wm, LeftTupleSource tupleSource)
createSegmentFromPrototype in interface InternalKnowledgeBasepublic SegmentMemory.Prototype getSegmentPrototype(SegmentMemory segment)
getSegmentPrototype in interface InternalKnowledgeBasepublic TypeDeclaration getTypeDeclaration(Class<?> clazz)
getTypeDeclaration in interface InternalKnowledgeBasepublic Collection<TypeDeclaration> getTypeDeclarations()
getTypeDeclarations in interface InternalKnowledgeBasepublic void addRule(InternalKnowledgePackage pkg, RuleImpl rule) throws InvalidPatternException
addRule in interface InternalKnowledgeBaseInvalidPatternExceptionprotected void addEntryPoint(Package pkg, String id) throws InvalidPatternException
InvalidPatternExceptionprotected void addRule(RuleImpl rule) throws InvalidPatternException
InvalidPatternExceptionprotected void addEntryPoint(String id) throws InvalidPatternException
InvalidPatternExceptionpublic void addWindowDeclaration(InternalKnowledgePackage pkg, WindowDeclaration window) throws InvalidPatternException
InvalidPatternExceptionprotected void addWindowDeclaration(WindowDeclaration window) throws InvalidPatternException
InvalidPatternExceptionpublic void removeQuery(String packageName, String ruleName)
removeQuery in interface org.kie.api.KieBaseremoveQuery in interface org.kie.internal.KnowledgeBasepublic void removeRule(String packageName, String ruleName)
removeRule in interface org.kie.api.KieBaseremoveRule in interface org.kie.internal.KnowledgeBasepublic void removeRule(InternalKnowledgePackage pkg, RuleImpl rule)
removeRule in interface InternalKnowledgeBaseprotected void removeRule(RuleImpl rule)
public void removeFunction(String packageName, String functionName)
removeFunction in interface org.kie.api.KieBaseremoveFunction in interface org.kie.internal.KnowledgeBaseprotected void removeFunction(String functionName)
KieBaseEventListener.beforeRuleRemoved(BeforeRuleRemovedEvent) before-rule-removed}
event is fired, and before the function is physically removed from the package.
This method is called with the rulebase lock held.functionName - public void addProcess(org.kie.api.definition.process.Process process)
addProcess in interface InternalKnowledgeBasepublic void removeProcess(String id)
removeProcess in interface InternalKnowledgeBaseremoveProcess in interface org.kie.api.KieBaseremoveProcess in interface org.kie.internal.KnowledgeBasepublic org.kie.api.definition.process.Process getProcess(String id)
getProcess in interface org.kie.api.KieBasegetProcess in interface org.kie.internal.KnowledgeBasepublic void addStatefulSession(StatefulKnowledgeSessionImpl wm)
public InternalKnowledgePackage getPackage(String name)
getPackage in interface InternalKnowledgeBasepublic StatefulKnowledgeSessionImpl[] getStatefulSessions()
public InternalWorkingMemory[] getWorkingMemories()
getWorkingMemories in interface InternalKnowledgeBasepublic RuleBaseConfiguration getConfiguration()
getConfiguration in interface InternalKnowledgeBasepublic ClassLoader getRootClassLoader()
getRootClassLoader in interface InternalKnowledgeBasepublic void executeQueuedActions()
executeQueuedActions in interface InternalKnowledgeBasepublic RuleBasePartitionId createNewPartitionId()
createNewPartitionId in interface InternalKnowledgeBasepublic List<RuleBasePartitionId> getPartitionIds()
public boolean isEvent(Class<?> clazz)
public org.kie.api.definition.type.FactType getFactType(String packageName, String typeName)
getFactType in interface org.kie.api.KieBasegetFactType in interface org.kie.internal.KnowledgeBasepublic org.kie.api.definition.type.FactType getFactType(String name)
public ClassFieldAccessorCache getClassFieldAccessorCache()
getClassFieldAccessorCache in interface InternalKnowledgeBasepublic Set<String> getEntryPointIds()
getEntryPointIds in interface org.kie.api.KieBasegetEntryPointIds in interface org.kie.internal.KnowledgeBasepublic TripleStore getTripleStore()
getTripleStore in interface InternalKnowledgeBasepublic TraitRegistry getTraitRegistry()
getTraitRegistry in interface InternalKnowledgeBasepublic boolean removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource)
removeObjectsGeneratedFromResource in interface InternalKnowledgeBaseCopyright © 2001–2015 JBoss by Red Hat. All rights reserved.