Package org.drools.core.impl
Class KnowledgeBaseImpl
- java.lang.Object
-
- org.drools.core.impl.KnowledgeBaseImpl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceKnowledgeBaseImpl.ClassRegister
-
Field Summary
Fields Modifier and Type Field Description java.util.List<java.util.List<java.lang.String>>jaxbClassesprotected static org.slf4j.Loggerloggerprotected java.util.Map<java.lang.String,InternalKnowledgePackage>pkgs
-
Constructor Summary
Constructors Constructor Description KnowledgeBaseImpl()KnowledgeBaseImpl(java.lang.String id, RuleBaseConfiguration config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGlobal(java.lang.String identifier, java.lang.reflect.Type type)java.util.concurrent.Future<org.kie.api.definition.KiePackage>addPackage(org.kie.api.definition.KiePackage newPkg)voidaddPackages(java.util.Collection<? extends org.kie.api.definition.KiePackage> newPkgs)Add aPackageto the network.voidaddProcess(org.kie.api.definition.process.Process process)voidaddReceiveNode(AsyncReceiveNode node)voidaddRules(java.util.Collection<RuleImpl> rules)voidafterIncrementalUpdate(KieBaseUpdate kieBaseUpdate)voidbeforeIncrementalUpdate(KieBaseUpdate kieBaseUpdate)RuleBasePartitionIdcreateNewPartitionId()SegmentMemorycreateSegmentFromPrototype(ReteEvaluator reteEvaluator, LeftTupleSource tupleSource)SegmentMemorycreateSegmentFromPrototype(ReteEvaluator reteEvaluator, SegmentMemory.SegmentPrototype proto)voidexecuteQueuedActions()java.util.Set<EntryPointNode>getAddedEntryNodeCache()ClassFieldAccessorCachegetClassFieldAccessorCache()RuleBaseConfigurationgetConfiguration()java.lang.StringgetContainerId()java.util.Set<java.lang.String>getEntryPointIds()TypeDeclarationgetExactTypeDeclaration(java.lang.Class<?> clazz)org.kie.api.definition.type.FactTypegetFactType(java.lang.String packageName, java.lang.String typeName)java.util.Map<java.lang.String,java.lang.reflect.Type>getGlobals()java.lang.StringgetId()org.kie.api.definition.KiePackagegetKiePackage(java.lang.String packageName)java.util.Collection<org.kie.api.definition.KiePackage>getKiePackages()intgetMemoryCount()intgetNodeCount()TypeDeclarationgetOrCreateExactTypeDeclaration(java.lang.Class<?> clazz)InternalKnowledgePackagegetPackage(java.lang.String name)InternalKnowledgePackage[]getPackages()java.util.Map<java.lang.String,InternalKnowledgePackage>getPackagesMap()org.kie.api.definition.process.ProcessgetProcess(java.lang.String id)java.util.Collection<org.kie.api.definition.process.Process>getProcesses()org.kie.api.definition.rule.QuerygetQuery(java.lang.String packageName, java.lang.String queryName)java.util.List<AsyncReceiveNode>getReceiveNodes()java.util.Set<EntryPointNode>getRemovedEntryNodeCache()org.kie.api.builder.ReleaseIdgetResolvedReleaseId()RetegetRete()Retrieve the Rete-OO network for thisRuleBase.ReteooBuildergetReteooBuilder()java.lang.ClassLoadergetRootClassLoader()org.kie.api.definition.rule.RulegetRule(java.lang.String packageName, java.lang.String ruleName)RuleUnitDescriptionRegistrygetRuleUnitDescriptionRegistry()SegmentMemory.SegmentPrototypegetSegmentPrototype(LeftTupleNode node)SegmentMemory.SegmentPrototypegetSegmentPrototype(SegmentMemory segment)SessionConfigurationgetSessionConfiguration()TypeDeclarationgetTypeDeclaration(java.lang.Class<?> clazz)java.util.Collection<TypeDeclaration>getTypeDeclarations()booleanhasMultipleAgendaGroups()booleanhasSegmentPrototypes()booleanhasUnits()voidinvalidateSegmentPrototype(LeftTupleNode rootNode)voidkBaseInternal_addPackages(java.util.Collection<InternalKnowledgePackage> clonedPkgs, java.util.Collection<InternalWorkingMemory> workingMemories)voidkBaseInternal_addProcess(org.kie.api.definition.process.Process process)voidkBaseInternal_addRules(java.util.Collection<? extends org.kie.api.definition.rule.Rule> rules, java.util.Collection<InternalWorkingMemory> workingMemories)java.util.concurrent.locks.ReentrantReadWriteLockkBaseInternal_getLock()voidkBaseInternal_lock()voidkBaseInternal_removeFunction(InternalKnowledgePackage pkg, java.lang.String functionName)voidkBaseInternal_removePackage(InternalKnowledgePackage pkg, java.util.Collection<InternalWorkingMemory> workingMemories)voidkBaseInternal_removeProcess(java.lang.String id, org.kie.api.definition.process.Process process)voidkBaseInternal_removeRule(InternalKnowledgePackage pkg, RuleImpl rule, java.util.Collection<InternalWorkingMemory> workingMemories)voidkBaseInternal_removeRules(java.util.Collection<? extends org.kie.api.definition.rule.Rule> rules, java.util.Collection<InternalWorkingMemory> workingMemories)booleankBaseInternal_tryWriteLock()voidkBaseInternal_unlock()voidkBaseInternal_writeLock()voidkBaseInternal_writeUnlock()FactHandleFactorynewFactHandleFactory()FactHandleFactorynewFactHandleFactory(long id, long counter)voidprocessAllTypesDeclaration(java.util.Collection<InternalKnowledgePackage> pkgs)protected voidprocessTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg)voidreadLock()voidreadUnlock()voidregisterAddedEntryNodeCache(EntryPointNode node)java.lang.Class<?>registerAndLoadTypeDefinition(java.lang.String className, byte[] def)static voidregisterFunctionClassAndInnerClasses(java.lang.String functionClassName, JavaDialectRuntimeData runtime, KnowledgeBaseImpl.ClassRegister consumer)voidregisteRremovedEntryNodeCache(EntryPointNode node)voidregisterSegmentPrototype(LeftTupleNode tupleSource, SegmentMemory.SegmentPrototype smem)voidregisterTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg)voidremoveFunction(java.lang.String packageName, java.lang.String functionName)voidremoveGlobal(java.lang.String identifier)voidremoveKiePackage(java.lang.String packageName)booleanremoveObjectsGeneratedFromResource(org.kie.api.io.Resource resource, java.util.Collection<InternalWorkingMemory> workingMemories)voidremoveProcess(java.lang.String id)voidremoveQuery(java.lang.String packageName, java.lang.String ruleName)voidremoveRule(java.lang.String packageName, java.lang.String ruleName)voidremoveRules(java.util.Collection<RuleImpl> rules)voidsetContainerId(java.lang.String containerId)voidsetResolvedReleaseId(org.kie.api.builder.ReleaseId currentReleaseId)protected voidsetupRete()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.core.impl.RuleBase
getWorkingMemoryCounter
-
-
-
-
Field Detail
-
logger
protected static final transient org.slf4j.Logger logger
-
pkgs
protected java.util.Map<java.lang.String,InternalKnowledgePackage> pkgs
-
jaxbClasses
public java.util.List<java.util.List<java.lang.String>> jaxbClasses
-
-
Constructor Detail
-
KnowledgeBaseImpl
public KnowledgeBaseImpl()
-
KnowledgeBaseImpl
public KnowledgeBaseImpl(java.lang.String id, RuleBaseConfiguration config)
-
-
Method Detail
-
getSessionConfiguration
public SessionConfiguration getSessionConfiguration()
- Specified by:
getSessionConfigurationin interfaceRuleBase
-
removeKiePackage
public void removeKiePackage(java.lang.String packageName)
- Specified by:
removeKiePackagein interfaceRuleBase
-
kBaseInternal_removePackage
public void kBaseInternal_removePackage(InternalKnowledgePackage pkg, java.util.Collection<InternalWorkingMemory> workingMemories)
-
getRule
public org.kie.api.definition.rule.Rule getRule(java.lang.String packageName, java.lang.String ruleName)
-
getQuery
public org.kie.api.definition.rule.Query getQuery(java.lang.String packageName, java.lang.String queryName)
-
getKiePackages
public java.util.Collection<org.kie.api.definition.KiePackage> getKiePackages()
- Specified by:
getKiePackagesin interfaceRuleBase
-
getKiePackage
public org.kie.api.definition.KiePackage getKiePackage(java.lang.String packageName)
- Specified by:
getKiePackagein interfaceRuleBase
-
newFactHandleFactory
public FactHandleFactory newFactHandleFactory()
- Specified by:
newFactHandleFactoryin interfaceRuleBase
-
newFactHandleFactory
public FactHandleFactory newFactHandleFactory(long id, long counter)
- Specified by:
newFactHandleFactoryin interfaceRuleBase
-
getProcesses
public java.util.Collection<org.kie.api.definition.process.Process> getProcesses()
- Specified by:
getProcessesin interfaceRuleBase
-
getPackages
public InternalKnowledgePackage[] getPackages()
- Specified by:
getPackagesin interfaceRuleBase
-
getPackagesMap
public java.util.Map<java.lang.String,InternalKnowledgePackage> getPackagesMap()
- Specified by:
getPackagesMapin interfaceRuleBase
-
getGlobals
public java.util.Map<java.lang.String,java.lang.reflect.Type> getGlobals()
- Specified by:
getGlobalsin interfaceRuleBase
-
kBaseInternal_lock
public void kBaseInternal_lock()
-
kBaseInternal_unlock
public void kBaseInternal_unlock()
-
readUnlock
public void readUnlock()
- Specified by:
readUnlockin interfaceRuleBase
-
kBaseInternal_getLock
public java.util.concurrent.locks.ReentrantReadWriteLock kBaseInternal_getLock()
-
kBaseInternal_writeLock
public void kBaseInternal_writeLock()
-
kBaseInternal_tryWriteLock
public boolean kBaseInternal_tryWriteLock()
-
kBaseInternal_writeUnlock
public void kBaseInternal_writeUnlock()
-
addPackages
public void addPackages(java.util.Collection<? extends org.kie.api.definition.KiePackage> newPkgs)
Add aPackageto the network. Iterates through thePackageadding Each individualRuleto the network. Before update network each referencedWorkingMemoryis locked.- Specified by:
addPackagesin interfaceRuleBase- Parameters:
newPkgs- The package to add.
-
addPackage
public java.util.concurrent.Future<org.kie.api.definition.KiePackage> addPackage(org.kie.api.definition.KiePackage newPkg)
- Specified by:
addPackagein interfaceRuleBase
-
kBaseInternal_addPackages
public void kBaseInternal_addPackages(java.util.Collection<InternalKnowledgePackage> clonedPkgs, java.util.Collection<InternalWorkingMemory> workingMemories)
-
processAllTypesDeclaration
public void processAllTypesDeclaration(java.util.Collection<InternalKnowledgePackage> pkgs)
- Specified by:
processAllTypesDeclarationin interfaceRuleBase
-
hasMultipleAgendaGroups
public boolean hasMultipleAgendaGroups()
- Specified by:
hasMultipleAgendaGroupsin interfaceRuleBase
-
registerFunctionClassAndInnerClasses
public static void registerFunctionClassAndInnerClasses(java.lang.String functionClassName, JavaDialectRuntimeData runtime, KnowledgeBaseImpl.ClassRegister consumer) throws java.lang.ClassNotFoundException- Throws:
java.lang.ClassNotFoundException
-
registerTypeDeclaration
public void registerTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg)
- Specified by:
registerTypeDeclarationin interfaceRuleBase
-
processTypeDeclaration
protected void processTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg)
-
registerAndLoadTypeDefinition
public java.lang.Class<?> registerAndLoadTypeDefinition(java.lang.String className, byte[] def) throws java.lang.ClassNotFoundException- Specified by:
registerAndLoadTypeDefinitionin interfaceRuleBase- Throws:
java.lang.ClassNotFoundException
-
addGlobal
public void addGlobal(java.lang.String identifier, java.lang.reflect.Type type)
-
removeGlobal
public void removeGlobal(java.lang.String identifier)
- Specified by:
removeGlobalin interfaceRuleBase
-
setupRete
protected void setupRete()
-
registerAddedEntryNodeCache
public void registerAddedEntryNodeCache(EntryPointNode node)
- Specified by:
registerAddedEntryNodeCachein interfaceRuleBase
-
getAddedEntryNodeCache
public java.util.Set<EntryPointNode> getAddedEntryNodeCache()
- Specified by:
getAddedEntryNodeCachein interfaceRuleBase
-
registeRremovedEntryNodeCache
public void registeRremovedEntryNodeCache(EntryPointNode node)
- Specified by:
registeRremovedEntryNodeCachein interfaceRuleBase
-
getRemovedEntryNodeCache
public java.util.Set<EntryPointNode> getRemovedEntryNodeCache()
- Specified by:
getRemovedEntryNodeCachein interfaceRuleBase
-
getRete
public Rete getRete()
Retrieve the Rete-OO network for thisRuleBase.
-
getReteooBuilder
public ReteooBuilder getReteooBuilder()
- Specified by:
getReteooBuilderin interfaceRuleBase
-
getNodeCount
public int getNodeCount()
- Specified by:
getNodeCountin interfaceRuleBase
-
getMemoryCount
public int getMemoryCount()
- Specified by:
getMemoryCountin interfaceRuleBase
-
hasSegmentPrototypes
public boolean hasSegmentPrototypes()
- Specified by:
hasSegmentPrototypesin interfaceRuleBase
-
registerSegmentPrototype
public void registerSegmentPrototype(LeftTupleNode tupleSource, SegmentMemory.SegmentPrototype smem)
- Specified by:
registerSegmentPrototypein interfaceRuleBase
-
invalidateSegmentPrototype
public void invalidateSegmentPrototype(LeftTupleNode rootNode)
- Specified by:
invalidateSegmentPrototypein interfaceRuleBase
-
getSegmentPrototype
public SegmentMemory.SegmentPrototype getSegmentPrototype(LeftTupleNode node)
- Specified by:
getSegmentPrototypein interfaceRuleBase
-
createSegmentFromPrototype
public SegmentMemory createSegmentFromPrototype(ReteEvaluator reteEvaluator, LeftTupleSource tupleSource)
- Specified by:
createSegmentFromPrototypein interfaceRuleBase
-
createSegmentFromPrototype
public SegmentMemory createSegmentFromPrototype(ReteEvaluator reteEvaluator, SegmentMemory.SegmentPrototype proto)
- Specified by:
createSegmentFromPrototypein interfaceRuleBase
-
getSegmentPrototype
public SegmentMemory.SegmentPrototype getSegmentPrototype(SegmentMemory segment)
- Specified by:
getSegmentPrototypein interfaceRuleBase
-
getExactTypeDeclaration
public TypeDeclaration getExactTypeDeclaration(java.lang.Class<?> clazz)
- Specified by:
getExactTypeDeclarationin interfaceRuleBase
-
getOrCreateExactTypeDeclaration
public TypeDeclaration getOrCreateExactTypeDeclaration(java.lang.Class<?> clazz)
- Specified by:
getOrCreateExactTypeDeclarationin interfaceRuleBase
-
getTypeDeclaration
public TypeDeclaration getTypeDeclaration(java.lang.Class<?> clazz)
- Specified by:
getTypeDeclarationin interfaceRuleBase
-
getTypeDeclarations
public java.util.Collection<TypeDeclaration> getTypeDeclarations()
- Specified by:
getTypeDeclarationsin interfaceRuleBase
-
beforeIncrementalUpdate
public void beforeIncrementalUpdate(KieBaseUpdate kieBaseUpdate)
- Specified by:
beforeIncrementalUpdatein interfaceRuleBase
-
afterIncrementalUpdate
public void afterIncrementalUpdate(KieBaseUpdate kieBaseUpdate)
- Specified by:
afterIncrementalUpdatein interfaceRuleBase
-
addRules
public void addRules(java.util.Collection<RuleImpl> rules) throws InvalidPatternException
- Specified by:
addRulesin interfaceRuleBase- Throws:
InvalidPatternException
-
kBaseInternal_addRules
public void kBaseInternal_addRules(java.util.Collection<? extends org.kie.api.definition.rule.Rule> rules, java.util.Collection<InternalWorkingMemory> workingMemories)
-
removeQuery
public void removeQuery(java.lang.String packageName, java.lang.String ruleName)- Specified by:
removeQueryin interfaceRuleBase
-
removeRules
public void removeRules(java.util.Collection<RuleImpl> rules)
- Specified by:
removeRulesin interfaceRuleBase
-
removeRule
public void removeRule(java.lang.String packageName, java.lang.String ruleName)- Specified by:
removeRulein interfaceRuleBase
-
kBaseInternal_removeRule
public void kBaseInternal_removeRule(InternalKnowledgePackage pkg, RuleImpl rule, java.util.Collection<InternalWorkingMemory> workingMemories)
-
kBaseInternal_removeRules
public void kBaseInternal_removeRules(java.util.Collection<? extends org.kie.api.definition.rule.Rule> rules, java.util.Collection<InternalWorkingMemory> workingMemories)
-
removeFunction
public void removeFunction(java.lang.String packageName, java.lang.String functionName)- Specified by:
removeFunctionin interfaceRuleBase
-
kBaseInternal_removeFunction
public void kBaseInternal_removeFunction(InternalKnowledgePackage pkg, java.lang.String functionName)
-
addProcess
public void addProcess(org.kie.api.definition.process.Process process)
- Specified by:
addProcessin interfaceRuleBase
-
kBaseInternal_addProcess
public void kBaseInternal_addProcess(org.kie.api.definition.process.Process process)
-
removeProcess
public void removeProcess(java.lang.String id)
- Specified by:
removeProcessin interfaceRuleBase
-
kBaseInternal_removeProcess
public void kBaseInternal_removeProcess(java.lang.String id, org.kie.api.definition.process.Process process)
-
getProcess
public org.kie.api.definition.process.Process getProcess(java.lang.String id)
- Specified by:
getProcessin interfaceRuleBase
-
getPackage
public InternalKnowledgePackage getPackage(java.lang.String name)
- Specified by:
getPackagein interfaceRuleBase
-
getConfiguration
public RuleBaseConfiguration getConfiguration()
- Specified by:
getConfigurationin interfaceRuleBase
-
getRootClassLoader
public java.lang.ClassLoader getRootClassLoader()
- Specified by:
getRootClassLoaderin interfaceRuleBase
-
executeQueuedActions
public void executeQueuedActions()
- Specified by:
executeQueuedActionsin interfaceRuleBase
-
createNewPartitionId
public RuleBasePartitionId createNewPartitionId()
- Specified by:
createNewPartitionIdin interfaceRuleBase
-
getFactType
public org.kie.api.definition.type.FactType getFactType(java.lang.String packageName, java.lang.String typeName)- Specified by:
getFactTypein interfaceRuleBase
-
getClassFieldAccessorCache
public ClassFieldAccessorCache getClassFieldAccessorCache()
- Specified by:
getClassFieldAccessorCachein interfaceRuleBase
-
getEntryPointIds
public java.util.Set<java.lang.String> getEntryPointIds()
- Specified by:
getEntryPointIdsin interfaceRuleBase
-
removeObjectsGeneratedFromResource
public boolean removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource, java.util.Collection<InternalWorkingMemory> workingMemories)- Specified by:
removeObjectsGeneratedFromResourcein interfaceRuleBase
-
getResolvedReleaseId
public org.kie.api.builder.ReleaseId getResolvedReleaseId()
- Specified by:
getResolvedReleaseIdin interfaceRuleBase
-
setResolvedReleaseId
public void setResolvedReleaseId(org.kie.api.builder.ReleaseId currentReleaseId)
- Specified by:
setResolvedReleaseIdin interfaceRuleBase
-
getContainerId
public java.lang.String getContainerId()
- Specified by:
getContainerIdin interfaceRuleBase
-
setContainerId
public void setContainerId(java.lang.String containerId)
- Specified by:
setContainerIdin interfaceRuleBase
-
getRuleUnitDescriptionRegistry
public RuleUnitDescriptionRegistry getRuleUnitDescriptionRegistry()
- Specified by:
getRuleUnitDescriptionRegistryin interfaceRuleBase
-
getReceiveNodes
public java.util.List<AsyncReceiveNode> getReceiveNodes()
- Specified by:
getReceiveNodesin interfaceRuleBase
-
addReceiveNode
public void addReceiveNode(AsyncReceiveNode node)
- Specified by:
addReceiveNodein interfaceRuleBase
-
-