com.starteam
Class CommandProcessor

java.lang.Object
  extended by com.starteam.CommandProcessor

public final class CommandProcessor
extends java.lang.Object

A Command Processor is a class that executes a sequence of commands against a selected server, in the context of a specific project and view. The class maintains a connection to a single view instance


Constructor Summary
CommandProcessor()
          Creates a new Command Processor, ready for execution
 
Method Summary
 void addListener(CommandProcessorListener listener)
          adds a CommandProcessor event listener to this command processor instance Relevant events will be fired through this interface
static boolean canParse(java.lang.String command)
          Returns true if the specified command can be parsed by this processor
 boolean canReturnHeader()
          Returns true if this Command can return a header along with the results false if this command will never return a header (whether or not it returns results)
 boolean canReturnResults()
          Returns true if this Command can return a result set of 0 or more rows false if this command will never return any results.
 java.lang.String[][] execute(java.lang.String command)
          Executes a command Throws an SDKRuntime exception if the command execution fails The error message will indicate the reason for failure.
 java.lang.String[] getExecutedCommands()
          Returns the LIFO set of all commands executed by this processor.
 Folder getFolder()
          Returns the folder within which this command processor is executing commands, null if not yet connected to a view Applications may register for supported events on this instance
 Project getProject()
          Returns the project within which this command processor is executing commands, null if not yet connected to a project Applications may register for supported events on this instance
 Server getServer()
          Returns the server against which this command processor is executing commands, null if not yet connected to a server Applications may register for supported events on this instance
 View getView()
          Returns the view within which this command processor is executing commands, null if not yet connected to a view Applications may register for supported events on this instance
 java.lang.String[] parse(java.lang.String command)
          Parses the command.
 java.lang.String toString()
          Returns the command currently being executed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandProcessor

public CommandProcessor()
Creates a new Command Processor, ready for execution

Method Detail

canParse

public static boolean canParse(java.lang.String command)
Returns true if the specified command can be parsed by this processor

Parameters:
command - the command to be parsed
Returns:
true if the specified command can be parsed by this processor

getServer

public Server getServer()
Returns the server against which this command processor is executing commands, null if not yet connected to a server Applications may register for supported events on this instance

Returns:
the server against which this command processor is executing commands,

getProject

public Project getProject()
Returns the project within which this command processor is executing commands, null if not yet connected to a project Applications may register for supported events on this instance

Returns:
the project within which this command processor is executing commands,

getView

public View getView()
Returns the view within which this command processor is executing commands, null if not yet connected to a view Applications may register for supported events on this instance

Returns:
the view within which this command processor is executing commands,

getFolder

public Folder getFolder()
Returns the folder within which this command processor is executing commands, null if not yet connected to a view Applications may register for supported events on this instance

Returns:
the folder within which this command processor is executing commands,

canReturnResults

public boolean canReturnResults()
Returns true if this Command can return a result set of 0 or more rows false if this command will never return any results. (e.g. connect)

Returns:
true if this Command can return a result set of 0 or more rows

canReturnHeader

public boolean canReturnHeader()
Returns true if this Command can return a header along with the results false if this command will never return a header (whether or not it returns results)

Returns:
true if this Command can return a header along with the results

parse

public java.lang.String[] parse(java.lang.String command)
Parses the command. throws an SDKRuntimeException if the command cannot be parsed. The error message will attempt to identify the suspect syntax

Parameters:
command - the command whose syntax needs to be validated
Returns:
an array of requested options if successful. The leading - or / character will have been stripped off

execute

public java.lang.String[][] execute(java.lang.String command)
Executes a command Throws an SDKRuntime exception if the command execution fails The error message will indicate the reason for failure. Underlying exceptions will be chained to this exception

Parameters:
command - the command to execute
Returns:
String[][] if relevant, tabular results of this command execution, or an empty result set

getExecutedCommands

public java.lang.String[] getExecutedCommands()
Returns the LIFO set of all commands executed by this processor.

Returns:
the LIFO set of all commands executed so far

addListener

public void addListener(CommandProcessorListener listener)
adds a CommandProcessor event listener to this command processor instance Relevant events will be fired through this interface

Parameters:
listener - the listener through which events will be fired

toString

public java.lang.String toString()
Returns the command currently being executed

Overrides:
toString in class java.lang.Object
Returns:
the command currently being executed


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.