org.apache.hadoop.fs
Class ShellCommand

java.lang.Object
  extended by org.apache.hadoop.fs.ShellCommand
Direct Known Subclasses:
DF, DU

public abstract class ShellCommand
extends Object

A base class for running a unix command like du or df


Method Summary
static String execCommand(String[] cmd)
          Static method to execute a command.
protected abstract  String[] getExecString()
          return an array comtaining the command name & its parameters
protected abstract  void parseExecResult(BufferedReader lines)
          Parse the execution result
protected  void run()
          check to see if a command needs to be execuated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

protected void run()
            throws IOException
check to see if a command needs to be execuated

Throws:
IOException

getExecString

protected abstract String[] getExecString()
return an array comtaining the command name & its parameters


parseExecResult

protected abstract void parseExecResult(BufferedReader lines)
                                 throws IOException
Parse the execution result

Throws:
IOException

execCommand

public static String execCommand(String[] cmd)
                          throws IOException
Static method to execute a command. Covers most of the simple cases without requiring the user to implement Command interface.

Throws:
IOException


Copyright © 2006 The Apache Software Foundation