org.apache.bsf.debug.jsdi
Interface JsEngine

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
JsEngineStub, JsEngineStub

public interface JsEngine
extends java.rmi.Remote

Represents a remote engine as seen from the debugger. It matches the notion of global object in JavaScript specification. In other words, a JsEngine is an execution context rather than an explicit engine. This also means that a JsEngine is not multi-threaded, there is only one execution being carried. Hence, there is only one stack of JsContext for a JsEngine. The stack is only accesible if the engine is in a callback mode to the debugger, that is, the execution is stopped at a breakpoint or after a stepping order has completed.


Method Summary
 java.lang.Object eval(java.lang.String docname, java.lang.String fnOrScript, int lineno)
          Allow the debugger to evaluate an expression within the current context.
 JsContext getContext(int depth)
          Returns the JsContext at a certain depth.
 int getContextCount()
          Returns the count of JsContext on the current stack.
 JsCallbacks getDebugger()
          Return the current debugger.
 JsObject getGlobalObject()
          Any execution in JavaScript happen with respect to a global object, sort of the top-level name space for properties.
 java.lang.String getThread()
          Returns name of the thread currently running in the engine
 java.lang.String getThreadGroup()
          Returns name of the ThreadGroup of the thread currently running in the engine
 JsObject getUndefinedValue()
          As per ECMA specification, each JavaScript execution defines a unique object for the undefined value.
 boolean isSuspended()
           
 boolean poll()
          Allows the client debugger to poll the connection.
 void run()
          Stepping commands: run: resume execution until it finishes or a breakpoint is hit.
 void setDebugger(JsCallbacks debugger)
          Set the associated debugger.
 void stepIn()
           
 void stepOut()
           
 void stepOver()
           
 

Method Detail

poll

boolean poll()
             throws java.rmi.RemoteException
Allows the client debugger to poll the connection.

Throws:
java.rmi.RemoteException

setDebugger

void setDebugger(JsCallbacks debugger)
                 throws java.rmi.RemoteException
Set the associated debugger.

Parameters:
debugger - the debugger to be used on callbacks from the engine.
Throws:
java.rmi.RemoteException

getDebugger

JsCallbacks getDebugger()
                        throws java.rmi.RemoteException
Return the current debugger.

Returns:
the debugger, or null if none is attached.
Throws:
java.rmi.RemoteException

eval

java.lang.Object eval(java.lang.String docname,
                      java.lang.String fnOrScript,
                      int lineno)
                      throws java.rmi.RemoteException
Allow the debugger to evaluate an expression within the current context.

Throws:
java.rmi.RemoteException

getContextCount

int getContextCount()
                    throws java.rmi.RemoteException
Returns the count of JsContext on the current stack. This is a valid call only if the engine is stopped in a callback to the debugger (breakpoint or stepping completed).

Throws:
java.rmi.RemoteException

getThread

java.lang.String getThread()
                           throws java.rmi.RemoteException
Returns name of the thread currently running in the engine

Throws:
java.rmi.RemoteException

getThreadGroup

java.lang.String getThreadGroup()
                                throws java.rmi.RemoteException
Returns name of the ThreadGroup of the thread currently running in the engine

Throws:
java.rmi.RemoteException

getContext

JsContext getContext(int depth)
                     throws java.rmi.RemoteException
Returns the JsContext at a certain depth. Depth zero is the top of the stack, that is, the inner execution context. This is a valid call only if the engine is stopped in a callback to the debugger (breakpoint or stepping completed).

Throws:
java.rmi.RemoteException

getGlobalObject

JsObject getGlobalObject()
                         throws java.rmi.RemoteException
Any execution in JavaScript happen with respect to a global object, sort of the top-level name space for properties. This is global object return by this call.

Throws:
java.rmi.RemoteException

getUndefinedValue

JsObject getUndefinedValue()
                           throws java.rmi.RemoteException
As per ECMA specification, each JavaScript execution defines a unique object for the undefined value.

Throws:
java.rmi.RemoteException

run

void run()
         throws java.rmi.RemoteException
Stepping commands: run: resume execution until it finishes or a breakpoint is hit. stepIn: steps to the next statement, considering callee's statement if any. stepOut: steps until the current JsContext exits. stepOver: steps to the next statement within the same JsContext.

Throws:
java.rmi.RemoteException

stepIn

void stepIn()
            throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

stepOut

void stepOut()
             throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

stepOver

void stepOver()
              throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

isSuspended

boolean isSuspended()
                    throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException