public class DefaultPlatformRuleEngineService extends java.lang.Object implements RuleEngineService
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MODULE_MVN_VERSION_NONE |
static java.lang.String |
SWAPPING_IS_BLOCKING |
| Constructor and Description |
|---|
DefaultPlatformRuleEngineService() |
| Modifier and Type | Method and Description |
|---|---|
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
Deprecated.
since 1811
|
RuleEngineActionResult |
archiveRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Deprecated.
since 1811
|
<T extends DroolsRuleModel> |
archiveRules(java.util.Collection<T> engineRules)
Archive a collection of rules
|
protected RuleEngineActionResult |
createRuleEngineActionResult(java.lang.String message,
java.lang.String moduleName,
boolean success,
MessageLevel level)
creates a RuleEngineActionResult object with the given parameters.
|
<T extends AbstractRuleEngineRuleModel> |
deactivateRulesModuleEngineRules(java.lang.String moduleName,
java.util.Collection<T> engineRules)
make the specified collection of engine rules belonging to a specified module inactive, so that the engine wouln't take them
in consideration during init
|
protected void |
doSwapKieContainers(KieContainer kieContainer,
KIEModuleCacheBuilder cache,
RuleEngineActionResult ruleEngineActionResult,
DroolsKIEModuleModel module,
java.lang.String deployedReleaseIdVersion,
boolean propagateToOtherNodes) |
RuleEvaluationResult |
evaluate(RuleEvaluationContext context)
Since 6.0
Executes rule evaluation for given RuleEvaluationContext.
|
protected java.util.function.Supplier<ExecutionResults> |
executionResultsSupplierWithStatefulSession(KieContainer kContainer,
BatchExecutionCommand command,
RuleEvaluationContext context) |
protected java.util.function.Supplier<ExecutionResults> |
executionResultsSupplierWithStatelessSession(KieContainer kContainer,
BatchExecutionCommand command,
RuleEvaluationContext context) |
protected ConcurrentMapFactory |
getConcurrentMapFactory() |
protected ConfigurationService |
getConfigurationService() |
protected DroolsKIEBaseFinderStrategy |
getDroolsKIEBaseFinderStrategy() |
protected EngineRuleDao |
getEngineRuleDao() |
protected RuleEngineTaskProcessor<AbstractRuleEngineRuleModel,TaskResult> |
getEngineRulesPersistingTaskProcessor() |
protected EngineRulesRepository |
getEngineRulesRepository() |
protected EventService |
getEventService() |
protected MultiFlag |
getInitializationMultiFlag() |
protected KieSessionHelper |
getKieSessionHelper() |
protected ModelService |
getModelService() |
protected PostRulesModuleSwappingTasksProvider |
getPostRulesModuleSwappingTasksProvider() |
protected RuleEngineBootstrap<KieServices,KieContainer,DroolsKIEModuleModel> |
getRuleEngineBootstrap() |
protected RuleEngineCacheService |
getRuleEngineCacheService() |
protected RuleEngineContainerRegistry<ReleaseId,KieContainer> |
getRuleEngineContainerRegistry() |
protected RuleEngineKieModuleSwapper |
getRuleEngineKieModuleSwapper() |
AbstractRuleEngineRuleModel |
getRuleForCodeAndModule(java.lang.String code,
java.lang.String moduleName)
Finds AbstractRuleEngineRuleModel for given code and module.
|
AbstractRuleEngineRuleModel |
getRuleForUuid(java.lang.String uuid)
Finds AbstractRuleEngineRuleModel for given uuid.
|
protected RulesModuleDao |
getRulesModuleDao() |
void |
initialize(AbstractRulesModuleModel abstractModule,
java.lang.String deployedMvnVersion,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate,
RuleEngineActionResult result)
Since 6.4
Initializes the given rules module (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
void |
initialize(AbstractRulesModuleModel abstractModule,
java.lang.String deployedMvnVersion,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate,
RuleEngineActionResult result,
ExecutionContext executionContext)
Since 18.08
Initializes the given rules module (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
InitializationFuture |
initialize(java.util.List<AbstractRulesModuleModel> modules,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate)
Since 6.4
Initializes the given rules module in blocking/async mode (depending on blocking param) (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
InitializationFuture |
initialize(java.util.List<AbstractRulesModuleModel> modules,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate,
ExecutionContext executionContext)
Since 6.7
Initializes the given rules module in blocking/async mode (depending on blocking param) (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
java.util.List<RuleEngineActionResult> |
initializeAllRulesModules()
Initializes all
AbstractRulesModuleModels that are marked as active (in case of cluster mode - on all the
nodes). |
java.util.List<RuleEngineActionResult> |
initializeAllRulesModules(boolean propagateToOtherNodes)
Initializes all
AbstractRulesModuleModels that are marked as active. |
void |
initializeNonBlocking(AbstractRulesModuleModel abstractModule,
java.lang.String deployedMvnVersion,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate,
RuleEngineActionResult result)
Since 6.4
Asynchronously initializes the given rules module (and if
propagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes). |
protected boolean |
isBlocking() |
protected boolean |
isRuleEngineActive() |
protected void |
notifyOtherNodes(RuleEngineActionResult result) |
protected void |
notifyOtherNodesAboutKieModuleSwapping(java.lang.String moduleName,
java.lang.String deployedReleaseIdVersion) |
protected void |
populateRuleEngineActionResult(RuleEngineActionResult result,
java.lang.String message,
java.lang.String moduleName,
boolean success,
MessageLevel level)
populates a RuleEngineActionResult object with the given parameters.
|
void |
setConcurrentMapFactory(ConcurrentMapFactory concurrentMapFactory) |
void |
setConfigurationService(ConfigurationService configurationService) |
void |
setDroolsKIEBaseFinderStrategy(DroolsKIEBaseFinderStrategy droolsKIEBaseFinderStrategy) |
void |
setEngineRuleDao(EngineRuleDao engineRuleDao) |
void |
setEngineRulesPersistingTaskProcessor(RuleEngineTaskProcessor<AbstractRuleEngineRuleModel,TaskResult> engineRulesPersistingTaskProcessor) |
void |
setEngineRulesRepository(EngineRulesRepository engineRulesRepository) |
void |
setEventService(EventService eventService) |
void |
setKieSessionHelper(KieSessionHelper kieSessionHelper) |
void |
setModelService(ModelService modelService) |
void |
setPostRulesModuleSwappingTasksProvider(PostRulesModuleSwappingTasksProvider postRulesModuleSwappingTasksProvider) |
void |
setRuleEngineBootstrap(RuleEngineBootstrap<KieServices,KieContainer,DroolsKIEModuleModel> ruleEngineBootstrap) |
void |
setRuleEngineCacheService(RuleEngineCacheService ruleEngineCacheService) |
void |
setRuleEngineContainerRegistry(RuleEngineContainerRegistry<ReleaseId,KieContainer> ruleEngineContainerRegistry) |
void |
setRuleEngineKieModuleSwapper(RuleEngineKieModuleSwapper ruleEngineKieModuleSwapper) |
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).
|
protected void |
switchKieModule(DroolsKIEModuleModel module,
KieContainerListener listener,
boolean propagateToOtherNodes,
boolean enableIncrementalUpdate,
RuleEngineActionResult result,
java.util.Collection<java.util.function.Supplier<java.lang.Object>> chainOfPostTasks)
Switches the Kie modules in the rule execution context
|
RuleEngineActionResult |
updateEngineRule(AbstractRuleEngineRuleModel ruleEngineRule,
AbstractRulesModuleModel rulesModule)
Updates the given rule if it already exists.
|
protected java.util.Optional<RuleEngineActionResult> |
validateEngineRulesModule(AbstractRulesModuleModel rulesModule) |
public static final java.lang.String MODULE_MVN_VERSION_NONE
public static final java.lang.String SWAPPING_IS_BLOCKING
public RuleEvaluationResult evaluate(RuleEvaluationContext context)
RuleEngineServiceevaluate in interface RuleEngineServicecontext - the rule engine context containing data about rule engine executionprotected java.util.function.Supplier<ExecutionResults> executionResultsSupplierWithStatefulSession(KieContainer kContainer,
BatchExecutionCommand command,
RuleEvaluationContext context)
protected java.util.function.Supplier<ExecutionResults> executionResultsSupplierWithStatelessSession(KieContainer kContainer,
BatchExecutionCommand command,
RuleEvaluationContext context)
public InitializationFuture initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate)
RuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initialize in interface RuleEngineServicemodules - the modules to be initializedpropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.enableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleInitializationFuture to be used for eventual blocking on multiple parallel swappingpublic InitializationFuture initialize(java.util.List<AbstractRulesModuleModel> modules, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, ExecutionContext executionContext)
RuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initialize in interface RuleEngineServicemodules - the modules to be initializedpropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.enableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleexecutionContext - instance of ExecutionContext that serves as a storage for initialization related dataInitializationFuture to be used for eventual blocking on multiple parallel swappingpublic void initializeNonBlocking(AbstractRulesModuleModel abstractModule, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
RuleEngineServicepropagateToOtherNodes is set to true propagates a
RuleEngineInitializedEvent to other nodes).initializeNonBlocking in interface RuleEngineServiceabstractModule - the module to be initializeddeployedMvnVersion - currently deployed version of the Kie ModulepropagateToOtherNodes - if true propagates a RuleEngineInitializedEvent to other nodes.enableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleresult - the instance of RuleEngineActionResult accumulating the results of initializationpublic void initialize(AbstractRulesModuleModel abstractModule, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result)
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.enableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleresult - the instance of RuleEngineActionResult accumulating the results of initializationpublic void initialize(AbstractRulesModuleModel abstractModule, java.lang.String deployedMvnVersion, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result, ExecutionContext executionContext)
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.enableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleresult - the instance of RuleEngineActionResult accumulating the results of initializationexecutionContext - the instance of ExecutionContext to be set as executionContext of RuleEngineActionResult if not nullpublic <T extends AbstractRuleEngineRuleModel> void deactivateRulesModuleEngineRules(java.lang.String moduleName, java.util.Collection<T> engineRules)
RuleEngineServicedeactivateRulesModuleEngineRules in interface RuleEngineServiceT - a type of engine rulesmoduleName - Name of the module the rules should refer to when applying changesengineRules - A collection of AbstractRuleEngineRuleModel to be deactivatedprotected void doSwapKieContainers(KieContainer kieContainer,
KIEModuleCacheBuilder cache,
RuleEngineActionResult ruleEngineActionResult,
DroolsKIEModuleModel module,
java.lang.String deployedReleaseIdVersion,
boolean propagateToOtherNodes)
protected boolean isBlocking()
protected void switchKieModule(DroolsKIEModuleModel module, KieContainerListener listener, boolean propagateToOtherNodes, boolean enableIncrementalUpdate, RuleEngineActionResult result, java.util.Collection<java.util.function.Supplier<java.lang.Object>> chainOfPostTasks)
module - instance of the DroolsKIEModuleModel modulelistener - instance of KieContainerListener that implements the switching logicpropagateToOtherNodes - flag, if true, enables the module swap/initialization event be propagated in the clusterenableIncrementalUpdate - flag, if true, enables for incremental updates of the rule engine kie moduleresult - instance of RuleEngineActionResult to be used for cluster nodes notificationchainOfPostTasks - chain of suppliers to be used as a sequence of post-swapping tasksprotected void notifyOtherNodes(RuleEngineActionResult result)
protected void notifyOtherNodesAboutKieModuleSwapping(java.lang.String moduleName,
java.lang.String deployedReleaseIdVersion)
protected boolean isRuleEngineActive()
public java.util.List<RuleEngineActionResult> initializeAllRulesModules(boolean propagateToOtherNodes)
RuleEngineServiceAbstractRulesModuleModels that are marked as active.initializeAllRulesModules in interface RuleEngineServicepropagateToOtherNodes - if true on all the nodes of clusterpublic java.util.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, AbstractRulesModuleModel rulesModule)
RuleEngineServiceupdateEngineRule in interface RuleEngineServiceruleEngineRule - Rule to be updatedrulesModule - AbstractRulesModuleModel where the Rule be updatedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)protected java.util.Optional<RuleEngineActionResult> validateEngineRulesModule(AbstractRulesModuleModel rulesModule)
@Deprecated public RuleEngineActionResult archiveRule(AbstractRuleEngineRuleModel ruleEngineRule)
RuleEngineServicearchiveRule in interface RuleEngineServiceruleEngineRule - Rule to be archivedRuleEngineActionResult.isActionFailed() to check if the
action succeeded)@Deprecated 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 <T extends DroolsRuleModel> java.util.Optional<InitializationFuture> archiveRules(java.util.Collection<T> engineRules)
RuleEngineServicearchiveRules in interface RuleEngineServiceT - subtype of DroolsRuleModelengineRules - collection of DroolsRuleModel instancesInitializationFuture keeping the status of initializationpublic AbstractRuleEngineRuleModel getRuleForCodeAndModule(java.lang.String code, java.lang.String moduleName)
RuleEngineServicegetRuleForCodeAndModule in interface RuleEngineServicecode - the rule codemoduleName - the rules module namepublic AbstractRuleEngineRuleModel getRuleForUuid(java.lang.String uuid)
RuleEngineServicegetRuleForUuid in interface RuleEngineServiceuuid - the rule uuidprotected EventService getEventService()
public void setEventService(EventService eventService)
protected ConfigurationService getConfigurationService()
public void setConfigurationService(ConfigurationService configurationService)
protected RuleEngineActionResult createRuleEngineActionResult(java.lang.String message, java.lang.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, java.lang.String message, java.lang.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 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 MultiFlag getInitializationMultiFlag()
protected KieSessionHelper getKieSessionHelper()
public void setKieSessionHelper(KieSessionHelper kieSessionHelper)
protected RuleEngineTaskProcessor<AbstractRuleEngineRuleModel,TaskResult> getEngineRulesPersistingTaskProcessor()
public void setEngineRulesPersistingTaskProcessor(RuleEngineTaskProcessor<AbstractRuleEngineRuleModel,TaskResult> engineRulesPersistingTaskProcessor)
protected RuleEngineBootstrap<KieServices,KieContainer,DroolsKIEModuleModel> getRuleEngineBootstrap()
public void setRuleEngineBootstrap(RuleEngineBootstrap<KieServices,KieContainer,DroolsKIEModuleModel> ruleEngineBootstrap)
protected RuleEngineContainerRegistry<ReleaseId,KieContainer> getRuleEngineContainerRegistry()
public void setRuleEngineContainerRegistry(RuleEngineContainerRegistry<ReleaseId,KieContainer> ruleEngineContainerRegistry)
protected EngineRulesRepository getEngineRulesRepository()
public void setEngineRulesRepository(EngineRulesRepository engineRulesRepository)
protected PostRulesModuleSwappingTasksProvider getPostRulesModuleSwappingTasksProvider()
public void setPostRulesModuleSwappingTasksProvider(PostRulesModuleSwappingTasksProvider postRulesModuleSwappingTasksProvider)
Copyright © 2018 SAP SE. All Rights Reserved.