org.globus.cog.gridshell.commands.gsh
Class Gsh

java.lang.Object
  extended byorg.globus.cog.gridshell.commands.AbstractCommand
      extended byorg.globus.cog.gridshell.commands.AbstractShellCommand
          extended byorg.globus.cog.gridshell.commands.AbstractShellProgram
              extended byorg.globus.cog.gridshell.commands.gsh.Gsh
All Implemented Interfaces:
Command, Comparable, EventListener, GridShell, Program, PropertyChangeListener, PropertyChangeNotifier, Runnable

public class Gsh
extends AbstractShellProgram
implements GridShell

This is a controller portion of the shell in a MVC scheme TODO: commands should be in a thread pool, not a new thread each time


Field Summary
 Validator FILE_VALIDATOR
           
static String PARAM_createCommand_commandValue
           
 
Fields inherited from class org.globus.cog.gridshell.commands.AbstractShellCommand
getopt
 
Fields inherited from class org.globus.cog.gridshell.commands.AbstractCommand
PROPERTY_STATUS_CODE
 
Fields inherited from interface org.globus.cog.gridshell.interfaces.GridShell
DEFAULT_PROMPT
 
Constructor Summary
Gsh()
           
 
Method Summary
 void acceptCommandState()
          Switches to an accepting command state
 void createAndExecuteCommand(Map args)
          Calls createCommand(Map args).execute()
 Command createCommand(Map args)
          Creates a command
 AbstractShellCommand createCommand(String commandName)
          A helper method so that errors are very carefully described.
static GetOpt createGetOpt(AbstractShellCommand command, Scope scope)
          Creates a getopt for given command, adds the help option, and adds the background argument
 GetOpt createGetOpt(Scope scope)
          Returns the GetOpt object used to parse and validate this command
 Object destroy()
          Destroys this command - called after the command has been completed
 Object execute()
          Executes this command
 void executeCommand(Command command)
          To run a command (ie calls command.execute change states while it runs)
 GridShellApp getApplication()
          Gets the App Component associated with this GridShell
 Collection getAvaialbeCommandNames()
           
 Action getCloseAction()
          Returns the action invoked to close the GridShell
protected  String getCommandName(String commandEntered)
          Just a helper method to break things down
 ConnectionManager getConnectionManager()
           
static String getExceptionString(Throwable thrown)
           
 GshEngine getGshEngine()
           
 GridShellSwingGUI getGUI()
          Gets the GUI Component associated with this GridShell
 Scope getManPageMapping()
           
 Object init(Map args)
          Init the super class, then init ourself Requires AbstractActionBinder.init's arguments and gridShellSwingGUI->an instance of gridShellSwingGUI
 void initCommand(AbstractShellCommand command, String commandEntered)
           
 Object kill()
          Kills this command
 void processCommandState()
          Switches to a processing state
 void propertyChange(PropertyChangeEvent pcEvent)
           
 Object resume()
          Resumes this command
 void setApplication(GridShellApp nApp)
          Allows applications to be set by new shells
 Object suspend()
          Suspends this command
 
Methods inherited from class org.globus.cog.gridshell.commands.AbstractShellProgram
addCommand, getCommands, removeCommand
 
Methods inherited from class org.globus.cog.gridshell.commands.AbstractShellCommand
createAbstractShellCommand, getCredentials, getGetOpt, getGridShell, getGsh, run, toString
 
Methods inherited from class org.globus.cog.gridshell.commands.AbstractCommand
addPropertyChangeListener, addPropertyChangeListener, arrayToMap, compareTo, getIdentity, getParent, getResult, getScope, getStatus, removePropertyChangeListener, setResult, setStatusCode, setStatusCompleted, setStatusFailed, setStatusFailed, unsupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.globus.cog.gridshell.interfaces.Program
addCommand, getCommands, removeCommand
 
Methods inherited from interface org.globus.cog.gridshell.interfaces.Command
getIdentity, getParent, getResult, getScope, getStatus, setStatusCode
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface org.globus.cog.gridshell.interfaces.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

PARAM_createCommand_commandValue

public static final String PARAM_createCommand_commandValue
See Also:
Constant Field Values

FILE_VALIDATOR

public final Validator FILE_VALIDATOR
Constructor Detail

Gsh

public Gsh()
Method Detail

getConnectionManager

public ConnectionManager getConnectionManager()

getCloseAction

public Action getCloseAction()
Description copied from interface: GridShell
Returns the action invoked to close the GridShell

Specified by:
getCloseAction in interface GridShell
Returns:

init

public Object init(Map args)
            throws Exception
Init the super class, then init ourself Requires AbstractActionBinder.init's arguments and gridShellSwingGUI->an instance of gridShellSwingGUI

Specified by:
init in interface Command
Overrides:
init in class AbstractShellCommand
Throws:
Exception

createCommand

public Command createCommand(Map args)
                      throws Exception
Description copied from interface: Program
Creates a command

Specified by:
createCommand in interface Program
Parameters:
args -
Throws:
Exception

initCommand

public void initCommand(AbstractShellCommand command,
                        String commandEntered)
                 throws Exception
Throws:
Exception

executeCommand

public void executeCommand(Command command)
Description copied from interface: Program
To run a command (ie calls command.execute change states while it runs)

Specified by:
executeCommand in interface Program
Parameters:
command -

createAndExecuteCommand

public void createAndExecuteCommand(Map args)
Description copied from interface: Program
Calls createCommand(Map args).execute()

Specified by:
createAndExecuteCommand in interface Program

execute

public Object execute()
               throws Exception
Description copied from interface: Command
Executes this command

Specified by:
execute in interface Command
Returns:
Throws:
Exception

destroy

public Object destroy()
               throws Exception
Description copied from interface: Command
Destroys this command - called after the command has been completed

Specified by:
destroy in interface Command
Returns:
Throws:
Exception

suspend

public Object suspend()
               throws Exception
Description copied from interface: Command
Suspends this command

Specified by:
suspend in interface Command
Overrides:
suspend in class AbstractShellCommand
Throws:
Exception

resume

public Object resume()
              throws Exception
Description copied from interface: Command
Resumes this command

Specified by:
resume in interface Command
Overrides:
resume in class AbstractShellCommand
Throws:
Exception

kill

public Object kill()
            throws Exception
Description copied from interface: Command
Kills this command

Specified by:
kill in interface Command
Overrides:
kill in class AbstractShellCommand
Throws:
Exception

propertyChange

public void propertyChange(PropertyChangeEvent pcEvent)
Specified by:
propertyChange in interface PropertyChangeListener

getExceptionString

public static String getExceptionString(Throwable thrown)

processCommandState

public void processCommandState()
Description copied from interface: GridShell
Switches to a processing state

Specified by:
processCommandState in interface GridShell

acceptCommandState

public void acceptCommandState()
Description copied from interface: GridShell
Switches to an accepting command state

Specified by:
acceptCommandState in interface GridShell

getGUI

public GridShellSwingGUI getGUI()
Description copied from interface: GridShell
Gets the GUI Component associated with this GridShell

Specified by:
getGUI in interface GridShell
Returns:

getApplication

public GridShellApp getApplication()
Description copied from interface: GridShell
Gets the App Component associated with this GridShell

Specified by:
getApplication in interface GridShell
Returns:

setApplication

public void setApplication(GridShellApp nApp)
Description copied from interface: GridShell
Allows applications to be set by new shells

Specified by:
setApplication in interface GridShell
Parameters:
nApp - - the new application

createCommand

public AbstractShellCommand createCommand(String commandName)
                                   throws Exception
A helper method so that errors are very carefully described. Only creats the command, still needs initialized.

Parameters:
commandName -
Returns:
Throws:
Exception

createGetOpt

public GetOpt createGetOpt(Scope scope)
Description copied from class: AbstractShellCommand
Returns the GetOpt object used to parse and validate this command

Specified by:
createGetOpt in class AbstractShellCommand
Parameters:
scope -
Returns:

createGetOpt

public static GetOpt createGetOpt(AbstractShellCommand command,
                                  Scope scope)
Creates a getopt for given command, adds the help option, and adds the background argument

Parameters:
command -
scope -
Returns:

getCommandName

protected String getCommandName(String commandEntered)
Just a helper method to break things down

Parameters:
commandEntered -
Returns:

getAvaialbeCommandNames

public Collection getAvaialbeCommandNames()

getManPageMapping

public Scope getManPageMapping()

getGshEngine

public GshEngine getGshEngine()