use of org.camunda.bpm.engine.rest.spi.ProcessEngineProvider in project camunda-bpm-platform by camunda.
the class NamedProcessEngineRestServiceImpl method getProcessEngineProvider.
protected ProcessEngineProvider getProcessEngineProvider() {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if (iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
return provider;
} else {
throw new RestException(Status.INTERNAL_SERVER_ERROR, "No process engine provider found");
}
}
use of org.camunda.bpm.engine.rest.spi.ProcessEngineProvider in project camunda-bpm-platform by camunda.
the class EngineUtil method lookupProcessEngine.
/**
* Look up the process engine from the {@link ProcessEngineProvider}. If engineName is null, the default engine is returned.
* @param engineName
* @return
*/
public static ProcessEngine lookupProcessEngine(String engineName) {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if (iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
if (engineName == null) {
return provider.getDefaultProcessEngine();
} else {
return provider.getProcessEngine(engineName);
}
} else {
throw new RestException(Status.INTERNAL_SERVER_ERROR, "Could not find an implementation of the " + ProcessEngineProvider.class + "- SPI");
}
}
use of org.camunda.bpm.engine.rest.spi.ProcessEngineProvider in project camunda-bpm-platform by camunda.
the class NamedProcessEngineRestServiceImpl method getProcessEngineNames.
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<ProcessEngineDto> getProcessEngineNames() {
ProcessEngineProvider provider = getProcessEngineProvider();
Set<String> engineNames = provider.getProcessEngineNames();
List<ProcessEngineDto> results = new ArrayList<ProcessEngineDto>();
for (String engineName : engineNames) {
ProcessEngineDto dto = new ProcessEngineDto();
dto.setName(engineName);
results.add(dto);
}
return results;
}
use of org.camunda.bpm.engine.rest.spi.ProcessEngineProvider in project camunda-bpm-platform by camunda.
the class AbstractRestServiceTest method getProcessEngine.
protected ProcessEngine getProcessEngine(String name) {
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if (iterator.hasNext()) {
ProcessEngineProvider provider = iterator.next();
return provider.getProcessEngine(name);
} else {
throw new ProcessEngineException("No provider found");
}
}
use of org.camunda.bpm.engine.rest.spi.ProcessEngineProvider in project camunda-bpm-platform by camunda.
the class AbstractRestServiceTest method setupTestScenario.
protected static void setupTestScenario() throws IOException {
setupRestAssured();
ServiceLoader<ProcessEngineProvider> serviceLoader = ServiceLoader.load(ProcessEngineProvider.class);
Iterator<ProcessEngineProvider> iterator = serviceLoader.iterator();
if (iterator.hasNext()) {
MockedProcessEngineProvider provider = (MockedProcessEngineProvider) iterator.next();
// reset engine mocks before every test
provider.resetEngines();
processEngine = provider.getDefaultProcessEngine();
}
}
Aggregations