jgroup.experiment
Class ShellCommand

java.lang.Object
  extended by jgroup.experiment.ShellCommand

public final class ShellCommand
extends java.lang.Object

General class for executing shell commands.

Author:
Bjarte Svaeren, Hein Meling

Constructor Summary
ShellCommand(java.lang.String cmd, java.lang.ThreadGroup threadGroup)
          Constructs a shell command object for the given cmd string.
ShellCommand(java.lang.String cmd, java.lang.ThreadGroup threadGroup, boolean suppressCmdOutput)
          Constructs a shell command object for the given cmd string.
 
Method Summary
static void exec(java.lang.String cmd)
          Same as exec(commandString, null).
static void exec(java.lang.String cmd, java.lang.ThreadGroup threadGroup)
          Takes a String and a ThreadGroup as parameters, and executes the string as a shell command.
 boolean stderrModified()
           
 boolean stdoutModified()
           
static void waitFor(java.lang.ThreadGroup threadGroup)
           
static void waitFor(java.lang.ThreadGroup threadGroup, boolean debug)
          This methods takes a ThreadGroup as a parameter, and simply loops until all the threads in the ThreadGroup have completed their tasks.
 boolean waitForProcess()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellCommand

public ShellCommand(java.lang.String cmd,
                    java.lang.ThreadGroup threadGroup)
Constructs a shell command object for the given cmd string. If a thread group is provided, the command will be forked in a separate thread.

Parameters:
command - The command to be executed.
threadGroup - The ThreadGroup the shell command will run in. If null, the command will run in the current thread.

ShellCommand

public ShellCommand(java.lang.String cmd,
                    java.lang.ThreadGroup threadGroup,
                    boolean suppressCmdOutput)
Constructs a shell command object for the given cmd string. If a thread group is provided, the command will be forked in a separate thread.

Parameters:
command - The command to be executed.
threadGroup - The ThreadGroup the shell command will run in. If null, the command will run in the current thread.
suppressCmdOutput - True will suppress command output.
Method Detail

waitForProcess

public boolean waitForProcess()

stdoutModified

public boolean stdoutModified()

stderrModified

public boolean stderrModified()

exec

public static void exec(java.lang.String cmd,
                        java.lang.ThreadGroup threadGroup)
                 throws java.io.IOException
Takes a String and a ThreadGroup as parameters, and executes the string as a shell command. A new Thread in the ThreadGroup given as a parameter, unless the ThreadGroup parameter is null. If the parameter is null, the command is run in the current thread.

Parameters:
command - The command to be executed.
threadGroup - The ThreadGroup the shell command will run in. If null, the command will run in the current thread.
Throws:
java.lang.Exception
java.io.IOException

exec

public static void exec(java.lang.String cmd)
                 throws java.io.IOException
Same as exec(commandString, null).

Parameters:
command -
Throws:
java.lang.Exception
java.io.IOException

waitFor

public static void waitFor(java.lang.ThreadGroup threadGroup,
                           boolean debug)
This methods takes a ThreadGroup as a parameter, and simply loops until all the threads in the ThreadGroup have completed their tasks.

Parameters:
threadGroup - The ThreadGroup that contain the threads to wait for.

waitFor

public static void waitFor(java.lang.ThreadGroup threadGroup)


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.