
org.testifyproject.github.dockerjava.jaxrs.AbstrSyncDockerCmdExec Maven / Gradle / Ivy
package org.testifyproject.testifyproject.github.dockerjava.jaxrs;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.WebTarget;
import org.testifyproject.testifyproject.github.dockerjava.api.org.testifyproject.testifyprojectmand.DockerCmd;
import org.testifyproject.testifyproject.github.dockerjava.api.org.testifyproject.testifyprojectmand.DockerCmdSyncExec;
import org.testifyproject.testifyproject.github.dockerjava.api.exception.DockerException;
import org.testifyproject.testifyproject.github.dockerjava.core.DockerClientConfig;
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 org.testifyproject.testifyprojectmand) {
// this hack works because of ResponseStatusExceptionFilter
try (CMD_T cmd = org.testifyproject.testifyprojectmand) {
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 org.testifyproject.testifyprojectmand);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy