You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2014/06/05 09:01:25 UTC
[3/6] Docker IaaS support initial implementation
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/strategy/DockerComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/strategy/DockerComputeServiceAdapter.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/strategy/DockerComputeServiceAdapter.java
new file mode 100644
index 0000000..5646054
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/compute/strategy/DockerComputeServiceAdapter.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.compute.strategy;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.docker.DockerApi;
+import org.jclouds.docker.compute.options.DockerTemplateOptions;
+import org.jclouds.docker.domain.Config;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.domain.HostConfig;
+import org.jclouds.docker.domain.Image;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.contains;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.find;
+
+/**
+ * defines the connection between the {@link org.jclouds.docker.DockerApi} implementation and
+ * the jclouds {@link org.jclouds.compute.ComputeService}
+ */
+@Singleton
+public class DockerComputeServiceAdapter implements
+ ComputeServiceAdapter<Container, Hardware, Image, Location> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ private final DockerApi api;
+
+ @Inject
+ public DockerComputeServiceAdapter(DockerApi api) {
+ this.api = checkNotNull(api, "api");
+ }
+
+ @Override
+ public NodeAndInitialCredentials<Container> createNodeWithGroupEncodedIntoName(String group, String name,
+ Template template) {
+ checkNotNull(template, "template was null");
+ checkNotNull(template.getOptions(), "template options was null");
+ DockerTemplateOptions templateOptions = DockerTemplateOptions.class.cast(template.getOptions());
+
+ String imageId = checkNotNull(template.getImage().getId(), "template image id must not be null");
+ String loginUser = template.getImage().getDefaultCredentials().getUser();
+ String loginUserPassword = template.getImage().getDefaultCredentials().getPassword();
+
+ Map<String, Object> exposedPorts = Maps.newHashMap();
+ int[] inboundPorts = template.getOptions().getInboundPorts();
+ for (int inboundPort : inboundPorts) {
+ exposedPorts.put(inboundPort + "/tcp", Maps.newHashMap());
+ }
+
+ Config.Builder configBuilder = Config.builder()
+ .imageId(template.getImage().getName())
+ //.cmd(ImmutableList.of("/usr/sbin/sshd", "-D"))
+ .attachStdout(true)
+ .attachStderr(true)
+ .exposedPorts(exposedPorts);
+
+ if (templateOptions.getVolumes().isPresent()) {
+ Map<String, Object> volumes = Maps.newLinkedHashMap();
+ for (String containerDir : templateOptions.getVolumes().get().values()) {
+ volumes.put(containerDir, Maps.newHashMap());
+ }
+ configBuilder.volumes(volumes);
+ }
+ Config config = configBuilder.build();
+
+ logger.debug(">> creating new container with config(%s)", config);
+ Container container = api.getRemoteApi().createContainer(name, config);
+ logger.trace("<< container(%s)", container.getId());
+
+ // set up for port bindings
+ Map<String, List<Map<String, String>>> portBindings = Maps.newHashMap();
+ HostConfig.Builder hostConfigBuilder = HostConfig.builder()
+ .portBindings(portBindings)
+ .publishAllPorts(true)
+ .privileged(true);
+
+ // set up for volume bindings
+ if (templateOptions.getVolumes().isPresent()) {
+ for (Map.Entry<String,String> entry : templateOptions.getVolumes().get().entrySet()) {
+ hostConfigBuilder.binds(ImmutableList.of(entry.getKey() + ":" + entry.getValue()));
+ }
+ }
+ HostConfig hostConfig = hostConfigBuilder.build();
+
+ api.getRemoteApi().startContainer(container.getId(), hostConfig);
+ container = api.getRemoteApi().inspectContainer(container.getId());
+ if (!container.getState().isRunning()) {
+ destroyNode(container.getId());
+ throw new IllegalStateException(String.format("Container %s has not started correctly", container.getId()));
+ }
+ return new NodeAndInitialCredentials<Container>(container, container.getId(),
+ LoginCredentials.builder().user(loginUser).password(loginUserPassword).build());
+ }
+
+ @Override
+ public Iterable<Hardware> listHardwareProfiles() {
+ Set<Hardware> hardware = Sets.newLinkedHashSet();
+ // todo they are only placeholders at the moment
+ hardware.add(new HardwareBuilder().ids("micro").hypervisor("lxc").name("micro").ram(512).build());
+ hardware.add(new HardwareBuilder().ids("small").hypervisor("lxc").name("small").ram(1024).build());
+ hardware.add(new HardwareBuilder().ids("medium").hypervisor("lxc").name("medium").ram(2048).build());
+ hardware.add(new HardwareBuilder().ids("large").hypervisor("lxc").name("large").ram(3072).build());
+ return hardware;
+ }
+
+ @Override
+ public Set<Image> listImages() {
+ //return api.getRemoteApi().listImages();
+ Set<Image> images = Sets.newHashSet();
+ for (Image image : api.getRemoteApi().listImages()) {
+ // less efficient than just listNodes but returns richer json that needs repoTags coming from listImages
+ Image inspected = api.getRemoteApi().inspectImage(image.getId());
+ if(image.getRepoTags() != null) {
+ inspected = Image.builder().fromImage(inspected).repoTags(image.getRepoTags()).build();
+ }
+ images.add(inspected);
+ }
+ return images;
+ }
+
+ @Override
+ public Image getImage(final String imageId) {
+ return find(listImages(), new Predicate<Image>() {
+
+ @Override
+ public boolean apply(Image input) {
+ return input.getId().equals(imageId);
+ }
+
+ }, null);
+ }
+
+ @Override
+ public Iterable<Container> listNodes() {
+ Set<Container> containers = Sets.newHashSet();
+ for (Container container : api.getRemoteApi().listContainers()) {
+ // less efficient than just listNodes but returns richer json
+ containers.add(api.getRemoteApi().inspectContainer(container.getId()));
+ }
+ return containers;
+ }
+
+ @Override
+ public Iterable<Container> listNodesByIds(final Iterable<String> ids) {
+ return filter(listNodes(), new Predicate<Container>() {
+
+ @Override
+ public boolean apply(Container server) {
+ return contains(ids, server.getId());
+ }
+ });
+ }
+
+ @Override
+ public Iterable<Location> listLocations() {
+ return ImmutableSet.of();
+ }
+
+ @Override
+ public Container getNode(String id) {
+ return api.getRemoteApi().inspectContainer(id);
+ }
+
+ @Override
+ public void destroyNode(String id) {
+ api.getRemoteApi().stopContainer(id);
+ api.getRemoteApi().removeContainer(id);
+ }
+
+ @Override
+ public void rebootNode(String id) {
+ api.getRemoteApi().startContainer(id);
+ }
+
+ @Override
+ public void resumeNode(String id) {
+ api.getRemoteApi().startContainer(id);
+ }
+
+ @Override
+ public void suspendNode(String id) {
+ api.getRemoteApi().stopContainer(id);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerHttpApiModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerHttpApiModule.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerHttpApiModule.java
new file mode 100644
index 0000000..464eb8d
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerHttpApiModule.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.config;
+
+import org.jclouds.docker.DockerApi;
+import org.jclouds.docker.handlers.DockerErrorHandler;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+
+/**
+ * Configures the Docker connection.
+ *
+ * @author Andrea Turli
+ */
+@ConfiguresHttpApi
+public class DockerHttpApiModule extends HttpApiModule<DockerApi> {
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(DockerErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(DockerErrorHandler.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(DockerErrorHandler.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerParserModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerParserModule.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerParserModule.java
new file mode 100644
index 0000000..abdeea3
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerParserModule.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.config;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import org.jclouds.docker.domain.Container;
+import org.jclouds.docker.domain.Image;
+import org.jclouds.json.config.GsonModule;
+
+import javax.inject.Singleton;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+/**
+ * @author Andrea Turli
+ */
+public class DockerParserModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
+ }
+
+ @Provides
+ @Singleton
+ public Map<Type, Object> provideCustomAdapterBindings() {
+ return new ImmutableMap.Builder<Type, Object>()
+ .put(Container.class, new ContainerTypeAdapter())
+ .put(Image.class, new ImageTypeAdapter())
+ .build();
+ }
+
+ protected static class ContainerTypeAdapter implements JsonDeserializer<Container> {
+
+ @Override
+ public Container deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws
+ JsonParseException {
+ Gson gson = new GsonBuilder().serializeNulls().create();
+ final JsonObject jsonObject = json.getAsJsonObject();
+
+ // container:inspect returns ID instead of Id as listContainers
+ if (jsonObject.has("ID")) {
+ JsonElement id = jsonObject.get("ID");
+ jsonObject.remove("ID");
+ jsonObject.add("Id", id);
+ }
+ // container:inspect returns Name instead of Names as listContainers
+ if (jsonObject.has("Names")) {
+ final JsonArray jsonNamesArray = jsonObject.getAsJsonArray("Names");
+ jsonObject.remove("Names");
+ jsonObject.add("Name", jsonNamesArray.get(0));
+ }
+ return gson.fromJson(jsonObject, Container.class);
+ }
+
+ }
+
+ protected static class ImageTypeAdapter implements JsonDeserializer<Image> {
+
+ @Override
+ public Image deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws
+ JsonParseException {
+ Gson gson = new GsonBuilder().serializeNulls().create();
+ final JsonObject jsonObject = json.getAsJsonObject();
+
+ // image:inspect returns id instead of Id as listImages
+ if (jsonObject.has("Id")) {
+ JsonElement id = jsonObject.get("Id");
+ jsonObject.remove("Id");
+ jsonObject.add("id", id);
+ }
+ return gson.fromJson(jsonObject, Image.class);
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerProperties.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerProperties.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerProperties.java
new file mode 100644
index 0000000..487b19b
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/config/DockerProperties.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.config;
+
+/**
+ * @author Andrea Turli
+ */
+public class DockerProperties {
+
+ /**
+ * default Docker host password
+ */
+ public static final String HOST_PASSWORD = "jclouds.docker.host.password";
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Config.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Config.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Config.java
new file mode 100644
index 0000000..91dd47e
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Config.java
@@ -0,0 +1,460 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Andrea Turli
+ */
+public class Config {
+
+ @SerializedName("Hostname")
+ private final String hostname;
+ @SerializedName("Domainname")
+ private final String domainName;
+ @SerializedName("User")
+ private final String user;
+ @SerializedName("Memory")
+ private final int memory;
+ @SerializedName("MemorySwap")
+ private final int memorySwap;
+ @SerializedName("CpuShares")
+ private final int cpuShares;
+ @SerializedName("AttachStdin")
+ private final boolean attachStdin;
+ @SerializedName("AttachStdout")
+ private final boolean attachStdout;
+ @SerializedName("AttachStderr")
+ private final boolean attachStderr;
+ @SerializedName("ExposedPorts")
+ private final Map<String, ?> exposedPorts;
+ @SerializedName("Tty")
+ private final boolean tty;
+ @SerializedName("OpenStdin")
+ private final boolean openStdin;
+ @SerializedName("StdinOnce")
+ private final boolean stdinOnce;
+ @SerializedName("Env")
+ private final List<String> env;
+ @SerializedName("Cmd")
+ private final List<String> cmd;
+ @SerializedName("Dns")
+ private final List<String> dns;
+ @SerializedName("Image")
+ private final String imageId;
+ @SerializedName("Volumes")
+ private final Map<String, ?> volumes;
+ @SerializedName("VolumesFrom")
+ private final String volumesFrom;
+ @SerializedName("WorkingDir")
+ private final String workingDir;
+ @SerializedName("Entrypoint")
+ private final List<String> entrypoint;
+ @SerializedName("NetworkDisabled")
+ private final boolean networkDisabled;
+ @SerializedName("OnBuild")
+ private final String onBuild;
+
+
+ @ConstructorProperties({ "Hostname", "Domainname", "User", "Memory", "MemorySwap", "CpuShares", "AttachStdin",
+ "AttachStdout", "AttachStderr", "PortSpecs", "ExposedPorts", "Tty", "OpenStdin", "StdinOnce", "Env", "Cmd",
+ "Dns", "Image", "Volumes", "VolumesFrom", "WorkingDir", "Entrypoint", "NetworkDisabled", "OnBuild" })
+ Config(@Nullable String hostname, @Nullable String domainName, @Nullable String user, int memory, int memorySwap,
+ int cpuShares, boolean attachStdin, boolean attachStdout, boolean attachStderr,
+ Map<String, ?> exposedPorts, boolean tty, boolean openStdin, boolean stdinOnce,
+ @Nullable List<String> env, @Nullable List<String> cmd, @Nullable List<String> dns, String imageId,
+ Map<String, ?> volumes, @Nullable String volumesFrom, @Nullable String workingDir,
+ @Nullable List<String> entrypoint, @Nullable boolean networkDisabled, @Nullable String onBuild) {
+ this.hostname = hostname;
+ this.domainName = domainName;
+ this.user = user;
+ this.memory = checkNotNull(memory, "memory");
+ this.memorySwap = checkNotNull(memorySwap, "memorySwap");
+ this.cpuShares = checkNotNull(cpuShares, "cpuShares");
+ this.attachStdin = checkNotNull(attachStdin, "attachStdin");
+ this.attachStdout = checkNotNull(attachStdout, "attachStdout");
+ this.attachStderr = checkNotNull(attachStderr, "attachStderr");
+ this.exposedPorts = exposedPorts != null ? ImmutableMap.copyOf(exposedPorts) : ImmutableMap.<String, Object> of();
+ this.tty = checkNotNull(tty, "tty");
+ this.openStdin = checkNotNull(openStdin, "openStdin");
+ this.stdinOnce = checkNotNull(stdinOnce, "stdinOnce");
+ this.env = env != null ? ImmutableList.copyOf(cmd) : ImmutableList.<String> of();
+ this.cmd = cmd != null ? ImmutableList.copyOf(cmd) : ImmutableList.<String> of();
+ this.dns = dns != null ? ImmutableList.copyOf(dns) : ImmutableList.<String> of();
+ this.imageId = checkNotNull(imageId, "imageId");
+ this.volumes = volumes != null ? ImmutableMap.copyOf(volumes) : ImmutableMap.<String, Object> of();
+ this.volumesFrom = volumesFrom;
+ this.workingDir = workingDir;
+ this.entrypoint = entrypoint;
+ this.networkDisabled = networkDisabled;
+ this.onBuild = onBuild;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public int getMemory() {
+ return memory;
+ }
+
+ public int getMemorySwap() {
+ return memorySwap;
+ }
+
+ public int getCpuShares() {
+ return cpuShares;
+ }
+
+ public boolean isAttachStdin() {
+ return attachStdin;
+ }
+
+ public boolean isAttachStdout() {
+ return attachStdout;
+ }
+
+ public boolean isAttachStderr() {
+ return attachStderr;
+ }
+
+ public Map<String, ?> getExposedPorts() {
+ return exposedPorts;
+ }
+
+ public boolean isTty() {
+ return tty;
+ }
+
+ public boolean isOpenStdin() {
+ return openStdin;
+ }
+
+ public boolean isStdinOnce() {
+ return stdinOnce;
+ }
+
+ public List<String> getEnv() {
+ return env;
+ }
+
+ public List<String> getCmd() {
+ return cmd;
+ }
+
+ public List<String> getDns() {
+ return dns;
+ }
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ public Map<String, ?> getVolumes() {
+ return volumes;
+ }
+
+ public String getVolumesFrom() {
+ return volumesFrom;
+ }
+
+ public String getWorkingDir() {
+ return workingDir;
+ }
+
+ public List<String> getEntrypoint() {
+ return entrypoint;
+ }
+
+ public boolean isNetworkDisabled() {
+ return networkDisabled;
+ }
+
+ public String getOnBuild() {
+ return onBuild;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Config that = (Config) o;
+
+ return Objects.equal(this.hostname, that.hostname) &&
+ Objects.equal(this.domainName, that.domainName) &&
+ Objects.equal(this.user, that.user) &&
+ Objects.equal(this.memory, that.memory) &&
+ Objects.equal(this.memorySwap, that.memorySwap) &&
+ Objects.equal(this.cpuShares, that.cpuShares) &&
+ Objects.equal(this.attachStdin, that.attachStdin) &&
+ Objects.equal(this.attachStdout, that.attachStdout) &&
+ Objects.equal(this.attachStderr, that.attachStderr) &&
+ Objects.equal(this.exposedPorts, that.exposedPorts) &&
+ Objects.equal(this.tty, that.tty) &&
+ Objects.equal(this.openStdin, that.openStdin) &&
+ Objects.equal(this.stdinOnce, that.stdinOnce) &&
+ Objects.equal(this.env, that.env) &&
+ Objects.equal(this.cmd, that.cmd) &&
+ Objects.equal(this.dns, that.dns) &&
+ Objects.equal(this.imageId, that.imageId) &&
+ Objects.equal(this.volumes, that.volumes) &&
+ Objects.equal(this.volumesFrom, that.volumesFrom) &&
+ Objects.equal(this.workingDir, that.workingDir) &&
+ Objects.equal(this.entrypoint, that.entrypoint) &&
+ Objects.equal(this.onBuild, that.onBuild);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(hostname, domainName, user, memory, memorySwap, cpuShares, attachStdin, attachStdout,
+ attachStderr, exposedPorts, tty, openStdin, stdinOnce, env, cmd, dns, imageId, volumes,
+ volumesFrom, workingDir, entrypoint, networkDisabled, onBuild);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("hostname", hostname)
+ .add("domainName", domainName)
+ .add("user", user)
+ .add("memory", memory)
+ .add("memorySwap", memorySwap)
+ .add("cpuShares", cpuShares)
+ .add("attachStdin", attachStdin)
+ .add("attachStdout", attachStdout)
+ .add("attachStderr", attachStderr)
+ .add("exposedPorts", exposedPorts)
+ .add("tty", tty)
+ .add("openStdin", openStdin)
+ .add("stdinOnce", stdinOnce)
+ .add("env", env)
+ .add("cmd", cmd)
+ .add("dns", dns)
+ .add("imageId", imageId)
+ .add("volumes", volumes)
+ .add("volumesFrom", volumesFrom)
+ .add("workingDir", workingDir)
+ .add("entrypoint", entrypoint)
+ .add("networkDisabled", networkDisabled)
+ .add("onBuild", onBuild)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromConfig(this);
+ }
+
+ public static final class Builder {
+ private String hostname;
+ private String domainName;
+ private String user;
+ private int memory;
+ private int memorySwap;
+ private int cpuShares;
+ private boolean attachStdin;
+ private boolean attachStdout;
+ private boolean attachStderr;
+ private Map<String, ?> portSpecs = ImmutableMap.of();
+ private Map<String, ?> exposedPorts = ImmutableMap.of();
+ private boolean tty;
+ private boolean openStdin;
+ private boolean stdinOnce;
+ private List<String> env = ImmutableList.of();
+ private List<String> cmd = ImmutableList.of();
+ private List<String> dns = ImmutableList.of();
+ private String imageId;
+ private Map<String, ?> volumes = ImmutableMap.of();
+ private String volumesFrom;
+ private String workingDir;
+ private List<String> entrypoint = ImmutableList.of();
+ private boolean networkDisabled;
+ private String onBuild;
+
+ public Builder hostname(String hostname) {
+ this.hostname = hostname;
+ return this;
+ }
+
+ public Builder domainName(String domainName) {
+ this.domainName = domainName;
+ return this;
+ }
+
+ public Builder user(String user) {
+ this.user = user;
+ return this;
+ }
+
+ public Builder memory(int memory) {
+ this.memory = memory;
+ return this;
+ }
+
+ public Builder memorySwap(int memorySwap) {
+ this.memorySwap = memorySwap;
+ return this;
+ }
+
+ public Builder cpuShares(int cpuShares) {
+ this.cpuShares = cpuShares;
+ return this;
+ }
+
+ public Builder attachStdin(boolean attachStdin) {
+ this.attachStdin = attachStdin;
+ return this;
+ }
+
+ public Builder attachStdout(boolean attachStdout) {
+ this.attachStdout = attachStdout;
+ return this;
+ }
+
+ public Builder attachStderr(boolean attachStderr) {
+ this.attachStderr = attachStderr;
+ return this;
+ }
+
+ public Builder exposedPorts(Map<String, ?> exposedPorts) {
+ this.exposedPorts = ImmutableMap.copyOf(checkNotNull(exposedPorts, "exposedPorts"));
+ return this;
+ }
+
+ public Builder tty(boolean tty) {
+ this.tty = tty;
+ return this;
+ }
+
+ public Builder openStdin(boolean openStdin) {
+ this.openStdin = openStdin;
+ return this;
+ }
+
+ public Builder stdinOnce(boolean stdinOnce) {
+ this.stdinOnce = stdinOnce;
+ return this;
+ }
+
+ public Builder env(List<String> env) {
+ this.env = env;
+ return this;
+ }
+
+ public Builder cmd(List<String> cmd) {
+ this.cmd = ImmutableList.copyOf(checkNotNull(cmd, "cmd"));
+ return this;
+ }
+
+ public Builder dns(List<String> dns) {
+ this.dns = ImmutableList.copyOf(checkNotNull(dns, "dns"));
+ return this;
+ }
+
+ public Builder imageId(String imageId) {
+ this.imageId = imageId;
+ return this;
+ }
+
+ public Builder volumes(Map<String, ?> volumes) {
+ this.volumes = ImmutableMap.copyOf(checkNotNull(volumes, "volumes"));
+ return this;
+ }
+
+ public Builder volumesFrom(String volumesFrom) {
+ this.volumesFrom = volumesFrom;
+ return this;
+ }
+
+ public Builder workingDir(String workingDir) {
+ this.workingDir = workingDir;
+ return this;
+ }
+
+ public Builder entrypoint(List<String> entrypoint) {
+ this.entrypoint = entrypoint;
+ return this;
+ }
+
+ public Builder networkDisabled(boolean networkDisabled) {
+ this.networkDisabled = networkDisabled;
+ return this;
+ }
+
+ public Builder onBuild(String onBuild) {
+ this.onBuild = onBuild;
+ return this;
+ }
+
+ public Config build() {
+ return new Config(hostname, domainName, user, memory, memorySwap, cpuShares, attachStdin, attachStdout,
+ attachStderr, exposedPorts, tty, openStdin, stdinOnce, env, cmd, dns, imageId, volumes,
+ volumesFrom, workingDir, entrypoint, networkDisabled, onBuild);
+ }
+
+ public Builder fromConfig(Config in) {
+ return this
+ .hostname(in.getHostname())
+ .domainName(in.getDomainName())
+ .user(in.getUser())
+ .memory(in.getMemory())
+ .memorySwap(in.getMemorySwap())
+ .cpuShares(in.getCpuShares())
+ .attachStdin(in.isAttachStdin())
+ .attachStdout(in.isAttachStdout())
+ .attachStderr(in.isAttachStderr())
+ .exposedPorts(in.getExposedPorts())
+ .tty(in.isTty())
+ .openStdin(in.isOpenStdin())
+ .stdinOnce(in.isStdinOnce())
+ .env(in.getEnv())
+ .cmd(in.getCmd())
+ .dns(in.getDns())
+ .imageId(in.getImageId())
+ .volumes(in.getVolumes())
+ .volumesFrom(in.getVolumesFrom())
+ .workingDir(in.getWorkingDir())
+ .entrypoint(in.getEntrypoint())
+ .networkDisabled(in.isNetworkDisabled())
+ .onBuild(in.getOnBuild());
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Container.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Container.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Container.java
new file mode 100644
index 0000000..8f0129e
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Container.java
@@ -0,0 +1,372 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Andrea Turli
+ */
+public class Container {
+
+ @SerializedName("Id")
+ private final String id;
+ @SerializedName("Name")
+ private final String name;
+ @SerializedName("Created")
+ private final String created;
+ @SerializedName("Path")
+ private final String path;
+ @SerializedName("Args")
+ private final String[] args;
+ @SerializedName("Config")
+ private final Config config;
+ @SerializedName("State")
+ private final State state;
+ @SerializedName("Image")
+ private final String image;
+ @SerializedName("NetworkSettings")
+ private final NetworkSettings networkSettings;
+ @SerializedName("ResolvConfPath")
+ private final String resolvConfPath;
+ @SerializedName("Driver")
+ private final String driver;
+ @SerializedName("ExecDriver")
+ private final String execDriver;
+ @SerializedName("Volumes")
+ private final Map<String, String> volumes;
+ @SerializedName("VolumesRW")
+ private final Map<String, Boolean> volumesRw;
+ @SerializedName("Command")
+ private final String command;
+ @SerializedName("Status")
+ private final String status;
+ @SerializedName("HostConfig")
+ private final HostConfig hostConfig;
+ @SerializedName("Ports")
+ private final List<Port> ports;
+
+ @ConstructorProperties({ "Id", "Name", "Created", "Path", "Args", "Config", "State", "Image", "NetworkSettings",
+ "ResolvConfPath", "Driver", "ExecDriver", "Volumes", "VolumesRW", "Command", "Status", "HostConfig", "Ports" })
+ public Container(String id, String name, String created, String path, String[] args, Config config, State state,
+ String image, NetworkSettings networkSettings, String resolvConfPath,
+ String driver, String execDriver, Map<String, String> volumes, Map<String, Boolean> volumesRW,
+ String command, String status, HostConfig hostConfig, List<Port> ports) {
+ this.id = checkNotNull(id, "id");
+ this.name = checkNotNull(name, "name");
+ this.created = checkNotNull(created, "created");
+ this.path = checkNotNull(path, "path");
+ this.args = checkNotNull(args, "args");
+ this.config = checkNotNull(config, "config");
+ this.state = checkNotNull(state, "state");
+ this.image = checkNotNull(image, "image");
+ this.networkSettings = checkNotNull(networkSettings, "networkSettings");
+ this.resolvConfPath = checkNotNull(resolvConfPath, "resolvConfPath");
+ this.driver = checkNotNull(driver, "driver");
+ this.execDriver = checkNotNull(execDriver, "execDriver");
+ this.volumes = checkNotNull(volumes, "volumes");
+ this.volumesRw = checkNotNull(volumesRW, "volumesRW");
+ this.command = checkNotNull(command, "command");
+ this.status = checkNotNull(status, "status");
+ this.hostConfig = checkNotNull(hostConfig, "hostConfig");
+ this.ports = checkNotNull(ports, "ports");
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String[] getArgs() {
+ return args;
+ }
+
+ public Config getConfig() {
+ return config;
+ }
+
+ public State getState() {
+ return state;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public NetworkSettings getNetworkSettings() {
+ return networkSettings;
+ }
+
+ public String getResolvConfPath() {
+ return resolvConfPath;
+ }
+
+ public String getDriver() {
+ return driver;
+ }
+
+ public String getExecDriver() {
+ return execDriver;
+ }
+
+ public Map<String, String> getVolumes() {
+ return volumes;
+ }
+
+ public Map<String, Boolean> getVolumesRw() {
+ return volumesRw;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public HostConfig getHostConfig() {
+ return hostConfig;
+ }
+
+ public List<Port> getPorts() {
+ return ports;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Container that = (Container) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.name, that.name) &&
+ Objects.equal(this.created, that.created) &&
+ Objects.equal(this.path, that.path) &&
+ Objects.equal(this.args, that.args) &&
+ Objects.equal(this.config, that.config) &&
+ Objects.equal(this.state, that.state) &&
+ Objects.equal(this.image, that.image) &&
+ Objects.equal(this.networkSettings, that.networkSettings) &&
+ Objects.equal(this.resolvConfPath, that.resolvConfPath) &&
+ Objects.equal(this.driver, that.driver) &&
+ Objects.equal(this.execDriver, that.execDriver) &&
+ Objects.equal(this.volumes, that.volumes) &&
+ Objects.equal(this.volumesRw, that.volumesRw) &&
+ Objects.equal(this.command, that.command) &&
+ Objects.equal(this.status, that.status) &&
+ Objects.equal(this.hostConfig, that.hostConfig) &&
+ Objects.equal(this.ports, that.ports);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, name, created, path, args, config, state, image, networkSettings, resolvConfPath,
+ driver, execDriver, volumes, volumesRw, command, status, hostConfig, ports);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("name", name)
+ .add("created", created)
+ .add("path", path)
+ .add("args", args)
+ .add("config", config)
+ .add("state", state)
+ .add("image", image)
+ .add("networkSettings", networkSettings)
+ .add("resolvConfPath", resolvConfPath)
+ .add("driver", driver)
+ .add("execDriver", execDriver)
+ .add("volumes", volumes)
+ .add("volumesRw", volumesRw)
+ .add("command", command)
+ .add("status", status)
+ .add("hostConfig", hostConfig)
+ .add("ports", ports)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromContainer(this);
+ }
+
+ public static final class Builder {
+
+ private String id;
+ private String name;
+ private String created;
+ private String path;
+ private String[] args;
+ private Config config;
+ private State state;
+ private String image;
+ private NetworkSettings networkSettings;
+ private String resolvConfPath;
+ private String driver;
+ private String execDriver;
+ private Map<String, String> volumes = ImmutableMap.of();
+ private Map<String, Boolean> volumesRw = ImmutableMap.of();
+ private String command;
+ private String status;
+ private HostConfig hostConfig;
+ private List<Port> ports = ImmutableList.of();
+
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder created(String created) {
+ this.created = created;
+ return this;
+ }
+
+ public Builder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public Builder args(String[] args) {
+ this.args = args;
+ return this;
+ }
+
+ public Builder config(Config config) {
+ this.config = config;
+ return this;
+ }
+
+ public Builder state(State state) {
+ this.state = state;
+ return this;
+ }
+
+ public Builder image(String imageName) {
+ this.image = imageName;
+ return this;
+ }
+
+ public Builder networkSettings(NetworkSettings networkSettings) {
+ this.networkSettings = networkSettings;
+ return this;
+ }
+
+ public Builder resolvConfPath(String resolvConfPath) {
+ this.resolvConfPath = resolvConfPath;
+ return this;
+ }
+
+ public Builder driver(String driver) {
+ this.driver = driver;
+ return this;
+ }
+
+ public Builder execDriver(String execDriver) {
+ this.execDriver = execDriver;
+ return this;
+ }
+
+ public Builder volumes(Map<String, String> volumes) {
+ this.volumes = volumes;
+ return this;
+ }
+
+ public Builder volumesRw(Map<String, Boolean> volumesRw) {
+ this.volumesRw = volumesRw;
+ return this;
+ }
+
+ public Builder command(String command) {
+ this.command = command;
+ return this;
+ }
+
+ public Builder status(String status) {
+ this.status = status;
+ return this;
+ }
+
+ public Builder hostConfig(HostConfig hostConfig) {
+ this.hostConfig = hostConfig;
+ return this;
+ }
+
+ public Builder ports(List<Port> ports) {
+ this.ports = ports;
+ return this;
+ }
+
+ public Container build() {
+ return new Container(id, name, created, path, args, config, state, image, networkSettings, resolvConfPath,
+ driver, execDriver, volumes, volumesRw, command, status, hostConfig, ports);
+ }
+
+ public Builder fromContainer(Container in) {
+ return this
+ .id(in.getId())
+ .name(in.getName())
+ .created(in.getCreated())
+ .path(in.getPath())
+ .args(in.getArgs())
+ .config(in.getConfig())
+ .state(in.getState())
+ .image(in.getImage())
+ .networkSettings(in.getNetworkSettings())
+ .resolvConfPath(in.getResolvConfPath())
+ .driver(in.getDriver())
+ .execDriver(in.getExecDriver())
+ .volumes(in.getVolumes())
+ .volumesRw(in.getVolumesRw())
+ .command(in.getCommand())
+ .status(in.getStatus())
+ .hostConfig(in.getHostConfig())
+ .ports(in.getPorts());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/ExposedPorts.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/ExposedPorts.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/ExposedPorts.java
new file mode 100644
index 0000000..146c38b
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/ExposedPorts.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableSet;
+
+import java.beans.ConstructorProperties;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * @author Andrea Turli
+ */
+public class ExposedPorts {
+
+ private final String portAndProtocol;
+ private final Set<String> hostPorts;
+
+ @ConstructorProperties({ "PortAndProtocol", "HostPorts" })
+ public ExposedPorts(String portAndProtocol, Set<String> hostPorts) {
+ this.portAndProtocol = checkNotNull(portAndProtocol, "portAndProtocol");
+ this.hostPorts = hostPorts != null ? ImmutableSet.copyOf(hostPorts) : ImmutableSet.<String> of();
+ }
+
+ public String getPortAndProtocol() {
+ return portAndProtocol;
+ }
+
+ public Set<String> getHostPorts() {
+ return hostPorts;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ExposedPorts that = (ExposedPorts) o;
+
+ return Objects.equal(this.portAndProtocol, that.portAndProtocol) &&
+ Objects.equal(this.hostPorts, that.hostPorts);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(portAndProtocol, hostPorts);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("portAndProtocol", portAndProtocol)
+ .add("hostPorts", hostPorts)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromExposedPorts(this);
+ }
+
+ public static final class Builder {
+
+ private String portAndProtocol;
+ private Set<String> hostPorts = ImmutableSet.of();
+
+ public Builder portAndProtocol(String portAndProtocol) {
+ this.portAndProtocol = portAndProtocol;
+ return this;
+ }
+
+ public Builder hostPorts(Set<String> hostPorts) {
+ this.hostPorts = ImmutableSet.copyOf(checkNotNull(hostPorts, "hostPorts"));
+ return this;
+ }
+
+ public ExposedPorts build() {
+ return new ExposedPorts(portAndProtocol, hostPorts);
+ }
+
+ public Builder fromExposedPorts(ExposedPorts in) {
+ return this.portAndProtocol(in.getPortAndProtocol())
+ .hostPorts(in.getHostPorts());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/HostConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/HostConfig.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/HostConfig.java
new file mode 100644
index 0000000..10ae1c1
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/HostConfig.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.annotations.SerializedName;
+import org.jclouds.javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * @author Andrea Turli
+ */
+public class HostConfig {
+
+ @SerializedName("ContainerIDFile")
+ private final String containerIDFile;
+ @SerializedName("Binds")
+ private final List<String> binds;
+ @SerializedName("Privileged")
+ private final boolean privileged;
+ @SerializedName("PortBindings")
+ private final Map<String, List<Map<String, String>>> portBindings;
+ @SerializedName("Links")
+ private final List<String> links;
+ @SerializedName("PublishAllPorts")
+ private final boolean publishAllPorts;
+
+ @ConstructorProperties({ "ContainerIDFile", "Binds", "Privileged", "PortBindings", "Links", "Size",
+ "PublishAllPorts" })
+ public HostConfig(@Nullable String containerIDFile, @Nullable List<String> binds, @Nullable boolean privileged,
+ @Nullable Map<String, List<Map<String, String>>> portBindings, @Nullable List<String> links,
+ @Nullable boolean publishAllPorts) {
+ this.containerIDFile = containerIDFile;
+ this.binds = binds != null ? ImmutableList.copyOf(binds) : ImmutableList.<String> of();
+ this.privileged = privileged;
+ this.portBindings = portBindings != null ? ImmutableMap.copyOf(portBindings) : ImmutableMap.<String, List<Map<String, String>>> of();
+ this.links = links != null ? ImmutableList.copyOf(links) : ImmutableList.<String> of();
+ this.publishAllPorts = publishAllPorts;
+ }
+
+ public String getContainerIDFile() {
+ return containerIDFile;
+ }
+
+ public List<String> getBinds() {
+ return binds;
+ }
+
+ public boolean isPrivileged() {
+ return privileged;
+ }
+
+ public Map<String, List<Map<String, String>>> getPortBindings() {
+ return portBindings;
+ }
+
+ @Nullable
+ public List<String> getLinks() {
+ return links;
+ }
+
+ public boolean isPublishAllPorts() {
+ return publishAllPorts;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ HostConfig that = (HostConfig) o;
+
+ return Objects.equal(this.containerIDFile, that.containerIDFile) &&
+ Objects.equal(this.binds, that.binds) &&
+ Objects.equal(this.privileged, that.privileged) &&
+ Objects.equal(this.portBindings, that.portBindings) &&
+ Objects.equal(this.links, that.links) &&
+ Objects.equal(this.publishAllPorts, that.publishAllPorts);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(containerIDFile, binds, privileged, portBindings, links, publishAllPorts);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("containerIDFile", containerIDFile)
+ .add("binds", binds)
+ .add("privileged", privileged)
+ .add("portBindings", portBindings)
+ .add("links", links)
+ .add("publishAllPorts", publishAllPorts)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromHostConfig(this);
+ }
+
+ public static final class Builder {
+
+ private String containerIDFile;
+ private List<String> binds = ImmutableList.of();
+ private boolean privileged;
+ private Map<String, List<Map<String, String>>> portBindings = ImmutableMap.of();
+ private List<String> links = ImmutableList.of();
+ private boolean publishAllPorts;
+
+ public Builder containerIDFile(String containerIDFile) {
+ this.containerIDFile = containerIDFile;
+ return this;
+ }
+
+ public Builder binds(List<String> binds) {
+ this.binds = ImmutableList.copyOf(checkNotNull(binds, "binds"));
+ return this;
+ }
+
+ public Builder privileged(boolean privileged) {
+ this.privileged = privileged;
+ return this;
+ }
+
+ public Builder links(List<String> links) {
+ this.links = ImmutableList.copyOf(checkNotNull(links, "links"));
+ return this;
+ }
+
+ public Builder portBindings(Map<String, List<Map<String, String>>> portBindings) {
+ this.portBindings = ImmutableMap.copyOf(portBindings);
+ return this;
+ }
+
+ public Builder publishAllPorts(boolean publishAllPorts) {
+ this.publishAllPorts = publishAllPorts;
+ return this;
+ }
+
+ public HostConfig build() {
+ return new HostConfig(containerIDFile, binds, privileged, portBindings, links, publishAllPorts);
+ }
+
+ public Builder fromHostConfig(HostConfig in) {
+ return this
+ .containerIDFile(in.getContainerIDFile())
+ .binds(in.getBinds())
+ .privileged(in.isPrivileged())
+ .links(in.getLinks())
+ .portBindings(in.getPortBindings())
+ .publishAllPorts(in.isPublishAllPorts());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Image.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Image.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Image.java
new file mode 100644
index 0000000..aa811f3
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Image.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+import com.google.gson.annotations.SerializedName;
+import org.jclouds.javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class Image {
+
+ @SerializedName("id")
+ private final String id;
+ @SerializedName("parent")
+ private final String parent;
+ @SerializedName("Created")
+ private final String created;
+ @SerializedName("container")
+ private final String container;
+ @SerializedName("docker_version")
+ private final String dockerVersion;
+ @SerializedName("architecture")
+ private final String architecture;
+ @SerializedName("os")
+ private final String os;
+ @SerializedName("Size")
+ private final long size;
+ @SerializedName("VirtualSize")
+ private final long virtualSize;
+ @SerializedName("RepoTags")
+ private final List<String> repoTags;
+
+ @ConstructorProperties({ "id", "parent", "created", "container", "docker_version", "architecture", "os", "Size",
+ "VirtualSize", "RepoTags" })
+ public Image(String id, @Nullable String parent, @Nullable String created, @Nullable String container,
+ @Nullable String dockerVersion, @Nullable String architecture, @Nullable String os, long size,
+ @Nullable long virtualSize, @Nullable List<String> repoTags) {
+ this.id = checkNotNull(id, "id");
+ this.parent = parent;
+ this.created = created;
+ this.container = container;
+ this.dockerVersion = dockerVersion;
+ this.architecture = architecture;
+ this.os = os;
+ this.size = size;
+ this.virtualSize = virtualSize;
+ this.repoTags = repoTags != null ? ImmutableList.copyOf(repoTags) : ImmutableList.<String> of();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getParent() {
+ return parent;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public String getContainer() {
+ return container;
+ }
+
+ public String getDockerVersion() {
+ return dockerVersion;
+ }
+
+ public String getArchitecture() {
+ return architecture;
+ }
+
+ public String getOs() {
+ return os;
+ }
+
+ public long getSize() {
+ return size;
+ }
+
+ public long getVirtualSize() {
+ return virtualSize;
+ }
+
+ public List<String> getRepoTags() {
+ return repoTags;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Image that = (Image) o;
+
+ return Objects.equal(this.id, that.id) &&
+ Objects.equal(this.parent, that.parent) &&
+ Objects.equal(this.created, that.created) &&
+ Objects.equal(this.container, that.container) &&
+ Objects.equal(this.dockerVersion, that.dockerVersion) &&
+ Objects.equal(this.architecture, that.architecture) &&
+ Objects.equal(this.os, that.os) &&
+ Objects.equal(this.size, that.size) &&
+ Objects.equal(this.virtualSize, that.virtualSize);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(id, parent, created, container, dockerVersion, architecture, os, size,
+ virtualSize);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("id", id)
+ .add("parent", parent)
+ .add("created", created)
+ .add("container", container)
+ .add("dockerVersion", dockerVersion)
+ .add("architecture", architecture)
+ .add("os", os)
+ .add("size", size)
+ .add("virtualSize", virtualSize)
+ .add("repoTags", repoTags)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromImage(this);
+ }
+
+ public static final class Builder {
+
+ private String id;
+ private String parent;
+ private String created;
+ private String container;
+ private Config containerConfig;
+ private String dockerVersion;
+ private String architecture;
+ private String os;
+ private long size;
+ private long virtualSize;
+ private List<String> repoTags = ImmutableList.of();
+
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder parent(String parent) {
+ this.parent = parent;
+ return this;
+ }
+
+ public Builder created(String created) {
+ this.created = created;
+ return this;
+ }
+
+ public Builder container(String container) {
+ this.container = container;
+ return this;
+ }
+
+ public Builder dockerVersion(String dockerVersion) {
+ this.dockerVersion = dockerVersion;
+ return this;
+ }
+
+ public Builder architecture(String architecture) {
+ this.architecture = architecture;
+ return this;
+ }
+
+ public Builder os(String os) {
+ this.os = os;
+ return this;
+ }
+
+ public Builder size(long size) {
+ this.size = size;
+ return this;
+ }
+
+ public Builder virtualSize(long virtualSize) {
+ this.virtualSize = virtualSize;
+ return this;
+ }
+
+ public Builder repoTags(List<String> repoTags) {
+ this.repoTags = ImmutableList.copyOf(checkNotNull(repoTags, "repoTags"));
+ return this;
+ }
+
+ public Image build() {
+ return new Image(id, parent, created, container, dockerVersion, architecture, os, size,
+ virtualSize, repoTags);
+ }
+
+ public Builder fromImage(Image in) {
+ return this
+ .id(in.getId())
+ .parent(in.getParent())
+ .created(in.getCreated())
+ .container(in.getContainer())
+ .dockerVersion(in.getDockerVersion())
+ .architecture(in.getArchitecture())
+ .os(in.getOs())
+ .size(in.getSize())
+ .virtualSize(in.getVirtualSize());
+ //DO NOT add .repoTags(in.getRepoTags());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/NetworkSettings.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/NetworkSettings.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/NetworkSettings.java
new file mode 100644
index 0000000..d700c77
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/NetworkSettings.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableMap;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Andrea Turli
+ */
+public class NetworkSettings {
+
+ @SerializedName("IPAddress")
+ private final String ipAddress;
+ @SerializedName("IPPrefixLen")
+ private final int ipPrefixLen;
+ @SerializedName("Gateway")
+ private final String gateway;
+ @SerializedName("Bridge")
+ private final String bridge;
+ @SerializedName("PortMapping")
+ private final String portMapping;
+ @SerializedName("Ports")
+ private final Map<String, List<Map<String, String>>> ports;
+
+ @ConstructorProperties({ "IpAddress", "IpPrefixLen", "Gateway", "Bridge", "Ports" })
+ public NetworkSettings(String ipAddress, int ipPrefixLen, String gateway, String bridge, String portMapping,
+ Map<String, List<Map<String, String>>> ports) {
+ this.ipAddress = ipAddress;
+ this.ipPrefixLen = ipPrefixLen;
+ this.gateway = gateway;
+ this.bridge = bridge;
+ this.portMapping = portMapping;
+ this.ports = ports != null ? ImmutableMap.copyOf(ports) : ImmutableMap.<String, List<Map<String, String>>> of();
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public int getIpPrefixLen() {
+ return ipPrefixLen;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getBridge() {
+ return bridge;
+ }
+
+ public String getPortMapping() {
+ return portMapping;
+ }
+
+ public Map<String, List<Map<String, String>>> getPorts() {
+ return ports;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ NetworkSettings that = (NetworkSettings) o;
+
+ return Objects.equal(this.ipAddress, that.ipAddress) &&
+ Objects.equal(this.ipPrefixLen, that.ipPrefixLen) &&
+ Objects.equal(this.gateway, that.gateway) &&
+ Objects.equal(this.bridge, that.bridge) &&
+ Objects.equal(this.portMapping, that.portMapping) &&
+ Objects.equal(this.ports, that.ports);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipAddress, ipPrefixLen, gateway, bridge, portMapping, ports);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("ipAddress", ipAddress)
+ .add("ipPrefixLen", ipPrefixLen)
+ .add("gateway", gateway)
+ .add("bridge", bridge)
+ .add("portMapping", portMapping)
+ .add("ports", ports)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromNetworkSettings(this);
+ }
+
+ public static final class Builder {
+
+ private String ipAddress;
+ private int ipPrefixLen;
+ private String gateway;
+ private String bridge;
+ private String portMapping;
+ private Map<String, List<Map<String, String>>> ports = ImmutableMap.of();
+
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ public Builder ipPrefixLen(int ipPrefixLen) {
+ this.ipPrefixLen = ipPrefixLen;
+ return this;
+ }
+
+ public Builder gateway(String gateway) {
+ this.gateway = gateway;
+ return this;
+ }
+
+ public Builder bridge(String bridge) {
+ this.bridge = bridge;
+ return this;
+ }
+
+ public Builder portMapping(String portMapping) {
+ this.portMapping = portMapping;
+ return this;
+ }
+
+ public Builder ports(Map<String, List<Map<String, String>>> ports) {
+ this.ports = ImmutableMap.copyOf(checkNotNull(ports, "ports"));
+ return this;
+ }
+
+ public NetworkSettings build() {
+ return new NetworkSettings(ipAddress, ipPrefixLen, gateway, bridge, portMapping, ports);
+ }
+
+ public Builder fromNetworkSettings(NetworkSettings in) {
+ return this
+ .ipAddress(in.getIpAddress())
+ .ipPrefixLen(in.getIpPrefixLen())
+ .gateway(in.getGateway())
+ .bridge(in.getBridge())
+ .portMapping(in.getPortMapping())
+ .ports(in.getPorts());
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Port.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Port.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Port.java
new file mode 100644
index 0000000..e5aad02
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Port.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
+
+import java.beans.ConstructorProperties;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * @author Andrea Turli
+ */
+public class Port {
+
+ @SerializedName("PrivatePort")
+ private final int privatePort;
+ @SerializedName("PublicPort")
+ private final int publicPort;
+ @SerializedName("Type")
+ private final String type;
+ @SerializedName("IP")
+ private final String ip;
+
+ @ConstructorProperties({ "PrivatePort", "PublicPort", "Type", "Ip" })
+ public Port(int privatePort, int publicPort, String type, String ip) {
+ this.privatePort = checkNotNull(privatePort, "privatePort");
+ this.publicPort = checkNotNull(publicPort, "publicPort");
+ this.type = checkNotNull(type, "type");
+ this.ip = checkNotNull(ip, "ip");
+ }
+
+ public int getPrivatePort() {
+ return privatePort;
+ }
+
+ public int getPublicPort() {
+ return publicPort;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Port that = (Port) o;
+
+ return Objects.equal(this.privatePort, that.privatePort) &&
+ Objects.equal(this.publicPort, that.publicPort) &&
+ Objects.equal(this.type, that.type) &&
+ Objects.equal(this.ip, that.ip);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(privatePort, publicPort, type, ip);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("privatePort", privatePort)
+ .add("publicPort", publicPort)
+ .add("type", type)
+ .add("ip", ip)
+ .toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/State.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/State.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/State.java
new file mode 100644
index 0000000..7207a86
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/State.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Andrea Turli
+ */
+public class State {
+ @SerializedName("Pid")
+ private final int pid;
+ @SerializedName("Running")
+ private final boolean running;
+ @SerializedName("ExitCode")
+ private final int exitCode;
+ @SerializedName("StartedAt")
+ private final String startedAt;
+ @SerializedName("FinishedAt")
+ private final String finishedAt;
+ @SerializedName("Ghost")
+ private final boolean ghost;
+
+ @ConstructorProperties({ "Pid", "Running", "ExitCode", "StartedAt", "FinishedAt", "Ghost" })
+ public State(int pid, boolean running, int exitCode, String startedAt, String finishedAt, boolean ghost) {
+ this.pid = checkNotNull(pid, "pid");
+ this.running = checkNotNull(running, "running");
+ this.exitCode = checkNotNull(exitCode, "exitCode");
+ this.startedAt = checkNotNull(startedAt, "startedAt");
+ this.finishedAt = checkNotNull(finishedAt, "finishedAt");
+ this.ghost = checkNotNull(ghost, "ghost");
+ }
+
+ public int getPid() {
+ return pid;
+ }
+
+ public boolean isRunning() {
+ return running;
+ }
+
+ public int getExitCode() {
+ return exitCode;
+ }
+
+ public String getStartedAt() {
+ return startedAt;
+ }
+
+ public String getFinishedAt() {
+ return finishedAt;
+ }
+
+ public boolean isGhost() {
+ return ghost;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ State that = (State) o;
+
+ return Objects.equal(this.pid, that.pid) &&
+ Objects.equal(this.running, that.running) &&
+ Objects.equal(this.exitCode, that.exitCode) &&
+ Objects.equal(this.startedAt, that.startedAt) &&
+ Objects.equal(this.finishedAt, that.finishedAt) &&
+ Objects.equal(this.ghost, that.ghost);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(pid, running, exitCode, startedAt, finishedAt, ghost);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("pid", pid)
+ .add("running", running)
+ .add("exitCode", exitCode)
+ .add("startedAt", startedAt)
+ .add("finishedAt", finishedAt)
+ .add("ghost", ghost)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromState(this);
+ }
+
+ public static final class Builder {
+
+ private int pid;
+ private boolean running;
+ private int exitCode;
+ private String startedAt;
+ private String finishedAt;
+ private boolean ghost;
+
+ public Builder pid(int pid) {
+ this.pid = pid;
+ return this;
+ }
+
+ public Builder running(boolean running) {
+ this.running = running;
+ return this;
+ }
+
+ public Builder exitCode(int exitCode) {
+ this.exitCode = exitCode;
+ return this;
+ }
+
+ public Builder startedAt(String startedAt) {
+ this.startedAt = startedAt;
+ return this;
+ }
+
+ public Builder finishedAt(String finishedAt) {
+ this.finishedAt = finishedAt;
+ return this;
+ }
+
+ public Builder ghost(boolean ghost) {
+ this.ghost = ghost;
+ return this;
+ }
+
+ public State build() {
+ return new State(pid, running, exitCode, startedAt, finishedAt, ghost);
+ }
+
+ public Builder fromState(State in) {
+ return this
+ .pid(in.getPid())
+ .running(in.isRunning())
+ .exitCode(in.getExitCode())
+ .startedAt(in.getStartedAt())
+ .finishedAt(in.getFinishedAt())
+ .ghost(in.isGhost());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/d45ad99a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Version.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Version.java b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Version.java
new file mode 100644
index 0000000..1b6984e
--- /dev/null
+++ b/dependencies/jclouds/apis/docker/1.7.1-stratos/src/main/java/org/jclouds/docker/domain/Version.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.docker.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.beans.ConstructorProperties;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Andrea Turli
+ */
+public class Version {
+ @SerializedName("Arch")
+ private final String arch;
+ @SerializedName("GitCommit")
+ private final String gitCommit;
+ @SerializedName("GoVersion")
+ private final String goVersion;
+ @SerializedName("KernelVersion")
+ private final String kernelVersion;
+ @SerializedName("Os")
+ private final String os;
+ @SerializedName("Version")
+ private final String version;
+
+ @ConstructorProperties({ "Arch", "GitCommit", "GoVersion", "KernelVersion", "Os", "Version" })
+ public Version(String arch, String gitCommit, String goVersion, String kernelVersion, String os, String version) {
+ this.arch = checkNotNull(arch, "arch");
+ this.gitCommit = checkNotNull(gitCommit, "gitCommit");
+ this.goVersion = checkNotNull(goVersion, "goVersion");
+ this.kernelVersion = checkNotNull(kernelVersion, "kernelVersion");
+ this.os = checkNotNull(os, "os");
+ this.version = checkNotNull(version, "version");
+ }
+
+ public String getArch() {
+ return arch;
+ }
+
+ public String getGitCommit() {
+ return gitCommit;
+ }
+
+ public String getGoVersion() {
+ return goVersion;
+ }
+
+ public String getKernelVersion() {
+ return kernelVersion;
+ }
+
+ public String getOs() {
+ return os;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Version that = (Version) o;
+
+ return Objects.equal(this.arch, that.arch) &&
+ Objects.equal(this.gitCommit, that.gitCommit) &&
+ Objects.equal(this.goVersion, that.goVersion) &&
+ Objects.equal(this.kernelVersion, that.kernelVersion) &&
+ Objects.equal(this.os, that.os) &&
+ Objects.equal(this.version, that.version);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(arch, gitCommit, goVersion, kernelVersion, os, version);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(this)
+ .add("arch", arch)
+ .add("gitCommit", gitCommit)
+ .add("goVersion", goVersion)
+ .add("kernelVersion", kernelVersion)
+ .add("os", os)
+ .add("version", version)
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromVersion(this);
+ }
+
+ public static final class Builder {
+
+ private String arch;
+ private String gitCommit;
+ private String goVersion;
+ private String kernelVersion;
+ private String os;
+ private String version;
+
+ public Builder arch(String arch) {
+ this.arch = arch;
+ return this;
+ }
+
+ public Builder gitCommit(String gitCommit) {
+ this.gitCommit = gitCommit;
+ return this;
+ }
+
+ public Builder goVersion(String goVersion) {
+ this.goVersion = goVersion;
+ return this;
+ }
+
+ public Builder kernelVersion(String kernelVersion) {
+ this.kernelVersion = kernelVersion;
+ return this;
+ }
+
+ public Builder os(String os) {
+ this.os = os;
+ return this;
+ }
+
+ public Builder version(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public Version build() {
+ return new Version(arch, gitCommit, goVersion, kernelVersion, os, version);
+ }
+
+ public Builder fromVersion(Version in) {
+ return this
+ .arch(in.getArch())
+ .gitCommit(in.getGitCommit())
+ .goVersion(in.getGoVersion())
+ .kernelVersion(in.getKernelVersion())
+ .os(in.getOs())
+ .version(in.getVersion());
+ }
+ }
+}