Class CommandWithArgumentList<C extends CommandWithArgumentList>

  • All Implemented Interfaces:
    com.oracle.bedrock.runtime.MetaClass<com.oracle.bedrock.runtime.Application>
    Direct Known Subclasses:
    Images, Inspect, Kill, Logs, Network, Remove, Stop

    public abstract class CommandWithArgumentList<C extends CommandWithArgumentList>
    extends AbstractDockerCommand<C>
    An immutable SimpleDockerCommand with a list of Arguments that will be appended to the end of the command line. For example the command line "docker command [args...] [end-args...]" the Arguments are applied to the end-args position. A concrete example would be the Docker rm command to remove containers, this command takes the form docker rm [args...] [containers...] where there are some optional args, such as --force, but the container names are always appended to the end of the command line.

    Copyright (c) 2016. All Rights Reserved. Oracle Corporation.
    Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

    Author:
    Jonathan Knight
    • Constructor Detail

      • CommandWithArgumentList

        protected CommandWithArgumentList​(com.oracle.bedrock.runtime.options.Arguments arguments,
                                          List<?> argList)
        Parameters:
        arguments - the command Arguments
        argList - List of Arguments that will be appended to the end of the command line
      • CommandWithArgumentList

        protected CommandWithArgumentList​(String command,
                                          List<?> argList)
        Parameters:
        command - the Docker command
        argList - List of Arguments that will be appended to the end of the command line
    • Method Detail

      • withoutCommandArguments

        public C withoutCommandArguments​(com.oracle.bedrock.runtime.options.Argument... args)
        Description copied from class: AbstractDockerCommand
        Obtain a copy of this AbstractDockerCommand without the specified command arguments Arguments.

        Command arguments in Docker come after the command name on the command line, e.g. docker [options...] COMMAND_NAME [args...] Parts of the Docker documentation that refer to these parameters as both arguments and options. In our case we refer to them as arguments and the are applied after the command name on the command line.

        Specified by:
        withoutCommandArguments in class AbstractDockerCommand<C extends CommandWithArgumentList>
        Parameters:
        args - the additional Arguments
        Returns:
        a copy of this AbstractDockerCommand without the specified Arguments
      • withCommandArguments

        protected abstract C withCommandArguments​(List<com.oracle.bedrock.runtime.options.Argument> endArgs,
                                                  com.oracle.bedrock.runtime.options.Argument... args)
        Obtain a copy of this CommandWithArgumentList with the addition of the specified command arguments Arguments.
        Parameters:
        endArgs - the List of Arguments that appear at the end of the command line
        args - the new command to add
        Returns:
        a copy of this CommandWithArgumentList with the addition of the specified command arguments Arguments
      • withoutCommandArguments

        protected abstract C withoutCommandArguments​(List<com.oracle.bedrock.runtime.options.Argument> endArgs,
                                                     com.oracle.bedrock.runtime.options.Argument... args)
        Obtain a copy of this CommandWithArgumentList without the the specified command arguments Arguments.
        Parameters:
        endArgs - the List of Arguments that appear at the end of the command line
        args - the new command to add
        Returns:
        a copy of this CommandWithArgumentList without the specified command arguments Arguments
      • onLaunch

        public void onLaunch​(com.oracle.bedrock.runtime.Platform platform,
                             com.oracle.bedrock.OptionsByType optionsByType)
        On launching add the Arguments to the end of the command line arguments.
        Specified by:
        onLaunch in interface com.oracle.bedrock.runtime.MetaClass<C extends CommandWithArgumentList>
        Overrides:
        onLaunch in class AbstractDockerCommand<C extends CommandWithArgumentList>
        Parameters:
        platform - the Platform launching the command
        optionsByType - the OptionsByType for the command