站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

ExecuteCommand (NetBeans VCS API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.modules.vcscore.cmdline
Class ExecuteCommand

java.lang.Object
  extended byorg.netbeans.modules.vcscore.cmdline.ExecuteCommand
All Implemented Interfaces:
Runnable, TextInput, VcsCommandExecutor
Direct Known Subclasses:
CommandLineVcsDirReader, CommandLineVcsDirReaderRecursive

public class ExecuteCommand
extends Object
implements VcsCommandExecutor

Execute command.


Field Summary
static String DEFAULT_REGEX
           
protected  int exitStatus
           
static String STATUS_USE_REG_EXP_PARSE_OUTPUT
           
 
Fields inherited from interface org.netbeans.modules.vcscore.commands.VcsCommandExecutor
FAILED, INTERRUPTED, SUCCEEDED
 
Constructor Summary
ExecuteCommand(CommandExecutionContext executionContext, UserCommand cmd, Hashtable vars)
           
ExecuteCommand(CommandExecutionContext executionContext, UserCommand cmd, Hashtable vars, String preferredExec)
           
 
Method Summary
 void addDataErrorOutputListener(CommandDataOutputListener l)
          Deprecated. Kept for compatibility reasons only. Use addRegexErrorListener(org.netbeans.modules.vcscore.commands.RegexOutputListener) instead.
 void addDataOutputListener(CommandDataOutputListener l)
          Deprecated. Kept for compatibility reasons only. Use addRegexOutputListener(org.netbeans.modules.vcscore.commands.RegexOutputListener) instead.
 void addErrorOutputListener(CommandOutputListener l)
          Deprecated. Kept for compatibility reasons only. Use addTextErrorListener(org.netbeans.modules.vcscore.commands.TextOutputListener) instead.
 void addFileReaderListener(FileReaderListener l)
          Add a file reader listener, that gets the updated attributes of the processed file(s).
 void addImmediateTextErrorListener(TextOutputListener l)
          Add a listener to the standard error output, that will be noified immediately as soon as the output text is available.
 void addImmediateTextOutputListener(TextOutputListener l)
          Add a listener to the standard output, that will be noified immediately as soon as the output text is available.
 void addOutputListener(CommandOutputListener l)
          Deprecated. Kept for compatibility reasons only. Use addTextOutputListener(org.netbeans.modules.vcscore.commands.TextOutputListener) instead.
 void addRegexErrorListener(RegexOutputListener l)
          Add the listener to the data error output of the command.
 void addRegexOutputListener(RegexOutputListener l)
          Add the listener to the data output of the command.
 void addTextErrorListener(TextOutputListener l)
          Add the listener to the error output of the command.
 void addTextOutputListener(TextOutputListener l)
          Add the listener to the standard output of the command.
static Collection createProcessingFiles(CommandExecutionContext executionContext, Hashtable vars)
          Get the set of files being processed by the command.
 VcsCommand getCommand()
          The executed command.
 VcsDescribedCommand getDescribedCommand()
          Deprecated. Needed for the compatibility with old "API" only.
 String getExec()
          Get the updated execution string.
 int getExitStatus()
          Get the exit status of the execution.
 Collection getFiles()
          Get the set of files being processed by the command.
protected  VcsFileSystem getFileSystem()
           
 CommandTask getTask()
          Set the CommandTask, that is associated with this executor.
 Hashtable getVariables()
          Get the variables used by this command execution.
 VcsCommandVisualizer getVisualizer()
          Get the graphical visualization of the command.
 String preprocessCommand(VcsCommand vc, Hashtable vars, String exec, StructuredExec sexec)
          This method can be used to do some preprocessing of the command which is to be run.
protected  void printDataErrorOutput(String[] data)
           
protected  void printDataErrorOutputReal(String[] data)
           
protected  void printDataOutput(String[] data)
           
protected  void printErrorOutput(String line)
           
protected  void printOutput(String line)
           
 void run()
          Execute the command.
protected  void runClass(String exec, String className, String[] args)
          Loads class of given name with some arguments and execute its exec() method.
protected  void runCommand(String[] execs)
          Execute a command-line command.
protected  void runCommand(StructuredExec exec)
          Execute a command-line command.
 void sendInput(String input)
          Send an input string to the standard input of the command.
protected static void setAdditionalParams(Object execCommand, VcsFileSystem fileSystem)
          Search for optional methods and set additional parameters.
protected static void setAdditionalParams(Object execCommand, VcsFileSystem fileSystem, CommandExecutionContext executionContext)
          Search for optional methods and set additional parameters.
 void setDescribedCommand(VcsDescribedCommand command)
          Deprecated. Needed for the compatibility with old "API" only.
 void setTask(CommandTask task)
          Get the CommandTask, that is associated with this executor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REGEX

public static final String DEFAULT_REGEX
See Also:
Constant Field Values

STATUS_USE_REG_EXP_PARSE_OUTPUT

public static final String STATUS_USE_REG_EXP_PARSE_OUTPUT
See Also:
Constant Field Values

exitStatus

protected int exitStatus
Constructor Detail

ExecuteCommand

public ExecuteCommand(CommandExecutionContext executionContext,
                      UserCommand cmd,
                      Hashtable vars)

ExecuteCommand

public ExecuteCommand(CommandExecutionContext executionContext,
                      UserCommand cmd,
                      Hashtable vars,
                      String preferredExec)
Method Detail

getDescribedCommand

public VcsDescribedCommand getDescribedCommand()
Deprecated. Needed for the compatibility with old "API" only.

Get the command associated with this ExecuteCommand.


setDescribedCommand

public void setDescribedCommand(VcsDescribedCommand command)
Deprecated. Needed for the compatibility with old "API" only.

Set the command associated with this ExecuteCommand.


getTask

public CommandTask getTask()
Set the CommandTask, that is associated with this executor.


setTask

public void setTask(CommandTask task)
Get the CommandTask, that is associated with this executor.


addTextOutputListener

public final void addTextOutputListener(TextOutputListener l)
Add the listener to the standard output of the command. The listeners are removed when the command finishes.

Specified by:
addTextOutputListener in interface VcsCommandExecutor

addTextErrorListener

public final void addTextErrorListener(TextOutputListener l)
Add the listener to the error output of the command. The listeners are removed when the command finishes.

Specified by:
addTextErrorListener in interface VcsCommandExecutor

addRegexOutputListener

public final void addRegexOutputListener(RegexOutputListener l)
Add the listener to the data output of the command. This output may contain a parsed information from its standard output or some other data provided by this command. The listeners are removed when the command finishes.

Specified by:
addRegexOutputListener in interface VcsCommandExecutor

addRegexErrorListener

public final void addRegexErrorListener(RegexOutputListener l)
Add the listener to the data error output of the command. This output may contain a parsed information from its error output or some other data provided by this command. If there are some data given to this listener, the command is supposed to fail. The listeners are removed when the command finishes.

Specified by:
addRegexErrorListener in interface VcsCommandExecutor

addOutputListener

public void addOutputListener(CommandOutputListener l)
Deprecated. Kept for compatibility reasons only. Use addTextOutputListener(org.netbeans.modules.vcscore.commands.TextOutputListener) instead.

Add the listener to the standard output of the command. The listeners should be released by the implementing class, when the command finishes.

Specified by:
addOutputListener in interface VcsCommandExecutor

addErrorOutputListener

public void addErrorOutputListener(CommandOutputListener l)
Deprecated. Kept for compatibility reasons only. Use addTextErrorListener(org.netbeans.modules.vcscore.commands.TextOutputListener) instead.

Add the listener to the error output of the command. The listeners should be released by the implementing class, when the command finishes.

Specified by:
addErrorOutputListener in interface VcsCommandExecutor

addDataOutputListener

public void addDataOutputListener(CommandDataOutputListener l)
Deprecated. Kept for compatibility reasons only. Use addRegexOutputListener(org.netbeans.modules.vcscore.commands.RegexOutputListener) instead.

Add the listener to the data output of the command. This output may contain a parsed information from its standard output or some other data provided by this command. The listeners should be released by the implementing class, when the command finishes.

Specified by:
addDataOutputListener in interface VcsCommandExecutor

addDataErrorOutputListener

public void addDataErrorOutputListener(CommandDataOutputListener l)
Deprecated. Kept for compatibility reasons only. Use addRegexErrorListener(org.netbeans.modules.vcscore.commands.RegexOutputListener) instead.

Add the listener to the data error output of the command. This output may contain a parsed information from its error output or some other data provided by this command. If there are some data given to this listener, the command is supposed to fail. The listeners should be released by the implementing class, when the command finishes.

Specified by:
addDataErrorOutputListener in interface VcsCommandExecutor

addImmediateTextOutputListener

public void addImmediateTextOutputListener(TextOutputListener l)
Description copied from interface: VcsCommandExecutor
Add a listener to the standard output, that will be noified immediately as soon as the output text is available. It does not wait for the new line and does not send output line-by-line.

Specified by:
addImmediateTextOutputListener in interface VcsCommandExecutor

addImmediateTextErrorListener

public void addImmediateTextErrorListener(TextOutputListener l)
Description copied from interface: VcsCommandExecutor
Add a listener to the standard error output, that will be noified immediately as soon as the output text is available. It does not wait for the new line and does not send output line-by-line.

Specified by:
addImmediateTextErrorListener in interface VcsCommandExecutor

sendInput

public void sendInput(String input)
Description copied from interface: TextInput
Send an input string to the standard input of the command.

Specified by:
sendInput in interface TextInput
Parameters:
input - The input text.

getCommand

public final VcsCommand getCommand()
Description copied from interface: VcsCommandExecutor
The executed command.

Specified by:
getCommand in interface VcsCommandExecutor

getVariables

public final Hashtable getVariables()
Get the variables used by this command execution.

Specified by:
getVariables in interface VcsCommandExecutor

getExitStatus

public final int getExitStatus()
Description copied from interface: VcsCommandExecutor
Get the exit status of the execution.

Specified by:
getExitStatus in interface VcsCommandExecutor
Returns:
the exit value, it may be one of SUCCEEDED, FAILED, INTERRUPTED.

getVisualizer

public VcsCommandVisualizer getVisualizer()
Get the graphical visualization of the command. The returned visualizer might need to be initialized in UserCommandTask, that owns the CommandOutputCollector.

Specified by:
getVisualizer in interface VcsCommandExecutor
Returns:
null no visualization is desired.

preprocessCommand

public String preprocessCommand(VcsCommand vc,
                                Hashtable vars,
                                String exec,
                                StructuredExec sexec)
This method can be used to do some preprocessing of the command which is to be run.

Specified by:
preprocessCommand in interface VcsCommandExecutor
Parameters:
vc - the command to be preprocessed.
vars - the variables
exec - the updated execution string. It may contain user input from variable input dialog
Returns:
the updated exec property

getExec

public String getExec()
Get the updated execution string. It may contain user input now.

Specified by:
getExec in interface VcsCommandExecutor

getFileSystem

protected final VcsFileSystem getFileSystem()

runCommand

protected void runCommand(String[] execs)
Execute a command-line command.


runCommand

protected void runCommand(StructuredExec exec)
Execute a command-line command.


printOutput

protected final void printOutput(String line)

printErrorOutput

protected final void printErrorOutput(String line)

printDataOutput

protected void printDataOutput(String[] data)

printDataErrorOutput

protected void printDataErrorOutput(String[] data)

printDataErrorOutputReal

protected void printDataErrorOutputReal(String[] data)

runClass

protected void runClass(String exec,
                        String className,
                        String[] args)
Loads class of given name with some arguments and execute its exec() method.

Parameters:
className - the name of the class to be loaded
args - the arguments

run

public void run()
Execute the command.

Specified by:
run in interface Runnable

setAdditionalParams

protected static void setAdditionalParams(Object execCommand,
                                          VcsFileSystem fileSystem)
Search for optional methods and set additional parameters.


setAdditionalParams

protected static void setAdditionalParams(Object execCommand,
                                          VcsFileSystem fileSystem,
                                          CommandExecutionContext executionContext)
Search for optional methods and set additional parameters.


getFiles

public Collection getFiles()
Get the set of files being processed by the command.

Specified by:
getFiles in interface VcsCommandExecutor
Returns:
the set of files of type String relative to the file system root.

createProcessingFiles

public static Collection createProcessingFiles(CommandExecutionContext executionContext,
                                               Hashtable vars)
Get the set of files being processed by the command.

Returns:
the set of files of type String relative to the file system root.

addFileReaderListener

public void addFileReaderListener(FileReaderListener l)
Add a file reader listener, that gets the updated attributes of the processed file(s).

Specified by:
addFileReaderListener in interface VcsCommandExecutor

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.