edu.iastate.jtm.util
Class ProcessWrapper

java.lang.Object
  extended by edu.iastate.jtm.gui.DefaultMonitorable
      extended by edu.iastate.jtm.util.ProcessWrapper
All Implemented Interfaces:
Monitorable

public class ProcessWrapper
extends DefaultMonitorable

A wrapper class for a commandline process.

Author:
Jing Ding

Nested Class Summary
static class ProcessWrapper.CmdNotFoundException
           
 
Field Summary
protected  java.lang.String cmdline
           
 
Fields inherited from class edu.iastate.jtm.gui.DefaultMonitorable
message, monitorable, progress
 
Constructor Summary
ProcessWrapper(java.lang.String cmd)
          Creates a new instance of ProcessMoniter
 
Method Summary
 void addProcessListener(ProcessListener pl)
           
protected  void end(int eValue)
           
 int getExitValue()
           
 boolean isTerminated()
           
static void main(java.lang.String[] args)
           
protected  void processStderr(char[] output, int count)
           
protected  void processStdout(char[] output, int count)
           
 void removeProcessListener(ProcessListener pl)
           
protected  void report(java.lang.String message, float progress)
           
 int run(java.lang.String args)
           
 void setCmdline(java.lang.String c)
           
 void setWaitTime(long wt)
           
 
Methods inherited from class edu.iastate.jtm.gui.DefaultMonitorable
getMessage, getProgress, isDeterministic, isFinished, isMonitorable, isRunning, setMessage, setMonitorable, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cmdline

protected java.lang.String cmdline
Constructor Detail

ProcessWrapper

public ProcessWrapper(java.lang.String cmd)
               throws ProcessWrapper.CmdNotFoundException
Creates a new instance of ProcessMoniter

Throws:
ProcessWrapper.CmdNotFoundException
Method Detail

setCmdline

public void setCmdline(java.lang.String c)
                throws ProcessWrapper.CmdNotFoundException
Throws:
ProcessWrapper.CmdNotFoundException

isTerminated

public boolean isTerminated()

getExitValue

public int getExitValue()

setWaitTime

public void setWaitTime(long wt)

addProcessListener

public void addProcessListener(ProcessListener pl)

removeProcessListener

public void removeProcessListener(ProcessListener pl)

report

protected void report(java.lang.String message,
                      float progress)

end

protected void end(int eValue)

run

public int run(java.lang.String args)
        throws java.io.IOException
Throws:
java.io.IOException

processStdout

protected void processStdout(char[] output,
                             int count)

processStderr

protected void processStderr(char[] output,
                             int count)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        ProcessWrapper.CmdNotFoundException
Parameters:
args - the command line arguments
Throws:
java.io.IOException
ProcessWrapper.CmdNotFoundException