use of org.jbpm.kie.services.impl.admin.ProcessInstanceMigrationServiceImpl in project jbpm by kiegroup.
the class DefaultCaseServiceConfigurator method configureServices.
@Override
public void configureServices(String puName, IdentityProvider identityProvider) {
emf = EntityManagerFactoryManager.get().getOrCreate(puName);
authorizationManager = new AuthorizationManagerImpl(identityProvider, new TransactionalCommandService(emf));
// build definition service
bpmn2Service = new BPMN2DataServiceImpl();
DeploymentRolesManager deploymentRolesManager = new DeploymentRolesManager();
queryService = new QueryServiceImpl();
((QueryServiceImpl) queryService).setIdentityProvider(identityProvider);
((QueryServiceImpl) queryService).setCommandService(new TransactionalCommandService(emf));
((QueryServiceImpl) queryService).init();
// build deployment service
deploymentService = new KModuleDeploymentService();
((KModuleDeploymentService) deploymentService).setBpmn2Service(bpmn2Service);
((KModuleDeploymentService) deploymentService).setEmf(emf);
((KModuleDeploymentService) deploymentService).setIdentityProvider(identityProvider);
((KModuleDeploymentService) deploymentService).setManagerFactory(new RuntimeManagerFactoryImpl());
((KModuleDeploymentService) deploymentService).setFormManagerService(new FormManagerServiceImpl());
TaskService taskService = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).getTaskService();
// build runtime data service
runtimeDataService = new RuntimeDataServiceImpl();
((RuntimeDataServiceImpl) runtimeDataService).setCommandService(new TransactionalCommandService(emf));
((RuntimeDataServiceImpl) runtimeDataService).setIdentityProvider(identityProvider);
((RuntimeDataServiceImpl) runtimeDataService).setTaskService(taskService);
((RuntimeDataServiceImpl) runtimeDataService).setDeploymentRolesManager(deploymentRolesManager);
((RuntimeDataServiceImpl) runtimeDataService).setTaskAuditService(TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService());
((KModuleDeploymentService) deploymentService).setRuntimeDataService(runtimeDataService);
// build process service
processService = new ProcessServiceImpl();
((ProcessServiceImpl) processService).setDataService(runtimeDataService);
((ProcessServiceImpl) processService).setDeploymentService(deploymentService);
// build user task service
userTaskService = new UserTaskServiceImpl();
((UserTaskServiceImpl) userTaskService).setDataService(runtimeDataService);
((UserTaskServiceImpl) userTaskService).setDeploymentService(deploymentService);
// build case id generator
caseIdGenerator = new TableCaseIdGenerator(new TransactionalCommandService(emf));
// build case runtime data service
caseRuntimeDataService = new CaseRuntimeDataServiceImpl();
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setCaseIdGenerator(caseIdGenerator);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setRuntimeDataService(runtimeDataService);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setCommandService(new TransactionalCommandService(emf));
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setIdentityProvider(identityProvider);
((CaseRuntimeDataServiceImpl) caseRuntimeDataService).setDeploymentRolesManager(deploymentRolesManager);
advanceCaseRuntimeDataService = new AdvanceCaseRuntimeDataServiceImpl();
((AdvanceCaseRuntimeDataServiceImpl) advanceCaseRuntimeDataService).setEmf(emf);
((AdvanceCaseRuntimeDataServiceImpl) advanceCaseRuntimeDataService).setCommandService(new TransactionalCommandService(emf));
// build case service
caseService = new CaseServiceImpl();
((CaseServiceImpl) caseService).setCaseIdGenerator(caseIdGenerator);
((CaseServiceImpl) caseService).setCaseRuntimeDataService(caseRuntimeDataService);
((CaseServiceImpl) caseService).setProcessService(processService);
((CaseServiceImpl) caseService).setDeploymentService(deploymentService);
((CaseServiceImpl) caseService).setRuntimeDataService(runtimeDataService);
((CaseServiceImpl) caseService).setCommandService(new TransactionalCommandService(emf));
((CaseServiceImpl) caseService).setAuthorizationManager(authorizationManager);
((CaseServiceImpl) caseService).setIdentityProvider(identityProvider);
CaseConfigurationDeploymentListener configurationListener = new CaseConfigurationDeploymentListener(identityProvider);
// set runtime data service as listener on deployment service
((KModuleDeploymentService) deploymentService).addListener((RuntimeDataServiceImpl) runtimeDataService);
((KModuleDeploymentService) deploymentService).addListener((BPMN2DataServiceImpl) bpmn2Service);
((KModuleDeploymentService) deploymentService).addListener((QueryServiceImpl) queryService);
((KModuleDeploymentService) deploymentService).addListener((CaseRuntimeDataServiceImpl) caseRuntimeDataService);
((KModuleDeploymentService) deploymentService).addListener(configurationListener);
// build case instance migration service
migrationService = new ProcessInstanceMigrationServiceImpl();
caseInstanceMigrationService = new CaseInstanceMigrationServiceImpl();
((CaseInstanceMigrationServiceImpl) caseInstanceMigrationService).setCaseRuntimeDataService(caseRuntimeDataService);
((CaseInstanceMigrationServiceImpl) caseInstanceMigrationService).setCommandService(new TransactionalCommandService(emf));
((CaseInstanceMigrationServiceImpl) caseInstanceMigrationService).setProcessInstanceMigrationService(migrationService);
((CaseInstanceMigrationServiceImpl) caseInstanceMigrationService).setProcessService(processService);
}
use of org.jbpm.kie.services.impl.admin.ProcessInstanceMigrationServiceImpl in project droolsjbpm-integration by kiegroup.
the class JbpmKieServerExtension method configureServices.
protected void configureServices(KieServerImpl kieServer, KieServerRegistry registry) {
KieServerConfig config = registry.getConfig();
// loaded from system property as callback info isn't stored as configuration in kie server repository
String callbackConfig = System.getProperty(KieServerConstants.CFG_HT_CALLBACK);
// if no other callback set, use Elytron or jaas by default
if (callbackConfig == null || callbackConfig.isEmpty()) {
if (ElytronIdentityProvider.available()) {
System.setProperty(KieServerConstants.CFG_HT_CALLBACK, "custom");
String name = ElytronUserGroupCallbackImpl.class.getName();
ElytronUserGroupCallbackImpl.addExternalUserGroupAdapter(new JMSUserGroupAdapter());
System.setProperty(KieServerConstants.CFG_HT_CALLBACK_CLASS, name);
} else {
System.setProperty(KieServerConstants.CFG_HT_CALLBACK, "jaas");
JAASUserGroupCallbackImpl.addExternalUserGroupAdapter(new JMSUserGroupAdapter());
}
}
this.isExecutorAvailable = isExecutorOnClasspath();
EntityManagerFactory emf = build(getPersistenceProperties(config));
EntityManagerFactoryManager.get().addEntityManagerFactory(persistenceUnitName, emf);
formManagerService = new FormManagerServiceImpl();
// build definition service
definitionService = new BPMN2DataServiceImpl();
// build deployment service
deploymentService = new KModuleDeploymentService();
((KModuleDeploymentService) deploymentService).setBpmn2Service(definitionService);
((KModuleDeploymentService) deploymentService).setEmf(emf);
((KModuleDeploymentService) deploymentService).setIdentityProvider(registry.getIdentityProvider());
((KModuleDeploymentService) deploymentService).setManagerFactory(new RuntimeManagerFactoryImpl());
((KModuleDeploymentService) deploymentService).setFormManagerService(formManagerService);
// configure user group callback
UserGroupCallback userGroupCallback = UserDataServiceProvider.getUserGroupCallback();
UserInfo userInfo = UserDataServiceProvider.getUserInfo();
TaskService taskService = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).userGroupCallback(userGroupCallback).userInfo(userInfo).getTaskService();
// build runtime data service
runtimeDataService = new RuntimeDataServiceImpl();
((RuntimeDataServiceImpl) runtimeDataService).setCommandService(new TransactionalCommandService(emf));
((RuntimeDataServiceImpl) runtimeDataService).setIdentityProvider(registry.getIdentityProvider());
((RuntimeDataServiceImpl) runtimeDataService).setTaskService(taskService);
((RuntimeDataServiceImpl) runtimeDataService).setTaskAuditService(TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService());
((KModuleDeploymentService) deploymentService).setRuntimeDataService(runtimeDataService);
// build process service
processService = new ProcessServiceImpl();
((ProcessServiceImpl) processService).setDataService(runtimeDataService);
((ProcessServiceImpl) processService).setDeploymentService(deploymentService);
// build user task service
userTaskService = new UserTaskServiceImpl();
((UserTaskServiceImpl) userTaskService).setDataService(runtimeDataService);
((UserTaskServiceImpl) userTaskService).setDeploymentService(deploymentService);
// build query service
queryService = new QueryServiceImpl();
((QueryServiceImpl) queryService).setIdentityProvider(registry.getIdentityProvider());
((QueryServiceImpl) queryService).setCommandService(new TransactionalCommandService(emf));
Function<String, String> kieServerDataSourceResolver = input -> {
String dataSource = input;
Matcher matcher = PARAMETER_MATCHER.matcher(dataSource);
while (matcher.find()) {
String paramName = matcher.group(1);
KieServerConfig configuration = context.getStateRepository().load(KieServerEnvironment.getServerId()).getConfiguration();
dataSource = configuration.getConfigItemValue(paramName, "java:jboss/datasources/ExampleDS");
logger.info("Data source expression {} resolved to {}", input, dataSource);
}
return dataSource;
};
((QueryServiceImpl) queryService).setDataSourceResolver(kieServerDataSourceResolver);
((QueryServiceImpl) queryService).init();
// set runtime data service as listener on deployment service
((KModuleDeploymentService) deploymentService).addListener(((RuntimeDataServiceImpl) runtimeDataService));
((KModuleDeploymentService) deploymentService).addListener(((BPMN2DataServiceImpl) definitionService));
((KModuleDeploymentService) deploymentService).addListener(((QueryServiceImpl) queryService));
if (config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_DISABLED, "false").equalsIgnoreCase("false")) {
String executorQueueName = config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_JMS_QUEUE, "queue/KIE.SERVER.EXECUTOR");
// build executor service
executorService = ExecutorServiceFactory.newExecutorService(emf);
executorService.setInterval(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_INTERVAL, "0")));
executorService.setRetries(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_RETRIES, "3")));
executorService.setThreadPoolSize(Integer.parseInt(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_POOL, "1")));
executorService.setTimeunit(TimeUnit.valueOf(config.getConfigItemValue(KieServerConstants.CFG_EXECUTOR_TIME_UNIT, "SECONDS")));
((ExecutorImpl) ((ExecutorServiceImpl) executorService).getExecutor()).setQueueName(executorQueueName);
((KModuleDeploymentService) deploymentService).setExecutorService(executorService);
}
// admin services
this.processInstanceMigrationService = new ProcessInstanceMigrationServiceImpl();
this.processInstanceAdminService = new ProcessInstanceAdminServiceImpl();
((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setProcessService(processService);
((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setRuntimeDataService(runtimeDataService);
((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setCommandService(new TransactionalCommandService(emf));
((ProcessInstanceAdminServiceImpl) this.processInstanceAdminService).setIdentityProvider(registry.getIdentityProvider());
this.userTaskAdminService = new UserTaskAdminServiceImpl();
((UserTaskAdminServiceImpl) this.userTaskAdminService).setRuntimeDataService(runtimeDataService);
((UserTaskAdminServiceImpl) this.userTaskAdminService).setUserTaskService(userTaskService);
((UserTaskAdminServiceImpl) this.userTaskAdminService).setIdentityProvider(context.getIdentityProvider());
((UserTaskAdminServiceImpl) this.userTaskAdminService).setCommandService(new TransactionalCommandService(emf));
this.advanceRuntimeDataService = new AdvanceRuntimeDataServiceImpl();
((AdvanceRuntimeDataServiceImpl) this.advanceRuntimeDataService).setEmf(emf);
((AdvanceRuntimeDataServiceImpl) this.advanceRuntimeDataService).setCommandService(new TransactionalCommandService(emf));
this.kieContainerCommandService = new JBPMKieContainerCommandServiceImpl(context, deploymentService, new DefinitionServiceBase(definitionService, context), new ProcessServiceBase(processService, definitionService, runtimeDataService, context), new UserTaskServiceBase(userTaskService, context), new RuntimeDataServiceBase(runtimeDataService, advanceRuntimeDataService, context), new ExecutorServiceBase(executorService, context), new QueryDataServiceBase(queryService, context), new DocumentServiceBase(context), new ProcessAdminServiceBase(processInstanceMigrationService, processInstanceAdminService, runtimeDataService, context), new UserTaskAdminServiceBase(userTaskAdminService, context));
}
Aggregations