@Test public void testCreateContainer() throws IOException { testDeployContainer(VERSION); }
@SuppressWarnings("unchecked") @Override public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES); try { KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA); if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) { logger.info("Container {} does not include processes, {} skipped", id, this); return; } boolean hasStatefulSession = false; boolean hasDefaultSession = false; InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer(); Collection<String> kbaseNames = kieContainer.getKieBaseNames(); Collection<String> ksessionNames = new ArrayList<String>(); for (String kbaseName : kbaseNames) { ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName); for (String ksessionName : ksessionNames) { KieSessionModel model = kieContainer.getKieSessionModel(ksessionName); if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) { hasStatefulSession = true; } if (model.isDefault()) { hasDefaultSession = true; } } } if (!hasStatefulSession) { logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this); return; } ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId(); if (releaseId == null) { releaseId = kieContainerInstance.getResource().getReleaseId(); } KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion()); if (!hasDefaultSession) { unit.setKbaseName(kieContainer.getKieBaseModel(id).getName()); unit.setKsessionName(kieContainer.getKieSessionNamesInKieBase(id).iterator().next()); } KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems()); String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY); if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) { unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy)); } String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE); if (mergeMode != null && !mergeMode.isEmpty()) { unit.setMergeMode(MergeMode.valueOf(mergeMode)); } String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION); if (ksession != null) { unit.setKsessionName(ksession); } String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE); if (kbase != null && !kbase.isEmpty()) { unit.setKbaseName(kbase); } unit.setKieContainer(kieContainer); addAsyncHandler(unit, kieContainer); if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering TaskCleanUpProcessEventListener"); addTaskCleanUpProcessListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering BAMTaskEventListener"); addTaskBAMEventListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering IdentityProviderAwareProcessListener"); addProcessIdentityProcessListener(unit, kieContainer); } deploymentService.deploy(unit); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses()); customClasses.add(DocumentImpl.class); kieContainerInstance.addExtraClasses(customClasses); List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader()); if (addedMappers != null && !addedMappers.isEmpty()) { containerMappers.put(id, addedMappers); } QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader()); Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json"); while (queryDefinitionsFiles.hasMoreElements()) { try (InputStream qdStream = queryDefinitionsFiles.nextElement().openStream()) { loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id); } } logger.debug("Container {} created successfully by extension {}", id, this); } catch (Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage())); logger.error("Error when creating container {} by extension {}", id, this, e); } }
JbpmKieServerExtension implements KieServerExtension { @SuppressWarnings("unchecked") @Override public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES); try { KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA); if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) { logger.info("Container {} does not include processes, {} skipped", id, this); return; } boolean hasStatefulSession = false; boolean hasDefaultSession = false; InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer(); Collection<String> kbaseNames = kieContainer.getKieBaseNames(); Collection<String> ksessionNames = new ArrayList<String>(); for (String kbaseName : kbaseNames) { ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName); for (String ksessionName : ksessionNames) { KieSessionModel model = kieContainer.getKieSessionModel(ksessionName); if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) { hasStatefulSession = true; } if (model.isDefault()) { hasDefaultSession = true; } } } if (!hasStatefulSession) { logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this); return; } ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId(); if (releaseId == null) { releaseId = kieContainerInstance.getResource().getReleaseId(); } KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion()); if (!hasDefaultSession) { unit.setKbaseName(kieContainer.getKieBaseModel(id).getName()); unit.setKsessionName(kieContainer.getKieSessionNamesInKieBase(id).iterator().next()); } KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems()); String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY); if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) { unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy)); } String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE); if (mergeMode != null && !mergeMode.isEmpty()) { unit.setMergeMode(MergeMode.valueOf(mergeMode)); } String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION); if (ksession != null) { unit.setKsessionName(ksession); } String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE); if (kbase != null && !kbase.isEmpty()) { unit.setKbaseName(kbase); } unit.setKieContainer(kieContainer); addAsyncHandler(unit, kieContainer); if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering TaskCleanUpProcessEventListener"); addTaskCleanUpProcessListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering BAMTaskEventListener"); addTaskBAMEventListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering IdentityProviderAwareProcessListener"); addProcessIdentityProcessListener(unit, kieContainer); } deploymentService.deploy(unit); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses()); customClasses.add(DocumentImpl.class); kieContainerInstance.addExtraClasses(customClasses); List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader()); if (addedMappers != null && !addedMappers.isEmpty()) { containerMappers.put(id, addedMappers); } QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader()); Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json"); while (queryDefinitionsFiles.hasMoreElements()) { try (InputStream qdStream = queryDefinitionsFiles.nextElement().openStream()) { loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id); } } logger.debug("Container {} created successfully by extension {}", id, this); } catch (Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage())); logger.error("Error when creating container {} by extension {}", id, this, e); } } }
JbpmKieServerExtension implements KieServerExtension { @SuppressWarnings("unchecked") @Override public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES); try { KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA); if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) { logger.info("Container {} does not include processes, {} skipped", id, this); return; } boolean hasStatefulSession = false; boolean hasDefaultSession = false; InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer(); Collection<String> kbaseNames = kieContainer.getKieBaseNames(); Collection<String> ksessionNames = new ArrayList<String>(); for (String kbaseName : kbaseNames) { ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName); for (String ksessionName : ksessionNames) { KieSessionModel model = kieContainer.getKieSessionModel(ksessionName); if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) { hasStatefulSession = true; } if (model.isDefault()) { hasDefaultSession = true; } } } if (!hasStatefulSession) { logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this); return; } ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId(); if (releaseId == null) { releaseId = kieContainerInstance.getResource().getReleaseId(); } KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion()); if (!hasDefaultSession) { unit.setKbaseName(kieContainer.getKieBaseModel(id).getName()); unit.setKsessionName(kieContainer.getKieSessionNamesInKieBase(id).iterator().next()); } KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems()); String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY); if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) { unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy)); } String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE); if (mergeMode != null && !mergeMode.isEmpty()) { unit.setMergeMode(MergeMode.valueOf(mergeMode)); } String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION); if (ksession != null) { unit.setKsessionName(ksession); } String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE); if (kbase != null && !kbase.isEmpty()) { unit.setKbaseName(kbase); } unit.setKieContainer(kieContainer); addAsyncHandler(unit, kieContainer); if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering TaskCleanUpProcessEventListener"); addTaskCleanUpProcessListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering BAMTaskEventListener"); addTaskBAMEventListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering IdentityProviderAwareProcessListener"); addProcessIdentityProcessListener(unit, kieContainer); } deploymentService.deploy(unit); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses()); customClasses.add(DocumentImpl.class); kieContainerInstance.addExtraClasses(customClasses); List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader()); if (addedMappers != null && !addedMappers.isEmpty()) { containerMappers.put(id, addedMappers); } QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader()); Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json"); while (queryDefinitionsFiles.hasMoreElements()) { try (InputStream qdStream = queryDefinitionsFiles.nextElement().openStream()) { loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id); } } logger.debug("Container {} created successfully by extension {}", id, this); } catch (Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage())); logger.error("Error when creating container {} by extension {}", id, this, e); } }  }
JbpmKieServerExtension implements KieServerExtension { @SuppressWarnings("unchecked") @Override public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES); try { KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA); if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) { logger.info("Container {} does not include processes, {} skipped", id, this); return; } boolean hasStatefulSession = false; boolean hasDefaultSession = false; InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer(); Collection<String> kbaseNames = kieContainer.getKieBaseNames(); Collection<String> ksessionNames = new ArrayList<String>(); for (String kbaseName : kbaseNames) { ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName); for (String ksessionName : ksessionNames) { KieSessionModel model = kieContainer.getKieSessionModel(ksessionName); if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) { hasStatefulSession = true; } if (model.isDefault()) { hasDefaultSession = true; } } } if (!hasStatefulSession) { logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this); return; } ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId(); if (releaseId == null) { releaseId = kieContainerInstance.getResource().getReleaseId(); } KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion()); if (!hasDefaultSession) { unit.setKbaseName(kieContainer.getKieBaseModel(id).getName()); unit.setKsessionName(kieContainer.getKieSessionNamesInKieBase(id).iterator().next()); } KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems()); String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY); if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) { unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy)); } String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE); if (mergeMode != null && !mergeMode.isEmpty()) { unit.setMergeMode(MergeMode.valueOf(mergeMode)); } String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION); if (ksession != null) { unit.setKsessionName(ksession); } String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE); if (kbase != null && !kbase.isEmpty()) { unit.setKbaseName(kbase); } unit.setKieContainer(kieContainer); addAsyncHandler(unit, kieContainer); if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering TaskCleanUpProcessEventListener"); addTaskCleanUpProcessListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering BAMTaskEventListener"); addTaskBAMEventListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering IdentityProviderAwareProcessListener"); addProcessIdentityProcessListener(unit, kieContainer); } deploymentService.deploy(unit); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses()); customClasses.add(DocumentImpl.class); kieContainerInstance.addExtraClasses(customClasses); List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader()); if (addedMappers != null && !addedMappers.isEmpty()) { containerMappers.put(id, addedMappers); } QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader()); Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json"); while (queryDefinitionsFiles.hasMoreElements()) { try (InputStream qdStream = queryDefinitionsFiles.nextElement().openStream()) { loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id); } } logger.debug("Container {} created successfully by extension {}", id, this); } catch (Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage())); logger.error("Error when creating container {} by extension {}", id, this, e); } }  @Override boolean isInitialized(); @Override boolean isActive(); @Override void init(KieServerImpl kieServer, KieServerRegistry registry); @Override void destroy(KieServerImpl kieServer, KieServerRegistry registry); @Override void serverStarted(); @SuppressWarnings("unchecked") @Override void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void prepareContainerUpdate(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void activateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void deactivateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override List<Object> getAppComponents(SupportedTransports type); @Override T getAppComponents(Class<T> serviceType); @Override String getImplementedCapability(); @Override List<Object> getServices(); @Override String getExtensionName(); @Override Integer getStartOrder(); @Override String toString(); @Override List<Message> healthCheck(boolean report); }
JbpmKieServerExtension implements KieServerExtension { @SuppressWarnings("unchecked") @Override public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { List<Message> messages = (List<Message>) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MESSAGES); try { KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA); if (metaData.getProcesses() == null || metaData.getProcesses().isEmpty()) { logger.info("Container {} does not include processes, {} skipped", id, this); return; } boolean hasStatefulSession = false; boolean hasDefaultSession = false; InternalKieContainer kieContainer = (InternalKieContainer) kieContainerInstance.getKieContainer(); Collection<String> kbaseNames = kieContainer.getKieBaseNames(); Collection<String> ksessionNames = new ArrayList<String>(); for (String kbaseName : kbaseNames) { ksessionNames = kieContainer.getKieSessionNamesInKieBase(kbaseName); for (String ksessionName : ksessionNames) { KieSessionModel model = kieContainer.getKieSessionModel(ksessionName); if (model.getType().equals(KieSessionModel.KieSessionType.STATEFUL)) { hasStatefulSession = true; } if (model.isDefault()) { hasDefaultSession = true; } } } if (!hasStatefulSession) { logger.info("Container {} does not define stateful ksession thus cannot be handled by extension {}", id, this); return; } ReleaseId releaseId = kieContainerInstance.getKieContainer().getReleaseId(); if (releaseId == null) { releaseId = kieContainerInstance.getResource().getReleaseId(); } KModuleDeploymentUnit unit = new CustomIdKmoduleDeploymentUnit(id, releaseId.getGroupId(), releaseId.getArtifactId(), releaseId.getVersion()); if (!hasDefaultSession) { unit.setKbaseName(kieContainer.getKieBaseModel(id).getName()); unit.setKsessionName(kieContainer.getKieSessionNamesInKieBase(id).iterator().next()); } KieServerConfig config = new KieServerConfig(kieContainerInstance.getResource().getConfigItems()); String runtimeStrategy = config.getConfigItemValue(KieServerConstants.PCFG_RUNTIME_STRATEGY); if (runtimeStrategy != null && !runtimeStrategy.isEmpty()) { unit.setStrategy(RuntimeStrategy.valueOf(runtimeStrategy)); } String mergeMode = config.getConfigItemValue(KieServerConstants.PCFG_MERGE_MODE); if (mergeMode != null && !mergeMode.isEmpty()) { unit.setMergeMode(MergeMode.valueOf(mergeMode)); } String ksession = config.getConfigItemValue(KieServerConstants.PCFG_KIE_SESSION); if (ksession != null) { unit.setKsessionName(ksession); } String kbase = config.getConfigItemValue(KieServerConstants.PCFG_KIE_BASE); if (kbase != null && !kbase.isEmpty()) { unit.setKbaseName(kbase); } unit.setKieContainer(kieContainer); addAsyncHandler(unit, kieContainer); if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_CLEANUP_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering TaskCleanUpProcessEventListener"); addTaskCleanUpProcessListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_TASK_BAM_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering BAMTaskEventListener"); addTaskBAMEventListener(unit, kieContainer); } if (System.getProperty(KieServerConstants.CFG_JBPM_PROCESS_IDENTITY_LISTENER, "true").equalsIgnoreCase("true")) { logger.debug("Registering IdentityProviderAwareProcessListener"); addProcessIdentityProcessListener(unit, kieContainer); } deploymentService.deploy(unit); DeployedUnit deployedUnit = deploymentService.getDeployedUnit(unit.getIdentifier()); Set<Class<?>> customClasses = new HashSet<Class<?>>(deployedUnit.getDeployedClasses()); customClasses.add(DocumentImpl.class); kieContainerInstance.addExtraClasses(customClasses); List<String> addedMappers = QueryMapperRegistry.get().discoverAndAddMappers(kieContainer.getClassLoader()); if (addedMappers != null && !addedMappers.isEmpty()) { containerMappers.put(id, addedMappers); } QueryParamBuilderManager.get().discoverAndAddQueryFactories(id, kieContainer.getClassLoader()); Enumeration<URL> queryDefinitionsFiles = kieContainer.getClassLoader().getResources("query-definitions.json"); while (queryDefinitionsFiles.hasMoreElements()) { try (InputStream qdStream = queryDefinitionsFiles.nextElement().openStream()) { loadAndRegisterQueryDefinitions(qdStream, kieContainerInstance.getMarshaller(MarshallingFormat.JSON), id); } } logger.debug("Container {} created successfully by extension {}", id, this); } catch (Exception e) { Throwable root = ExceptionUtils.getRootCause(e); if (root == null) { root = e; } messages.add(new Message(Severity.ERROR, "Error when creating container " + id + " by extension " + this + " due to " + root.getMessage())); logger.error("Error when creating container {} by extension {}", id, this, e); } }  @Override boolean isInitialized(); @Override boolean isActive(); @Override void init(KieServerImpl kieServer, KieServerRegistry registry); @Override void destroy(KieServerImpl kieServer, KieServerRegistry registry); @Override void serverStarted(); @SuppressWarnings("unchecked") @Override void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void prepareContainerUpdate(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void activateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void deactivateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override List<Object> getAppComponents(SupportedTransports type); @Override T getAppComponents(Class<T> serviceType); @Override String getImplementedCapability(); @Override List<Object> getServices(); @Override String getExtensionName(); @Override Integer getStartOrder(); @Override String toString(); @Override List<Message> healthCheck(boolean report); static final String EXTENSION_NAME; }