http://git-wip-us.apache.org/repos/asf/camel/blob/fb9556df/components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java index 9da5df2..aa7dacd 100644 --- a/components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java +++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java @@ -16,11 +16,6 @@ */ package org.apache.camel.component.docker.producer; -import java.io.File; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.AttachContainerCmd; import com.github.dockerjava.api.command.AuthCmd; @@ -31,6 +26,8 @@ import com.github.dockerjava.api.command.CopyFileFromContainerCmd; import com.github.dockerjava.api.command.CreateContainerCmd; import com.github.dockerjava.api.command.CreateImageCmd; import com.github.dockerjava.api.command.DockerCmd; +import com.github.dockerjava.api.command.ExecCreateCmd; +import com.github.dockerjava.api.command.ExecStartCmd; import com.github.dockerjava.api.command.InfoCmd; import com.github.dockerjava.api.command.InspectContainerCmd; import com.github.dockerjava.api.command.InspectImageCmd; @@ -59,12 +56,18 @@ import com.github.dockerjava.api.model.Capability; import com.github.dockerjava.api.model.Device; import com.github.dockerjava.api.model.ExposedPort; import com.github.dockerjava.api.model.ExposedPorts; +import com.github.dockerjava.api.model.HostConfig; import com.github.dockerjava.api.model.Link; import com.github.dockerjava.api.model.LxcConf; +import com.github.dockerjava.api.model.PortBinding; import com.github.dockerjava.api.model.Ports; import com.github.dockerjava.api.model.RestartPolicy; import com.github.dockerjava.api.model.Volume; import com.github.dockerjava.api.model.Volumes; + +import java.io.File; +import java.io.InputStream; + import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.docker.DockerClientFactory; @@ -75,6 +78,7 @@ import org.apache.camel.component.docker.DockerHelper; import org.apache.camel.component.docker.DockerOperation; import org.apache.camel.component.docker.exception.DockerException; import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -91,251 +95,214 @@ public class DockerProducer extends DefaultProducer { } public void process(Exchange exchange) throws Exception { - + DockerCmd<?> dockerCmd = null; - + Message message = exchange.getIn(); DockerClient client = DockerClientFactory.getDockerClient(configuration, message); - + DockerOperation operation = configuration.getOperation(); - - switch(operation) { - + + switch (operation) { + + /** General **/ case AUTH: dockerCmd = executeAuthRequest(client, message); break; case INFO: dockerCmd = executeInfoRequest(client, message); break; - case LIST_IMAGES: - dockerCmd = executeListImagesRequest(client, message); - break; case PING: dockerCmd = executePingRequest(client, message); break; case VERSION: dockerCmd = executeVersionRequest(client, message); break; + + /** Images **/ + case BUILD_IMAGE: + dockerCmd = executeBuildImageRequest(client, message); + break; + case CREATE_IMAGE: + dockerCmd = executeCreateImageRequest(client, message); + break; + case INSPECT_IMAGE: + dockerCmd = executeInspectImageRequest(client, message); + break; + case LIST_IMAGES: + dockerCmd = executeListImagesRequest(client, message); + break; case PULL_IMAGE: dockerCmd = executePullImageRequest(client, message); break; case PUSH_IMAGE: dockerCmd = executePushImageRequest(client, message); break; - case CREATE_IMAGE: - dockerCmd = executeCreateImageRequest(client, message); + case REMOVE_IMAGE: + dockerCmd = executeRemoveImageRequest(client, message); break; case SEARCH_IMAGES: dockerCmd = executeSearchImageRequest(client, message); break; - case REMOVE_IMAGE: - dockerCmd = executeRemoveImageRequest(client, message); + case TAG_IMAGE: + dockerCmd = executeTagImageRequest(client, message); break; - case INSPECT_IMAGE: - dockerCmd = executeInspectImageRequest(client, message); + + /** Containers **/ + case ATTACH_CONTAINER: + dockerCmd = executeAttachContainerRequest(client, message); break; - case LIST_CONTAINERS: - dockerCmd = executeListContainersRequest(client, message); + case COMMIT_CONTAINER: + dockerCmd = executeCommitContainerRequest(client, message); break; - case REMOVE_CONTAINER: - dockerCmd = executeRemoveContainerRequest(client, message); + case COPY_FILE_CONTAINER: + dockerCmd = executeCopyFileContainerRequest(client, message); + break; + case CREATE_CONTAINER: + dockerCmd = executeCreateContainerRequest(client, message); + break; + case DIFF_CONTAINER: + dockerCmd = executeDiffContainerRequest(client, message); break; case INSPECT_CONTAINER: dockerCmd = executeInspectContainerRequest(client, message); break; - case WAIT_CONTAINER: - dockerCmd = executeWaitContainerRequest(client, message); - break; - case ATTACH_CONTAINER: - dockerCmd = executeAttachContainerRequest(client, message); + case LIST_CONTAINERS: + dockerCmd = executeListContainersRequest(client, message); break; case LOG_CONTAINER: dockerCmd = executeLogContainerRequest(client, message); break; - case CONTAINER_COPY_FILE: - dockerCmd = executeCopyFileContainerRequest(client, message); - break; - case DIFF_CONTAINER: - dockerCmd = executeDiffContainerRequest(client, message); - break; - case STOP_CONTAINER: - dockerCmd = executeStopContainerRequest(client, message); - break; case KILL_CONTAINER: dockerCmd = executeKillContainerRequest(client, message); - break; + break; + case PAUSE_CONTAINER: + dockerCmd = executePauseContainerRequest(client, message); + break; + case REMOVE_CONTAINER: + dockerCmd = executeRemoveContainerRequest(client, message); + break; case RESTART_CONTAINER: dockerCmd = executeRestartContainerRequest(client, message); - break; + break; + case START_CONTAINER: + dockerCmd = executeStartContainerRequest(client, message); + break; + case STOP_CONTAINER: + dockerCmd = executeStopContainerRequest(client, message); + break; case TOP_CONTAINER: dockerCmd = executeTopContainerRequest(client, message); - break; - case TAG_IMAGE: - dockerCmd = executeTagImageRequest(client, message); - break; - case PAUSE_CONTAINER: - dockerCmd = executePauseContainerRequest(client, message); break; case UNPAUSE_CONTAINER: dockerCmd = executeUnpauseContainerRequest(client, message); break; - case BUILD_IMAGE: - dockerCmd = executeBuildImageRequest(client, message); - break; - case COMMIT_CONTAINER: - dockerCmd = executeCommitContainerRequest(client, message); + case WAIT_CONTAINER: + dockerCmd = executeWaitContainerRequest(client, message); break; - case CREATE_CONTAINER: - dockerCmd = executeCreateContainerRequest(client, message); + + /** Exec **/ + case EXEC_CREATE: + dockerCmd = executeExecCreateRequest(client, message); break; - case START_CONTAINER: - dockerCmd = executeStartContainerRequest(client, message); + case EXEC_START: + dockerCmd = executeExecStartRequest(client, message); break; default: throw new DockerException("Invalid operation: " + operation); } - + Object result = dockerCmd.exec(); - + // If request included a response, set as body if (result != null) { exchange.getIn().setBody(result); } - + + } - + /********************* - * Misc Requests + * General Requests ********************/ - + /** * Produces a Authorization request * * @param client * @param message * @return - * @throws DockerException */ - private AuthCmd executeAuthRequest(DockerClient client, Message message) throws DockerException { - + private AuthCmd executeAuthRequest(DockerClient client, Message message) { + LOGGER.debug("Executing Docker Auth Request"); + + AuthCmd authCmd = client.authCmd(); + + AuthConfig authConfig = client.authConfig(); - return client.authCmd(); + if(authCmd != null) { + authCmd.withAuthConfig(authConfig); + } + + return authCmd; } - + /** * Produces a platform information request * * @param client * @param message * @return - * @throws DockerException */ - private InfoCmd executeInfoRequest(DockerClient client, Message message) throws DockerException { + private InfoCmd executeInfoRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Info Request"); - + InfoCmd infoCmd = client.infoCmd(); - + return infoCmd; } - + /** * Executes a ping platform request * * @param client * @param message * @return - * @throws DockerException */ - private PingCmd executePingRequest(DockerClient client, Message message) throws DockerException { + private PingCmd executePingRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Ping Request"); - + PingCmd pingCmd = client.pingCmd(); - + return pingCmd; } - + /** * Executes a platform version request * * @param client * @param message * @return - * @throws DockerException */ - private VersionCmd executeVersionRequest(DockerClient client, Message message) throws DockerException { + private VersionCmd executeVersionRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Version Request"); - + VersionCmd versionCmd = client.versionCmd(); - + return versionCmd; } - - + /********************* * Image Requests ********************/ - - - - /** - * Performs a list images request - * - * @param client - * @param message - * @return - * @throws DockerException - */ - private ListImagesCmd executeListImagesRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Images List Request"); - - ListImagesCmd listImagesCmd = client.listImagesCmd(); - - String filter = DockerHelper.getProperty(DockerConstants.DOCKER_FILTER, configuration, message, String.class); - - if (filter != null) { - listImagesCmd.withFilters(filter); - } - - Boolean showAll = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_ALL, configuration, message, Boolean.class); - - if (showAll != null && showAll) { - listImagesCmd.withShowAll(showAll); - } - - return listImagesCmd; - - } - - /** - * Performs a create image request - * - * @param client - * @param message - * @return - * @throws DockerException - */ - private CreateImageCmd executeCreateImageRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Create Image Request"); - - String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); - - InputStream inputStream = message.getBody(InputStream.class); - - CreateImageCmd createImageCmd = client.createImageCmd(repository, inputStream); - - return createImageCmd; - } - /** * Produces a build image request * @@ -345,127 +312,197 @@ public class DockerProducer extends DefaultProducer { * @throws DockerException */ private BuildImageCmd executeBuildImageRequest(DockerClient client, Message message) throws DockerException { - + LOGGER.debug("Executing Docker Build Image Request"); - + Object body = message.getBody(); - + BuildImageCmd buildImageCmd; - + if (body != null && body instanceof InputStream) { - buildImageCmd = client.buildImageCmd((InputStream) body); + buildImageCmd = client.buildImageCmd((InputStream)body); } else if (body != null && body instanceof File) { - buildImageCmd = client.buildImageCmd((File) body); + buildImageCmd = client.buildImageCmd((File)body); } else { throw new DockerException("Unable to location source Image"); } - + Boolean noCache = DockerHelper.getProperty(DockerConstants.DOCKER_NO_CACHE, configuration, message, Boolean.class); - if (noCache != null && noCache) { - buildImageCmd.withNoCache(); + if (noCache != null) { + buildImageCmd.withNoCache(noCache); } - + Boolean quiet = DockerHelper.getProperty(DockerConstants.DOCKER_QUIET, configuration, message, Boolean.class); - if (quiet != null && quiet) { - buildImageCmd.withQuiet(); + if (quiet != null) { + buildImageCmd.withQuiet(quiet); } - + Boolean remove = DockerHelper.getProperty(DockerConstants.DOCKER_REMOVE, configuration, message, Boolean.class); - if (remove != null && remove) { - buildImageCmd.withRemove(); + if (remove != null) { + buildImageCmd.withRemove(remove); } - + String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); if (tag != null) { buildImageCmd.withTag(tag); } - + return buildImageCmd; } - + /** - * Produces a pull image request + * Performs a create image request * * @param client * @param message * @return - * @throws DockerException */ - private PullImageCmd executePullImageRequest(DockerClient client, Message message) throws DockerException { + private CreateImageCmd executeCreateImageRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Create Image Request"); - LOGGER.debug("Executing Docker Pull Image Request"); - String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); - - PullImageCmd pullImageCmd = client.pullImageCmd(repository); - - String registry = DockerHelper.getProperty(DockerConstants.DOCKER_REGISTRY, configuration, message, String.class); - if (registry != null) { - pullImageCmd.withRegistry(registry); - } - - String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); - if (tag != null) { - pullImageCmd.withTag(tag); + + InputStream inputStream = message.getBody(InputStream.class); + + if(repository == null || inputStream == null) { + throw new IllegalArgumentException("Inputstream must be present on message body and repository must be specified"); } - return pullImageCmd; + CreateImageCmd createImageCmd = client.createImageCmd(repository, inputStream); + + return createImageCmd; } /** - * Produces a push image request + * Produces a inspect image request * * @param client * @param message * @return - * @throws DockerException */ - private PushImageCmd executePushImageRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Push Image Request"); - - String name = DockerHelper.getProperty(DockerConstants.DOCKER_NAME, configuration, message, String.class); - - PushImageCmd pushImageCmd = client.pushImageCmd(name); - - AuthConfig authConfig = getAuthConfig(client); - - if (authConfig != null) { - pushImageCmd.withAuthConfig(authConfig); - } - - return pushImageCmd; - - } - + private InspectImageCmd executeInspectImageRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Inspect Image Request"); + + String imageId = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE_ID, configuration, message, String.class); + + ObjectHelper.notNull(imageId, "Image ID must be specified"); + + InspectImageCmd inspectImageCmd = client.inspectImageCmd(imageId); + + return inspectImageCmd; + + } + /** - * Produces a search image request + * Performs a list images request * * @param client * @param message * @return - * @throws DockerException */ - private SearchImagesCmd executeSearchImageRequest(DockerClient client, Message message) throws DockerException { + private ListImagesCmd executeListImagesRequest(DockerClient client, Message message) { - LOGGER.debug("Executing Docker Search Image Request"); - - String term = DockerHelper.getProperty(DockerConstants.DOCKER_TERM, configuration, message, String.class); - - SearchImagesCmd searchImagesCmd = client.searchImagesCmd(term); - - return searchImagesCmd; + LOGGER.debug("Executing Docker Images List Request"); + + ListImagesCmd listImagesCmd = client.listImagesCmd(); + + String filter = DockerHelper.getProperty(DockerConstants.DOCKER_FILTER, configuration, message, String.class); + + if (filter != null) { + listImagesCmd.withFilters(filter); + } + + Boolean showAll = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_ALL, configuration, message, Boolean.class); + + if (showAll != null) { + listImagesCmd.withShowAll(showAll); + } + + return listImagesCmd; + + } + + + /** + * Produces a pull image request + * + * @param client + * @param message + * @return + */ + private PullImageCmd executePullImageRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Pull Image Request"); + + String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); + + ObjectHelper.notNull(repository, "Repository must be specified"); + + PullImageCmd pullImageCmd = client.pullImageCmd(repository); + + String registry = DockerHelper.getProperty(DockerConstants.DOCKER_REGISTRY, configuration, message, String.class); + if (registry != null) { + pullImageCmd.withRegistry(registry); + } + + String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); + if (tag != null) { + pullImageCmd.withTag(tag); + } + + AuthConfig authConfig = client.authConfig(); + + if (authConfig != null) { + pullImageCmd.withAuthConfig(authConfig); + } + + return pullImageCmd; + + } + + + /** + * Produces a push image request + * + * @param client + * @param message + * @return + */ + private PushImageCmd executePushImageRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Push Image Request"); + + String name = DockerHelper.getProperty(DockerConstants.DOCKER_NAME, configuration, message, String.class); + + ObjectHelper.notNull(name, "Image name must be specified"); + + PushImageCmd pushImageCmd = client.pushImageCmd(name); + + String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); + + if (tag != null) { + pushImageCmd.withTag(tag); + } + + AuthConfig authConfig = client.authConfig(); + + if (authConfig != null) { + pushImageCmd.withAuthConfig(authConfig); + } + + return pushImageCmd; } - /** * Produces a remove image request @@ -473,31 +510,55 @@ public class DockerProducer extends DefaultProducer { * @param client * @param message * @return - * @throws DockerException */ - private RemoveImageCmd executeRemoveImageRequest(DockerClient client, Message message) throws DockerException { + private RemoveImageCmd executeRemoveImageRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Remove Image Request"); - + String imageId = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE_ID, configuration, message, String.class); - + + ObjectHelper.notNull(imageId, "Image ID must be specified"); + RemoveImageCmd removeImagesCmd = client.removeImageCmd(imageId); - + Boolean force = DockerHelper.getProperty(DockerConstants.DOCKER_FORCE, configuration, message, Boolean.class); - - if (force != null && force) { + + if (force != null) { removeImagesCmd.withForce(); } - - Boolean prune = DockerHelper.getProperty(DockerConstants.DOCKER_NO_PRUNE, configuration, message, Boolean.class); - - if (prune != null && prune) { - removeImagesCmd.withNoPrune(); + + Boolean noPrune = DockerHelper.getProperty(DockerConstants.DOCKER_NO_PRUNE, configuration, message, Boolean.class); + + if (noPrune != null) { + removeImagesCmd.withNoPrune(noPrune); } - + return removeImagesCmd; } + + + /** + * Produces a search image request + * + * @param client + * @param message + * @return + */ + private SearchImagesCmd executeSearchImageRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Search Image Request"); + + String term = DockerHelper.getProperty(DockerConstants.DOCKER_TERM, configuration, message, String.class); + + ObjectHelper.notNull(term, "Term must be specified"); + + SearchImagesCmd searchImagesCmd = client.searchImagesCmd(term); + + return searchImagesCmd; + + } + /** * Produces a tag image request @@ -505,96 +566,272 @@ public class DockerProducer extends DefaultProducer { * @param client * @param message * @return - * @throws DockerException */ - private TagImageCmd executeTagImageRequest(DockerClient client, Message message) throws DockerException { - + private TagImageCmd executeTagImageRequest(DockerClient client, Message message) { + LOGGER.debug("Executing Docker Tag Image Request"); - + String imageId = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE_ID, configuration, message, String.class); - + String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); - + String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); - + + if (imageId == null || repository == null || tag == null) { + throw new IllegalArgumentException("ImageId, repository and tag must be specified"); + } + TagImageCmd tagImageCmd = client.tagImageCmd(imageId, repository, tag); Boolean force = DockerHelper.getProperty(DockerConstants.DOCKER_FORCE, configuration, message, Boolean.class); - - if (force != null && force) { - tagImageCmd.withForce(); + + if (force != null) { + tagImageCmd.withForce(force); } - + return tagImageCmd; } - + + + /********************* + * Container Requests + ********************/ + /** - * Produces a inspect image request + * Produce a attach container request * * @param client * @param message * @return - * @throws DockerException */ - private InspectImageCmd executeInspectImageRequest(DockerClient client, Message message) throws DockerException { + private AttachContainerCmd executeAttachContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Attach Container Request"); + + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + AttachContainerCmd attachContainerCmd = client.attachContainerCmd(containerId); + + Boolean followStream = DockerHelper.getProperty(DockerConstants.DOCKER_FOLLOW_STREAM, configuration, message, Boolean.class); + + if (followStream != null) { + attachContainerCmd.withFollowStream(followStream); + } - LOGGER.debug("Executing Docker Inspect Image Request"); + Boolean logs = DockerHelper.getProperty(DockerConstants.DOCKER_LOGS, configuration, message, Boolean.class); - String imageId = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE_ID, configuration, message, String.class); + if (logs != null) { + attachContainerCmd.withLogs(logs); + } - InspectImageCmd inspectImageCmd = client.inspectImageCmd(imageId); + Boolean stdErr = DockerHelper.getProperty(DockerConstants.DOCKER_STD_ERR, configuration, message, Boolean.class); + + if (stdErr != null) { + attachContainerCmd.withStdErr(stdErr); + } - return inspectImageCmd; + Boolean stdOut = DockerHelper.getProperty(DockerConstants.DOCKER_STD_OUT, configuration, message, Boolean.class); + + if (stdOut != null) { + attachContainerCmd.withStdOut(stdOut); + } + + + Boolean timestamps = DockerHelper.getProperty(DockerConstants.DOCKER_TIMESTAMPS, configuration, message, Boolean.class); + + if (timestamps != null) { + attachContainerCmd.withTimestamps(timestamps); + } + + return attachContainerCmd; } - /********************* - * Container Requests - ********************/ - - /** - * Produces a list containers request + * Produces a commit container request * * @param client * @param message * @return * @throws DockerException */ - private ListContainersCmd executeListContainersRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker List Container Request"); + private CommitCmd executeCommitContainerRequest(DockerClient client, Message message) throws DockerException { + + LOGGER.debug("Executing Docker Commit Container Request"); + + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + + ObjectHelper.notNull(containerId, "Container ID must be specified"); - ListContainersCmd listContainersCmd = client.listContainersCmd(); - - Boolean showSize = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_SIZE, configuration, message, Boolean.class); - if (showSize != null && showSize) { - listContainersCmd.withShowSize(showSize); + CommitCmd commitCmd = client.commitCmd(containerId); + + String author = DockerHelper.getProperty(DockerConstants.DOCKER_AUTHOR, configuration, message, String.class); + + if (author != null) { + commitCmd.withAuthor(author); } - Boolean showAll = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_ALL, configuration, message, Boolean.class); - if (showAll != null && showAll) { - listContainersCmd.withShowAll(showAll); + Boolean attachStdErr = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_ERR, configuration, message, Boolean.class); + + if (attachStdErr != null) { + commitCmd.withAttachStderr(attachStdErr); } - - String before = DockerHelper.getProperty(DockerConstants.DOCKER_BEFORE, configuration, message, String.class); - if (before != null) { - listContainersCmd.withBefore(before); + + Boolean attachStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_IN, configuration, message, Boolean.class); + + if (attachStdIn != null) { + commitCmd.withAttachStdin(attachStdIn); + } + + Boolean attachStdOut = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_OUT, configuration, message, Boolean.class); + + if (attachStdOut != null) { + commitCmd.withAttachStdout(attachStdOut); + } + + String[] cmds = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CMD, message); + + if (cmds != null) { + commitCmd.withCmd(cmds); + } + + Boolean disableNetwork = DockerHelper.getProperty(DockerConstants.DOCKER_DISABLE_NETWORK, configuration, message, Boolean.class); + + if (disableNetwork != null) { + commitCmd.withDisableNetwork(disableNetwork); + } + + String[] envs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_ENV, message); + + if (envs != null) { + commitCmd.withEnv(envs); + } + + ExposedPorts exposedPorts = DockerHelper.getProperty(DockerConstants.DOCKER_EXPOSED_PORTS, configuration, message, ExposedPorts.class); + + if (exposedPorts != null) { + commitCmd.withExposedPorts(exposedPorts); + } + + String hostname = DockerHelper.getProperty(DockerConstants.DOCKER_HOSTNAME, configuration, message, String.class); + + if (hostname != null) { + commitCmd.withHostname(hostname); + } + + Integer memory = DockerHelper.getProperty(DockerConstants.DOCKER_MEMORY, configuration, message, Integer.class); + + if (memory != null) { + commitCmd.withMemory(memory); + } + + Integer memorySwap = DockerHelper.getProperty(DockerConstants.DOCKER_MEMORY_SWAP, configuration, message, Integer.class); + + if (memorySwap != null) { + commitCmd.withMemorySwap(memorySwap); + } + + String msg = DockerHelper.getProperty(DockerConstants.DOCKER_MESSAGE, configuration, message, String.class); + + if (msg != null) { + commitCmd.withMessage(msg); + } + + Boolean openStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_OPEN_STD_IN, configuration, message, Boolean.class); + + if (openStdIn != null) { + commitCmd.withOpenStdin(openStdIn); + } + + Boolean pause = DockerHelper.getProperty(DockerConstants.DOCKER_PAUSE, configuration, message, Boolean.class); + + if (pause != null) { + commitCmd.withPause(pause); + } + + String[] portSpecs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_PORT_SPECS, message); + + if (portSpecs != null) { + commitCmd.withPortSpecs(portSpecs); + } + + String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); + + if (repository != null) { + commitCmd.withRepository(repository); + } + + Boolean stdInOnce = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_ONCE, configuration, message, Boolean.class); + + if (stdInOnce != null) { + commitCmd.withStdinOnce(stdInOnce); + } + + String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); + + if (tag != null) { + commitCmd.withTag(tag); + } + + Boolean tty = DockerHelper.getProperty(DockerConstants.DOCKER_TTY, configuration, message, Boolean.class); + + if (tty != null) { + commitCmd.withTty(tty); + } + + String user = DockerHelper.getProperty(DockerConstants.DOCKER_USER, configuration, message, String.class); + + if (user != null) { + commitCmd.withUser(user); + } + + Volumes volumes = DockerHelper.getProperty(DockerConstants.DOCKER_VOLUMES, configuration, message, Volumes.class); + + if (volumes != null) { + commitCmd.withVolumes(volumes); + } + + String workingDir = DockerHelper.getProperty(DockerConstants.DOCKER_WORKING_DIR, configuration, message, String.class); + + if (workingDir != null) { + commitCmd.withWorkingDir(workingDir); } - - Integer limit = DockerHelper.getProperty(DockerConstants.DOCKER_LIMIT, configuration, message, Integer.class); - if (limit != null) { - listContainersCmd.withLimit(limit); + + return commitCmd; + + } + + /** + * Produces a copy file/folder from container request + * + * @param client + * @param message + * @return + */ + private CopyFileFromContainerCmd executeCopyFileContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Copy File/Folder Container Request"); + + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + String resource = DockerHelper.getProperty(DockerConstants.DOCKER_RESOURCE, configuration, message, String.class); + + if (containerId == null || resource == null) { + throw new IllegalArgumentException("Container ID and Resource must be specified"); } - - String since = DockerHelper.getProperty(DockerConstants.DOCKER_SINCE, configuration, message, String.class); - if (since != null) { - listContainersCmd.withSince(since); + + CopyFileFromContainerCmd copyFileContainerCmd = client.copyFileFromContainerCmd(containerId, resource); + + String hostPath = DockerHelper.getProperty(DockerConstants.DOCKER_HOST_PATH, configuration, message, String.class); + + if (hostPath != null) { + copyFileContainerCmd.withHostPath(hostPath); } - return listContainersCmd; + return copyFileContainerCmd; } @@ -604,74 +841,99 @@ public class DockerProducer extends DefaultProducer { * @param client * @param message * @return - * @throws DockerException */ - private CreateContainerCmd executeCreateContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker List Container Request"); - - String imageId = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE_ID, configuration, message, String.class); - - CreateContainerCmd createContainerCmd = client.createContainerCmd(imageId); + private CreateContainerCmd executeCreateContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Create Container Request"); + + String image = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE, configuration, message, String.class); + + ObjectHelper.notNull(image, "Image must be specified"); + + CreateContainerCmd createContainerCmd = client.createContainerCmd(image); + + Boolean attachStdErr = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_ERR, configuration, message, Boolean.class); + + if (attachStdErr != null) { + createContainerCmd.withAttachStderr(attachStdErr); + } - String name = DockerHelper.getProperty(DockerConstants.DOCKER_NAME, configuration, message, String.class); + Boolean attachStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_IN, configuration, message, Boolean.class); - if (name != null) { - createContainerCmd.withName(name); + if (attachStdIn != null) { + createContainerCmd.withAttachStdin(attachStdIn); } - ExposedPort[] exposedPorts = DockerHelper.getArrayProperty(DockerConstants.DOCKER_EXPOSED_PORTS, message, ExposedPort.class); + Boolean attachStdOut = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_OUT, configuration, message, Boolean.class); - if (exposedPorts != null) { - createContainerCmd.withExposedPorts(exposedPorts); + if (attachStdOut != null) { + createContainerCmd.withAttachStdout(attachStdOut); } - String workingDir = DockerHelper.getProperty(DockerConstants.DOCKER_WORKING_DIR, configuration, message, String.class); + Capability[] capAdd = DockerHelper.getArrayProperty(DockerConstants.DOCKER_CAP_ADD, message, Capability.class); - if (workingDir != null) { - createContainerCmd.withWorkingDir(workingDir); - } - - Boolean disabledNetwork = DockerHelper.getProperty(DockerConstants.DOCKER_DISABLE_NETWORK, configuration, message, Boolean.class); + if (capAdd != null) { + createContainerCmd.withCapAdd(capAdd); + } + + Capability[] capDrop = DockerHelper.getArrayProperty(DockerConstants.DOCKER_CAP_DROP, message, Capability.class); - if (disabledNetwork != null && disabledNetwork) { - createContainerCmd.withDisableNetwork(disabledNetwork); + if (capDrop != null) { + createContainerCmd.withCapDrop(capDrop); } - String hostName = DockerHelper.getProperty(DockerConstants.DOCKER_HOSTNAME, configuration, message, String.class); + String[] cmd = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CMD, message); - if (hostName != null) { - createContainerCmd.withHostName(hostName); - } + if (cmd != null) { + createContainerCmd.withCmd(cmd); + } - String[] portSpecs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_PORT_SPECS, message); + Integer cpuShares = DockerHelper.getProperty(DockerConstants.DOCKER_CPU_SHARES, configuration, message, Integer.class); - if (portSpecs != null) { - createContainerCmd.withPortSpecs(portSpecs); + if (cpuShares != null) { + createContainerCmd.withCpuShares(cpuShares); } - String user = DockerHelper.getProperty(DockerConstants.DOCKER_USER, configuration, message, String.class); + Boolean disableNetwork = DockerHelper.getProperty(DockerConstants.DOCKER_DISABLE_NETWORK, configuration, message, Boolean.class); - if (hostName != null) { - createContainerCmd.withUser(user); - } + if (disableNetwork != null) { + createContainerCmd.withDisableNetwork(disableNetwork); + } - Boolean tty = DockerHelper.getProperty(DockerConstants.DOCKER_TTY, configuration, message, Boolean.class); + String[] dns = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS, message); - if (tty != null && tty) { - createContainerCmd.withTty(tty); + if (dns != null) { + createContainerCmd.withDns(dns); + } + + String[] env = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_ENV, message); + + if (env != null) { + createContainerCmd.withEnv(env); } - Boolean stdInOpen = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_OPEN, configuration, message, Boolean.class); + String[] entrypoint = DockerHelper.getArrayProperty(DockerConstants.DOCKER_ENTRYPOINT, message, String.class); - if (stdInOpen != null && stdInOpen) { - createContainerCmd.withStdinOpen(stdInOpen); + if (entrypoint != null) { + createContainerCmd.withEntrypoint(entrypoint); + } + + ExposedPort[] exposedPorts = DockerHelper.getArrayProperty(DockerConstants.DOCKER_EXPOSED_PORTS, message, ExposedPort.class); + + if (exposedPorts != null) { + createContainerCmd.withExposedPorts(exposedPorts); } - Boolean stdInOnce = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_ONCE, configuration, message, Boolean.class); + HostConfig hostConfig = DockerHelper.getProperty(DockerConstants.DOCKER_HOST_CONFIG, configuration, message, HostConfig.class); - if (stdInOnce != null && stdInOnce) { - createContainerCmd.withStdInOnce(stdInOnce); + if (hostConfig != null) { + createContainerCmd.withHostConfig(hostConfig); + } + + String hostName = DockerHelper.getProperty(DockerConstants.DOCKER_HOSTNAME, configuration, message, String.class); + + if (hostName != null) { + createContainerCmd.withHostName(hostName); } Long memoryLimit = DockerHelper.getProperty(DockerConstants.DOCKER_MEMORY_LIMIT, configuration, message, Long.class); @@ -685,224 +947,185 @@ public class DockerProducer extends DefaultProducer { if (memorySwap != null) { createContainerCmd.withMemorySwap(memorySwap); } - - Integer cpuShares = DockerHelper.getProperty(DockerConstants.DOCKER_CPU_SHARES, configuration, message, Integer.class); - if (cpuShares != null) { - createContainerCmd.withCpuShares(cpuShares); - } - - Boolean attachStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_IN, configuration, message, Boolean.class); + String name = DockerHelper.getProperty(DockerConstants.DOCKER_NAME, configuration, message, String.class); - if (attachStdIn != null && attachStdIn) { - createContainerCmd.withAttachStdin(attachStdIn); + if (name != null) { + createContainerCmd.withName(name); } - - Boolean attachStdOut = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_OUT, configuration, message, Boolean.class); - if (attachStdOut != null && attachStdOut) { - createContainerCmd.withAttachStdout(attachStdOut); - } - - Boolean attachStdErr = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_ERR, configuration, message, Boolean.class); + String[] portSpecs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_PORT_SPECS, message); - if (attachStdErr != null && attachStdErr) { - createContainerCmd.withAttachStderr(attachStdErr); + if (portSpecs != null) { + createContainerCmd.withPortSpecs(portSpecs); } - - String[] env = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_ENV, message); - if (env != null) { - createContainerCmd.withEnv(env); + Boolean stdInOpen = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_OPEN, configuration, message, Boolean.class); + + if (stdInOpen != null) { + createContainerCmd.withStdinOpen(stdInOpen); } - - String[] cmd = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CMD, message); - if (cmd != null) { - createContainerCmd.withCmd(env); + Boolean stdInOnce = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_ONCE, configuration, message, Boolean.class); + + if (stdInOnce != null) { + createContainerCmd.withStdInOnce(stdInOnce); } - - String[] dns = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS, message); - if (dns != null) { - createContainerCmd.withDns(dns); + Boolean tty = DockerHelper.getProperty(DockerConstants.DOCKER_TTY, configuration, message, Boolean.class); + + if (tty != null) { + createContainerCmd.withTty(tty); } - String image = DockerHelper.getProperty(DockerConstants.DOCKER_IMAGE, configuration, message, String.class); + String user = DockerHelper.getProperty(DockerConstants.DOCKER_USER, configuration, message, String.class); - if (image != null) { - createContainerCmd.withImage(image); + if (user != null) { + createContainerCmd.withUser(user); } - + Volume[] volume = DockerHelper.getArrayProperty(DockerConstants.DOCKER_VOLUMES, message, Volume.class); if (volume != null) { createContainerCmd.withVolumes(volume); } - + String[] volumesFrom = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_VOLUMES_FROM, message); if (volumesFrom != null) { createContainerCmd.withVolumesFrom(volumesFrom); } + String workingDir = DockerHelper.getProperty(DockerConstants.DOCKER_WORKING_DIR, configuration, message, String.class); + + if (workingDir != null) { + createContainerCmd.withWorkingDir(workingDir); + } + return createContainerCmd; } /** - * Produce a start container request + * Produces a diff container request * * @param client * @param message * @return - * @throws DockerException */ - private StartContainerCmd executeStartContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Start Container Request"); - - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - StartContainerCmd startContainerCmd = client.startContainerCmd(containerId); - - Bind[] binds = DockerHelper.getArrayProperty(DockerConstants.DOCKER_BINDS, message, Bind.class); + private ContainerDiffCmd executeDiffContainerRequest(DockerClient client, Message message) { - if (binds != null) { - startContainerCmd.withBinds(binds); - } - - Link[] links = DockerHelper.getArrayProperty(DockerConstants.DOCKER_LINKS, message, Link.class); + LOGGER.debug("Executing Docker Diff Container Request"); - if (links != null) { - startContainerCmd.withLinks(links); - } - - LxcConf[] lxcConf = DockerHelper.getArrayProperty(DockerConstants.DOCKER_LXC_CONF, message, LxcConf.class); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - if (lxcConf != null) { - startContainerCmd.withLxcConf(lxcConf); - } - - Ports ports = DockerHelper.getProperty(DockerConstants.DOCKER_PORT_BINDINGS, configuration, message, Ports.class); + ObjectHelper.notNull(containerId, "Container ID must be specified"); - if (ports != null) { - startContainerCmd.withPortBindings(ports); - } - - Boolean privileged = DockerHelper.getProperty(DockerConstants.DOCKER_PRIVILEGED, configuration, message, Boolean.class); + ContainerDiffCmd diffContainerCmd = client.containerDiffCmd(containerId); - if (privileged != null && privileged) { - startContainerCmd.withPrivileged(privileged); - } - - Boolean publishAllPorts = DockerHelper.getProperty(DockerConstants.DOCKER_PUBLISH_ALL_PORTS, configuration, message, Boolean.class); + String containerIdDiff = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID_DIFF, configuration, message, String.class); - if (publishAllPorts != null && publishAllPorts) { - startContainerCmd.withPublishAllPorts(publishAllPorts); + if (containerIdDiff != null) { + diffContainerCmd.withContainerId(containerIdDiff); } - - String[] dns = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS, message); - if (dns != null) { - startContainerCmd.withDns(dns); - } - - String[] dnsSearch = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS_SEARCH, message); + return diffContainerCmd; - if (dnsSearch != null) { - startContainerCmd.withDnsSearch(dnsSearch); - } - - String volumesFrom = DockerHelper.getProperty(DockerConstants.DOCKER_VOLUMES_FROM, configuration, message, String.class); + } - if (volumesFrom != null) { - startContainerCmd.withVolumesFrom(volumesFrom); - } + /** + * Produce a inspect container request + * + * @param client + * @param message + * @return + */ + private InspectContainerCmd executeInspectContainerRequest(DockerClient client, Message message) { - String networkMode = DockerHelper.getProperty(DockerConstants.DOCKER_NETWORK_MODE, configuration, message, String.class); + LOGGER.debug("Executing Docker Inspect Container Request"); - if (networkMode != null) { - startContainerCmd.withNetworkMode(networkMode); - } + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - Device[] devices = DockerHelper.getArrayProperty(DockerConstants.DOCKER_DEVICES, message, Device.class); + ObjectHelper.notNull(containerId, "Container ID must be specified"); - if (devices != null) { - startContainerCmd.withDevices(devices); - } - - RestartPolicy restartPolicy = DockerHelper.getProperty(DockerConstants.DOCKER_RESTART_POLICY, configuration, message, RestartPolicy.class); + InspectContainerCmd inspectContainerCmd = client.inspectContainerCmd(containerId); - if (restartPolicy != null) { - startContainerCmd.withRestartPolicy(restartPolicy); - } - - String[] capAdd = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CAP_ADD, message); - if (capAdd != null) { - List<Capability> caps = new ArrayList<Capability>(); - for (String s : capAdd) { - Capability cap = Capability.valueOf(s); - caps.add(cap); - } - Capability[] array = caps.toArray(new Capability[caps.size()]); - startContainerCmd.withCapAdd(array); - } - - String[] capDrop = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CAP_DROP, message); - if (capDrop != null) { - if (capAdd != null) { - List<Capability> caps = new ArrayList<Capability>(); - for (String s : capDrop) { - Capability cap = Capability.valueOf(s); - caps.add(cap); - } - Capability[] array = caps.toArray(new Capability[caps.size()]); - startContainerCmd.withCapDrop(array); - } - } - - return startContainerCmd; + return inspectContainerCmd; } /** - * Produce a inspect container request + * Produces a kill container request * * @param client * @param message * @return - * @throws DockerException */ - private InspectContainerCmd executeInspectContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Inspect Container Request"); - + private KillContainerCmd executeKillContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Kill Container Request"); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - InspectContainerCmd inspectContainerCmd = client.inspectContainerCmd(containerId); - - return inspectContainerCmd; + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + KillContainerCmd killContainerCmd = client.killContainerCmd(containerId); + + String signal = DockerHelper.getProperty(DockerConstants.DOCKER_SIGNAL, configuration, message, String.class); + + if (signal != null) { + killContainerCmd.withSignal(signal); + } + + return killContainerCmd; } /** - * Produce a wait container request + * Produces a list containers request * * @param client * @param message * @return - * @throws DockerException */ - private WaitContainerCmd executeWaitContainerRequest(DockerClient client, Message message) throws DockerException { + private ListContainersCmd executeListContainersRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker List Container Request"); + + ListContainersCmd listContainersCmd = client.listContainersCmd(); + + String before = DockerHelper.getProperty(DockerConstants.DOCKER_BEFORE, configuration, message, String.class); - LOGGER.debug("Executing Docker Wait Container Request"); + if (before != null) { + listContainersCmd.withBefore(before); + } - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + Integer limit = DockerHelper.getProperty(DockerConstants.DOCKER_LIMIT, configuration, message, Integer.class); - WaitContainerCmd waitContainerCmd = client.waitContainerCmd(containerId); + if (limit != null) { + listContainersCmd.withLimit(limit); + } - return waitContainerCmd; + Boolean showAll = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_ALL, configuration, message, Boolean.class); + + if (showAll != null) { + listContainersCmd.withShowAll(showAll); + } + + Boolean showSize = DockerHelper.getProperty(DockerConstants.DOCKER_SHOW_SIZE, configuration, message, Boolean.class); + + if (showSize != null) { + listContainersCmd.withShowSize(showSize); + } + + + String since = DockerHelper.getProperty(DockerConstants.DOCKER_SINCE, configuration, message, String.class); + + if (since != null) { + listContainersCmd.withSince(since); + } + + return listContainersCmd; } @@ -912,135 +1135,111 @@ public class DockerProducer extends DefaultProducer { * @param client * @param message * @return - * @throws DockerException */ - private LogContainerCmd executeLogContainerRequest(DockerClient client, Message message) throws DockerException { - + private LogContainerCmd executeLogContainerRequest(DockerClient client, Message message) { + LOGGER.debug("Executing Docker Log Container Request"); - + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - LogContainerCmd logContainerCmd = client.logContainerCmd(containerId); + ObjectHelper.notNull(containerId, "Container ID must be specified"); - Boolean stdOut = DockerHelper.getProperty(DockerConstants.DOCKER_STD_OUT, configuration, message, Boolean.class); + LogContainerCmd logContainerCmd = client.logContainerCmd(containerId); - if (stdOut != null && stdOut) { - logContainerCmd.withStdOut(stdOut); + Boolean followStream = DockerHelper.getProperty(DockerConstants.DOCKER_FOLLOW_STREAM, configuration, message, Boolean.class); + + if (followStream != null) { + logContainerCmd.withFollowStream(followStream); } Boolean stdErr = DockerHelper.getProperty(DockerConstants.DOCKER_STD_ERR, configuration, message, Boolean.class); - - if (stdErr != null && stdErr) { + + if (stdErr != null) { logContainerCmd.withStdErr(stdErr); } + + Boolean stdOut = DockerHelper.getProperty(DockerConstants.DOCKER_STD_OUT, configuration, message, Boolean.class); + + if (stdOut != null) { + logContainerCmd.withStdOut(stdOut); + } - Boolean timestamps = DockerHelper.getProperty(DockerConstants.DOCKER_TIMESTAMPS, configuration, message, Boolean.class); - - if (timestamps != null && timestamps) { - logContainerCmd.withTimestamps(timestamps); - } - - Boolean followStream = DockerHelper.getProperty(DockerConstants.DOCKER_FOLLOW_STREAM, configuration, message, Boolean.class); - - if (followStream != null && followStream) { - logContainerCmd.withFollowStream(followStream); - } + Integer tail = DockerHelper.getProperty(DockerConstants.DOCKER_TAIL, configuration, message, Integer.class); + + if (tail != null) { + logContainerCmd.withTail(tail); + } Boolean tailAll = DockerHelper.getProperty(DockerConstants.DOCKER_TAIL_ALL, configuration, message, Boolean.class); - + if (tailAll != null && tailAll) { logContainerCmd.withTailAll(); } - - Integer tail = DockerHelper.getProperty(DockerConstants.DOCKER_TAIL, configuration, message, Integer.class); - - if (tailAll != null) { - logContainerCmd.withTail(tail); + + Boolean timestamps = DockerHelper.getProperty(DockerConstants.DOCKER_TIMESTAMPS, configuration, message, Boolean.class); + + if (timestamps != null) { + logContainerCmd.withTimestamps(timestamps); } - + return logContainerCmd; } - - + /** - * Produce a attach container request + * Produces a pause container request * * @param client * @param message * @return - * @throws DockerException */ - private AttachContainerCmd executeAttachContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Attach Container Request"); - + private PauseContainerCmd executePauseContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Pause Container Request"); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - AttachContainerCmd attachContainerCmd = client.attachContainerCmd(containerId); + ObjectHelper.notNull(containerId, "Container ID must be specified"); - Boolean stdOut = DockerHelper.getProperty(DockerConstants.DOCKER_STD_OUT, configuration, message, Boolean.class); - - if (stdOut != null && stdOut) { - attachContainerCmd.withStdOut(stdOut); - } - - Boolean stdErr = DockerHelper.getProperty(DockerConstants.DOCKER_STD_ERR, configuration, message, Boolean.class); - - if (stdErr != null && stdErr) { - attachContainerCmd.withStdErr(stdErr); - } - - Boolean logs = DockerHelper.getProperty(DockerConstants.DOCKER_LOGS, configuration, message, Boolean.class); - - if (logs != null && logs) { - attachContainerCmd.withLogs(logs); - } - - Boolean timestamps = DockerHelper.getProperty(DockerConstants.DOCKER_TIMESTAMPS, configuration, message, Boolean.class); - - if (timestamps != null && timestamps) { - attachContainerCmd.withTimestamps(timestamps); - } - - Boolean followStream = DockerHelper.getProperty(DockerConstants.DOCKER_FOLLOW_STREAM, configuration, message, Boolean.class); - - if (followStream != null && followStream) { - attachContainerCmd.withFollowStream(followStream); - } - - return attachContainerCmd; + PauseContainerCmd pauseContainerCmd = client.pauseContainerCmd(containerId); + + return pauseContainerCmd; } - /** - * Produces a stop container request + * Produces a remove container request * * @param client * @param message * @return - * @throws DockerException */ - private StopContainerCmd executeStopContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Kill Container Request"); - + private RemoveContainerCmd executeRemoveContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Remove Container Request"); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - StopContainerCmd stopContainerCmd = client.stopContainerCmd(containerId); - Integer timeout = DockerHelper.getProperty(DockerConstants.DOCKER_TIMEOUT, configuration, message, Integer.class); - - if (timeout != null) { - stopContainerCmd.withTimeout(timeout); + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + RemoveContainerCmd removeContainerCmd = client.removeContainerCmd(containerId); + + Boolean force = DockerHelper.getProperty(DockerConstants.DOCKER_FORCE, configuration, message, Boolean.class); + + if (force != null) { + removeContainerCmd.withForce(force); + } + + Boolean removeVolumes = DockerHelper.getProperty(DockerConstants.DOCKER_REMOVE_VOLUMES, configuration, message, Boolean.class); + + if (removeVolumes != null) { + removeContainerCmd.withRemoveVolumes(removeVolumes); } - - return stopContainerCmd; + + return removeContainerCmd; } - - + /** * Produces a restart container request * @@ -1050,375 +1249,323 @@ public class DockerProducer extends DefaultProducer { * @throws DockerException */ private RestartContainerCmd executeRestartContainerRequest(DockerClient client, Message message) throws DockerException { - + LOGGER.debug("Executing Docker Restart Container Request"); - + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - + RestartContainerCmd restartContainerCmd = client.restartContainerCmd(containerId); Integer timeout = DockerHelper.getProperty(DockerConstants.DOCKER_TIMEOUT, configuration, message, Integer.class); - + if (timeout != null) { restartContainerCmd.withtTimeout(timeout); } - + return restartContainerCmd; } - - + /** - * Produces a diff container request + * Produce a start container request * * @param client * @param message * @return - * @throws DockerException */ - private ContainerDiffCmd executeDiffContainerRequest(DockerClient client, Message message) throws DockerException { + private StartContainerCmd executeStartContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Start Container Request"); + + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + StartContainerCmd startContainerCmd = client.startContainerCmd(containerId); + + Bind[] binds = DockerHelper.getArrayProperty(DockerConstants.DOCKER_BINDS, message, Bind.class); + + if (binds != null) { + startContainerCmd.withBinds(binds); + } - LOGGER.debug("Executing Docker Diff Container Request"); + Capability[] capAdd = DockerHelper.getArrayProperty(DockerConstants.DOCKER_CAP_ADD, message, Capability.class); + + if (capAdd != null) { + startContainerCmd.withCapAdd(capAdd); + } + + Capability[] capDrop = DockerHelper.getArrayProperty(DockerConstants.DOCKER_CAP_DROP, message, Capability.class); + + if (capDrop != null) { + startContainerCmd.withCapDrop(capDrop); + } - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + Device[] devices = DockerHelper.getArrayProperty(DockerConstants.DOCKER_DEVICES, message, Device.class); + + if (devices != null) { + startContainerCmd.withDevices(devices); + } + + String[] dns = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS, message); + + if (dns != null) { + startContainerCmd.withDns(dns); + } + + String[] dnsSearch = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_DNS_SEARCH, message); + + if (dnsSearch != null) { + startContainerCmd.withDnsSearch(dnsSearch); + } + + Link[] links = DockerHelper.getArrayProperty(DockerConstants.DOCKER_LINKS, message, Link.class); + + if (links != null) { + startContainerCmd.withLinks(links); + } + + LxcConf[] lxcConf = DockerHelper.getArrayProperty(DockerConstants.DOCKER_LXC_CONF, message, LxcConf.class); + + if (lxcConf != null) { + startContainerCmd.withLxcConf(lxcConf); + } + + String networkMode = DockerHelper.getProperty(DockerConstants.DOCKER_NETWORK_MODE, configuration, message, String.class); + + if (networkMode != null) { + startContainerCmd.withNetworkMode(networkMode); + } + + Ports ports = DockerHelper.getProperty(DockerConstants.DOCKER_PORTS, configuration, message, Ports.class); + + if (ports != null) { + startContainerCmd.withPortBindings(ports); + } + + PortBinding[] portBinding = DockerHelper.getArrayProperty(DockerConstants.DOCKER_PORT_BINDINGS, message, PortBinding.class); + + if (portBinding != null) { + startContainerCmd.withPortBindings(portBinding); + } + + Boolean privileged = DockerHelper.getProperty(DockerConstants.DOCKER_PRIVILEGED, configuration, message, Boolean.class); - ContainerDiffCmd diffContainerCmd = client.containerDiffCmd(containerId); + if (privileged != null) { + startContainerCmd.withPrivileged(privileged); + } + + Boolean publishAllPorts = DockerHelper.getProperty(DockerConstants.DOCKER_PUBLISH_ALL_PORTS, configuration, message, Boolean.class); + + if (publishAllPorts != null) { + startContainerCmd.withPublishAllPorts(publishAllPorts); + } - return diffContainerCmd; + RestartPolicy restartPolicy = DockerHelper.getProperty(DockerConstants.DOCKER_RESTART_POLICY, configuration, message, RestartPolicy.class); + + if (restartPolicy != null) { + startContainerCmd.withRestartPolicy(restartPolicy); + } + + String volumesFrom = DockerHelper.getProperty(DockerConstants.DOCKER_VOLUMES_FROM, configuration, message, String.class); + + if (volumesFrom != null) { + startContainerCmd.withVolumesFrom(volumesFrom); + } + + return startContainerCmd; } /** - * Produces a kill container request + * Produces a stop container request * * @param client * @param message * @return - * @throws DockerException */ - private KillContainerCmd executeKillContainerRequest(DockerClient client, Message message) throws DockerException { - + private StopContainerCmd executeStopContainerRequest(DockerClient client, Message message) { + LOGGER.debug("Executing Docker Kill Container Request"); - + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - KillContainerCmd killContainerCmd = client.killContainerCmd(containerId); - String signal = DockerHelper.getProperty(DockerConstants.DOCKER_SIGNAL, configuration, message, String.class); - - if (signal != null) { - killContainerCmd.withSignal(signal); + StopContainerCmd stopContainerCmd = client.stopContainerCmd(containerId); + + Integer timeout = DockerHelper.getProperty(DockerConstants.DOCKER_TIMEOUT, configuration, message, Integer.class); + + if (timeout != null) { + stopContainerCmd.withTimeout(timeout); } - - return killContainerCmd; + + return stopContainerCmd; } - + /** * Produces a top container request * * @param client * @param message * @return - * @throws DockerException */ - private TopContainerCmd executeTopContainerRequest(DockerClient client, Message message) throws DockerException { - + private TopContainerCmd executeTopContainerRequest(DockerClient client, Message message) { + LOGGER.debug("Executing Docker Top Container Request"); - + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + TopContainerCmd topContainerCmd = client.topContainerCmd(containerId); String psArgs = DockerHelper.getProperty(DockerConstants.DOCKER_PS_ARGS, configuration, message, String.class); - + if (psArgs != null) { topContainerCmd.withPsArgs(psArgs); } - + return topContainerCmd; } - /** - * Produces a pause container request + * Produces a unpause container request * * @param client * @param message * @return - * @throws DockerException */ - private PauseContainerCmd executePauseContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Pause Container Request"); - + private UnpauseContainerCmd executeUnpauseContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Unpause Container Request"); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - PauseContainerCmd pauseContainerCmd = client.pauseContainerCmd(containerId); - - return pauseContainerCmd; + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + UnpauseContainerCmd unpauseContainerCmd = client.unpauseContainerCmd(containerId); + + return unpauseContainerCmd; } + /** - * Produces a unpause container request + * Produce a wait container request * * @param client * @param message * @return - * @throws DockerException */ - private UnpauseContainerCmd executeUnpauseContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Unpause Container Request"); - + private WaitContainerCmd executeWaitContainerRequest(DockerClient client, Message message) { + + LOGGER.debug("Executing Docker Wait Container Request"); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - UnpauseContainerCmd unpauseContainerCmd = client.unpauseContainerCmd(containerId); - - return unpauseContainerCmd; + + ObjectHelper.notNull(containerId, "Container ID must be specified"); + + WaitContainerCmd waitContainerCmd = client.waitContainerCmd(containerId); + + return waitContainerCmd; } + + /********************* + * Exec Requests + ********************/ + + /** - * Produces a commit container request + * Produces a exec create request * * @param client * @param message * @return - * @throws DockerException */ - private CommitCmd executeCommitContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Commit Container Request"); - - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - - CommitCmd commitCmd = client.commitCmd(containerId); - - String repository = DockerHelper.getProperty(DockerConstants.DOCKER_REPOSITORY, configuration, message, String.class); + private ExecCreateCmd executeExecCreateRequest(DockerClient client, Message message) { - if (repository != null) { - commitCmd.withRepository(repository); - } - - String msg = DockerHelper.getProperty(DockerConstants.DOCKER_MESSAGE, configuration, message, String.class); + LOGGER.debug("Executing Docker Exec Create Request"); - if (message != null) { - commitCmd.withMessage(msg); - } - - String tag = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); + String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - if (tag != null) { - commitCmd.withTag(tag); - } - - String author = DockerHelper.getProperty(DockerConstants.DOCKER_TAG, configuration, message, String.class); + ObjectHelper.notNull(containerId, "Container ID must be specified"); - if (author != null) { - commitCmd.withAuthor(tag); - } + ExecCreateCmd execCreateCmd = client.execCreateCmd(containerId); Boolean attachStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_IN, configuration, message, Boolean.class); - if (attachStdIn != null && attachStdIn) { - commitCmd.withAttachStdin(); - } - - Boolean attachStdOut = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_OUT, configuration, message, Boolean.class); - - if (attachStdOut != null && attachStdOut) { - commitCmd.withAttachStdout(); - } - Boolean attachStdErr = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_ERR, configuration, message, Boolean.class); - if (attachStdErr != null && attachStdErr) { - commitCmd.withAttachStderr(); - } - - String[] cmds = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CMD, message); - - if (cmds != null) { - commitCmd.withCmd(cmds); - } - - Boolean disableNetwork = DockerHelper.getProperty(DockerConstants.DOCKER_DISABLE_NETWORK, configuration, message, Boolean.class); - - if (disableNetwork != null && disableNetwork) { - commitCmd.withDisableNetwork(disableNetwork); - } - - Boolean pause = DockerHelper.getProperty(DockerConstants.DOCKER_PAUSE, configuration, message, Boolean.class); - - if (pause != null && pause) { - commitCmd.withPause(pause); - } - - String[] envs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_ENV, message); - - if (envs != null) { - commitCmd.withEnv(envs); - } - - ExposedPorts exposedPorts = DockerHelper.getProperty(DockerConstants.DOCKER_EXPOSED_PORTS, configuration, message, ExposedPorts.class); - - if (exposedPorts != null) { - commitCmd.withExposedPorts(exposedPorts); - } - - String hostname = DockerHelper.getProperty(DockerConstants.DOCKER_HOSTNAME, configuration, message, String.class); - - if (hostname != null) { - commitCmd.withHostname(hostname); + if (attachStdErr != null) { + execCreateCmd.withAttachStderr(attachStdErr); } - Integer memory = DockerHelper.getProperty(DockerConstants.DOCKER_MEMORY, configuration, message, Integer.class); - - if (memory != null) { - commitCmd.withMemory(memory); + if (attachStdIn != null) { + execCreateCmd.withAttachStdin(attachStdIn); } - Integer memorySwap = DockerHelper.getProperty(DockerConstants.DOCKER_MEMORY_SWAP, configuration, message, Integer.class); + Boolean attachStdOut = DockerHelper.getProperty(DockerConstants.DOCKER_ATTACH_STD_OUT, configuration, message, Boolean.class); - if (memorySwap != null) { - commitCmd.withMemorySwap(memorySwap); + if (attachStdOut != null) { + execCreateCmd.withAttachStdout(attachStdOut); } - Boolean openStdIn = DockerHelper.getProperty(DockerConstants.DOCKER_OPEN_STD_IN, configuration, message, Boolean.class); - - if (openStdIn != null && openStdIn) { - commitCmd.withOpenStdin(openStdIn); - } - - String[] portSpecs = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_PORT_SPECS, message); + String[] cmd = DockerHelper.parseDelimitedStringHeader(DockerConstants.DOCKER_CMD, message); - if (portSpecs != null) { - commitCmd.withPortSpecs(portSpecs); + if (cmd != null) { + execCreateCmd.withCmd(cmd); } - - Boolean stdInOnce = DockerHelper.getProperty(DockerConstants.DOCKER_STD_IN_ONCE, configuration, message, Boolean.class); - if (stdInOnce != null && stdInOnce) { - commitCmd.withStdinOnce(stdInOnce); - } - Boolean tty = DockerHelper.getProperty(DockerConstants.DOCKER_TTY, configuration, message, Boolean.class); - if (tty != null && tty) { - commitCmd.withTty(tty); - } - - String user = DockerHelper.getProperty(DockerConstants.DOCKER_USER, configuration, message, String.class); - - if (user != null) { - commitCmd.withUser(user); - } - - Volumes volumes = DockerHelper.getProperty(DockerConstants.DOCKER_VOLUMES, configuration, message, Volumes.class); - - if (volumes != null) { - commitCmd.withVolumes(volumes); + if (tty != null) { + execCreateCmd.withTty(tty); } - - String workingDir = DockerHelper.getProperty(DockerConstants.DOCKER_HOSTNAME, configuration, message, String.class); - if (workingDir != null) { - commitCmd.withWorkingDir(workingDir); - } - - - return commitCmd; + return execCreateCmd; } - + /** - * Produces a copy file/folder from container request + * Produces a exec start request * * @param client * @param message * @return - * @throws DockerException */ - private CopyFileFromContainerCmd executeCopyFileContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Copy File/Folder Container Request"); - - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); - String resource = DockerHelper.getProperty(DockerConstants.DOCKER_RESOURCE, configuration, message, String.class); + private ExecStartCmd executeExecStartRequest(DockerClient client, Message message) { - CopyFileFromContainerCmd copyFileContainerCmd = client.copyFileFromContainerCmd(containerId, resource); + LOGGER.debug("Executing Docker Exec Create Request"); - String hostPath = DockerHelper.getProperty(DockerConstants.DOCKER_HOST_PATH, configuration, message, String.class); - - if (hostPath != null) { - copyFileContainerCmd.withHostPath(hostPath); - } - - return copyFileContainerCmd; + String execId = DockerHelper.getProperty(DockerConstants.DOCKER_EXEC_ID, configuration, message, String.class); - } - - /** - * Produces a remove container request - * - * @param client - * @param message - * @return - * @throws DockerException - */ - private RemoveContainerCmd executeRemoveContainerRequest(DockerClient client, Message message) throws DockerException { - - LOGGER.debug("Executing Docker Remove Container Request"); - - String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class); + ObjectHelper.notNull(execId, "Exec ID must be specified"); - RemoveContainerCmd removeContainerCmd = client.removeContainerCmd(containerId); + ExecStartCmd execStartCmd = client.execStartCmd(execId); - Boolean force = DockerHelper.getProperty(DockerConstants.DOCKER_FORCE, configuration, message, Boolean.class); - - if (force != null && force) { - removeContainerCmd.withForce(force); + Boolean detach = DockerHelper.getProperty(DockerConstants.DOCKER_DETACH, configuration, message, Boolean.class); + + if (detach != null) { + execStartCmd.withDetach(detach); } - Boolean removeVolumes = DockerHelper.getProperty(DockerConstants.DOCKER_REMOVE_VOLUMES, configuration, message, Boolean.class); - - if (removeVolumes != null && removeVolumes) { - removeContainerCmd.withRemoveVolumes(removeVolumes); + Boolean tty = DockerHelper.getProperty(DockerConstants.DOCKER_TTY, configuration, message, Boolean.class); + + if (tty != null) { + execStartCmd.withTty(tty); } - - return removeContainerCmd; + + return execStartCmd; } - @Override protected void doStop() throws Exception { super.doStop(); } - - - /** - * Attempt to retrieve authorization details from the client - * - * @param client - * @return - */ - private AuthConfig getAuthConfig(DockerClient client) { - - AuthConfig authConfig = null; - - try { - authConfig = client.authConfig(); - } catch (Exception e) { - // Do nothing here - } - - return authConfig; - - } }
http://git-wip-us.apache.org/repos/asf/camel/blob/fb9556df/components/camel-docker/src/main/java/org/apache/camel/component/docker/ssl/NoImplSslConfig.java ---------------------------------------------------------------------- diff --git a/components/camel-docker/src/main/java/org/apache/camel/component/docker/ssl/NoImplSslConfig.java b/components/camel-docker/src/main/java/org/apache/camel/component/docker/ssl/NoImplSslConfig.java new file mode 100644 index 0000000..ada29b6 --- /dev/null +++ b/components/camel-docker/src/main/java/org/apache/camel/component/docker/ssl/NoImplSslConfig.java @@ -0,0 +1,38 @@ +/** + * 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.apache.camel.component.docker.ssl; + +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; + +import javax.net.ssl.SSLContext; + +import com.github.dockerjava.core.SSLConfig; + +/** + * A marker implementation of {@link SSLConfig} + */ +public class NoImplSslConfig implements SSLConfig { + + @Override + public SSLContext getSSLContext() throws KeyManagementException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException { + return null; + } + +}