com.fitbur.github.dockerjava.jaxrs.AbstrSyncDockerCmdExec Maven / Gradle / Ivy
package com.fitbur.github.dockerjava.jaxrs;
import com.fitbur.github.dockerjava.api.DockerException;
import com.fitbur.github.dockerjava.api.com.fitburmand.DockerCmd;
import com.fitbur.github.dockerjava.api.com.fitburmand.DockerCmdSyncExec;
import com.fitbur.github.dockerjava.core.DockerClientConfig;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.WebTarget;
public abstract class AbstrSyncDockerCmdExec, RES_T> extends AbstrDockerCmdExec
implements DockerCmdSyncExec {
public AbstrSyncDockerCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
public RES_T exec(CMD_T com.fitburmand) {
// this hack works because of ResponseStatusExceptionFilter
try (CMD_T cmd = com.fitburmand) {
try {
return execute(cmd);
} catch (ProcessingException e) {
if (e.getCause() instanceof DockerException) {
throw (DockerException) e.getCause();
} else {
throw e;
}
}
}
}
protected abstract RES_T execute(CMD_T com.fitburmand);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy