public abstract class Command
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Command.Fault
This exception is used to report problems with a specific command.
|
Modifier and Type | Field and Description |
---|---|
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.
|
Modifier | Constructor and Description |
---|---|
protected |
Command(java.lang.String name)
Create an instance of a command.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final int DEFAULT_DTMODE
public static final int DESKTOP_NOT_REQUIRED_DTMODE
public static final int DESKTOP_REQUIRED_DTMODE
protected Command(java.lang.String name)
name
- The name for this command.
The name will be saved as the first entry as the argument array.protected void addArg(java.lang.String arg)
arg
- the argument to be addedprotected java.lang.String nextArg(java.util.Iterator argIter)
argIter
- the iterator from which to get the next argumentprotected void putbackArg(java.util.ListIterator argIter)
argIter
- the iterator from which teh argument was obtainedpublic java.lang.String[] getArgs()
public java.lang.String toString()
toString
in class java.lang.Object
public int getDesktopMode()
DEFAULT_DTMODE
,
DESKTOP_NOT_REQUIRED_DTMODE
,
DESKTOP_REQUIRED_DTMODE
public java.net.URL getCustomSplash()
startup.icon
.ResourceBundle
public boolean isActionCommand()
public abstract void run(CommandContext ctx) throws Command.Fault
ctx
- context information that may be set up by preceding commands.Command.Fault
- if there is an error while executing this commandprotected InterviewParameters getConfig(CommandContext ctx) throws Command.Fault
ctx
- the command context from which to get the configurationCommand.Fault
- if there is a problem obtaining or evaluating
the configuration.Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.