Class DefaultScriptDebugger
- java.lang.Object
-
- ca.cgjennings.apps.arkham.plugins.debugging.DefaultScriptDebugger
-
public final class DefaultScriptDebugger extends java.lang.Object
The default debugger for scripts. This is a client-server implementation for which this is the server. The matching client application is implemented in theClient
class. When debugging is enabled, the server will accept network connections that use its debugging protocol and respond to the commands enumerated byCommand
.Protocol Summary: Each command is sent as a sequence of UTF-8 text lines. The first line must be the magic value SEDP3. The next line is the command name, as given by
Command.name()
. This is followed by zero or more lines, where each line represents one argument. The server will reply with either SEDP3 OK and the reply to the command (if any), or else SEDP3 ERR and an error message.- Since:
- 3.0
- Author:
- Chris Jennings
- See Also:
ScriptDebugging
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getDescription()
java.lang.String
getHost()
int
getPort()
protected static java.lang.String
getSimpleScriptURL(java.lang.String name)
static void
install()
Installs the script debugger if it is not already installed.static boolean
isClientConnected()
Returnstrue
if a client is connected to the debugger.static boolean
isInstalled()
Returnstrue
if the debugger has been installed.static void
preloadTopLevelScript(java.lang.String location, java.lang.String source)
If the debugger is running, the script identified by this resource is loaded and added to the debugger.static void
uninstall()
Uninstall the debugger.
-
-
-
Method Detail
-
getDescription
public static java.lang.String getDescription()
-
install
public static void install()
Installs the script debugger if it is not already installed. Once this returns, the debug server will be available to debug scripts. The debugger will be started automatically at application startup if user preferences direct this; however, it can also be started at any time in an already-running instance of the application.
-
uninstall
public static void uninstall()
Uninstall the debugger. The debugger is not intended to be started and restarted in a single session; this method is meant to be called at application shutdown. There is normally no need to call this directly as it will be called as part of normal application shutdown.
-
isInstalled
public static boolean isInstalled()
Returnstrue
if the debugger has been installed.- Returns:
true
if debugging is available
-
isClientConnected
public static boolean isClientConnected()
Returnstrue
if a client is connected to the debugger. Since the client does not maintain a continuous connection, this method cannot be guaranteed to be accurate. It works by tracking the last time that a client connected to the server, and returningtrue
if the last connection was in the near past.- Returns:
true
if a client application is probably available
-
preloadTopLevelScript
public static void preloadTopLevelScript(java.lang.String location, java.lang.String source)
If the debugger is running, the script identified by this resource is loaded and added to the debugger. This allows breakpoints to be set on the script even if it has not yet been run. If the debugger is not installed, this method does nothing.- Parameters:
location
- the resource that contains the scriptsource
- the text to use for the identified resource
-
getHost
public java.lang.String getHost()
-
getPort
public int getPort()
-
getSimpleScriptURL
protected static java.lang.String getSimpleScriptURL(java.lang.String name)
-
-