|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.util.Shell org.apache.hadoop.util.Shell.ShellCommandExecutor
public static class Shell.ShellCommandExecutor
A simple shell command executor.
ShellCommandExecutor
should be used in cases where the output
of the command needs no explicit parsing and where the command, working
directory and the environment remains unchanged. The output of the command
is stored as-is and is expected to be small.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.hadoop.util.Shell |
---|
Shell.ExitCodeException, Shell.ShellCommandExecutor |
Field Summary |
---|
Fields inherited from class org.apache.hadoop.util.Shell |
---|
LOG, SET_GROUP_COMMAND, SET_OWNER_COMMAND, SET_PERMISSION_COMMAND, timeOutInterval, ULIMIT_COMMAND, USER_NAME_COMMAND, WINDOWS |
Constructor Summary | |
---|---|
Shell.ShellCommandExecutor(String[] execString)
|
|
Shell.ShellCommandExecutor(String[] execString,
File dir)
|
|
Shell.ShellCommandExecutor(String[] execString,
File dir,
Map<String,String> env)
|
|
Shell.ShellCommandExecutor(String[] execString,
File dir,
Map<String,String> env,
long timeout)
Create a new instance of the ShellCommandExecutor to execute a command. |
Method Summary | |
---|---|
void |
execute()
Execute the shell command. |
protected String[] |
getExecString()
return an array containing the command name & its parameters |
String |
getOutput()
Get the output of the shell command. |
protected void |
parseExecResult(BufferedReader lines)
Parse the execution result |
String |
toString()
Returns the commands of this instance. |
Methods inherited from class org.apache.hadoop.util.Shell |
---|
execCommand, execCommand, execCommand, getExitCode, getGET_PERMISSION_COMMAND, getGroupsCommand, getGroupsForUserCommand, getProcess, getUlimitMemoryCommand, getUlimitMemoryCommand, getUsersForNetgroupCommand, isTimedOut, run, setEnvironment, setWorkingDirectory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Shell.ShellCommandExecutor(String[] execString)
public Shell.ShellCommandExecutor(String[] execString, File dir)
public Shell.ShellCommandExecutor(String[] execString, File dir, Map<String,String> env)
public Shell.ShellCommandExecutor(String[] execString, File dir, Map<String,String> env, long timeout)
execString
- The command to execute with argumentsdir
- If not-null, specifies the directory which should be set
as the current working directory for the command.
If null, the current working directory is not modified.env
- If not-null, environment of the command will include the
key-value pairs specified in the map. If null, the current
environment is not modified.timeout
- Specifies the time in milliseconds, after which the
command will be killed and the status marked as timedout.
If 0, the command will not be timed out.Method Detail |
---|
public void execute() throws IOException
IOException
protected String[] getExecString()
Shell
getExecString
in class Shell
protected void parseExecResult(BufferedReader lines) throws IOException
Shell
parseExecResult
in class Shell
IOException
public String getOutput()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |