com.sun.grid.jgdi.util.shell
Class AbstractCommand

java.lang.Object
  extended by com.sun.grid.jgdi.util.shell.AbstractCommand
Direct Known Subclasses:
AnnotatedCommand, QDelCommand, QHostCommand, QModCommand, QQuotaCommand, QrDelCommand

public abstract class AbstractCommand
extends java.lang.Object


Constructor Summary
AbstractCommand()
           
 
Method Summary
 int getExitCode()
          Gets the commands exit code
 Shell getShell()
           
 java.lang.String getUsage()
          Gets the command usage
 void init(Shell shell)
          Init command, set all needed arrtibutes from shell
 void printAnswers(java.util.List<JGDIAnswer> answers)
          Prints the JGDI answer list to specified PrintWriter.
abstract  void run(java.lang.String[] args)
          Run the command
protected  void setExitCode(int newCode)
          Sets the commands exit code to newCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

getUsage

public java.lang.String getUsage()
Gets the command usage


run

public abstract void run(java.lang.String[] args)
                  throws java.lang.Exception
Run the command

Parameters:
args -
Throws:
java.lang.Exception

init

public void init(Shell shell)
          throws java.lang.Exception
Init command, set all needed arrtibutes from shell

Parameters:
shell -
Throws:
java.lang.Exception

getShell

public Shell getShell()

printAnswers

public void printAnswers(java.util.List<JGDIAnswer> answers)

Prints the JGDI answer list to specified PrintWriter.

Helper method for JGDI methods *withAnswer

Parameters:
answers - a JGDI answer list

getExitCode

public int getExitCode()

Gets the commands exit code

Returns:
int exitCode

setExitCode

protected void setExitCode(int newCode)

Sets the commands exit code to newCode

Parameters:
newCode - new exitCode of this command


Copyright © 2007 Sun Microsystems, Inc. All rights reserved.