use of org.camunda.bpm.application.ProcessApplicationUnavailableException in project camunda-bpm-platform by camunda.
the class TypedValueField method getCurrentPaSerializers.
protected static VariableSerializers getCurrentPaSerializers() {
if (Context.getCurrentProcessApplication() != null) {
ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication();
try {
ProcessApplicationInterface processApplicationInterface = processApplicationReference.getProcessApplication();
ProcessApplicationInterface rawPa = processApplicationInterface.getRawObject();
if (rawPa instanceof AbstractProcessApplication) {
return ((AbstractProcessApplication) rawPa).getVariableSerializers();
} else {
return null;
}
} catch (ProcessApplicationUnavailableException e) {
throw LOG.cannotDeterminePaDataformats(e);
}
} else {
return null;
}
}
use of org.camunda.bpm.application.ProcessApplicationUnavailableException in project camunda-bpm-platform by camunda.
the class AbstractPaLocalScriptEngineTest method getProcessApplication.
protected ProcessApplicationInterface getProcessApplication() {
ProcessApplicationReference reference = processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<ProcessApplicationReference>() {
public ProcessApplicationReference execute(CommandContext commandContext) {
ProcessDefinitionEntity definition = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionByKey(PROCESS_ID);
String deploymentId = definition.getDeploymentId();
ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager();
return processApplicationManager.getProcessApplicationForDeployment(deploymentId);
}
});
assertNotNull(reference);
ProcessApplicationInterface processApplication = null;
try {
processApplication = reference.getProcessApplication();
} catch (ProcessApplicationUnavailableException e) {
fail("Could not retrieve process application");
}
return processApplication.getRawObject();
}
use of org.camunda.bpm.application.ProcessApplicationUnavailableException in project camunda-bpm-platform by camunda.
the class ProcessApplicationEventListenerDelegate method notifyExecutionListener.
protected void notifyExecutionListener(DelegateExecution execution) throws Exception {
ProcessApplicationReference processApp = Context.getCurrentProcessApplication();
try {
ProcessApplicationInterface processApplication = processApp.getProcessApplication();
ExecutionListener executionListener = processApplication.getExecutionListener();
if (executionListener != null) {
executionListener.notify(execution);
} else {
LOG.paDoesNotProvideExecutionListener(processApp.getName());
}
} catch (ProcessApplicationUnavailableException e) {
// Process Application unavailable => ignore silently
LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e);
}
}
use of org.camunda.bpm.application.ProcessApplicationUnavailableException in project camunda-bpm-platform by camunda.
the class ProcessApplicationEventListenerDelegate method notifyTaskListener.
protected void notifyTaskListener(DelegateTask task) throws Exception {
ProcessApplicationReference processApp = Context.getCurrentProcessApplication();
try {
ProcessApplicationInterface processApplication = processApp.getProcessApplication();
TaskListener taskListener = processApplication.getTaskListener();
if (taskListener != null) {
taskListener.notify(task);
} else {
LOG.paDoesNotProvideTaskListener(processApp.getName());
}
} catch (ProcessApplicationUnavailableException e) {
// Process Application unavailable => ignore silently
LOG.cannotInvokeListenerPaUnavailable(processApp.getName(), e);
}
}
use of org.camunda.bpm.application.ProcessApplicationUnavailableException in project camunda-bpm-platform by camunda.
the class Context method executeWithinProcessApplication.
public static <T> T executeWithinProcessApplication(Callable<T> callback, ProcessApplicationReference processApplicationReference, InvocationContext invocationContext) {
String paName = processApplicationReference.getName();
try {
ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication();
setCurrentProcessApplication(processApplicationReference);
try {
// wrap callback
ProcessApplicationClassloaderInterceptor<T> wrappedCallback = new ProcessApplicationClassloaderInterceptor<T>(callback);
// execute wrapped callback
return processApplication.execute(wrappedCallback, invocationContext);
} catch (Exception e) {
// unwrap exception
if (e.getCause() != null && e.getCause() instanceof RuntimeException) {
throw (RuntimeException) e.getCause();
} else {
throw new ProcessEngineException("Unexpected exeption while executing within process application ", e);
}
} finally {
removeCurrentProcessApplication();
}
} catch (ProcessApplicationUnavailableException e) {
throw new ProcessEngineException("Cannot switch to process application '" + paName + "' for execution: " + e.getMessage(), e);
}
}
Aggregations