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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static class Deserializer extends JsonDeserializer<Binds> {
public Binds deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {

List<Bind> binds = new ArrayList<Bind>();
List<Bind> binds = new ArrayList<>();
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
for (Iterator<JsonNode> it = node.elements(); it.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static class Deserializer extends JsonDeserializer<ExposedPorts> {
public ExposedPorts deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {

List<ExposedPort> exposedPorts = new ArrayList<ExposedPort>();
List<ExposedPort> exposedPorts = new ArrayList<>();
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
for (Iterator<Map.Entry<String, JsonNode>> it = node.fields(); it.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static class Deserializer extends JsonDeserializer<Links> {
@Override
public Links deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {
final List<Link> binds = new ArrayList<Link>();
final List<Link> binds = new ArrayList<>();
final ObjectCodec oc = jsonParser.getCodec();
final JsonNode node = oc.readTree(jsonParser);
for (final Iterator<JsonNode> it = node.elements(); it.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class Ports implements Serializable {
private static final long serialVersionUID = 1L;

private final Map<ExposedPort, Binding[]> ports = new HashMap<ExposedPort, Binding[]>();
private final Map<ExposedPort, Binding[]> ports = new HashMap<>();

/**
* Creates a {@link Ports} object with no {@link PortBinding}s. Use {@link #bind(ExposedPort, Binding)} or {@link #add(PortBinding...)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static final class Deserializer extends JsonDeserializer<VolumeBinds> {
public VolumeBinds deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {

List<VolumeBind> binds = new ArrayList<VolumeBind>();
List<VolumeBind> binds = new ArrayList<>();
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
for (Iterator<Map.Entry<String, JsonNode>> it = node.fields(); it.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static class Deserializer extends JsonDeserializer<Volumes> {
public Volumes deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {

List<Volume> volumes = new ArrayList<Volume>();
List<Volume> volumes = new ArrayList<>();
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
for (Iterator<Map.Entry<String, JsonNode>> it = node.fields(); it.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static final class Deserializer extends JsonDeserializer<VolumesRW> {
public VolumesRW deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException, JsonProcessingException {

List<VolumeRW> volumesRW = new ArrayList<VolumeRW>();
List<VolumeRW> volumesRW = new ArrayList<>();
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DefaultDockerClientConfig implements Serializable, DockerClientConf

private static final String DOCKER_JAVA_PROPERTIES = "docker-java.properties";

private static final Set<String> CONFIG_KEYS = new HashSet<String>();
private static final Set<String> CONFIG_KEYS = new HashSet<>();

static {
CONFIG_KEYS.add(DOCKER_HOST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class DockerConfigFile {
private final Map<String, AuthConfig> auths;

public DockerConfigFile() {
this(new HashMap<String, AuthConfig>());
this(new HashMap<>());
}

private DockerConfigFile(Map<String, AuthConfig> authConfigMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static boolean match(String pattern, File file) {
* Returns the matching patterns for the given string
*/
public static List<String> match(List<String> patterns, String name) {
List<String> matches = new ArrayList<String>();
List<String> matches = new ArrayList<>();
for (String pattern : patterns) {
if (match(pattern, name)) {
matches.add(pattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ public SSLContext getSSLContext() {
}

private PrivilegedAction<String> getSystemProperty(final String name, final String def) {
return new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty(name, def);
}
};
return () -> System.getProperty(name, def);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public BuildImageCmd withCpusetcpus(String cpusetcpus) {
@Override
public BuildImageCmd withBuildArg(String key, String value) {
if (this.buildArgs == null) {
this.buildArgs = new HashMap<String, String>();
this.buildArgs = new HashMap<>();
}
this.buildArgs.put(key, value);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Iterable<DockerfileStatement> getStatements() throws IOException {
}

public List<String> getIgnores() throws IOException {
List<String> ignores = new ArrayList<String>();
List<String> ignores = new ArrayList<>();
File dockerIgnoreFile = new File(baseDirectory, ".dockerignore");
if (dockerIgnoreFile.exists()) {
int lineNumber = 0;
Expand Down Expand Up @@ -118,7 +118,7 @@ public class ScannedResult {

final List<String> ignores;

final List<File> filesToAdd = new ArrayList<File>();
final List<File> filesToAdd = new ArrayList<>();

public InputStream buildDockerFolderTar() {
return buildDockerFolderTar(baseDirectory);
Expand Down Expand Up @@ -224,7 +224,7 @@ private boolean isBaseDirectory(File directory) {
* Returns all matching ignore patterns for the given file name.
*/
private List<String> matchingIgnorePatterns(String fileName) {
List<String> matches = new ArrayList<String>();
List<String> matches = new ArrayList<>();

int lineNumber = 0;
for (String pattern : ignores) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import org.apache.commons.lang.StringUtils;

import com.github.dockerjava.api.exception.DockerClientException;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;

/**
Expand Down Expand Up @@ -92,28 +90,19 @@ private Add(Collection<String> sources, String destination) {

@Override
public Add transform(final Map<String, String> env) {
Collection<String> resources = Collections2.transform(sources, new Function<String, String>() {
@Override
public String apply(String source) {
return filterForEnvironmentVars(env, source).trim();
}
});
Collection<String> resources = Collections2.transform(sources, source -> filterForEnvironmentVars(env, source).trim());
return new Add(resources, destination);
}

public Iterable<String> getFileResources() {
return Collections2.filter(sources, new Predicate<String>() {

@Override
public boolean apply(String source) {
URI uri;
try {
uri = new URI(source);
} catch (URISyntaxException e) {
return false;
}
return uri.getScheme() == null || "file".equals(uri.getScheme());
return Collections2.filter(sources, source -> {
URI uri;
try {
uri = new URI(source);
} catch (URISyntaxException e) {
return false;
}
return uri.getScheme() == null || "file".equals(uri.getScheme());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FiltersBuilder {
private static final Pattern UNTIL_GO_PATTERN =
Pattern.compile("^([1-9][0-9]*h)?([1-9][0-9]*m)?([1-9][0-9]*s)?$");

private Map<String, List<String>> filters = new HashMap<String, List<String>>();
private Map<String, List<String>> filters = new HashMap<>();

public FiltersBuilder() {
}
Expand Down Expand Up @@ -95,7 +95,7 @@ public FiltersBuilder withUntil(String until) throws NumberFormatException {
}

private static List<String> labelsMapToList(Map<String, String> labels) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
for (Entry<String, String> entry : labels.entrySet()) {
String rest = (entry.getValue() != null & !entry.getValue().isEmpty()) ? "=" + entry.getValue() : "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class SwarmNodesFiltersBuilder {

private Map<String, List<String>> filters = new HashMap<String, List<String>>();
private Map<String, List<String>> filters = new HashMap<>();

public SwarmNodesFiltersBuilder() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ApacheUnixSocket extends Socket {

private final AFUNIXSocket inner;

private final Queue<SocketOptionSetter> optionsToSet = new ArrayDeque<SocketOptionSetter>();
private final Queue<SocketOptionSetter> optionsToSet = new ArrayDeque<>();

public ApacheUnixSocket() throws IOException {
this.inner = AFUNIXSocket.newInstance();
Expand Down Expand Up @@ -132,12 +132,7 @@ private void setAllSocketOptions() throws SocketException {

@Override
public void setTcpNoDelay(final boolean on) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setTcpNoDelay(on);
}
});
setSocketOption(() -> inner.setTcpNoDelay(on));
}

@Override
Expand All @@ -147,12 +142,7 @@ public boolean getTcpNoDelay() throws SocketException {

@Override
public void setSoLinger(final boolean on, final int linger) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setSoLinger(on, linger);
}
});
setSocketOption(() -> inner.setSoLinger(on, linger));
}

@Override
Expand All @@ -167,12 +157,7 @@ public void sendUrgentData(final int data) throws IOException {

@Override
public void setOOBInline(final boolean on) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setOOBInline(on);
}
});
setSocketOption(() -> inner.setOOBInline(on));
}

@Override
Expand All @@ -182,12 +167,7 @@ public boolean getOOBInline() throws SocketException {

@Override
public synchronized void setSoTimeout(final int timeout) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setSoTimeout(timeout);
}
});
setSocketOption(() -> inner.setSoTimeout(timeout));
}

@Override
Expand All @@ -197,12 +177,7 @@ public synchronized int getSoTimeout() throws SocketException {

@Override
public synchronized void setSendBufferSize(final int size) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setSendBufferSize(size);
}
});
setSocketOption(() -> inner.setSendBufferSize(size));
}

@Override
Expand All @@ -212,12 +187,7 @@ public synchronized int getSendBufferSize() throws SocketException {

@Override
public synchronized void setReceiveBufferSize(final int size) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setReceiveBufferSize(size);
}
});
setSocketOption(() -> inner.setReceiveBufferSize(size));
}

@Override
Expand All @@ -227,12 +197,7 @@ public synchronized int getReceiveBufferSize() throws SocketException {

@Override
public void setKeepAlive(final boolean on) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setKeepAlive(on);
}
});
setSocketOption(() -> inner.setKeepAlive(on));
}

@Override
Expand All @@ -242,12 +207,7 @@ public boolean getKeepAlive() throws SocketException {

@Override
public void setTrafficClass(final int tc) throws SocketException {
setSocketOption(new SocketOptionSetter() {
@Override
public void run() throws SocketException {
inner.setTrafficClass(tc);
}
});
setSocketOption(() -> inner.setTrafficClass(tc));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ protected AbstractCallbackNotifier<Frame> callbackNotifier(AttachContainerCmd co

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

return new POSTCallbackNotifier<Frame>(new FrameStreamProcessor(), resultCallback, webTarget.request(), null);
return new POSTCallbackNotifier<>(new FrameStreamProcessor(), resultCallback, webTarget.request(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected AbstractCallbackNotifier<Event> callbackNotifier(EventsCmd command, Re

LOGGER.trace("GET: {}", webTarget);

return new GETCallbackNotifier<Event>(new JsonStreamProcessor<Event>(Event.class), resultCallback,
return new GETCallbackNotifier<>(new JsonStreamProcessor<>(Event.class), resultCallback,
webTarget.request());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected AbstractCallbackNotifier<Frame> callbackNotifier(ExecStartCmd command,

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

return new POSTCallbackNotifier<Frame>(new FrameStreamProcessor(), resultCallback, webTarget.request().accept(
return new POSTCallbackNotifier<>(new FrameStreamProcessor(), resultCallback, webTarget.request().accept(
MediaType.APPLICATION_JSON), entity(command, MediaType.APPLICATION_JSON));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ protected AbstractCallbackNotifier<Frame> callbackNotifier(LogContainerCmd comma

LOGGER.trace("GET: {}", webTarget);

return new GETCallbackNotifier<Frame>(new FrameStreamProcessor(), resultCallback, webTarget.request());
return new GETCallbackNotifier<>(new FrameStreamProcessor(), resultCallback, webTarget.request());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ protected AbstractCallbackNotifier<Frame> callbackNotifier(LogSwarmObjectCmd com
webTarget = booleanQueryParam(webTarget, "details", command.getDetails());
LOGGER.trace("GET: {}", webTarget);

return new GETCallbackNotifier<Frame>(new FrameStreamProcessor(), resultCallback, webTarget.request());
return new GETCallbackNotifier<>(new FrameStreamProcessor(), resultCallback, webTarget.request());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected AbstractCallbackNotifier<PullResponseItem> callbackNotifier(PullImageC
Builder builder = resourceWithOptionalAuthConfig(command.getAuthConfig(), webResource.request()).accept(
MediaType.APPLICATION_OCTET_STREAM_TYPE);

return new POSTCallbackNotifier<PullResponseItem>(new JsonStreamProcessor<PullResponseItem>(
return new POSTCallbackNotifier<>(new JsonStreamProcessor<>(
PullResponseItem.class), resultCallback, builder, entity(null, MediaType.APPLICATION_JSON));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected AbstractCallbackNotifier<PushResponseItem> callbackNotifier(PushImageC
Builder builder = resourceWithAuthConfig(command.getAuthConfig(), webResource.request())
.accept(MediaType.APPLICATION_JSON);

return new POSTCallbackNotifier<PushResponseItem>(new JsonStreamProcessor<PushResponseItem>(
return new POSTCallbackNotifier<>(new JsonStreamProcessor<>(
PushResponseItem.class), resultCallback, builder, entity(null, MediaType.APPLICATION_JSON));
}
}
Loading