com.ibm.di.util
Class DebugServer

java.lang.Object
  extended by com.ibm.di.util.DebugServer
All Implemented Interfaces:
ScriptEngineOptions.TDIDebugListener

public class DebugServer
extends Object
implements ScriptEngineOptions.TDIDebugListener


Field Summary
static String ABORTED
           
static String BREAK
           
static String BREAKAT
           
static String BREAKPOINT
           
static String BREAKPOINTS
           
static String CONFIG
           
static String CONT
           
static String CONTEXT
           
static String CONTROL
           
static int DEBUG_PORT
           
static String ENGINE_VARS
           
static String EVAL
           
static String FLAGS
           
static String HELLO
           
static String INIT
           
static String INIT_BREAK
           
static String LOGMSG
           
static String QUIT
           
static String SCRIPT
           
static String STATS
           
static String STATUS
           
static String STEP
           
static String STEP_OVER
           
static String STOP
           
static String UNIQUE_ID
           
 
Constructor Summary
DebugServer(String taskname)
           
 
Method Summary
 void aborted(Throwable t)
           
 void addScriptObject(String key, Object value)
           
 void clearScriptObjects()
           
 Attribute convertAttribute(Attribute a)
          Converts the values in the attribute to a serializable representation if needed.
 Entry convertEntry(Entry entry)
          Checks if entry is of type Entry and traverses all attributes and values to see if any of them are not serializable.
 Object convertObject(Object value)
          Converts an object to a serializable representation if needed.
 void debugBreak(Object obj)
           
 void debugBreak(Object obj, boolean onerror)
           
 void debugBreak(Object obj, boolean onerror, int linenumber)
           
 void debugBreak(Object obj, boolean onerror, int linenumber, int scriptRef)
           
 void debugClose()
           
 void debugClose(Object msg)
           
 boolean debugConnect()
           
 boolean debugConnect(int port)
           
 boolean debugConnect(String host, int tcpport)
           
 boolean debugConnect(String host, int tcpport, boolean onerror)
           
 void debugInit()
           
 void debugMsg(Object msg)
           
 void debugStatement(com.ibm.jscript.ASTTree.ASTNode statement, com.ibm.jscript.engine.IExecutionContext context)
          This method is called from ASTDebug for each node in the script.
 Hashtable<String,Breakpoint> getBreakpoints()
          This method returns a table of Breakpoints.
 Object getConnectorList(boolean includestats)
           
 DebugMessage getDebuggerFlags()
           
 List<String> getHookNames(AssemblyLineComponent tc, Object[] hooks)
           
 String getLastKnownLocation()
          Returns the last known location.
 Hashtable<String,Object> getScriptEngineVariables(String filter)
          Returns a table with the script engine variables.
 String getUniqueID()
           
 boolean isAborted()
          Returns true if an ABORT message has been sent to the remote CE
 boolean isConnected()
           
 boolean isOnerror()
           
 void logmsg(Object str)
           
 void safeWriteObject(Object obj)
          This method write an object or an exception to the debugger.
 void setLog(Log log)
           
 void setOnerror(boolean onerror)
          Sets the onerror flag.
 void setScriptEngine(ScriptEngine se)
           
 void setTask(Object task)
           
 void setUniqueID(String id)
           
 void switchTo(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_PORT

public static final int DEBUG_PORT
See Also:
Constant Field Values

CONTROL

public static final String CONTROL
See Also:
Constant Field Values

STOP

public static final String STOP
See Also:
Constant Field Values

CONT

public static final String CONT
See Also:
Constant Field Values

BREAK

public static final String BREAK
See Also:
Constant Field Values

LOGMSG

public static final String LOGMSG
See Also:
Constant Field Values

HELLO

public static final String HELLO
See Also:
Constant Field Values

EVAL

public static final String EVAL
See Also:
Constant Field Values

STATS

public static final String STATS
See Also:
Constant Field Values

QUIT

public static final String QUIT
See Also:
Constant Field Values

INIT

public static final String INIT
See Also:
Constant Field Values

FLAGS

public static final String FLAGS
See Also:
Constant Field Values

BREAKPOINTS

public static final String BREAKPOINTS
See Also:
Constant Field Values

BREAKPOINT

public static final String BREAKPOINT
See Also:
Constant Field Values

ENGINE_VARS

public static final String ENGINE_VARS
See Also:
Constant Field Values

STATUS

public static final String STATUS
See Also:
Constant Field Values

ABORTED

public static final String ABORTED
See Also:
Constant Field Values

STEP_OVER

public static final String STEP_OVER
See Also:
Constant Field Values

STEP

public static final String STEP
See Also:
Constant Field Values

BREAKAT

public static final String BREAKAT
See Also:
Constant Field Values

CONFIG

public static final String CONFIG
See Also:
Constant Field Values

UNIQUE_ID

public static final String UNIQUE_ID
See Also:
Constant Field Values

INIT_BREAK

public static final String INIT_BREAK
See Also:
Constant Field Values

SCRIPT

public static final String SCRIPT
See Also:
Constant Field Values

CONTEXT

public static final String CONTEXT
See Also:
Constant Field Values
Constructor Detail

DebugServer

public DebugServer(String taskname)
Method Detail

setLog

public void setLog(Log log)

setScriptEngine

public void setScriptEngine(ScriptEngine se)

setTask

public void setTask(Object task)

addScriptObject

public void addScriptObject(String key,
                            Object value)

clearScriptObjects

public void clearScriptObjects()

debugInit

public void debugInit()
               throws Exception
Throws:
Exception

switchTo

public void switchTo(String name)
              throws Exception
Throws:
Exception

debugConnect

public boolean debugConnect()

debugConnect

public boolean debugConnect(int port)

debugConnect

public boolean debugConnect(String host,
                            int tcpport)

debugConnect

public boolean debugConnect(String host,
                            int tcpport,
                            boolean onerror)

debugClose

public void debugClose()

isConnected

public boolean isConnected()

debugMsg

public void debugMsg(Object msg)
              throws Exception
Throws:
Exception

debugClose

public void debugClose(Object msg)

aborted

public void aborted(Throwable t)
             throws Exception
Throws:
Exception

debugBreak

public void debugBreak(Object obj)
                throws Exception
Throws:
Exception

debugBreak

public void debugBreak(Object obj,
                       boolean onerror)
                throws Exception
Throws:
Exception

debugBreak

public void debugBreak(Object obj,
                       boolean onerror,
                       int linenumber)
                throws Exception
Throws:
Exception

debugBreak

public void debugBreak(Object obj,
                       boolean onerror,
                       int linenumber,
                       int scriptRef)
                throws Exception
Throws:
Exception

getDebuggerFlags

public DebugMessage getDebuggerFlags()

getBreakpoints

public Hashtable<String,Breakpoint> getBreakpoints()
                                            throws Exception
This method returns a table of Breakpoints. There is one Breakpoint object for each component and its hooks in this table.

Returns:
Returns a Hashtable with a Breakpoint object for each possible breakpoint in the AL
Throws:
Exception

getScriptEngineVariables

public Hashtable<String,Object> getScriptEngineVariables(String filter)
Returns a table with the script engine variables. The variables that are not Serializable are returned as NotSerializable Objects instead of the actual object.

Parameters:
filter - regex to filter specific variables. Not used.
Returns:
Returns a Hashtable of script engine variables

convertEntry

public Entry convertEntry(Entry entry)
Checks if entry is of type Entry and traverses all attributes and values to see if any of them are not serializable. Non serializable values are converted to its string representation in the new returned entry.

Parameters:
entry - The Entry object to convert
Returns:
The converted Entry

convertAttribute

public Attribute convertAttribute(Attribute a)
Converts the values in the attribute to a serializable representation if needed.

Parameters:
a - The attribute to convert
Returns:
A new Attribute with serializable values

convertObject

public Object convertObject(Object value)
Converts an object to a serializable representation if needed.

Parameters:
value - Object to convert.
Returns:
A serializable representation of the object.

getHookNames

public List<String> getHookNames(AssemblyLineComponent tc,
                                 Object[] hooks)

getConnectorList

public Object getConnectorList(boolean includestats)
                        throws Exception
Throws:
Exception

logmsg

public void logmsg(Object str)

safeWriteObject

public void safeWriteObject(Object obj)
                     throws Exception
This method write an object or an exception to the debugger.

Throws:
Exception

isOnerror

public boolean isOnerror()
Returns:
the onerror flag

setOnerror

public void setOnerror(boolean onerror)
Sets the onerror flag. When true breakpoints are disabled except when there is an error.

Parameters:
onerror -

getLastKnownLocation

public String getLastKnownLocation()
Returns the last known location. This is the last call to debugBreak with a valid breakpoint name (e.g. conn.after_getnext etc).

Returns:
Last known location

isAborted

public boolean isAborted()
Returns true if an ABORT message has been sent to the remote CE

Returns:
Returns true if an ABORT message has been sent to the remote CE. Otherwise, false is returned.

debugStatement

public void debugStatement(com.ibm.jscript.ASTTree.ASTNode statement,
                           com.ibm.jscript.engine.IExecutionContext context)
                    throws com.ibm.jscript.JavaScriptException
This method is called from ASTDebug for each node in the script.

Specified by:
debugStatement in interface ScriptEngineOptions.TDIDebugListener
Throws:
com.ibm.jscript.JavaScriptException

getUniqueID

public String getUniqueID()

setUniqueID

public void setUniqueID(String id)