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 |
enqueueModification(Runnable modification) |
void |
executeQueuedActions() |
boolean |
flushModifications() |
Set<EntryPointNode> |
getAddedEntryNodeCache() |
StatefulKnowledgeSessionImpl |
getCachedSession(SessionConfiguration config,
org.kie.api.runtime.Environment environment) |
ClassFieldAccessorCache |
getClassFieldAccessorCache() |
RuleBaseConfiguration |
getConfig() |
RuleBaseConfiguration |
getConfiguration() |
String |
getContainerId() |
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() |
org.kie.api.builder.ReleaseId |
getResolvedReleaseId() |
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() |
TraitRegistry |
getTraitRegistry() |
TripleStore |
getTripleStore() |
TypeDeclaration |
getTypeDeclaration(Class<?> clazz) |
Collection<TypeDeclaration> |
getTypeDeclarations() |
InternalWorkingMemory[] |
getWorkingMemories() |
int |
getWorkingMemoryCounter() |
boolean |
hasSegmentPrototypes() |
void |
initMBeans() |
void |
invalidateSegmentPrototype(LeftTupleNode rootNode) |
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 |
registerTypeDeclaration(TypeDeclaration newDecl,
InternalKnowledgePackage newPkg) |
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.
|
void |
removeRule(String packageName,
String ruleName) |
void |
retractObject(org.kie.api.runtime.rule.FactHandle handle,
PropagationContext context,
StatefulKnowledgeSessionImpl workingMemory)
Retract a fact object.
|
void |
setContainerId(String containerId) |
void |
setResolvedReleaseId(org.kie.api.builder.ReleaseId currentReleaseId) |
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 void initMBeans()
initMBeans
in interface InternalKnowledgeBase
public int nextWorkingMemoryCounter()
nextWorkingMemoryCounter
in interface InternalKnowledgeBase
public int getWorkingMemoryCounter()
getWorkingMemoryCounter
in interface InternalKnowledgeBase
public void addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
addEventListener
in interface org.kie.api.event.kiebase.KieBaseEventManager
public void removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
removeEventListener
in interface org.kie.api.event.kiebase.KieBaseEventManager
public Collection<org.kie.api.event.kiebase.KieBaseEventListener> getKieBaseEventListeners()
getKieBaseEventListeners
in interface org.kie.api.event.kiebase.KieBaseEventManager
public void addKnowledgePackages(Collection<org.kie.internal.definition.KnowledgePackage> knowledgePackages)
addKnowledgePackages
in interface org.kie.internal.KnowledgeBase
public Collection<org.kie.internal.definition.KnowledgePackage> getKnowledgePackages()
getKnowledgePackages
in interface org.kie.internal.KnowledgeBase
public org.kie.internal.runtime.StatefulKnowledgeSession newStatefulKnowledgeSession()
newStatefulKnowledgeSession
in interface org.kie.internal.KnowledgeBase
public org.kie.internal.runtime.StatefulKnowledgeSession newStatefulKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf, org.kie.api.runtime.Environment environment)
newStatefulKnowledgeSession
in interface org.kie.internal.KnowledgeBase
public Collection<org.kie.internal.runtime.StatefulKnowledgeSession> getStatefulKnowledgeSessions()
getStatefulKnowledgeSessions
in interface org.kie.internal.KnowledgeBase
public org.kie.internal.runtime.StatelessKnowledgeSession newStatelessKnowledgeSession()
newStatelessKnowledgeSession
in interface org.kie.internal.KnowledgeBase
public org.kie.internal.runtime.StatelessKnowledgeSession newStatelessKnowledgeSession(org.kie.api.runtime.KieSessionConfiguration conf)
newStatelessKnowledgeSession
in interface org.kie.internal.KnowledgeBase
public void removeKnowledgePackage(String packageName)
removeKnowledgePackage
in interface org.kie.internal.KnowledgeBase
public org.kie.internal.definition.KnowledgePackage getKnowledgePackage(String packageName)
getKnowledgePackage
in interface org.kie.internal.KnowledgeBase
public org.kie.api.definition.rule.Rule getRule(String packageName, String ruleName)
getRule
in interface org.kie.api.KieBase
getRule
in interface org.kie.internal.KnowledgeBase
public org.kie.api.definition.rule.Query getQuery(String packageName, String queryName)
getQuery
in interface org.kie.api.KieBase
getQuery
in interface org.kie.internal.KnowledgeBase
public org.kie.api.runtime.KieSession newKieSession(org.kie.api.runtime.KieSessionConfiguration conf, org.kie.api.runtime.Environment environment)
newKieSession
in interface org.kie.api.KieBase
public org.kie.api.runtime.KieSession newKieSession()
newKieSession
in interface org.kie.api.KieBase
public Collection<? extends org.kie.api.runtime.KieSession> getKieSessions()
getKieSessions
in interface org.kie.api.KieBase
public org.kie.api.runtime.StatelessKieSession newStatelessKieSession(org.kie.api.runtime.KieSessionConfiguration conf)
newStatelessKieSession
in interface org.kie.api.KieBase
public org.kie.api.runtime.StatelessKieSession newStatelessKieSession()
newStatelessKieSession
in interface org.kie.api.KieBase
public Collection<org.kie.api.definition.KiePackage> getKiePackages()
getKiePackages
in interface org.kie.api.KieBase
public org.kie.api.definition.KiePackage getKiePackage(String packageName)
getKiePackage
in interface org.kie.api.KieBase
public void removeKiePackage(String packageName)
removeKiePackage
in interface org.kie.api.KieBase
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public String getId()
getId
in interface InternalKnowledgeBase
public RuleBaseConfiguration getConfig()
public StatefulKnowledgeSessionImpl newStatefulSession()
public void disposeStatefulSession(StatefulKnowledgeSessionImpl statefulSession)
disposeStatefulSession
in interface InternalKnowledgeBase
public StatefulKnowledgeSessionImpl getCachedSession(SessionConfiguration config, org.kie.api.runtime.Environment environment)
getCachedSession
in interface InternalKnowledgeBase
public FactHandleFactory getFactHandleFactory()
public FactHandleFactory newFactHandleFactory()
newFactHandleFactory
in interface InternalKnowledgeBase
public FactHandleFactory newFactHandleFactory(int id, long counter)
newFactHandleFactory
in interface InternalKnowledgeBase
public Collection<org.kie.api.definition.process.Process> getProcesses()
getProcesses
in interface org.kie.api.KieBase
getProcesses
in interface org.kie.internal.KnowledgeBase
public InternalKnowledgePackage[] getPackages()
public Map<String,InternalKnowledgePackage> getPackagesMap()
getPackagesMap
in interface InternalKnowledgeBase
public Map<String,Class<?>> getGlobals()
getGlobals
in interface InternalKnowledgeBase
public void lock()
lock
in interface InternalKnowledgeBase
public void unlock()
unlock
in interface InternalKnowledgeBase
public void readLock()
readLock
in interface InternalKnowledgeBase
public void readUnlock()
readUnlock
in interface InternalKnowledgeBase
public 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 InternalKnowledgeBase
newPkgs
- The package to add.public void enqueueModification(Runnable modification)
enqueueModification
in interface InternalKnowledgeBase
public boolean flushModifications()
flushModifications
in interface InternalKnowledgeBase
public void registerTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg)
registerTypeDeclaration
in interface InternalKnowledgeBase
protected void processTypeDeclaration(TypeDeclaration newDecl, InternalKnowledgePackage newPkg) throws ClassNotFoundException
ClassNotFoundException
public Class<?> registerAndLoadTypeDefinition(String className, byte[] def) throws ClassNotFoundException
registerAndLoadTypeDefinition
in interface InternalKnowledgeBase
ClassNotFoundException
protected void updateDependentTypes(InternalKnowledgePackage newPkg, TypeDeclaration typeDeclaration)
public void addGlobal(String identifier, Class clazz)
addGlobal
in interface InternalKnowledgeBase
public void removeGlobal(String identifier)
removeGlobal
in interface InternalKnowledgeBase
protected void setupRete()
public void registerAddedEntryNodeCache(EntryPointNode node)
registerAddedEntryNodeCache
in interface InternalKnowledgeBase
public Set<EntryPointNode> getAddedEntryNodeCache()
getAddedEntryNodeCache
in interface InternalKnowledgeBase
public void registeRremovedEntryNodeCache(EntryPointNode node)
registeRremovedEntryNodeCache
in interface InternalKnowledgeBase
public Set<EntryPointNode> getRemovedEntryNodeCache()
getRemovedEntryNodeCache
in interface InternalKnowledgeBase
public Rete getRete()
RuleBase
.getRete
in interface InternalKnowledgeBase
public ReteooBuilder getReteooBuilder()
getReteooBuilder
in interface InternalKnowledgeBase
public void assertObject(org.kie.api.runtime.rule.FactHandle handle, Object object, PropagationContext context, InternalWorkingMemory workingMemory)
assertObject
in interface InternalKnowledgeBase
handle
- 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 InternalKnowledgeBase
handle
- 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 InternalKnowledgeBase
public void addPackages(InternalKnowledgePackage[] pkgs)
addPackages
in interface InternalKnowledgeBase
public void addPackage(InternalKnowledgePackage newPkg)
addPackage
in interface InternalKnowledgeBase
public void registerSegmentPrototype(LeftTupleSource tupleSource, SegmentMemory smem)
public boolean hasSegmentPrototypes()
hasSegmentPrototypes
in interface InternalKnowledgeBase
public void invalidateSegmentPrototype(LeftTupleNode rootNode)
invalidateSegmentPrototype
in interface InternalKnowledgeBase
public SegmentMemory createSegmentFromPrototype(InternalWorkingMemory wm, LeftTupleSource tupleSource)
createSegmentFromPrototype
in interface InternalKnowledgeBase
public SegmentMemory.Prototype getSegmentPrototype(SegmentMemory segment)
getSegmentPrototype
in interface InternalKnowledgeBase
public TypeDeclaration getTypeDeclaration(Class<?> clazz)
getTypeDeclaration
in interface InternalKnowledgeBase
public Collection<TypeDeclaration> getTypeDeclarations()
getTypeDeclarations
in interface InternalKnowledgeBase
public void addRule(InternalKnowledgePackage pkg, RuleImpl rule) throws InvalidPatternException
addRule
in interface InternalKnowledgeBase
InvalidPatternException
protected void addEntryPoint(Package pkg, String id) throws InvalidPatternException
InvalidPatternException
protected void addRule(RuleImpl rule) throws InvalidPatternException
InvalidPatternException
protected void addEntryPoint(String id) throws InvalidPatternException
InvalidPatternException
public void addWindowDeclaration(InternalKnowledgePackage pkg, WindowDeclaration window) throws InvalidPatternException
InvalidPatternException
protected void addWindowDeclaration(WindowDeclaration window) throws InvalidPatternException
InvalidPatternException
public void removeQuery(String packageName, String ruleName)
removeQuery
in interface org.kie.api.KieBase
removeQuery
in interface org.kie.internal.KnowledgeBase
public void removeRule(String packageName, String ruleName)
removeRule
in interface org.kie.api.KieBase
removeRule
in interface org.kie.internal.KnowledgeBase
public void removeRule(InternalKnowledgePackage pkg, RuleImpl rule)
removeRule
in interface InternalKnowledgeBase
public void removeFunction(String packageName, String functionName)
removeFunction
in interface org.kie.api.KieBase
removeFunction
in interface org.kie.internal.KnowledgeBase
protected 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 InternalKnowledgeBase
public void removeProcess(String id)
removeProcess
in interface InternalKnowledgeBase
removeProcess
in interface org.kie.api.KieBase
removeProcess
in interface org.kie.internal.KnowledgeBase
public org.kie.api.definition.process.Process getProcess(String id)
getProcess
in interface org.kie.api.KieBase
getProcess
in interface org.kie.internal.KnowledgeBase
public void addStatefulSession(StatefulKnowledgeSessionImpl wm)
public InternalKnowledgePackage getPackage(String name)
getPackage
in interface InternalKnowledgeBase
public InternalWorkingMemory[] getWorkingMemories()
getWorkingMemories
in interface InternalKnowledgeBase
public RuleBaseConfiguration getConfiguration()
getConfiguration
in interface InternalKnowledgeBase
public ClassLoader getRootClassLoader()
getRootClassLoader
in interface InternalKnowledgeBase
public void executeQueuedActions()
executeQueuedActions
in interface InternalKnowledgeBase
public RuleBasePartitionId createNewPartitionId()
createNewPartitionId
in interface InternalKnowledgeBase
public List<RuleBasePartitionId> getPartitionIds()
public org.kie.api.definition.type.FactType getFactType(String packageName, String typeName)
getFactType
in interface org.kie.api.KieBase
getFactType
in interface org.kie.internal.KnowledgeBase
public org.kie.api.definition.type.FactType getFactType(String name)
public ClassFieldAccessorCache getClassFieldAccessorCache()
getClassFieldAccessorCache
in interface InternalKnowledgeBase
public Set<String> getEntryPointIds()
getEntryPointIds
in interface org.kie.api.KieBase
getEntryPointIds
in interface org.kie.internal.KnowledgeBase
public TripleStore getTripleStore()
getTripleStore
in interface InternalKnowledgeBase
public TraitRegistry getTraitRegistry()
getTraitRegistry
in interface InternalKnowledgeBase
public boolean removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource)
removeObjectsGeneratedFromResource
in interface InternalKnowledgeBase
public org.kie.api.builder.ReleaseId getResolvedReleaseId()
getResolvedReleaseId
in interface InternalKnowledgeBase
public void setResolvedReleaseId(org.kie.api.builder.ReleaseId currentReleaseId)
setResolvedReleaseId
in interface InternalKnowledgeBase
public String getContainerId()
getContainerId
in interface InternalKnowledgeBase
public void setContainerId(String containerId)
setContainerId
in interface InternalKnowledgeBase
Copyright © 2001–2018 JBoss by Red Hat. All rights reserved.