Class AbstractDockerCommand<C extends AbstractDockerCommand>

  • All Implemented Interfaces:
    com.oracle.bedrock.runtime.MetaClass<com.oracle.bedrock.runtime.Application>
    Direct Known Subclasses:
    Build, CommandWithArgumentList, Events, Run, SimpleDockerCommand

    public abstract class AbstractDockerCommand<C extends AbstractDockerCommand>
    extends Object
    implements com.oracle.bedrock.runtime.MetaClass<com.oracle.bedrock.runtime.Application>
    A MetaClass representing a Docker command.

    Instances of AbstractDockerCommand are immutable. All mutating operations return new instances of AbstractDockerCommand with the mutations applied.

    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

      • AbstractDockerCommand

        public AbstractDockerCommand​(com.oracle.bedrock.runtime.options.Arguments commandArguments)
        Constructs a AbstractDockerCommand given the specified Arguments.
        Parameters:
        commandArguments - the Arguments representing the options for the command
      • AbstractDockerCommand

        public AbstractDockerCommand​(String command)
        Constructs a AbstractDockerCommand for a given Docker command.
        Parameters:
        command - the Docker command that will be executed
    • Method Detail

      • getImplementationClass

        public Class<? extends com.oracle.bedrock.runtime.Application> getImplementationClass​(com.oracle.bedrock.runtime.Platform platform,
                                                                                              com.oracle.bedrock.OptionsByType optionsByType)
        Specified by:
        getImplementationClass in interface com.oracle.bedrock.runtime.MetaClass<C extends AbstractDockerCommand>
      • onLaunching

        public void onLaunching​(com.oracle.bedrock.runtime.Platform platform,
                                com.oracle.bedrock.OptionsByType optionsByType)
        Specified by:
        onLaunching in interface com.oracle.bedrock.runtime.MetaClass<C extends AbstractDockerCommand>
      • onLaunch

        public void onLaunch​(com.oracle.bedrock.runtime.Platform platform,
                             com.oracle.bedrock.OptionsByType optionsByType)
        Specified by:
        onLaunch in interface com.oracle.bedrock.runtime.MetaClass<C extends AbstractDockerCommand>
      • onLaunched

        public void onLaunched​(com.oracle.bedrock.runtime.Platform platform,
                               com.oracle.bedrock.runtime.Application application,
                               com.oracle.bedrock.OptionsByType optionsByType)
        Specified by:
        onLaunched in interface com.oracle.bedrock.runtime.MetaClass<C extends AbstractDockerCommand>
      • withCommandArguments

        public abstract C withCommandArguments​(com.oracle.bedrock.runtime.options.Argument... args)
        Obtain a copy of this AbstractDockerCommand with the addition of 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.

        Parameters:
        args - the additional Arguments
        Returns:
        a copy of this AbstractDockerCommand with the addition of the specified Arguments
      • withoutCommandArguments

        public abstract C withoutCommandArguments​(com.oracle.bedrock.runtime.options.Argument... args)
        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.

        Parameters:
        args - the additional Arguments
        Returns:
        a copy of this AbstractDockerCommand without the specified Arguments
      • getCommandArguments

        public com.oracle.bedrock.runtime.options.Arguments getCommandArguments()
        Obtain the Arguments for this command.
        Returns:
        the Arguments for this command
      • timeoutAfter

        public C timeoutAfter​(long duration,
                              TimeUnit units)
        Set the Timeout to use when running the command.
        Parameters:
        duration - the duration for the Timeout
        units - the TimeUnits for the duration of the Timeout
        Returns:
        a copy of this AbstractDockerCommand with the addition of the specified timeout
      • timeoutAfter

        public C timeoutAfter​(com.oracle.bedrock.options.Timeout timeout)
        Set the Timeout to use when running the command.
        Parameters:
        timeout - the Timeout to use when executing the command
        Returns:
        a copy of this AbstractDockerCommand with the addition of the specified timeout
      • getTimeout

        public com.oracle.bedrock.options.Timeout getTimeout()
        Obtain the Timeout to use when executing the command.
        Returns:
        the Timeout to use when executing the command