Search in sources :

Example 6 with RuntimeOperationException

use of org.guvnor.ala.exceptions.RuntimeOperationException in project kie-wb-common by kiegroup.

the class OpenShiftRuntimeManager method pause.

@Override
public void pause(RuntimeId runtimeId) throws RuntimeOperationException {
    OpenShiftRuntime runtime = (OpenShiftRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        LOG.info("Pausing runtime: " + runtimeId.getId());
        openshift.getOpenShiftClient(runtime.getProviderId()).pause(runtime.getId());
        refresh(runtimeId);
        LOG.info("Paused runtime: " + runtimeId.getId());
    } catch (OpenShiftClientException ex) {
        LOG.error("Error Pausing runtime: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Pausing runtime: " + runtimeId.getId(), ex);
    }
}
Also used : OpenShiftRuntime(org.guvnor.ala.openshift.model.OpenShiftRuntime) OpenShiftClientException(org.guvnor.ala.openshift.access.exceptions.OpenShiftClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 7 with RuntimeOperationException

use of org.guvnor.ala.exceptions.RuntimeOperationException in project kie-wb-common by kiegroup.

the class OpenShiftRuntimeExecExecutor method destroy.

@Override
public void destroy(final RuntimeId runtimeId) {
    final Optional<OpenShiftProvider> _openshiftProvider = runtimeRegistry.getProvider(runtimeId.getProviderId(), OpenShiftProvider.class);
    if (!_openshiftProvider.isPresent()) {
        return;
    }
    OpenShiftProvider openshiftProvider = _openshiftProvider.get();
    try {
        LOG.info("Destroying runtime: " + runtimeId.getId());
        openshift.getOpenShiftClient(openshiftProvider).destroy(runtimeId.getId());
        LOG.info("Destroyed runtime: " + runtimeId.getId());
    } catch (OpenShiftClientException ex) {
        throw new RuntimeOperationException("Error Destroying runtime: " + runtimeId.getId(), ex);
    }
    runtimeRegistry.deregisterRuntime(runtimeId);
}
Also used : OpenShiftProvider(org.guvnor.ala.openshift.model.OpenShiftProvider) OpenShiftClientException(org.guvnor.ala.openshift.access.exceptions.OpenShiftClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 8 with RuntimeOperationException

use of org.guvnor.ala.exceptions.RuntimeOperationException in project kie-wb-common by kiegroup.

the class WildflyRuntimeManager method restart.

@Override
public void restart(RuntimeId runtimeId) {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        wildfly.getWildflyClient(runtime.getProviderId()).restart(runtime.getId());
        refresh(runtimeId);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId() + "\n\t There as a problem with restarting your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 9 with RuntimeOperationException

use of org.guvnor.ala.exceptions.RuntimeOperationException in project kie-wb-common by kiegroup.

the class WildflyRuntimeManager method pause.

@Override
public void pause(RuntimeId runtimeId) throws RuntimeOperationException {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        wildfly.getWildflyClient(runtime.getProviderId()).stop(runtime.getId());
        refresh(runtimeId);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Pausing container: " + runtimeId.getId() + "\n\t There as a problem with stopping your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 10 with RuntimeOperationException

use of org.guvnor.ala.exceptions.RuntimeOperationException in project kie-wb-common by kiegroup.

the class WildflyRuntimeManager method refresh.

@Override
public void refresh(RuntimeId runtimeId) throws RuntimeOperationException {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        WildflyAppState appState = wildfly.getWildflyClient(runtime.getProviderId()).getAppState(runtime.getId());
        WildflyRuntime newRuntime = new WildflyRuntime(runtime.getId(), runtime.getName(), runtime.getConfig(), runtime.getProviderId(), runtime.getEndpoint(), runtime.getInfo(), new WildflyRuntimeState(appState.getState(), runtime.getState().getStartedAt()));
        runtimeRegistry.registerRuntime(newRuntime);
    } catch (WildflyClientException ex) {
        throw new RuntimeOperationException("Error Refreshing container: " + runtimeId.getId() + "\n\t There as a problem with refreshing your application, please check into the Wildfly Logs for more information.", ex);
    }
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) WildflyClientException(org.guvnor.ala.wildfly.access.exceptions.WildflyClientException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException) WildflyRuntimeState(org.guvnor.ala.wildfly.model.WildflyRuntimeState) WildflyAppState(org.guvnor.ala.wildfly.access.WildflyAppState)

Aggregations

RuntimeOperationException (org.guvnor.ala.exceptions.RuntimeOperationException)16 OpenShiftClientException (org.guvnor.ala.openshift.access.exceptions.OpenShiftClientException)6 DockerException (com.spotify.docker.client.DockerException)5 DockerRuntime (org.guvnor.ala.docker.model.DockerRuntime)5 OpenShiftRuntime (org.guvnor.ala.openshift.model.OpenShiftRuntime)5 WildflyRuntime (org.guvnor.ala.wildfly.model.WildflyRuntime)5 WildflyClientException (org.guvnor.ala.wildfly.access.exceptions.WildflyClientException)4 ContainerInfo (com.spotify.docker.client.messages.ContainerInfo)1 ContainerState (com.spotify.docker.client.messages.ContainerState)1 DockerRuntimeState (org.guvnor.ala.docker.model.DockerRuntimeState)1 OpenShiftProvider (org.guvnor.ala.openshift.model.OpenShiftProvider)1 OpenShiftRuntimeState (org.guvnor.ala.openshift.model.OpenShiftRuntimeState)1 WildflyAppState (org.guvnor.ala.wildfly.access.WildflyAppState)1 WildflyRuntimeState (org.guvnor.ala.wildfly.model.WildflyRuntimeState)1