use of org.guvnor.ala.services.exceptions.BusinessException in project kie-wb-common by kiegroup.
the class RestPipelineServiceImpl method runPipeline.
@Override
public String runPipeline(final String pipelineId, final Input input, final boolean async) throws BusinessException {
final Pipeline pipeline = pipelineRegistry.getPipelineByName(pipelineId);
if (pipeline == null) {
throw new BusinessException("Pipeline: " + pipelineId + " was not found.");
}
String providerName = input.get(ProviderConfig.PROVIDER_NAME);
Provider provider = null;
ProviderType providerType = null;
PipelineExecutorTaskDef taskDef;
if (providerName != null && !providerName.isEmpty()) {
provider = runtimeRegistry.getProvider(providerName);
}
if (provider == null) {
providerType = pipelineRegistry.getProviderType(pipelineId);
}
if (provider != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, provider);
} else if (providerType != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, providerType);
} else {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
}
return executorTaskManager.execute(taskDef, async ? PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS : PipelineExecutorTaskManager.ExecutionMode.SYNCHRONOUS);
}
use of org.guvnor.ala.services.exceptions.BusinessException in project kie-wb-common by kiegroup.
the class RestRuntimeProvisioningServiceImpl method destroyRuntime.
@Override
public void destroyRuntime(String runtimeId, boolean forced) throws BusinessException {
final Runtime runtimeById = runtimeRegistry.getRuntimeById(runtimeId);
if (runtimeById == null) {
throw new BusinessException("No runtime was found for runtimeId: " + runtimeId);
}
final PipelineExecutorTrace pipelineTrace = pipelineExecutorRegistry.getExecutorTrace(runtimeById);
try {
runtimeFactory.destroyRuntime(runtimeById);
} catch (Exception e) {
if (forced) {
LOG.warn("Runtime destroy raised the following error for runtime: " + runtimeId + " but forced destroy will still remove the runtime from registry.", e);
runtimeRegistry.deregisterRuntime(runtimeById);
} else {
throw e;
}
}
if (pipelineTrace != null) {
pipelineExecutorRegistry.deregister(pipelineTrace.getTaskId());
}
}
use of org.guvnor.ala.services.exceptions.BusinessException in project kie-wb-common by kiegroup.
the class RestRuntimeProvisioningServiceImpl method restartRuntime.
@Override
public void restartRuntime(String runtimeId) throws BusinessException {
final Runtime runtimeById = runtimeRegistry.getRuntimeById(runtimeId);
if (runtimeById == null) {
throw new BusinessException("No runtime was found for runtimeId: " + runtimeId);
}
runtimeManagerFactory.restartRuntime(runtimeById);
}
use of org.guvnor.ala.services.exceptions.BusinessException in project kie-wb-common by kiegroup.
the class RestRuntimeProvisioningServiceImpl method startRuntime.
@Override
public void startRuntime(String runtimeId) throws BusinessException {
final Runtime runtimeById = runtimeRegistry.getRuntimeById(runtimeId);
if (runtimeById == null) {
throw new BusinessException("No runtime was found for runtimeId: " + runtimeId);
}
runtimeManagerFactory.startRuntime(runtimeById);
}
use of org.guvnor.ala.services.exceptions.BusinessException in project kie-wb-common by kiegroup.
the class RestRuntimeProvisioningServiceImpl method stopRuntime.
@Override
public void stopRuntime(String runtimeId) throws BusinessException {
final Runtime runtimeById = runtimeRegistry.getRuntimeById(runtimeId);
if (runtimeById == null) {
throw new BusinessException("No runtime was found for runtimeId: " + runtimeId);
}
runtimeManagerFactory.stopRuntime(runtimeById);
}
Aggregations