Search in sources :

Example 11 with AbstractProcessApplication

use of org.camunda.bpm.application.AbstractProcessApplication in project camunda-bpm-platform by camunda.

the class PreUndeployInvocationStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    final String paName = processApplication.getName();
    Class<? extends AbstractProcessApplication> paClass = processApplication.getClass();
    Method preUndeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, PreUndeploy.class);
    if (preUndeployMethod == null) {
        LOG.debugPaLifecycleMethodNotFound(CALLBACK_NAME, paName);
        return;
    }
    LOG.debugFoundPaLifecycleCallbackMethod(CALLBACK_NAME, paName);
    // resolve injections
    Object[] injections = InjectionUtil.resolveInjections(operationContext, preUndeployMethod);
    try {
        // perform the actual invocation
        preUndeployMethod.invoke(processApplication, injections);
    } catch (IllegalArgumentException e) {
        throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
    } catch (IllegalAccessException e) {
        throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
    } catch (InvocationTargetException e) {
        Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        } else {
            throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
        }
    }
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 12 with AbstractProcessApplication

use of org.camunda.bpm.application.AbstractProcessApplication in project camunda-bpm-platform by camunda.

the class ProcessesXmlStopProcessEnginesStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    final JmxManagedProcessApplication deployedProcessApplication = serviceContainer.getService(ServiceTypes.PROCESS_APPLICATION, processApplication.getName());
    ensureNotNull("Cannot find process application with name " + processApplication.getName(), "deployedProcessApplication", deployedProcessApplication);
    List<ProcessesXml> processesXmls = deployedProcessApplication.getProcessesXmls();
    for (ProcessesXml processesXml : processesXmls) {
        stopProcessEngines(processesXml.getProcessEngines(), operationContext);
    }
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) ProcessesXml(org.camunda.bpm.application.impl.metadata.spi.ProcessesXml) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) JmxManagedProcessApplication(org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)

Example 13 with AbstractProcessApplication

use of org.camunda.bpm.application.AbstractProcessApplication in project camunda-bpm-platform by camunda.

the class PostDeployInvocationStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    final String paName = processApplication.getName();
    Class<? extends AbstractProcessApplication> paClass = processApplication.getClass();
    Method postDeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, PostDeploy.class);
    if (postDeployMethod == null) {
        LOG.debugPaLifecycleMethodNotFound(CALLBACK_NAME, paName);
        return;
    }
    LOG.debugFoundPaLifecycleCallbackMethod(CALLBACK_NAME, paName);
    // resolve injections
    Object[] injections = InjectionUtil.resolveInjections(operationContext, postDeployMethod);
    try {
        // perform the actual invocation
        postDeployMethod.invoke(processApplication, injections);
    } catch (IllegalArgumentException e) {
        throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
    } catch (IllegalAccessException e) {
        throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
    } catch (InvocationTargetException e) {
        Throwable cause = e.getCause();
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        } else {
            throw LOG.exceptionWhileInvokingPaLifecycleCallback(CALLBACK_NAME, paName, e);
        }
    }
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 14 with AbstractProcessApplication

use of org.camunda.bpm.application.AbstractProcessApplication in project camunda-bpm-platform by camunda.

the class ParseProcessesXmlStep method performOperationStep.

public void performOperationStep(DeploymentOperation operationContext) {
    final AbstractProcessApplication processApplication = operationContext.getAttachment(PROCESS_APPLICATION);
    Map<URL, ProcessesXml> parsedFiles = parseProcessesXmlFiles(processApplication);
    // attach parsed metadata
    operationContext.addAttachment(PROCESSES_XML_RESOURCES, parsedFiles);
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) ProcessesXml(org.camunda.bpm.application.impl.metadata.spi.ProcessesXml) URL(java.net.URL)

Example 15 with AbstractProcessApplication

use of org.camunda.bpm.application.AbstractProcessApplication in project camunda-bpm-platform by camunda.

the class PaLocalScriptEngineDisabledCacheTest method shouldNotCacheScriptEngine.

@Test
public void shouldNotCacheScriptEngine() {
    AbstractProcessApplication processApplication = (AbstractProcessApplication) getProcessApplication();
    assertNotEquals(processApplication.getScriptEngineForName(SCRIPT_FORMAT, false), processApplication.getScriptEngineForName(SCRIPT_FORMAT, false));
}
Also used : AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) Test(org.junit.Test)

Aggregations

AbstractProcessApplication (org.camunda.bpm.application.AbstractProcessApplication)17 PlatformServiceContainer (org.camunda.bpm.container.impl.spi.PlatformServiceContainer)9 ProcessesXml (org.camunda.bpm.application.impl.metadata.spi.ProcessesXml)4 JmxManagedProcessApplication (org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessApplication)4 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)3 ProcessApplicationUnavailableException (org.camunda.bpm.application.ProcessApplicationUnavailableException)3 DeployedProcessArchive (org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 URL (java.net.URL)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 JobExecutor (org.camunda.bpm.engine.impl.jobexecutor.JobExecutor)2 Test (org.junit.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)1 ProcessArchiveXml (org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml)1 JmxManagedBpmPlatformPlugins (org.camunda.bpm.container.impl.jmx.services.JmxManagedBpmPlatformPlugins)1