public class DefaultPlatformRuleEngineService extends Object implements RuleEngineService
| Modifier and Type | Field and Description |
|---|---|
static String |
SWAPPING_IS_BLOCKING |
| Constructor and Description |
|---|
DefaultPlatformRuleEngineService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addKieBaseModel(KieModuleModel module,
KieFileSystem kfs,
DroolsKIEBaseModel base)
Deprecated.
Will be substituted by
RuleEngineKieModuleSwapper interface call |
protected void |
addKieSessionModel(KieBaseModel base,
DroolsKIESessionModel session)
Deprecated.
to be substituted with
RuleEngineKieModuleSwapper interface call |
protected void |
addRules(KieBaseModel kieBaseModel,
KieFileSystem kfs,
DroolsKIEBaseModel base)
Deprecated.
to be substituted with
RuleEngineKieModuleSwapper interface method call |
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
Archives the given rule if it already exists.
|
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Archives the given rule if it already exists.
|
protected MessageLevel |
convertLevel(Level level)
Deprecated.
|
protected KieModule |
createKieModule(DroolsKIEModuleModel module,
RuleEngineActionResult result)
Deprecated.
substituted by
RuleEngineKieModuleSwapper interface methods |
protected RuleEngineActionResult |
createRuleEngineActionResult(String message,
String moduleName,
boolean success,
MessageLevel level)
creates a RuleEngineActionResult object with the given parameters.
|
protected RuleExecutionCountListener |
createRuleExecutionCounterListener() |
protected void |
doSwapKieContainers(KieContainer kieContainer,
KIEModuleCacheBuilder cache,
RuleEngineActionResult ruleEngineActionResult,
DroolsKIEModuleModel module,
String deployedReleaseIdVersion,
boolean propagateToOtherNodes) |
RuleEvaluationResult |
evaluate(RuleEvaluationContext context)
Executes rule evaluation for given RuleEvaluationContext.
|
protected ConcurrentMapFactory |
getConcurrentMapFactory() |
protected ConfigurationService |
getConfigurationService() |
protected DroolsKIEBaseFinderStrategy |
getDroolsKIEBaseFinderStrategy() |
protected EngineRuleDao |
getEngineRuleDao() |
protected EqualityBehaviorOption |
getEqualityBehaviorOption(DroolsEqualityBehavior behavior)
Deprecated.
|
protected EventProcessingOption |
getEventProcessingOption(DroolsEventProcessingMode eventProcessingMode)
Deprecated.
|
protected EventService |
getEventService() |
protected MultiFlag |
getInitializationMultiFlag() |
protected KieServices |
getKieServices() |
protected ModelService |
getModelService() |
protected Lock |
getReadLock() |
protected ReadWriteLock |
getReadWriteLock() |
protected ReleaseId |
getReleaseId(DroolsKIEModuleModel module)
Deprecated.
Will be substituted by
RuleEngineKieModuleSwapper interface call |
protected RuleEngineCacheService |
getRuleEngineCacheService() |
protected RuleEngineKieModuleSwapper |
getRuleEngineKieModuleSwapper() |
Class<? extends RuleExecutionCountListener> |
getRuleExecutionCounterClass() |
AbstractRuleEngineRuleModel |
getRuleForCode(String code)
Finds AbstractRuleEngineRuleModel for given code.
|
AbstractRuleEngineRuleModel |
getRuleForUuid(String uuid)
Finds AbstractRuleEngineRuleModel for given uuid.
|
protected RuleModuleFinderStrategy |
getRuleModuleFinderStrategy() |
AbstractRulesModuleModel |
getRuleModuleForRule(AbstractRuleEngineRuleModel rule)
Finds AbstractRulesModuleModel by corresponding AbstractRuleEngineRuleModel.
|
protected RulesModuleDao |
getRulesModuleDao() |
protected KieSessionType |
getSessionType(DroolsSessionType sessionType)
Deprecated.
|
protected Lock |
getWriteLock() |
RuleEngineActionResult |
initialize(AbstractRulesModuleModel module)
Initializes the given rules module and propagates a
RuleEngineInitializedEvent to other nodes. |
RuleEngineActionResult |
initialize(AbstractRulesModuleModel abstractModule,
boolean propagateToOtherNodes)
Deprecated.
since 6.3. Please use
initialize method instead |
RuleEngineActionResult |
initialize(AbstractRulesModuleModel abstractModule,
String deployedMvnVersion,
boolean propagateToOtherNodes)
Initializes the given rules module (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
List<RuleEngineActionResult> |
initializeAllRulesModules()
Initializes all
AbstractRulesModuleModels that are marked as active (in case of cluster mode - on all the
nodes). |
List<RuleEngineActionResult> |
initializeAllRulesModules(boolean propagateToOtherNodes)
Initializes all
AbstractRulesModuleModels that are marked as active. |
protected boolean |
isBlocking() |
protected boolean |
isRuleEngineActive() |
protected boolean |
isSessionStateless(DroolsRuleEngineContextModel ruleEngineContext)
Determine if the current RuleEngineContext's KieSession is Stateless.
|
protected Optional<ReleaseId> |
lookupForDeployedReleaseId(DroolsKIEModuleModel kieModule) |
protected void |
notifyOtherNodes(RuleEngineActionResult result) |
protected void |
notifyOtherNodesAboutKieModuleSwapping(String moduleName,
String deployedReleaseIdVersion) |
protected void |
populateRuleEngineActionResult(RuleEngineActionResult result,
String message,
String moduleName,
boolean success,
MessageLevel level)
populates a RuleEngineActionResult object with the given parameters.
|
protected boolean |
removeOldKieModuleIfSwapSuccessful(RuleEngineActionResult result,
ReleaseId oldReleaseId) |
void |
setConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setDroolsKIEBaseFinderStrategy(DroolsKIEBaseFinderStrategy droolsKIEBaseFinderStrategy) |
void |
setEngineRuleDao(EngineRuleDao engineRuleDao) |
void |
setEventService(EventService eventService) |
protected void |
setKieServices(KieServices kieServices) |
void |
setModelService(ModelService modelService) |
void |
setRuleEngineCacheService(RuleEngineCacheService ruleEngineCacheService) |
void |
setRuleEngineKieModuleSwapper(RuleEngineKieModuleSwapper ruleEngineKieModuleSwapper) |
void |
setRuleExecutionCounterClass(Class<? extends RuleExecutionCountListener> ruleExecutionCounterClass) |
void |
setRuleModuleFinderStrategy(RuleModuleFinderStrategy ruleModuleFinderStrategy) |
void |
setRulesModuleDao(RulesModuleDao rulesModuleDao) |
void |
setup()
The method is used to set the date format and KIEServices before the class is put into service(dependency
injection).
|
void |
setUpKieServices()
Deprecated.
substituted by analogous method in
RuleEngineKieModuleSwapper
The method is used to set KIEServices. |
protected void |
switchKieModule(DroolsKIEModuleModel module,
RuleEngineActionResult result,
KieContainerListener listener,
boolean propagateToOtherNodes,
Supplier<Object>... chainOfPostTasks)
Switches the Kie modules in the rule execution context
|
protected ExecutionResultImpl |
tryExecution(StatelessKieSession session,
Command command,
int currentAttempt)
Deprecated.
do not use, this method is subject to change without further notice.
|
RuleEngineActionResult |
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule)
Updates the given rule if it already exists and returns true if update was successful.
|
RuleEngineActionResult |
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Updates the given rule if it already exists.
|
protected DroolsRuleEngineContextModel |
validateRuleEvaluationContext(RuleEvaluationContext context) |
protected void |
writeKModuleXML(KieModuleModel module,
KieFileSystem kfs)
Deprecated.
Will be substituted by
RuleEngineKieModuleSwapper interface call |
protected void |
writePomXML(DroolsKIEModuleModel module,
KieFileSystem kfs)
Deprecated.
Will be substituted by
RuleEngineKieModuleSwapper interface call |
public static final String SWAPPING_IS_BLOCKING
public RuleEvaluationResult evaluate(RuleEvaluationContext context)
RuleEngineServiceevaluate in interface RuleEngineServicecontext - the rule engine context containing data about rule engine executionprotected Optional<ReleaseId> lookupForDeployedReleaseId(DroolsKIEModuleModel kieModule)
protected DroolsRuleEngineContextModel validateRuleEvaluationContext(RuleEvaluationContext context)
@Deprecated protected ExecutionResultImpl tryExecution(StatelessKieSession session, Command command, int currentAttempt)
protected boolean isSessionStateless(DroolsRuleEngineContextModel ruleEngineContext)
ruleEngineContext - the rule engine context@Deprecated public RuleEngineActionResult initialize(AbstractRulesModuleModel abstractModule, boolean propagateToOtherNodes)
initialize method insteadRuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initialize in interface RuleEngineServiceabstractModule - the module to be initializedpropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.RuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult initialize(AbstractRulesModuleModel abstractModule, String deployedMvnVersion, boolean propagateToOtherNodes)
RuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initialize in interface RuleEngineServiceabstractModule - the module to be initializeddeployedMvnVersion - currently deployed mvn version of the rule engine modulepropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.RuleEngineActionResult.isActionFailed() to check if the
action succeeded)protected boolean removeOldKieModuleIfSwapSuccessful(RuleEngineActionResult result, ReleaseId oldReleaseId)
protected boolean isBlocking()
protected void switchKieModule(DroolsKIEModuleModel module, RuleEngineActionResult result, KieContainerListener listener, boolean propagateToOtherNodes, Supplier<Object>... chainOfPostTasks)
module - instance of the DroolsKIEModuleModel moduleresult - instance of RuleEngineActionResult to be used for cluster nodes notificationlistener - instance of KieContainerListener that implements the switching logicchainOfPostTasks - chain of suppliers to be used as a sequence of post-swapping tasksprotected void doSwapKieContainers(KieContainer kieContainer,
KIEModuleCacheBuilder cache,
RuleEngineActionResult ruleEngineActionResult,
DroolsKIEModuleModel module,
String deployedReleaseIdVersion,
boolean propagateToOtherNodes)
@Deprecated protected KieModule createKieModule(DroolsKIEModuleModel module, RuleEngineActionResult result) throws DroolsInitializationException
RuleEngineKieModuleSwapper interface methodsKieModule based on the given DroolsKIEModuleModel object. This makes use of
the following methods:
module - the module to create the KieModule fromDroolsInitializationException - if any errors are encountered during the creationprotected void notifyOtherNodes(RuleEngineActionResult result)
protected void notifyOtherNodesAboutKieModuleSwapping(String moduleName, String deployedReleaseIdVersion)
protected boolean isRuleEngineActive()
public RuleEngineActionResult initialize(AbstractRulesModuleModel module)
RuleEngineServiceRuleEngineInitializedEvent to other nodes.initialize in interface RuleEngineServicemodule - the module to be initializedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public List<RuleEngineActionResult> initializeAllRulesModules(boolean propagateToOtherNodes)
RuleEngineServiceAbstractRulesModuleModels that are marked as active.initializeAllRulesModules in interface RuleEngineServicepropagateToOtherNodes - if true on all the nodes of clusterpublic List<RuleEngineActionResult> initializeAllRulesModules()
RuleEngineServiceAbstractRulesModuleModels that are marked as active (in case of cluster mode - on all the
nodes).initializeAllRulesModules in interface RuleEngineServiceRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule)
RuleEngineServiceupdateEngineRule in interface RuleEngineServiceruleEngineRule - Rule to be updatedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
RuleEngineServiceupdateEngineRule in interface RuleEngineServiceruleEngineRule - Rule to be updatedrulesModule - AbstractRulesModuleModel where the Rule be updatedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
RuleEngineServicearchiveRule in interface RuleEngineServiceruleEngineRule - Rule to be archivedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule, AbstractRulesModuleModel rulesModule)
RuleEngineServicearchiveRule in interface RuleEngineServiceruleEngineRule - Rule to be archivedrulesModule - AbstractRulesModuleModel where the Rule is archivedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)public AbstractRuleEngineRuleModel getRuleForCode(String code)
RuleEngineServicegetRuleForCode in interface RuleEngineServicecode - the rule codepublic AbstractRuleEngineRuleModel getRuleForUuid(String uuid)
RuleEngineServicegetRuleForUuid in interface RuleEngineServiceuuid - the rule uuidpublic AbstractRulesModuleModel getRuleModuleForRule(AbstractRuleEngineRuleModel rule)
RuleEngineServicegetRuleModuleForRule in interface RuleEngineServicerule - the AbstractRuleEngineRuleModel@Deprecated protected void writeKModuleXML(KieModuleModel module, KieFileSystem kfs)
RuleEngineKieModuleSwapper interface callmodule to the given kfs file system.module - the kie modulekfs - the file system@Deprecated protected void writePomXML(DroolsKIEModuleModel module, KieFileSystem kfs)
RuleEngineKieModuleSwapper interface callmodule's pom file to the given kfs file system.module - the kie modulekfs - the file system@Deprecated protected void addKieBaseModel(KieModuleModel module, KieFileSystem kfs, DroolsKIEBaseModel base)
RuleEngineKieModuleSwapper interface callmodule based on the given base. This method
internally calls addRules(KieBaseModel, KieFileSystem, DroolsKIEBaseModel) and
addKieSessionModel(KieBaseModel, DroolsKIESessionModel)module - the kie modulekfs - the file systembase - the hybris KIE base object@Deprecated protected void addRules(KieBaseModel kieBaseModel, KieFileSystem kfs, DroolsKIEBaseModel base)
RuleEngineKieModuleSwapper interface method callbase's rules to the given kfs.kieBaseModel - the kieBaseModelkfs - the file systembase - the hybris KIE base object@Deprecated protected void addKieSessionModel(KieBaseModel base, DroolsKIESessionModel session)
RuleEngineKieModuleSwapper interface callbase based on the given session.base - the kie basesession - the hybris KIE session object@Deprecated protected MessageLevel convertLevel(Level level)
Level to a MessageLevel.@Deprecated protected KieSessionType getSessionType(DroolsSessionType sessionType)
@Deprecated protected EventProcessingOption getEventProcessingOption(DroolsEventProcessingMode eventProcessingMode)
@Deprecated protected EqualityBehaviorOption getEqualityBehaviorOption(DroolsEqualityBehavior behavior)
protected RuleExecutionCountListener createRuleExecutionCounterListener()
@Deprecated protected ReleaseId getReleaseId(DroolsKIEModuleModel module)
RuleEngineKieModuleSwapper interface callmodule - the module to create the ReleaseId forpublic Class<? extends RuleExecutionCountListener> getRuleExecutionCounterClass()
public void setRuleExecutionCounterClass(Class<? extends RuleExecutionCountListener> ruleExecutionCounterClass)
protected EventService getEventService()
public void setEventService(EventService eventService)
protected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
protected RuleEngineActionResult createRuleEngineActionResult(String message, String moduleName, boolean success, MessageLevel level)
message and level.message - the messagemoduleName - the module's namesuccess - whether the operation of this result was successful or not (sets
RuleEngineActionResult.setActionFailed(boolean) with the negated value of successlevel - the message level of the ResultItemprotected void populateRuleEngineActionResult(RuleEngineActionResult result, String message, String moduleName, boolean success, MessageLevel level)
RuleEngineActionResult and should be used with careresult - the RuleEngineActionResult instance to be populated with given fieldsmessage - the messagemoduleName - the module's namesuccess - whether the operation of this result was successful or not (sets
RuleEngineActionResult.setActionFailed(boolean) with the negated value of successlevel - the message level of the ResultItem@PostConstruct public void setup()
protected EngineRuleDao getEngineRuleDao()
public void setEngineRuleDao(EngineRuleDao engineRuleDao)
protected RulesModuleDao getRulesModuleDao()
public void setRulesModuleDao(RulesModuleDao rulesModuleDao)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected RuleModuleFinderStrategy getRuleModuleFinderStrategy()
public void setRuleModuleFinderStrategy(RuleModuleFinderStrategy ruleModuleFinderStrategy)
protected RuleEngineKieModuleSwapper getRuleEngineKieModuleSwapper()
public void setRuleEngineKieModuleSwapper(RuleEngineKieModuleSwapper ruleEngineKieModuleSwapper)
protected DroolsKIEBaseFinderStrategy getDroolsKIEBaseFinderStrategy()
public void setDroolsKIEBaseFinderStrategy(DroolsKIEBaseFinderStrategy droolsKIEBaseFinderStrategy)
protected RuleEngineCacheService getRuleEngineCacheService()
public void setRuleEngineCacheService(RuleEngineCacheService ruleEngineCacheService)
protected ConcurrentMapFactory getConcurrentMapFactory()
public void setConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory)
protected ReadWriteLock getReadWriteLock()
protected Lock getReadLock()
protected Lock getWriteLock()
protected KieServices getKieServices()
protected void setKieServices(KieServices kieServices)
protected MultiFlag getInitializationMultiFlag()
@Deprecated public void setUpKieServices()
RuleEngineKieModuleSwapper
The method is used to set KIEServices.Copyright © 2017 SAP SE. All Rights Reserved.