org.camunda.bpm.application.ProcessApplicationUnavailableException Java Examples

The following examples show how to use org.camunda.bpm.application.ProcessApplicationUnavailableException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPaLocalScriptEngineTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #2
Source File: ProcessApplicationElResolverDelegate.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected ELResolver getElResolverDelegate() {

    ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication();
    if(processApplicationReference != null) {

      try {
        ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication();
        return processApplication.getElResolver();

      } catch (ProcessApplicationUnavailableException e) {
        throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e);
      }

    } else {
      return null;
    }

  }
 
Example #3
Source File: ProcessApplicationBeanElResolverDelegate.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected ELResolver getElResolverDelegate() {

    ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication();
    if(processApplicationReference != null) {

      try {
        ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication();
        return processApplication.getBeanElResolver();

      } catch (ProcessApplicationUnavailableException e) {
        throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e);
      }

    } else {
      return new BeanELResolver();
    }

  }
 
Example #4
Source File: TypedValueField.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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;
  }
}
 
Example #5
Source File: ProcessApplicationEventListenerDelegate.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
  }
}
 
Example #6
Source File: ProcessApplicationEventListenerDelegate.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
  }
}
 
Example #7
Source File: ProcessApplicationReferenceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public AbstractProcessApplication getProcessApplication() throws ProcessApplicationUnavailableException {
  AbstractProcessApplication application = processApplication.get();
  if (application == null) {
    throw LOG.processApplicationUnavailableException(name);
  }
  else {
    return application;
  }
}
 
Example #8
Source File: NoViewProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessApplicationInterface getValue() throws IllegalStateException, IllegalArgumentException {
  try {
    return reference.getProcessApplication();
    
  } catch (ProcessApplicationUnavailableException e) {
    throw new IllegalStateException("Process application '"+reference.getName()+"' is not unavailable.", e);
  }
}
 
Example #9
Source File: NoViewProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessApplicationInterface getValue() throws IllegalStateException, IllegalArgumentException {
  try {
    return reference.getProcessApplication();
    
  } catch (ProcessApplicationUnavailableException e) {
    throw new IllegalStateException("Process application '"+reference.getName()+"' is not unavailable.", e);
  }
}
 
Example #10
Source File: ProcessApplicationContextTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void testSetPAContextByRawPA() throws ProcessApplicationUnavailableException {
  Assert.assertNull(Context.getCurrentProcessApplication());

  try {
    ProcessApplicationContext.setCurrentProcessApplication(pa);

    Assert.assertEquals(pa, getCurrentContextApplication().getProcessApplication());
  } finally {
    ProcessApplicationContext.clear();
  }

  Assert.assertNull(Context.getCurrentProcessApplication());
}
 
Example #11
Source File: ProcessApplicationContextTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void testSetPAContextByReference() throws ProcessApplicationUnavailableException {
  Assert.assertNull(Context.getCurrentProcessApplication());

  try {
    ProcessApplicationContext.setCurrentProcessApplication(pa.getReference());

    Assert.assertEquals(getCurrentContextApplication().getProcessApplication(), pa);
  } finally {
    ProcessApplicationContext.clear();
  }

  Assert.assertNull(Context.getCurrentProcessApplication());
}
 
Example #12
Source File: ProcessApplicationContextTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void testSetPAContextByName() throws ProcessApplicationUnavailableException {

    Assert.assertNull(Context.getCurrentProcessApplication());

    try {
      ProcessApplicationContext.setCurrentProcessApplication(pa.getName());

      Assert.assertEquals(getCurrentContextApplication().getProcessApplication(), pa);
    } finally {
      ProcessApplicationContext.clear();
    }

    Assert.assertNull(Context.getCurrentProcessApplication());
  }
 
Example #13
Source File: ScriptingEnvironment.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected Map<String, List<ExecutableScript>> getPaEnvScripts(ProcessApplicationReference pa) {
  try {
    ProcessApplicationInterface processApplication = pa.getProcessApplication();
    ProcessApplicationInterface rawObject = processApplication.getRawObject();

    if (rawObject instanceof AbstractProcessApplication) {
      AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication) rawObject;
      return abstractProcessApplication.getEnvironmentScripts();
    }
    return null;
  }
  catch (ProcessApplicationUnavailableException e) {
    throw new ProcessEngineException("Process Application is unavailable.", e);
  }
}
 
Example #14
Source File: ScriptingEngines.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected ScriptEngine getPaScriptEngine(String language, ProcessApplicationReference pa) {
  try {
    ProcessApplicationInterface processApplication = pa.getProcessApplication();
    ProcessApplicationInterface rawObject = processApplication.getRawObject();

    if (rawObject instanceof AbstractProcessApplication) {
      AbstractProcessApplication abstractProcessApplication = (AbstractProcessApplication) rawObject;
      return abstractProcessApplication.getScriptEngineForName(language, enableScriptEngineCaching);
    }
    return null;
  }
  catch (ProcessApplicationUnavailableException e) {
    throw new ProcessEngineException("Process Application is unavailable.", e);
  }
}
 
Example #15
Source File: BPMModule.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroy(OrienteerWebApplication app, ODatabaseDocument db) {
	super.onDestroy(app, db);
	app.unregisterWidgets("org.orienteer.bpm.component.widget");
	app.unmountPages("org.orienteer.bpm.web");
	app.getOrientDbSettings().getORecordHooks().remove(BpmnHook.class);
	if(processApplicationReference!=null) {
		try {
			processApplicationReference.getProcessApplication().undeploy();
		} catch (ProcessApplicationUnavailableException e) {
			LOG.error("Can't undeploy process application", e);
		}
	}
}
 
Example #16
Source File: EjbProcessApplicationReference.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public ProcessApplicationInterface getProcessApplication() throws ProcessApplicationUnavailableException {
  try {
    // check whether process application is still deployed
    selfReference.getName();
  }
  catch(EJBException e) {
    throw LOG.processApplicationUnavailableException(processApplicationName, e);
  }
  return selfReference;
}
 
Example #17
Source File: OSGiProcessApplicationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Test
public void getReference() throws ProcessApplicationUnavailableException {
  OSGiProcessApplication app = new OSGiProcessApplication(createBundleMock(), createBlueprintContainerMock());
  ProcessApplicationReference ref = app.getReference();
  assertThat(ref, is(instanceOf(OSGiProcessApplicationReference.class)));
  assertThat((OSGiProcessApplication) ref.getProcessApplication(), is(sameInstance(app)));
  assertThat(ref.getName(), is(BUNDLE_NAME));
}
 
Example #18
Source File: OProcessApplication.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public static OProcessApplication get() {
	try {
		return (OProcessApplication) OProcessApplicationReference.INSTANCE.getProcessApplication();
	} catch (ProcessApplicationUnavailableException e) {
		return null;
	}
}
 
Example #19
Source File: ProcessApplicationReferenceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void processEngineStopping(ProcessEngine processEngine) throws ProcessApplicationUnavailableException {
  // do nothing
}
 
Example #20
Source File: ProcessApplicationLogger.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ProcessApplicationUnavailableException processApplicationUnavailableException(String name) {
  return new ProcessApplicationUnavailableException(exceptionMessage(
      "011",
      "Process Application '{}' unavailable", name));
}
 
Example #21
Source File: ProcessApplicationLogger.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ProcessApplicationUnavailableException processApplicationUnavailableException(String name, Throwable cause) {
  return new ProcessApplicationUnavailableException(exceptionMessage(
      "011",
      "Process Application '{}' unavailable", name), cause);
}
 
Example #22
Source File: EnginePersistenceLogger.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ProcessEngineException cannotDeterminePaDataformats(ProcessApplicationUnavailableException e) {
  return new ProcessEngineException(exceptionMessage(
      "071","Cannot determine process application variable serializers. Context Process Application is unavailable."), e);
}
 
Example #23
Source File: ProcessApplicationLogger.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void cannotInvokeListenerPaUnavailable(String paName, ProcessApplicationUnavailableException e) {
  logDebug("005",
      "Exception while invoking listener: target process application '{}' unavailable", paName, e);
}
 
Example #24
Source File: EmbeddedProcessApplicationReferenceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public ProcessApplicationInterface getProcessApplication() throws ProcessApplicationUnavailableException {
  return application;
}
 
Example #25
Source File: EjbProcessApplicationReference.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void processEngineStopping(ProcessEngine processEngine) throws ProcessApplicationUnavailableException {
  // do nothing.
}
 
Example #26
Source File: OSGiProcessApplicationReference.java    From camunda-bpm-platform-osgi with Apache License 2.0 4 votes vote down vote up
@Override
public ProcessApplicationInterface getProcessApplication() throws ProcessApplicationUnavailableException {
  return application;
}
 
Example #27
Source File: OProcessApplicationReference.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public ProcessApplicationInterface getProcessApplication() throws ProcessApplicationUnavailableException {
	OrienteerWebApplication app = OrienteerWebApplication.lookupApplication();
	return app.getMetaData(OProcessApplication.PROCESS_APPLICATION_KEY);
}