Class CommandWithArgumentList<C extends CommandWithArgumentList>
- java.lang.Object
-
- com.oracle.bedrock.runtime.docker.commands.AbstractDockerCommand<C>
-
- com.oracle.bedrock.runtime.docker.commands.CommandWithArgumentList<C>
-
- All Implemented Interfaces:
com.oracle.bedrock.runtime.MetaClass<com.oracle.bedrock.runtime.Application>
public abstract class CommandWithArgumentList<C extends CommandWithArgumentList> extends AbstractDockerCommand<C>
An immutableSimpleDockerCommandwith a list ofArguments that will be appended to the end of the command line. For example the command line"docker command [args...] [end-args...]"theArguments are applied to the end-args position. A concrete example would be the Docker rm command to remove containers, this command takes the formdocker 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 Summary
Constructors Modifier Constructor Description protectedCommandWithArgumentList(com.oracle.bedrock.runtime.options.Arguments arguments, List<?> argList)Create aCommandWithArgumentList.protectedCommandWithArgumentList(String command, List<?> argList)Create aCommandWithArgumentList.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidonLaunch(com.oracle.bedrock.runtime.Platform platform, com.oracle.bedrock.OptionsByType optionsByType)On launching add theArguments to the end of the command line arguments.CwithCommandArguments(com.oracle.bedrock.runtime.options.Argument... args)Obtain a copy of thisCommandWithArgumentListwith the addition of the specified command argumentsArguments.protected abstract CwithCommandArguments(List<com.oracle.bedrock.runtime.options.Argument> endArgs, com.oracle.bedrock.runtime.options.Argument... args)Obtain a copy of thisCommandWithArgumentListwith the addition of the specified command argumentsArguments.CwithoutCommandArguments(com.oracle.bedrock.runtime.options.Argument... args)Obtain a copy of thisAbstractDockerCommandwithout the specified command argumentsArguments.protected abstract CwithoutCommandArguments(List<com.oracle.bedrock.runtime.options.Argument> endArgs, com.oracle.bedrock.runtime.options.Argument... args)Obtain a copy of thisCommandWithArgumentListwithout the the specified command argumentsArguments.-
Methods inherited from class com.oracle.bedrock.runtime.docker.commands.AbstractDockerCommand
getCommandArguments, getImplementationClass, getTimeout, onLaunched, onLaunching, timeoutAfter, timeoutAfter
-
-
-
-
Constructor Detail
-
CommandWithArgumentList
protected CommandWithArgumentList(com.oracle.bedrock.runtime.options.Arguments arguments, List<?> argList)Create aCommandWithArgumentList.- Parameters:
arguments- the commandArgumentsargList-ListofArguments that will be appended to the end of the command line
-
CommandWithArgumentList
protected CommandWithArgumentList(String command, List<?> argList)
Create aCommandWithArgumentList.- Parameters:
command- the Docker commandargList-ListofArguments that will be appended to the end of the command line
-
-
Method Detail
-
withCommandArguments
public C withCommandArguments(com.oracle.bedrock.runtime.options.Argument... args)
Obtain a copy of thisCommandWithArgumentListwith the addition of the specified command argumentsArguments.- Specified by:
withCommandArgumentsin classAbstractDockerCommand<C extends CommandWithArgumentList>- Parameters:
args- the additionalArguments- Returns:
- a copy of this
CommandWithArgumentListwith the addition of the specifiedArguments
-
withoutCommandArguments
public C withoutCommandArguments(com.oracle.bedrock.runtime.options.Argument... args)
Description copied from class:AbstractDockerCommandObtain a copy of thisAbstractDockerCommandwithout the specified command argumentsArguments.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:
withoutCommandArgumentsin classAbstractDockerCommand<C extends CommandWithArgumentList>- Parameters:
args- the additionalArguments- Returns:
- a copy of this
AbstractDockerCommandwithout the specifiedArguments
-
withCommandArguments
protected abstract C withCommandArguments(List<com.oracle.bedrock.runtime.options.Argument> endArgs, com.oracle.bedrock.runtime.options.Argument... args)
Obtain a copy of thisCommandWithArgumentListwith the addition of the specified command argumentsArguments.- Parameters:
endArgs- theListofArgumentsthat appear at the end of the command lineargs- the new command to add- Returns:
- a copy of this
CommandWithArgumentListwith the addition of the specified command argumentsArguments
-
withoutCommandArguments
protected abstract C withoutCommandArguments(List<com.oracle.bedrock.runtime.options.Argument> endArgs, com.oracle.bedrock.runtime.options.Argument... args)
Obtain a copy of thisCommandWithArgumentListwithout the the specified command argumentsArguments.- Parameters:
endArgs- theListofArgumentsthat appear at the end of the command lineargs- the new command to add- Returns:
- a copy of this
CommandWithArgumentListwithout the specified command argumentsArguments
-
onLaunch
public void onLaunch(com.oracle.bedrock.runtime.Platform platform, com.oracle.bedrock.OptionsByType optionsByType)On launching add theArguments to the end of the command line arguments.- Specified by:
onLaunchin interfacecom.oracle.bedrock.runtime.MetaClass<C extends CommandWithArgumentList>- Overrides:
onLaunchin classAbstractDockerCommand<C extends CommandWithArgumentList>- Parameters:
platform- thePlatformlaunching the commandoptionsByType- theOptionsByTypefor the command
-
-