Search in sources :

Example 11 with RuntimeOperationException

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

the class DockerRuntimeManager method start.

@Override
public void start(RuntimeId runtimeId) throws RuntimeOperationException {
    DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        LOG.info("Starting container: " + runtimeId.getId());
        docker.getDockerClient(runtime.getProviderId()).startContainer(runtime.getId());
        refresh(runtimeId);
    } catch (DockerException | InterruptedException ex) {
        LOG.error("Error Starting container: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Starting container: " + runtimeId.getId(), ex);
    }
}
Also used : DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) DockerException(com.spotify.docker.client.DockerException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 12 with RuntimeOperationException

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

the class DockerRuntimeManager method restart.

@Override
public void restart(RuntimeId runtimeId) throws RuntimeOperationException {
    DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        docker.getDockerClient(runtime.getProviderId()).restartContainer(runtime.getId());
        refresh(runtimeId);
    } catch (DockerException | InterruptedException ex) {
        LOG.error("Error Restarting container: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId(), ex);
    }
}
Also used : DockerRuntime(org.guvnor.ala.docker.model.DockerRuntime) DockerException(com.spotify.docker.client.DockerException) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 13 with RuntimeOperationException

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

the class WildflyRuntimeManager method start.

@Override
public void start(RuntimeId runtimeId) throws RuntimeOperationException {
    WildflyRuntime runtime = (WildflyRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    int result = wildfly.getWildflyClient(runtime.getProviderId()).start(runtime.getId());
    if (result != 200) {
        throw new RuntimeOperationException("Error Starting container: " + runtimeId.getId() + " \n\t There as a problem with starting your application, please check into the Wildfly Logs for more information.");
    }
    refresh(runtimeId);
}
Also used : WildflyRuntime(org.guvnor.ala.wildfly.model.WildflyRuntime) RuntimeOperationException(org.guvnor.ala.exceptions.RuntimeOperationException)

Example 14 with RuntimeOperationException

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

the class WildflyRuntimeManager method stop.

@Override
public void stop(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 Stopping 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 15 with RuntimeOperationException

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

the class OpenShiftRuntimeManager method restart.

@Override
public void restart(RuntimeId runtimeId) throws RuntimeOperationException {
    OpenShiftRuntime runtime = (OpenShiftRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId());
    try {
        LOG.info("Restarting runtime: " + runtimeId.getId());
        openshift.getOpenShiftClient(runtime.getProviderId()).restart(runtime.getId());
        refresh(runtimeId);
        LOG.info("Restarted runtime: " + runtimeId.getId());
    } catch (OpenShiftClientException ex) {
        LOG.error("Error Restarting runtime: " + runtimeId.getId(), ex);
        throw new RuntimeOperationException("Error Restarting 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)

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