org.bdgenomics.cannoli.builder

## Class CommandBuilder

- java.lang.Object
- - org.bdgenomics.cannoli.builder.CommandBuilder

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  DockerBuilder, LocalBuilder, SingularityBuilder

    public abstract class CommandBuilder
    extends Object
    implements Serializable

Abstract command builder.

See Also:
  Serialized Form

### Constructor Summary

Constructors
`protected` `CommandBuilder()` Create a new command builder.
`protected` `CommandBuilder(String executable)` Create a new command builder with the specified executable.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`CommandBuilder` `add(Iterable<String> arguments)` Add one or more arguments to the list of command arguments for this command builder.
`CommandBuilder` `add(String... arguments)` Add one or more arguments to the list of command arguments for this command builder.
`CommandBuilder` `addArgument(String argument)` Add an argument to the list of command arguments for this command builder.
`CommandBuilder` `addArguments(Iterable<String> arguments)` Add one or more arguments to the list of command arguments for this command builder.
`CommandBuilder` `addArguments(String... arguments)` Add one or more arguments to the list of command arguments for this command builder.
`CommandBuilder` `addEnvironment(Map<String,String> environment)` Add environment variables to the map of environment variables for this command builder.
`CommandBuilder` `addEnvironment(String variable, String value)` Add an environment variable to the map of environment variables for this command builder.
`CommandBuilder` `addFile(String file)` Add a file to the list of files to make available locally for this command builder.
`CommandBuilder` `addFiles(Iterable<String> files)` Add files to the list of files to make available locally for this command builder.
`CommandBuilder` `addFiles(String... files)` Add zero or more files to the list of files to make available locally for this command builder.
`CommandBuilder` `addMount(String mount)` Add the specified mount point to the map of mount points for this command builder.
`CommandBuilder` `addMount(String source, String target)` Add the specified mount point to the map of mount points for this command builder.
`CommandBuilder` `addMounts(Map<String,String> mounts)` Add the specified mount points to the map of mount points for this command builder.
`abstract List<String>` `build()` Build and return the command for this command builder as a list of strings.
`List<String>` `getArguments()` Return an immutable list of command arguments for this command builder.
`Map<String,String>` `getEnvironment()` Return an immutable map of environment variables for this command builder.
`String` `getExecutable()` Return the executable for this command builder.
`List<String>` `getFiles()` Return an immutable list of files to make available locally for this command builder.
`Integer` `getFlankSize()` Return the number of bases to flank each command invocation by for this builder.
`String` `getImage()` Return the image for this command builder.
`Map<String,String>` `getMounts()` Return the map of mount points for this command builder.
`Optional<Integer>` `getOptFlankSize()` Return the number of bases to flank each command invocation by for this builder, as an optional.
`Optional<Long>` `getOptTimeout()` Return how long to let a single partition run for, in seconds, for this builder, as an optional.
`boolean` `getSudo()` Return true to run via sudo for this command builder.
`Long` `getTimeout()` Return how long to let a single partition run for, in seconds, for this builder.
`boolean` `isSudo()` Return true to run via sudo for this command builder.
`CommandBuilder` `reset()` Reset this command builder.
`CommandBuilder` `setExecutable(String executable)` Set the executable for this command builder.
`CommandBuilder` `setFlankSize(Integer flankSize)` Set the number of bases to flank each command invocation by for this builder.
`CommandBuilder` `setImage(String image)` Set the image for this command builder.
`CommandBuilder` `setSudo(boolean sudo)` Set to true to run via sudo for this command builder.
`CommandBuilder` `setTimeout(Long timeout)` Set how long to let a single partition run for, in seconds, for this builder.
`CommandBuilder` `setTimeout(long duration, TimeUnit timeUnit)` Set how long to let a single partition run for, in the specified time unit, for this builder.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CommandBuilder

    protected CommandBuilder()

Create a new command builder.

#### CommandBuilder

    protected CommandBuilder(String executable)

Create a new command builder with the specified executable.

Parameters:
  `executable` - executable, must not be null

### Method Detail

#### setExecutable

    public final CommandBuilder setExecutable(String executable)

Set the executable for this command builder.

Parameters:
  `executable` - executable, must not be null
Returns:
  this command builder

#### setFlankSize

    public final CommandBuilder setFlankSize(@Nullable
                                             Integer flankSize)

Set the number of bases to flank each command invocation by for this builder.

Parameters:
  `flankSize` - number of bases to flank each command invocation by
Returns:
  this command builder

#### setImage

    public final CommandBuilder setImage(String image)

Set the image for this command builder.

Parameters:
  `image` - image, must not be null
Returns:
  this command builder

#### setSudo

    public final CommandBuilder setSudo(boolean sudo)

Set to true to run via sudo for this command builder.

Parameters:
  `sudo` - true to run via sudo
Returns:
  this command builder

#### setTimeout

    public final CommandBuilder setTimeout(@Nullable
                                           Long timeout)

Set how long to let a single partition run for, in seconds, for this builder.

Parameters:
  `timeout` - how long to let a single partition run for, in seconds
Returns:
  this command builder

#### setTimeout

    public final CommandBuilder setTimeout(long duration,
                                           TimeUnit timeUnit)

Set how long to let a single partition run for, in the specified time unit, for this builder.

Parameters:
  `duration` - duration
  `timeUnit` - time unit, must not be null
Returns:
  this command builder

#### add

    public final CommandBuilder add(String... arguments)

Add one or more arguments to the list of command arguments for this command builder.

Parameters:
  `arguments` - variable number of arguments to add, must not be null
Returns:
  this command builder

#### add

    public final CommandBuilder add(Iterable<String> arguments)

Add one or more arguments to the list of command arguments for this command builder.

Parameters:
  `arguments` - arguments to add, must not be null
Returns:
  this command builder

#### addArgument

    public final CommandBuilder addArgument(String argument)

Add an argument to the list of command arguments for this command builder.

Parameters:
  `argument` - argument to add, must not be null
Returns:
  this command builder

#### addArguments

    public final CommandBuilder addArguments(String... arguments)

Add one or more arguments to the list of command arguments for this command builder.

Parameters:
  `arguments` - variable number of arguments to add, must not be null
Returns:
  this command builder

#### addArguments

    public final CommandBuilder addArguments(Iterable<String> arguments)

Add one or more arguments to the list of command arguments for this command builder.

Parameters:
  `arguments` - arguments to add, must not be null
Returns:
  this command builder

#### addEnvironment

    public final CommandBuilder addEnvironment(String variable,
                                               String value)

Add an environment variable to the map of environment variables for this command builder.

Parameters:
  `variable` - environment variable to add, must not be null
  `value` - environment variable value to add, must not be null
Returns:
  this command builder

#### addEnvironment

    public final CommandBuilder addEnvironment(Map<String,String> environment)

Add environment variables to the map of environment variables for this command builder.

Parameters:
  `environment` - environment variables to add, must not be null
Returns:
  this command builder

#### addFile

    public final CommandBuilder addFile(String file)

Add a file to the list of files to make available locally for this command builder.

Parameters:
  `file` - file to add, must not be null
Returns:
  this command builder

#### addFiles

    public final CommandBuilder addFiles(String... files)

Add zero or more files to the list of files to make available locally for this command builder.

Parameters:
  `files` - variable number of files to add, must not be null
Returns:
  this command builder

#### addFiles

    public final CommandBuilder addFiles(Iterable<String> files)

Add files to the list of files to make available locally for this command builder.

Parameters:
  `files` - files to add, must not be null
Returns:
  this command builder

#### addMount

    public final CommandBuilder addMount(String mount)

Add the specified mount point to the map of mount points for this command builder.

Parameters:
  `mount` - mount point source and target, must not be null
Returns:
  this command builder

#### addMount

    public final CommandBuilder addMount(String source,
                                         String target)

Add the specified mount point to the map of mount points for this command builder.

Parameters:
  `source` - mount point source, must not be null
  `target` - mount point target, must not be null
Returns:
  this command builder

#### addMounts

    public final CommandBuilder addMounts(Map<String,String> mounts)

Add the specified mount points to the map of mount points for this command builder.

Parameters:
  `mounts` - mount points to add, must not be null
Returns:
  this command builder

#### getExecutable

    public final String getExecutable()

Return the executable for this command builder.

Returns:
  the executable for this command builder

#### getFlankSize

    public final Integer getFlankSize()

Return the number of bases to flank each command invocation by for this builder. May be null.

Returns:
  the number of bases to flank each command invocation by for this builder

#### getOptFlankSize

    public final Optional<Integer> getOptFlankSize()

Return the number of bases to flank each command invocation by for this builder, as an optional.

Returns:
  the number of bases to flank each command invocation by for this builder, as an optional

#### getImage

    public final String getImage()

Return the image for this command builder.

Returns:
  the image for this command builder.

#### getTimeout

    public final Long getTimeout()

Return how long to let a single partition run for, in seconds, for this builder. May be null.

Returns:
  how long to let a single partition run for, in seconds, for this builder

#### getOptTimeout

    public final Optional<Long> getOptTimeout()

Return how long to let a single partition run for, in seconds, for this builder, as an optional.

Returns:
  how long to let a single partition run for, in seconds, for this builder, as an optional

#### getSudo

    public final boolean getSudo()

Return true to run via sudo for this command builder.

Returns:
  true to run via sudo for this command builder

#### isSudo

    public final boolean isSudo()

Return true to run via sudo for this command builder.

Returns:
  true to run via sudo for this command builder

#### getArguments

    public final List<String> getArguments()

Return an immutable list of command arguments for this command builder.

Returns:
  an immutable list of command arguments for this command builder

#### getEnvironment

    public final Map<String,String> getEnvironment()

Return an immutable map of environment variables for this command builder.

Returns:
  an immutable map of environment variables for this command builder

#### getFiles

    public final List<String> getFiles()

Return an immutable list of files to make available locally for this command builder.

Returns:
  an immutable list of files to make available locally for this command builder

#### getMounts

    public final Map<String,String> getMounts()

Return the map of mount points for this command builder.

Returns:
  the map of mount points for this command builder

#### reset

    public final CommandBuilder reset()

Reset this command builder.

Returns:
  this command builder

#### build

    public abstract List<String> build()

Build and return the command for this command builder as a list of strings.

Returns:
  the command for this command builder as a list of strings.
Throws:
  `IllegalStateException` - if this builder is in an illegal state, e.g. if required values are not set