org.apache.bsf.debug.meta

Class JsEngineStub

Implemented Interfaces:
JsEngine, Remote, RemoteService

public class JsEngineStub
extends Stub
implements JsEngine

Field Summary

Fields inherited from class org.apache.bsf.debug.util.Stub

NOT_FOUND, UNDEFINED, m_con, m_revoked, m_tid, m_uid

Constructor Summary

JsEngineStub(SocketConnection con, int tid, int uid)

Method Summary

Object
eval(String docname, 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.
String
getThread()
Returns name of the thread currently running in the engine
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()

Methods inherited from class org.apache.bsf.debug.util.Stub

Init, addListener, completeFuture, createFuture, equals, getConnection, getTid, getUid, removeListener, revokeFuture, revoked, suspendFuture, swizzle

Constructor Details

JsEngineStub

public JsEngineStub(SocketConnection con,
                    int tid,
                    int uid)

Method Details

eval

public Object eval(String docname,
                   String fnOrScript,
                   int lineno)
            throws RemoteException
Allow the debugger to evaluate an expression within the current context.
Specified by:
eval in interface JsEngine


getContext

public JsContext getContext(int depth)
            throws 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).
Specified by:
getContext in interface JsEngine


getContextCount

public int getContextCount()
            throws 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).
Specified by:
getContextCount in interface JsEngine


getDebugger

public JsCallbacks getDebugger()
            throws RemoteException
Return the current debugger.
Specified by:
getDebugger in interface JsEngine

Returns:
the debugger, or null if none is attached.


getGlobalObject

public JsObject getGlobalObject()
            throws 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.
Specified by:
getGlobalObject in interface JsEngine


getThread

public String getThread()
            throws RemoteException
Returns name of the thread currently running in the engine
Specified by:
getThread in interface JsEngine


getThreadGroup

public String getThreadGroup()
            throws RemoteException
Returns name of the ThreadGroup of the thread currently running in the engine
Specified by:
getThreadGroup in interface JsEngine


getUndefinedValue

public JsObject getUndefinedValue()
            throws RemoteException
As per ECMA specification, each JavaScript execution defines a unique object for the undefined value.
Specified by:
getUndefinedValue in interface JsEngine


isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface JsEngine


poll

public boolean poll()
            throws RemoteException
Allows the client debugger to poll the connection.
Specified by:
poll in interface JsEngine


run

public void run()
            throws 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.
Specified by:
run in interface JsEngine


setDebugger

public void setDebugger(JsCallbacks debugger)
            throws RemoteException
Set the associated debugger.
Specified by:
setDebugger in interface JsEngine

Parameters:
debugger - the debugger to be used on callbacks from the engine.


stepIn

public void stepIn()
            throws RemoteException
Specified by:
stepIn in interface JsEngine


stepOut

public void stepOut()
            throws RemoteException
Specified by:
stepOut in interface JsEngine


stepOver

public void stepOver()
            throws RemoteException
Specified by:
stepOver in interface JsEngine