Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/com/github/dockerjava/api/DockerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public CopyFileFromContainerCmd copyFileFromContainerCmd(

public EventsCmd eventsCmd(EventCallback eventCallback);

@Override
public void close() throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public interface CommitCmd extends DockerCmd<String>{
/**
* @throws NotFoundException No such container
*/
@Override
public String exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<CommitCmd, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ public interface ContainerDiffCmd extends DockerCmd<List<ChangeLog>> {

public ContainerDiffCmd withContainerId(String containerId);

@Override
public String toString();

/**
* @throws NotFoundException No such container
* @throws InternalServerErrorException server error
* @throws DockerException unexpected http status code
*/
@Override
public List<ChangeLog> exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<ContainerDiffCmd, List<ChangeLog>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public interface CopyFileFromContainerCmd extends DockerCmd<InputStream> {
/**
* @throws NotFoundException No such container
*/
@Override
public InputStream exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<CopyFileFromContainerCmd, InputStream> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public interface DockerCmdExecFactory extends Closeable {

public EventsCmd.Exec createEventsCmdExec();

@Override
public void close() throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public interface InspectContainerCmd extends DockerCmd<InspectContainerResponse>
/**
* @throws NotFoundException No such container
*/
@Override
public InspectContainerResponse exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<InspectContainerCmd, InspectContainerResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface InspectImageCmd extends DockerCmd<InspectImageResponse>{
/**
* @throws NotFoundException No such image
*/
@Override
public InspectImageResponse exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<InspectImageCmd, InspectImageResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface KillContainerCmd extends DockerCmd<Void> {
/**
* @throws NotFoundException No such container
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<KillContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
/**
* @throws NotFoundException No such container
*/
@Override
public InputStream exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<LogContainerCmd, InputStream> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface PauseContainerCmd extends DockerCmd<Void>{
/**
* @throws NotFoundException No such container
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<PauseContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public interface PushImageCmd extends DockerCmd<InputStream>{
/**
* @throws NotFoundException No such image
*/
@Override
public InputStream exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<PushImageCmd, InputStream> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public interface RemoveContainerCmd extends DockerCmd<Void> {
/**
* @throws NotFoundException No such container
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<RemoveContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public interface RemoveImageCmd extends DockerCmd<Void>{
/**
* @throws NotFoundException No such image
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<RemoveImageCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public interface RestartContainerCmd extends DockerCmd<Void> {
/**
* @throws NotFoundException No such container
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<RestartContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public interface StartContainerCmd extends DockerCmd<Void> {
* @throws NotModifiedException
* Container already started
*/
@Override
public Void exec() throws NotFoundException, NotModifiedException;

public static interface Exec extends DockerCmdExec<StartContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public interface StopContainerCmd extends DockerCmd<Void> {
* @throws NotFoundException No such container
* @throws NotModifiedException Container already stopped
*/
@Override
public Void exec() throws NotFoundException, NotModifiedException;

public static interface Exec extends DockerCmdExec<StopContainerCmd, Void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface TopContainerCmd extends DockerCmd<TopContainerResponse> {
/**
* @throws NotFoundException No such container
*/
@Override
public TopContainerResponse exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<TopContainerCmd, TopContainerResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface UnpauseContainerCmd extends DockerCmd<Void> {
/**
* @throws NotFoundException No such container
*/
@Override
public Void exec() throws NotFoundException;

public static interface Exec extends DockerCmdExec<UnpauseContainerCmd, Void> {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/github/dockerjava/api/model/Links.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,4 @@ public String toString() {
public InputStream exec() throws NotFoundException {
return super.exec();
}

// protected InputStream impl() throws DockerException {
//
// CopyFileFromContainerCmd command = this;
//
// WebTarget webResource =
// baseResource.path("/containers/{id}/copy").resolveTemplate("id", command.getContainerId());
//
// LOGGER.trace("POST: " + webResource.toString());
//
// return webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE).post(entity(command, MediaType.APPLICATION_JSON), Response.class).readEntity(InputStream.class);
// }


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,58 @@ public ExecCreateCmdImpl(ExecCreateCmd.Exec exec, String containerId) {
withContainerId(containerId);
}

@Override
public ExecCreateCmd withContainerId(String containerId) {
checkNotNull(containerId, "containerId was not specified");
this.containerId = containerId;
return this;
}

@Override
public ExecCreateCmd withAttachStdin(boolean attachStdin) {
this.attachStdin = attachStdin;
return this;
}

@Override
public ExecCreateCmd withAttachStdin() {
return withAttachStdin(true);
}

@Override
public ExecCreateCmd withAttachStdout(boolean attachStdout) {
this.attachStdout = attachStdout;
return this;
}

@Override
public ExecCreateCmd withAttachStdout() {
return withAttachStdout(true);
}

@Override
public ExecCreateCmd withAttachStderr(boolean attachStderr) {
this.attachStderr = attachStderr;
return this;
}

@Override
public ExecCreateCmd withAttachStderr() {
return withAttachStderr(true);
}

@Override
public ExecCreateCmd withTty(boolean tty) {
this.tty = tty;
return this;
}

@Override
public ExecCreateCmd withTty() {
return withTty(true);
}

@Override
public ExecCreateCmd withCmd(String... cmd) {
this.cmd = cmd;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected String registryAuth(AuthConfig authConfig) {
}
}

@Override
public RES_T exec(CMD_T command) {
// this hack works because of ResponseStatusExceptionFilter
RES_T result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.dockerjava.jaxrs;

import static javax.ws.rs.client.Entity.entity;

import java.io.InputStream;

import javax.ws.rs.client.WebTarget;
Expand All @@ -13,29 +11,34 @@

import com.github.dockerjava.api.command.AttachContainerCmd;

public class AttachContainerCmdExec extends AbstrDockerCmdExec<AttachContainerCmd, InputStream> implements AttachContainerCmd.Exec {

public class AttachContainerCmdExec extends
AbstrDockerCmdExec<AttachContainerCmd, InputStream> implements
AttachContainerCmd.Exec {

private static final Logger LOGGER = LoggerFactory
.getLogger(AttachContainerCmdExec.class);

public AttachContainerCmdExec(WebTarget baseResource) {
super(baseResource);
}

@Override
protected InputStream execute(AttachContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/attach")
.resolveTemplate("id", command.getContainerId())
.queryParam("logs", command.hasLogsEnabled() ? "1" : "0")
// .queryParam("stdin", command.hasStdinEnabled() ? "1" : "0")
.queryParam("stdout", command.hasStdoutEnabled() ? "1" : "0")
.queryParam("stderr", command.hasStderrEnabled() ? "1" : "0")
.queryParam("stream", command.hasFollowStreamEnabled() ? "1" : "0");
WebTarget webResource = getBaseResource()
.path("/containers/{id}/attach")
.resolveTemplate("id", command.getContainerId())
.queryParam("logs", command.hasLogsEnabled() ? "1" : "0")
// .queryParam("stdin", command.hasStdinEnabled() ? "1" : "0")
.queryParam("stdout", command.hasStdoutEnabled() ? "1" : "0")
.queryParam("stderr", command.hasStderrEnabled() ? "1" : "0")
.queryParam("stream",
command.hasFollowStreamEnabled() ? "1" : "0");

LOGGER.trace("POST: {}", webResource);

return webResource.request().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
.post(entity(null, MediaType.APPLICATION_JSON), Response.class).readEntity(InputStream.class);

return webResource.request()
.accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
.post(null, Response.class).readEntity(InputStream.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ protected ExecCreateCmdResponse execute(ExecCreateCmd command) {

LOGGER.trace("POST: {}", webResource);

return webResource.request().accept(MediaType.APPLICATION_JSON).post(entity(command, MediaType.APPLICATION_JSON), ExecCreateCmdResponse.class);
return webResource
.request()
.accept(MediaType.APPLICATION_JSON)
.post(entity(command, MediaType.APPLICATION_JSON), ExecCreateCmdResponse.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protected InputStream execute(ExecStartCmd command) {

LOGGER.trace("POST: {}", webResource);

return webResource.request().accept(MediaType.APPLICATION_JSON).post(entity(command, MediaType.APPLICATION_JSON), Response.class).readEntity(InputStream.class);
return webResource
.request()
.accept(MediaType.APPLICATION_JSON)
.post(entity(command, MediaType.APPLICATION_JSON), Response.class).readEntity(InputStream.class);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.dockerjava.jaxrs;

import static javax.ws.rs.client.Entity.entity;

import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;

Expand All @@ -10,25 +8,28 @@

import com.github.dockerjava.api.command.KillContainerCmd;

public class KillContainerCmdExec extends AbstrDockerCmdExec<KillContainerCmd, Void> implements KillContainerCmd.Exec {

public class KillContainerCmdExec extends
AbstrDockerCmdExec<KillContainerCmd, Void> implements
KillContainerCmd.Exec {

private static final Logger LOGGER = LoggerFactory
.getLogger(KillContainerCmdExec.class);

public KillContainerCmdExec(WebTarget baseResource) {
super(baseResource);
}

@Override
protected Void execute(KillContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/kill").resolveTemplate("id", command.getContainerId());
WebTarget webResource = getBaseResource().path("/containers/{id}/kill")
.resolveTemplate("id", command.getContainerId());

if(command.getSignal() != null) {
if (command.getSignal() != null) {
webResource = webResource.queryParam("signal", command.getSignal());
}

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(entity(null, MediaType.APPLICATION_JSON));
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);

return null;
}
Expand Down
Loading