Skip to content

Commit d5dbb5d

Browse files
author
Marcus Linke
committed
Added some javadoc
1 parent 8039e18 commit d5dbb5d

File tree

10 files changed

+65
-70
lines changed

10 files changed

+65
-70
lines changed

src/main/java/com/github/dockerjava/netty/DockerCmdExecFactoryImpl.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import javax.net.ssl.SSLParameters;
2828

2929
import org.bouncycastle.jce.provider.BouncyCastleProvider;
30-
import org.slf4j.Logger;
31-
import org.slf4j.LoggerFactory;
3230

3331
import com.github.dockerjava.api.command.AttachContainerCmd;
3432
import com.github.dockerjava.api.command.AuthCmd;
@@ -70,6 +68,7 @@
7068
import com.github.dockerjava.api.command.VersionCmd;
7169
import com.github.dockerjava.api.command.WaitContainerCmd;
7270
import com.github.dockerjava.core.DockerClientConfig;
71+
import com.github.dockerjava.core.DockerClientImpl;
7372
import com.github.dockerjava.netty.exec.AttachContainerCmdExec;
7473
import com.github.dockerjava.netty.exec.AuthCmdExec;
7574
import com.github.dockerjava.netty.exec.BuildImageCmdExec;
@@ -110,17 +109,27 @@
110109
import com.github.dockerjava.netty.exec.WaitContainerCmdExec;
111110

112111
/**
113-
* http://stackoverflow.com/questions/33296749/netty-connect-to-unix-domain-socket-failed
114-
* http://netty.io/wiki/native-transports.html
115-
* https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/http/snoop/HttpSnoopClient.java
116-
* https://github.com/slandelle/netty-request-chunking/blob/master/src/test/java/slandelle/ChunkingTest.java
112+
* Experimental implementation of {@link DockerCmdExecFactory} that supports http connection hijacking that is needed to
113+
* pass STDIN to the container.
117114
*
118-
* @author Marcus Linke
115+
* To use it just pass an instance via {@link DockerClientImpl#withDockerCmdExecFactory(DockerCmdExecFactory)}
116+
*
117+
* @see https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#attach-to-a-container
118+
* @see https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#exec-start
119119
*
120+
*
121+
* @author Marcus Linke
120122
*/
121123
public class DockerCmdExecFactoryImpl implements DockerCmdExecFactory {
122124

123-
private static final Logger LOGGER = LoggerFactory.getLogger(DockerCmdExecFactoryImpl.class.getName());
125+
/*
126+
* useful links:
127+
*
128+
* http://stackoverflow.com/questions/33296749/netty-connect-to-unix-domain-socket-failed
129+
* http://netty.io/wiki/native-transports.html
130+
* https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/http/snoop/HttpSnoopClient.java
131+
* https://github.com/slandelle/netty-request-chunking/blob/master/src/test/java/slandelle/ChunkingTest.java
132+
*/
124133

125134
private DockerClientConfig dockerClientConfig;
126135

src/main/java/com/github/dockerjava/netty/InvocationBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
import com.github.dockerjava.netty.handler.HttpResponseStreamHandler;
4646
import com.github.dockerjava.netty.handler.JsonResponseCallbackHandler;
4747

48+
/**
49+
* This class is basically a replacement of javax.ws.rs.client.Invocation.Builder to allow simpler
50+
* migration of JAX-RS code to a netty based implementation.
51+
*
52+
* @author Marcus Linke
53+
*/
4854
public class InvocationBuilder {
4955

5056
public class ResponseCallback<T> extends ResultCallbackTemplate<ResponseCallback<T>, T> {

src/main/java/com/github/dockerjava/netty/MediaType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.github.dockerjava.netty;
22

3+
/**
4+
* This class is basically a replacement of javax.ws.rs.core.MediaType to allow simpler
5+
* migration of JAX-RS code to a netty based implementation.
6+
*
7+
* @author Marcus Linke
8+
*/
39
public enum MediaType {
410

511
APPLICATION_JSON("application/json"),

src/main/java/com/github/dockerjava/netty/WebTarget.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
import org.apache.commons.lang.StringUtils;
1010

11+
/**
12+
* This class is basically a replacement of javax.ws.rs.client.WebTarget to allow simpler
13+
* migration of JAX-RS code to a netty based implementation.
14+
*
15+
* @author Marcus Linke
16+
*/
1117
public class WebTarget {
1218

1319
private ChannelProvider channelProvider;

src/main/java/com/github/dockerjava/netty/handler/FramedResponseStreamHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
import com.github.dockerjava.api.model.Frame;
1010
import com.github.dockerjava.api.model.StreamType;
1111

12+
/**
13+
* Handler that decodes a docker-raw-stream as described here:
14+
*
15+
* https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#attach-to-a-container
16+
*
17+
* It drives the {@link ResultCallback#onNext(Object)} method of the passed {@link ResultCallback}.
18+
*
19+
* @author Marcus Linke
20+
*/
1221
public class FramedResponseStreamHandler extends SimpleChannelInboundHandler<ByteBuf> {
1322

1423
private static final int HEADER_SIZE = 8;

src/main/java/com/github/dockerjava/netty/handler/HttpResponseHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
import com.github.dockerjava.api.exception.NotModifiedException;
2424
import com.github.dockerjava.api.exception.UnauthorizedException;
2525

26+
/**
27+
* Handler that is responsible to handle an incoming {@link HttpResponse}. It evaluates the status code and
28+
* triggers the appropriate lifecycle methods at the passed {@link ResultCallback}.
29+
*
30+
* @author Marcus Linke
31+
*/
2632
public class HttpResponseHandler extends SimpleChannelInboundHandler<HttpObject> {
2733

2834
private HttpResponse response;

src/main/java/com/github/dockerjava/netty/handler/HttpResponseStreamHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
import com.github.dockerjava.api.async.ResultCallback;
1414

15+
/**
16+
* Handler that converts an incoming byte stream to an {@link InputStream}.
17+
*
18+
* @author marcus
19+
*/
1520
public class HttpResponseStreamHandler extends SimpleChannelInboundHandler<ByteBuf> {
1621

1722
private HttpResponseInputStream stream = new HttpResponseInputStream();

src/main/java/com/github/dockerjava/netty/handler/JsonRequestHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
import com.fasterxml.jackson.databind.ObjectMapper;
88

9+
/**
10+
* Handler that encodes an outgoing object to JSON.
11+
*
12+
* @author Marcus Linke
13+
*/
914
public class JsonRequestHandler extends MessageToByteEncoder<Object>{
1015

1116
private ObjectMapper mapper = new ObjectMapper();

src/main/java/com/github/dockerjava/netty/handler/JsonResponseCallbackHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
import com.fasterxml.jackson.databind.ObjectMapper;
99
import com.github.dockerjava.api.async.ResultCallback;
1010

11+
/**
12+
* Handler that decodes an incoming byte stream into objects of T and calls {@link ResultCallback#onNext(Object)}
13+
*
14+
* @author Marcus Linke
15+
*/
1116
public class JsonResponseCallbackHandler<T> extends SimpleChannelInboundHandler<ByteBuf> {
1217

1318
private static ObjectMapper objectMapper = new ObjectMapper();

src/main/java/com/github/dockerjava/netty/handler/JsonResponseHandler.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)