Class DefaultRuleEngineContainerRegistry
java.lang.Object
de.hybris.platform.ruleengine.init.impl.DefaultRuleEngineContainerRegistry
- All Implemented Interfaces:
RuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
public class DefaultRuleEngineContainerRegistry
extends Object
implements RuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
Default implementation of
RuleEngineContainerRegistry interface, based on Drools-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.kie.api.runtime.KieContainergetActiveContainer(org.kie.api.builder.ReleaseId releaseId) Retrieve knowledge base container reference, identified by release idprotected ConcurrentMapFactoryprotected Lockprotected ReadWriteLockprotected Lockprotected booleanbooleanCheck if the registry is locked for readingbooleanCheck if the registry is locked for writingprotected booleanisPreviousReleaseId(org.kie.api.builder.ReleaseId newReleaseId, org.kie.api.builder.ReleaseId oldReleaseId) protected booleanvoidlock registry for reading operationsvoidlock registry for writing operationsOptional<org.kie.api.builder.ReleaseId>lookupForDeployedRelease(String... releaseTokens) Lookup for a deployed knowledge base container release id by partial release id tokens (e.g.org.kie.api.runtime.KieContainerremoveActiveContainer(org.kie.api.builder.ReleaseId releaseHolder) Remove knowledge base container identified by release idprotected voidremoveAllPreviousVersions(org.kie.api.builder.ReleaseId newReleaseId) voidsetActiveContainer(org.kie.api.builder.ReleaseId releaseId, org.kie.api.runtime.KieContainer rulesContainer) Adds another active container, identified by release, to a repositoryvoidsetConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory) voidsetKeepOnlyOneContainerVersion(boolean keepOnlyOneContainerVersion) voidsetReadLockEnabled(boolean readLockEnabled) voidsetup()voidunlock registry for reading operationsvoidunlock registry for writing operations
-
Constructor Details
-
DefaultRuleEngineContainerRegistry
public DefaultRuleEngineContainerRegistry()
-
-
Method Details
-
setActiveContainer
public void setActiveContainer(org.kie.api.builder.ReleaseId releaseId, org.kie.api.runtime.KieContainer rulesContainer) Adds another active container, identified by release, to a repository. Note: Depending on the flag set viasetKeepOnlyOneContainerVersion(boolean)(OOTB this is set via the propertyruleengine.containerregistry.keep.only.one.module.version) this call will also remove all other KieContainer instances of the same groupId and artifactId (essentially all previously deployed versions of the same rule module).- Specified by:
setActiveContainerin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Parameters:
releaseId- knowledge base container module release identifierrulesContainer- knowledge base container instance
-
getActiveContainer
public org.kie.api.runtime.KieContainer getActiveContainer(org.kie.api.builder.ReleaseId releaseId) Description copied from interface:RuleEngineContainerRegistryRetrieve knowledge base container reference, identified by release id- Specified by:
getActiveContainerin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Parameters:
releaseId- knowledge base container module release identifier- Returns:
- knowledge base container instance
-
lookupForDeployedRelease
Description copied from interface:RuleEngineContainerRegistryLookup for a deployed knowledge base container release id by partial release id tokens (e.g. group id and artifact id)- Specified by:
lookupForDeployedReleasein interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Parameters:
releaseTokens- knowledge base container module release identifier- Returns:
- optional of container release id
-
removeActiveContainer
public org.kie.api.runtime.KieContainer removeActiveContainer(org.kie.api.builder.ReleaseId releaseHolder) Description copied from interface:RuleEngineContainerRegistryRemove knowledge base container identified by release id- Specified by:
removeActiveContainerin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Parameters:
releaseHolder- knowledge base container module release identifier- Returns:
- removed knowledge base container instance, null if not found
-
lockReadingRegistry
public void lockReadingRegistry()Description copied from interface:RuleEngineContainerRegistrylock registry for reading operations- Specified by:
lockReadingRegistryin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
-
unlockReadingRegistry
public void unlockReadingRegistry()Description copied from interface:RuleEngineContainerRegistryunlock registry for reading operations- Specified by:
unlockReadingRegistryin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
-
lockWritingRegistry
public void lockWritingRegistry()Description copied from interface:RuleEngineContainerRegistrylock registry for writing operations- Specified by:
lockWritingRegistryin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
-
unlockWritingRegistry
public void unlockWritingRegistry()Description copied from interface:RuleEngineContainerRegistryunlock registry for writing operations- Specified by:
unlockWritingRegistryin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer>
-
isLockedForReading
public boolean isLockedForReading()Description copied from interface:RuleEngineContainerRegistryCheck if the registry is locked for reading- Specified by:
isLockedForReadingin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Returns:
- true if the registry is in the state locked for reading
-
isLockedForWriting
public boolean isLockedForWriting()Description copied from interface:RuleEngineContainerRegistryCheck if the registry is locked for writing- Specified by:
isLockedForWritingin interfaceRuleEngineContainerRegistry<org.kie.api.builder.ReleaseId,org.kie.api.runtime.KieContainer> - Returns:
- true if the registry is in the state locked for writing
-
setup
@PostConstruct public void setup() -
getConcurrentMapFactory
-
setConcurrentMapFactory
-
getReadWriteLock
-
getReadLock
-
getWriteLock
-
isKeepOnlyOneContainerVersion
protected boolean isKeepOnlyOneContainerVersion() -
setKeepOnlyOneContainerVersion
public void setKeepOnlyOneContainerVersion(boolean keepOnlyOneContainerVersion) -
removeAllPreviousVersions
protected void removeAllPreviousVersions(org.kie.api.builder.ReleaseId newReleaseId) -
isPreviousReleaseId
protected boolean isPreviousReleaseId(org.kie.api.builder.ReleaseId newReleaseId, org.kie.api.builder.ReleaseId oldReleaseId) -
isReadLockEnabled
protected boolean isReadLockEnabled() -
setReadLockEnabled
public void setReadLockEnabled(boolean readLockEnabled)
-