org.apache.bsf.util
Class BSFDebugManagerImpl

java.lang.Object
  |
  +--org.apache.bsf.debug.util.Skeleton
        |
        +--org.apache.bsf.util.BSFDebugManagerImpl
All Implemented Interfaces:
BSFDebugManager, java.rmi.Remote, RemoteServiceListener

public class BSFDebugManagerImpl
extends Skeleton
implements BSFDebugManager, RemoteServiceListener


Constructor Summary
BSFDebugManagerImpl()
           
 
Method Summary
 void finalize()
           
 java.lang.String getLangFromFilename(java.lang.String fileName)
          Determine the language of a script file by looking at the file extension.
 boolean isLanguageRegistered(java.lang.String lang)
          Determine whether a language is registered.
 DocumentCell loadDocumentNotify(BSFEngine eng, java.lang.String name)
           
 void placeBreakpointAtLine(int brkptid, java.lang.String docname, int lineno)
          Breakpoints are placed within documents either at a specific line or offset.
 void placeBreakpointAtOffset(int brkptid, java.lang.String docname, int offset)
           
 void registerDebugger(java.lang.String lang, BSFDebugger debugger)
          Register a debugger for a scripting engine.
 void registerEngine(BSFManager mger, BSFEngine eng, java.lang.String lang)
           
 void registerManager(BSFManager mger)
           
 void removeAllBreakpoints()
           
 void removeBreakpoint(java.lang.String docname, int brkptid)
          Allows to remove a breakpoint.
 void revokedNotify(RemoteService service)
          Callback from the socket/stub layer.
 void setEntryExit(java.lang.String docname, boolean on)
          Allows setting entry/exit mode
 boolean supportBreakpointAtLine(java.lang.String lang)
           
 boolean supportBreakpointAtOffset(java.lang.String lang)
          Allows a debugger to ask if the engine for a given language will support either line or offset breakpoints.
 void terminate()
           
 void terminateEngineNotify(BSFManager mger, BSFEngine eng, java.lang.String lang)
           
 void terminateManagerNotify(BSFManager mger)
           
 void unregisterDebugger(java.lang.String lang)
           
 
Methods inherited from class org.apache.bsf.debug.util.Skeleton
addListener, allocOid, completeFuture, createFuture, equals, getTid, getUid, hasNoUid, removeListener, suspendFuture
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSFDebugManagerImpl

public BSFDebugManagerImpl()
                    throws java.rmi.RemoteException
Method Detail

revokedNotify

public void revokedNotify(RemoteService service)
Callback from the socket/stub layer. A stub for a remote debugger is being revoked due to a lost connection. Since we support only one debuggers from only one JVM, there is only one connection and therefore we can drop all debuggers... and then drop all breakpoints. ATTENTION: Breakpoints shall not be dropped if we extend this implementation to multiple debuggers through multiple socket connections.

Specified by:
revokedNotify in interface RemoteServiceListener

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

getLangFromFilename

public java.lang.String getLangFromFilename(java.lang.String fileName)
                                     throws java.rmi.RemoteException
Determine the language of a script file by looking at the file extension.

Specified by:
getLangFromFilename in interface BSFDebugManager
Returns:
the scripting language the file is in if the file extension is known to me (must have been registered via registerScriptingEngine).
Throws:
java.rmi.RemoteException - if file's extension is unknown.

isLanguageRegistered

public boolean isLanguageRegistered(java.lang.String lang)
Determine whether a language is registered.

Specified by:
isLanguageRegistered in interface BSFDebugManager
Parameters:
lang - string identifying a language
Returns:
true iff it is

supportBreakpointAtOffset

public boolean supportBreakpointAtOffset(java.lang.String lang)
                                  throws java.rmi.RemoteException
Allows a debugger to ask if the engine for a given language will support either line or offset breakpoints. Note: this will most likely provoke the loading of the engine.

Specified by:
supportBreakpointAtOffset in interface BSFDebugManager
java.rmi.RemoteException

supportBreakpointAtLine

public boolean supportBreakpointAtLine(java.lang.String lang)
                                throws java.rmi.RemoteException
Specified by:
supportBreakpointAtLine in interface BSFDebugManager
java.rmi.RemoteException

placeBreakpointAtLine

public void placeBreakpointAtLine(int brkptid,
                                  java.lang.String docname,
                                  int lineno)
                           throws java.rmi.RemoteException
Description copied from interface: BSFDebugManager
Breakpoints are placed within documents either at a specific line or offset. While breakpoints can be set at lines and offsets in the same document, there is no conversions between lines and offsets. Some engines may support only offsets or only lines and therefore some breakpoints may be ignored. Placing a breakpoint is local to a debugger connection. In other words, breakpoints set by other debuggers are not visible to a given debugger. Breakpoints are given identifiers so to make easier for debuggers to manipulate breakpoints. Identifiers are allocated by the debugger; they must be unique for the entire session between that debugger and the debug manager.

Specified by:
placeBreakpointAtLine in interface BSFDebugManager
java.rmi.RemoteException

placeBreakpointAtOffset

public void placeBreakpointAtOffset(int brkptid,
                                    java.lang.String docname,
                                    int offset)
                             throws java.rmi.RemoteException
Specified by:
placeBreakpointAtOffset in interface BSFDebugManager
java.rmi.RemoteException

removeBreakpoint

public void removeBreakpoint(java.lang.String docname,
                             int brkptid)
                      throws java.rmi.RemoteException
Description copied from interface: BSFDebugManager
Allows to remove a breakpoint.

Specified by:
removeBreakpoint in interface BSFDebugManager
java.rmi.RemoteException

setEntryExit

public void setEntryExit(java.lang.String docname,
                         boolean on)
                  throws java.rmi.RemoteException
Description copied from interface: BSFDebugManager
Allows setting entry/exit mode

Specified by:
setEntryExit in interface BSFDebugManager
java.rmi.RemoteException

removeAllBreakpoints

public void removeAllBreakpoints()

registerDebugger

public void registerDebugger(java.lang.String lang,
                             BSFDebugger debugger)
                      throws java.rmi.RemoteException
Register a debugger for a scripting engine.

Specified by:
registerDebugger in interface BSFDebugManager
Parameters:
lang - string identifying language
Throws:
java.rmi.RemoteException - if the language is unknown (i.e., if it has not been registered) with a reason of REASON_UNKNOWN_LANGUAGE. If the language is known but if the interface can't be created for some reason, then the reason is set to REASON_OTHER_ERROR and the actual exception is passed on as well.

loadDocumentNotify

public DocumentCell loadDocumentNotify(BSFEngine eng,
                                       java.lang.String name)

registerEngine

public void registerEngine(BSFManager mger,
                           BSFEngine eng,
                           java.lang.String lang)

registerManager

public void registerManager(BSFManager mger)

terminateManagerNotify

public void terminateManagerNotify(BSFManager mger)

terminate

public void terminate()

unregisterDebugger

public void unregisterDebugger(java.lang.String lang)
                        throws java.rmi.RemoteException
Specified by:
unregisterDebugger in interface BSFDebugManager
java.rmi.RemoteException

terminateEngineNotify

public void terminateEngineNotify(BSFManager mger,
                                  BSFEngine eng,
                                  java.lang.String lang)