Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest.tool
Class Command

    java.lang.Object
      com.sun.javatest.tool.Command

Direct Known Subclasses:
  VerboseCommand

    public abstract class Command

extends java.lang.Object

A class to represent a command to be executed. Commands are typically read from the command line or from command files.

Nested Class Summary
`class` | `Command.Fault` This exception is used to report problems with a specific command.

Field Summary
`static int` | `DEFAULT_DTMODE` A value to indicate that a command accepts the default desktop mode.
`static int` | `DESKTOP_NOT_REQUIRED_DTMODE` A value to indicate that a command does not require the use of a desktop to function.
`static int` | `DESKTOP_REQUIRED_DTMODE` A value to indicate that a command requires the use of a desktop to function.

Constructor Summary
`protected` | `Command(java.lang.String name)` Create an instance of a command.

Method Summary
`protected void` | `addArg(java.lang.String arg)` Record another argument in the argument array.
`java.lang.String[]` | `getArgs()` Get the array of arguments for this command.
`protected InterviewParameters` | `getConfig(CommandContext ctx)` A convenience method to get the configuration from a command context, and rewrapping any exception that might occur.
`java.net.URL` | `getCustomSplash()` Get the classpath to load the custom splash screen from.
`int` | `getDesktopMode()` Get the desktop mode for this command.
`boolean` | `isActionCommand()` Check whether this command is an action command or not.
`protected java.lang.String` | `nextArg(java.util.Iterator argIter)` Get another argument from the iterator, and add it to the argument array.
`protected void` | `putbackArg(java.util.ListIterator argIter)` Back up the iterator to reject an argument, and remove the corresponding entry from the argument array.
`abstract void` | `run(CommandContext ctx)` Execute the work embodied by this command, using the given command context.
`java.lang.String` | `toString()` Get a printable representation of this command.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### DEFAULT_DTMODE

    public static final int DEFAULT_DTMODE

  A value to indicate that a command accepts the default desktop mode. This means that it neither requires nor discourages the use of a desktop for its use.

  See Also:
    `getDesktopMode()`, `DESKTOP_NOT_REQUIRED_DTMODE`, `DESKTOP_REQUIRED_DTMODE`, Constant Field Values

### DESKTOP_NOT_REQUIRED_DTMODE

    public static final int DESKTOP_NOT_REQUIRED_DTMODE

  A value to indicate that a command does not require the use of a desktop to function.

  See Also:
    `getDesktopMode()`, `DEFAULT_DTMODE`, `DESKTOP_REQUIRED_DTMODE`, Constant Field Values

### DESKTOP_REQUIRED_DTMODE

    public static final int DESKTOP_REQUIRED_DTMODE

  A value to indicate that a command requires the use of a desktop to function.

  See Also:
    `getDesktopMode()`, `DEFAULT_DTMODE`, `DESKTOP_NOT_REQUIRED_DTMODE`, Constant Field Values

Constructor Detail

### Command

    protected Command(java.lang.String name)

  Create an instance of a command.

  Parameters:
    `name` - The name for this command. The name will be saved as the first entry as the argument array.

Method Detail

### addArg

    protected void addArg(java.lang.String arg)

  Record another argument in the argument array.

  Parameters:
    `arg` - the argument to be added

### nextArg

    protected java.lang.String nextArg(java.util.Iterator argIter)

  Get another argument from the iterator, and add it to the argument array.

  Parameters:
    `argIter` - the iterator from which to get the next argument
  Returns:
    the next argument from the iterator

### putbackArg

    protected void putbackArg(java.util.ListIterator argIter)

  Back up the iterator to reject an argument, and remove the corresponding entry from the argument array.

  Parameters:
    `argIter` - the iterator from which teh argument was obtained

### getArgs

    public java.lang.String[] getArgs()

  Get the array of arguments for this command. The first element in the array will be the command name; the subsequent arguments will be the ones added by the addArg method.

  Returns:
    the array of arguments for this command

### toString

    public java.lang.String toString()

  Get a printable representation of this command. The string is composed of the entries in the argument array.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a printable representation of this command

### getDesktopMode

    public int getDesktopMode()

  Get the desktop mode for this command. Valid responses are one of DEFAULT_DTMODE, DESKTOP_NOT_REQUIRED_DTMODE, DESKTOP_REQUIRED_DTMODE. The default is DESKTOP_NOT_REQUIRED_DTMODE if isActionCommand is true, and DESKTOP_DEFAULT_DTMODE otherwise.

  Returns:
    a value indicating the desktop mode for this command
  See Also:
    `DEFAULT_DTMODE`, `DESKTOP_NOT_REQUIRED_DTMODE`, `DESKTOP_REQUIRED_DTMODE`

### getCustomSplash

    public java.net.URL getCustomSplash()

  Get the classpath to load the custom splash screen from. At this location, it is expected that a resource bundle prefixed with "splash" will be available. The search strategy given in ResourceBundle will be used, with the returned File as the classpath for the class loader. The limited classpath/classloader is used to make this operation as fast as possible, rather than requiring that the command's entire context be loaded. In the resource bundle, there should be a property named `startup.icon`.

  Returns:
    the location of the splash screen resource bundle
  Since:
    4.0
  See Also:
    `ResourceBundle`

### isActionCommand

    public boolean isActionCommand()

  Check whether this command is an action command or not. Action commands are those that do work such as running tests, writing a report, etc. The default implementation is to return false.

  Returns:
    true if this command is an action command, and false otherwise

### run

    public abstract void run(CommandContext ctx)
                      throws Command.Fault

  Execute the work embodied by this command, using the given command context.

  Parameters:
    `ctx` - context information that may be set up by preceding commands.
  Throws:
    `Command.Fault` - if there is an error while executing this command

### getConfig

    protected InterviewParameters getConfig(CommandContext ctx)
                                     throws Command.Fault

  A convenience method to get the configuration from a command context, and rewrapping any exception that might occur.

  Parameters:
    `ctx` - the command context from which to get the configuration
  Returns:
    the current configuration from the command context
  Throws:
    `Command.Fault` - if there is a problem obtaining or evaluating the configuration.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.