jcaas.util
Class JDIClassRunner

java.lang.Object
  extended by jcaas.util.JDIClassRunner
All Implemented Interfaces:
JDIHandler

public class JDIClassRunner
extends java.lang.Object
implements JDIHandler

This is the main top-level JDI simulator class. This class will take information about a class to be run and spawn off a JDI instance to run it. It is really a JDI wrapper around ClassRunner.

Author:
steppm

Constructor Summary
JDIClassRunner(java.lang.String classpath, java.lang.String annotateScript, java.lang.String evalScript, java.lang.String classname, java.lang.String[] args)
          Constructor.
 
Method Summary
 void addJDIHandler(JDIHandler handler)
          Adds another JDIHandler to this list of handlers that will receive events from the JDI.
 void begin()
          This is the method to start up the JDI VM.
 void closeConsole()
          Closes the console window, if any
 int getBlackBoardIntField(java.lang.String fieldname)
          This will retrieve the integer value from any static BlackBoard field.
 void handleEvent(com.sun.jdi.event.Event e)
          This class is also a JDIHandler, because it must deal with VMDeathEvents.
 void handleSTDERR(java.lang.String str)
          Does nothing
 void handleSTDOUT(java.lang.String str)
          Does nothing
 boolean isDead()
          Checks to see if this class is done running (dead).
 boolean isRunning()
          Checks if this class is still running.
 void kill()
          Kills the JDI JVM.
 void requestExceptionEvents(java.lang.String classname)
          Registers an ExceptionEvent that the system should watch for
 void requestFieldAccessEvents(java.lang.String classname, java.lang.String fieldname)
          Registers a AccessWatchpointEvent that the system should watch for.
 void requestFieldModifyEvents(java.lang.String classname, java.lang.String fieldname)
          Registers a ModificationWatchpointEvent that the system should watch for.
 void requestMethodBeginEvents(java.lang.String classname, java.lang.String methodname, java.lang.String signature)
          Registers a MethodEntryEvent that the system should watch for.
 void requestMethodEndEvents(java.lang.String classname, java.lang.String methodname, java.lang.String signature)
          Registers a MethodExitEvent that the system should watch for.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDIClassRunner

public JDIClassRunner(java.lang.String classpath,
                      java.lang.String annotateScript,
                      java.lang.String evalScript,
                      java.lang.String classname,
                      java.lang.String[] args)
Constructor.

Parameters:
classpath - the classpath needed for the program, just as it would appear on the command line (use the right separator)
annotateScript - the filename of annotation script
evalScript - the filename of the evaluation script
classname - the name of the class to run
args - the command-line args for the program
Method Detail

requestMethodBeginEvents

public void requestMethodBeginEvents(java.lang.String classname,
                                     java.lang.String methodname,
                                     java.lang.String signature)
Registers a MethodEntryEvent that the system should watch for.

Parameters:
classname - the name of the parent class of the method
methodname - the name of the method (i.e. "setSize")
the - internal signature of the method (i.e. "(II)V")

requestMethodEndEvents

public void requestMethodEndEvents(java.lang.String classname,
                                   java.lang.String methodname,
                                   java.lang.String signature)
Registers a MethodExitEvent that the system should watch for.

Parameters:
classname - the name of the parent class of the method
methodname - the name of the method (i.e. "setSize")
the - internal signature of the method (i.e. "(II)V")

requestFieldAccessEvents

public void requestFieldAccessEvents(java.lang.String classname,
                                     java.lang.String fieldname)
Registers a AccessWatchpointEvent that the system should watch for.

Parameters:
classname - the name of the parent class of the field
fieldname - the name of the field (i.e. "myBiscuit")

requestFieldModifyEvents

public void requestFieldModifyEvents(java.lang.String classname,
                                     java.lang.String fieldname)
Registers a ModificationWatchpointEvent that the system should watch for.

Parameters:
classname - the name of the parent class of the field
fieldname - the name of the field (i.e. "myBiscuit")

requestExceptionEvents

public void requestExceptionEvents(java.lang.String classname)
Registers an ExceptionEvent that the system should watch for

Parameters:
classname - the name of the exception

begin

public void begin()
This is the method to start up the JDI VM. After this method is called, the program will begin running.


isRunning

public boolean isRunning()
Checks if this class is still running.

Returns:
true iff the JDI VM is still running

isDead

public boolean isDead()
Checks to see if this class is done running (dead). This class is unusable after it is dead.

Returns:
true iff this class is dead

addJDIHandler

public void addJDIHandler(JDIHandler handler)
Adds another JDIHandler to this list of handlers that will receive events from the JDI.

Parameters:
handler - the handler

kill

public void kill()
Kills the JDI JVM. This object will be invalid after this call completes.


closeConsole

public void closeConsole()
Closes the console window, if any


handleEvent

public void handleEvent(com.sun.jdi.event.Event e)
This class is also a JDIHandler, because it must deal with VMDeathEvents.

Specified by:
handleEvent in interface JDIHandler

handleSTDOUT

public void handleSTDOUT(java.lang.String str)
Does nothing

Specified by:
handleSTDOUT in interface JDIHandler

handleSTDERR

public void handleSTDERR(java.lang.String str)
Does nothing

Specified by:
handleSTDERR in interface JDIHandler

getBlackBoardIntField

public int getBlackBoardIntField(java.lang.String fieldname)
                          throws java.lang.Exception
This will retrieve the integer value from any static BlackBoard field. Ex: getBlackBoardIntField("invoke");

Throws:
java.lang.Exception