use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class ScriptingEngines method getScriptEngineForLanguage.
/**
* Loads the given script engine by language name. Will throw an exception if no script engine can be loaded for the given language name.
*
* @param language the name of the script language to lookup an implementation for
* @return the script engine
* @throws ProcessEngineException if no such engine can be found.
*/
public ScriptEngine getScriptEngineForLanguage(String language) {
if (language != null) {
language = language.toLowerCase();
}
ProcessApplicationReference pa = Context.getCurrentProcessApplication();
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
ScriptEngine engine = null;
if (config.isEnableFetchScriptEngineFromProcessApplication()) {
if (pa != null) {
engine = getPaScriptEngine(language, pa);
}
}
if (engine == null) {
engine = getGlobalScriptEngine(language);
}
return engine;
}
use of org.camunda.bpm.application.ProcessApplicationReference 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.ProcessApplicationReference 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.ProcessApplicationReference 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.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class GetProcessApplicationForDeploymentCmd method execute.
public String execute(CommandContext commandContext) {
commandContext.getAuthorizationManager().checkCamundaAdmin();
ProcessApplicationReference reference = Context.getProcessEngineConfiguration().getProcessApplicationManager().getProcessApplicationForDeployment(deploymentId);
if (reference != null) {
return reference.getName();
} else {
return null;
}
}
Aggregations