Search in sources :

Example 1 with MscManagedProcessEngineController

use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.

the class ProcessEngineStartProcessor method startProcessEngine.

protected void startProcessEngine(ProcessEngineXml processEngineXml, DeploymentPhaseContext phaseContext) {
    final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
    // transform configuration
    ManagedProcessEngineMetadata configuration = transformConfiguration(processEngineXml);
    // validate the configuration
    configuration.validate();
    // create service instance
    MscManagedProcessEngineController service = new MscManagedProcessEngineController(configuration);
    // get the service name for the process engine
    ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngineXml.getName());
    // get service builder
    ServiceBuilder<ProcessEngine> serviceBuilder = serviceTarget.addService(serviceName, service);
    // make this service depend on the current phase -> makes sure it is removed with the phase service at undeployment
    serviceBuilder.addDependency(phaseContext.getPhaseServiceName());
    // add Service dependencies
    MscManagedProcessEngineController.initializeServiceBuilder(configuration, service, serviceBuilder, processEngineXml.getJobAcquisitionName());
    // make this start on demand
    serviceBuilder.setInitialMode(Mode.ACTIVE);
    // install the service
    serviceBuilder.install();
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) ManagedProcessEngineMetadata(org.camunda.bpm.container.impl.jboss.config.ManagedProcessEngineMetadata) MscManagedProcessEngineController(org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 2 with MscManagedProcessEngineController

use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.

the class JBossSubsystemXMLTest method testInstallSubsystemWithEnginesAndPropertiesXml.

@Test
public void testInstallSubsystemWithEnginesAndPropertiesXml() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_AND_PROPERTIES);
    KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
    ServiceContainer container = services.getContainer();
    assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));
    ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
    assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
    ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
    Map<String, String> configurationProperties = metadata.getConfigurationProperties();
    assertEquals("default", configurationProperties.get("job-name"));
    assertEquals("default", configurationProperties.get("job-acquisition"));
    assertEquals("default", configurationProperties.get("job-acquisition-name"));
    Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
    assertTrue(foxLegacyProperties.isEmpty());
    assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));
    assertNotNull("process engine controller for engine __emptyPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__emptyPropertiesTag")));
    assertNotNull("process engine controller for engine __noPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__noPropertiesTag")));
}
Also used : ServiceContainer(org.jboss.msc.service.ServiceContainer) KernelServices(org.jboss.as.subsystem.test.KernelServices) ManagedProcessEngineMetadata(org.camunda.bpm.container.impl.jboss.config.ManagedProcessEngineMetadata) MscManagedProcessEngineController(org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

Example 3 with MscManagedProcessEngineController

use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.

the class JBossSubsystemXMLTest method testInstallSubsystemWithEnginesPropertiesPlugins.

@Test
public void testInstallSubsystemWithEnginesPropertiesPlugins() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_PROPERTIES_PLUGINS);
    KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
    ServiceContainer container = services.getContainer();
    assertNotNull("platform service should be installed", container.getRequiredService(PLATFORM_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getRequiredService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));
    ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
    assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
    ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
    Map<String, String> configurationProperties = metadata.getConfigurationProperties();
    assertEquals("default", configurationProperties.get("job-name"));
    assertEquals("default", configurationProperties.get("job-acquisition"));
    assertEquals("default", configurationProperties.get("job-acquisition-name"));
    Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
    assertTrue(foxLegacyProperties.isEmpty());
    assertNotNull("process engine controller for engine __default is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__default")));
    assertNotNull("process engine controller for engine __test is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")));
    // check we have parsed the plugin configurations
    metadata = ((MscManagedProcessEngineController) container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")).getService()).getProcessEngineMetadata();
    List<ProcessEnginePluginXml> pluginConfigurations = metadata.getPluginConfigurations();
    ProcessEnginePluginXml processEnginePluginXml = pluginConfigurations.get(0);
    assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.getPluginClass());
    Map<String, String> processEnginePluginXmlProperties = processEnginePluginXml.getProperties();
    assertEquals("abc", processEnginePluginXmlProperties.get("test"));
    assertEquals("123", processEnginePluginXmlProperties.get("number"));
    assertEquals("true", processEnginePluginXmlProperties.get("bool"));
    processEnginePluginXml = pluginConfigurations.get(1);
    assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.getPluginClass());
    processEnginePluginXmlProperties = processEnginePluginXml.getProperties();
    assertEquals("cba", processEnginePluginXmlProperties.get("test"));
    assertEquals("321", processEnginePluginXmlProperties.get("number"));
    assertEquals("false", processEnginePluginXmlProperties.get("bool"));
    // test correct subsystem removal
    assertRemoveSubsystemResources(services);
    try {
        ServiceController<?> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__default"));
        fail("Service '" + service.getName() + "' should have been removed.");
    } catch (Exception expected) {
    // nop
    }
    try {
        ServiceController<?> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__test"));
        fail("Service '" + service.getName() + "' should have been removed.");
    } catch (Exception expected) {
    // nop
    }
}
Also used : ServiceContainer(org.jboss.msc.service.ServiceContainer) ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) KernelServices(org.jboss.as.subsystem.test.KernelServices) ManagedProcessEngineMetadata(org.camunda.bpm.container.impl.jboss.config.ManagedProcessEngineMetadata) MscManagedProcessEngineController(org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController) XMLStreamException(javax.xml.stream.XMLStreamException) AbstractSubsystemTest(org.jboss.as.subsystem.test.AbstractSubsystemTest) Test(org.junit.Test)

Example 4 with MscManagedProcessEngineController

use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.

the class ProcessEngineAdd method installService.

protected ServiceController<ProcessEngine> installService(OperationContext context, ServiceVerificationHandler verificationHandler, ManagedProcessEngineMetadata processEngineConfiguration) {
    MscManagedProcessEngineController service = new MscManagedProcessEngineController(processEngineConfiguration);
    ServiceName name = ServiceNames.forManagedProcessEngine(processEngineConfiguration.getEngineName());
    ServiceBuilder<ProcessEngine> serviceBuilder = context.getServiceTarget().addService(name, service);
    MscManagedProcessEngineController.initializeServiceBuilder(processEngineConfiguration, service, serviceBuilder, processEngineConfiguration.getJobExecutorAcquisitionName());
    serviceBuilder.addListener(verificationHandler);
    return serviceBuilder.install();
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) MscManagedProcessEngineController(org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Aggregations

MscManagedProcessEngineController (org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController)4 ManagedProcessEngineMetadata (org.camunda.bpm.container.impl.jboss.config.ManagedProcessEngineMetadata)3 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 AbstractSubsystemTest (org.jboss.as.subsystem.test.AbstractSubsystemTest)2 KernelServices (org.jboss.as.subsystem.test.KernelServices)2 ServiceContainer (org.jboss.msc.service.ServiceContainer)2 ServiceName (org.jboss.msc.service.ServiceName)2 Test (org.junit.Test)2 XMLStreamException (javax.xml.stream.XMLStreamException)1 ProcessEnginePluginXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1