uk.ac.ic.doc.automed.util
Class Debugger

java.lang.Object
  extended by uk.ac.ic.doc.automed.util.Debugger

public class Debugger
extends java.lang.Object


Field Summary
static int DEBUG_CACHE
          Debug section: cache
static int DEBUG_DIRECTORY
          Debug section: directory service
static int DEBUG_DIRECTORY_REPOSITORY
           
static int DEBUG_DIRECTORY_TIMER
           
static int DEBUG_GENERAL
           
static int DEBUG_GUI
          Debug information from the gui package
static int DEBUG_HELLO
          Debug Hello protocol
static int DEBUG_LEVEL_ALL
          All debug information
static int DEBUG_LEVEL_DEFAULT
          No debug but report run-time errors
static int DEBUG_LEVEL_DETAILED
          Detailed debug information
static int DEBUG_LEVEL_ERROR
          Error information
static int DEBUG_LEVEL_INFO
          Debug information to let user know what is going on
static int DEBUG_LEVEL_NONE
          No debug at all
static int DEBUG_LEVEL_PACKET
          Packet-level debug information
static int DEBUG_LEVEL_STD
          Standard debug information
static int DEBUG_LEVEL_WARN
          Warning information
static int DEBUG_P2P
          Debug information from the p2p package
static int DEBUG_P2P_MESSAGING
           
static int DEBUG_P2P_OVERLAY
           
static int DEBUG_PATHWAY
          Debug information about pathway manipulations in the reps package
static int DEBUG_QUERY
          Debug section: query processing
static int DEBUG_QUERY_REWRITE
           
static int DEBUG_REGISTRY
          Debug section: registry
static int DEBUG_REPOSITORY
          Debug the repository
static int DEBUG_SCHEMA
          Debug the exchange of schema information
static int DEBUG_WRAPPER
          Debug information from the wrappers package
static int LEVEL_ALL
          All debug information
static int LEVEL_ERROR
          Error information
static int LEVEL_FINE
          Application operations with some details
static int LEVEL_FINER
          Application operations with greater details
static int LEVEL_FINEST
          Application operations with finest details
static int LEVEL_INFO
          Debug information to let user know what is going on
static int LEVEL_OFF
          No debug at all
static int LEVEL_WARN
          Warning information
 
Constructor Summary
Debugger()
          Creates a new instance of Debugger
 
Method Summary
static boolean atDebugLevel(int level)
          Return true if the debug level set by setDebugLevel(int) is at least at a certain level.
static boolean atSectionDebugLevel(int section, int level)
          Tests whether the section of code has been set to at least the debug level specified.
static void debugPrintStackTrace(java.lang.Throwable throwable, int level)
          Print an throwable's stack trace, but only at a certain debug level
static int getDebugLevel()
          Return the value of the debug level at set by setDebugLevel(int)
static int getSectionDebugLevel(int section)
          Gets the debug level which the section of code has been set to.
static void setDebugLevel(int level)
          Control the printing of debug information printed on the command line
static void setSectionDebugLevel(int section, int level)
          Set the level of debug info output to the console for a numbered section of code.
static void setSectionDebugLevel(java.lang.String[] cmdArgs)
          From command-line arguments, find debug flag and set debug settings accordingly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_GENERAL

public static final int DEBUG_GENERAL
See Also:
Constant Field Values

DEBUG_GUI

public static final int DEBUG_GUI
Debug information from the gui package

See Also:
Constant Field Values

DEBUG_PATHWAY

public static final int DEBUG_PATHWAY
Debug information about pathway manipulations in the reps package

See Also:
Constant Field Values

DEBUG_P2P

public static final int DEBUG_P2P
Debug information from the p2p package

See Also:
Constant Field Values

DEBUG_P2P_OVERLAY

public static final int DEBUG_P2P_OVERLAY
See Also:
Constant Field Values

DEBUG_P2P_MESSAGING

public static final int DEBUG_P2P_MESSAGING
See Also:
Constant Field Values

DEBUG_WRAPPER

public static final int DEBUG_WRAPPER
Debug information from the wrappers package

See Also:
Constant Field Values

DEBUG_HELLO

public static final int DEBUG_HELLO
Debug Hello protocol

See Also:
Constant Field Values

DEBUG_REPOSITORY

public static final int DEBUG_REPOSITORY
Debug the repository

See Also:
Constant Field Values

DEBUG_SCHEMA

public static final int DEBUG_SCHEMA
Debug the exchange of schema information

See Also:
Constant Field Values

DEBUG_CACHE

public static final int DEBUG_CACHE
Debug section: cache

See Also:
Constant Field Values

DEBUG_QUERY

public static final int DEBUG_QUERY
Debug section: query processing

See Also:
Constant Field Values

DEBUG_QUERY_REWRITE

public static final int DEBUG_QUERY_REWRITE
See Also:
Constant Field Values

DEBUG_REGISTRY

public static final int DEBUG_REGISTRY
Debug section: registry

See Also:
Constant Field Values

DEBUG_DIRECTORY

public static final int DEBUG_DIRECTORY
Debug section: directory service

See Also:
Constant Field Values

DEBUG_DIRECTORY_TIMER

public static final int DEBUG_DIRECTORY_TIMER
See Also:
Constant Field Values

DEBUG_DIRECTORY_REPOSITORY

public static final int DEBUG_DIRECTORY_REPOSITORY
See Also:
Constant Field Values

DEBUG_LEVEL_NONE

public static final int DEBUG_LEVEL_NONE
No debug at all

See Also:
Constant Field Values

DEBUG_LEVEL_DEFAULT

public static final int DEBUG_LEVEL_DEFAULT
No debug but report run-time errors

See Also:
Constant Field Values

DEBUG_LEVEL_INFO

public static final int DEBUG_LEVEL_INFO
Debug information to let user know what is going on

See Also:
Constant Field Values

DEBUG_LEVEL_WARN

public static final int DEBUG_LEVEL_WARN
Warning information

See Also:
Constant Field Values

DEBUG_LEVEL_STD

public static final int DEBUG_LEVEL_STD
Standard debug information

See Also:
Constant Field Values

DEBUG_LEVEL_ERROR

public static final int DEBUG_LEVEL_ERROR
Error information

See Also:
Constant Field Values

DEBUG_LEVEL_DETAILED

public static final int DEBUG_LEVEL_DETAILED
Detailed debug information

See Also:
Constant Field Values

DEBUG_LEVEL_PACKET

public static final int DEBUG_LEVEL_PACKET
Packet-level debug information

See Also:
Constant Field Values

DEBUG_LEVEL_ALL

public static final int DEBUG_LEVEL_ALL
All debug information

See Also:
Constant Field Values

LEVEL_OFF

public static final int LEVEL_OFF
No debug at all

See Also:
Constant Field Values

LEVEL_INFO

public static final int LEVEL_INFO
Debug information to let user know what is going on

See Also:
Constant Field Values

LEVEL_WARN

public static final int LEVEL_WARN
Warning information

See Also:
Constant Field Values

LEVEL_ERROR

public static final int LEVEL_ERROR
Error information

See Also:
Constant Field Values

LEVEL_FINE

public static final int LEVEL_FINE
Application operations with some details

See Also:
Constant Field Values

LEVEL_FINER

public static final int LEVEL_FINER
Application operations with greater details

See Also:
Constant Field Values

LEVEL_FINEST

public static final int LEVEL_FINEST
Application operations with finest details

See Also:
Constant Field Values

LEVEL_ALL

public static final int LEVEL_ALL
All debug information

See Also:
Constant Field Values
Constructor Detail

Debugger

public Debugger()
Creates a new instance of Debugger

Method Detail

setDebugLevel

public static void setDebugLevel(int level)
Control the printing of debug information printed on the command line

Parameters:
level - value to set the debug level at, according to the following scale: -1: no debug information, and no reporting of errors the system finds in its execution if the system can ignore them 0: no debug information (default), but report on errors that the system has ignored during its execution 1: only debug information that is to explain to users what is going on 5: standard information for software development work on repository 8: detailed information for software development work on repository 10: all debug information

getDebugLevel

public static int getDebugLevel()
Return the value of the debug level at set by setDebugLevel(int)


atDebugLevel

public static boolean atDebugLevel(int level)
Return true if the debug level set by setDebugLevel(int) is at least at a certain level. For example, this is used in code of the form if (atDebugLevel(5)) ... to ensure that something is only executed when the system has been set at debug level 5 or more

Parameters:
level - threshold value of debug level for which being "at a debug level" is true

setSectionDebugLevel

public static void setSectionDebugLevel(int section,
                                        int level)
Set the level of debug info output to the console for a numbered section of code.

Parameters:
section - The section of code to set the level for. Setting the debug level for section 0 sets the global debug level
level - The debug level for the section of code

setSectionDebugLevel

public static void setSectionDebugLevel(java.lang.String[] cmdArgs)
                                 throws AutoMedException
From command-line arguments, find debug flag and set debug settings accordingly

Parameters:
cmdArgs - the array of command line arguments
Throws:
AutoMedException

getSectionDebugLevel

public static int getSectionDebugLevel(int section)
Gets the debug level which the section of code has been set to.

Parameters:
section - The section of code for which the debug level is wanted. Getting section 0 returns the global debug level
Returns:
The debug level set for the numbered section or the global debug level if none is set for the specified section.

atSectionDebugLevel

public static boolean atSectionDebugLevel(int section,
                                          int level)
Tests whether the section of code has been set to at least the debug level specified.

Parameters:
section - The section of code to check the debug level for
level - The debug level for which is returned true if the section has been set to a least this value
Returns:
True if the general level of debug is at least at the specified level, or the numbered section of code has been set to at least the debug level specified.

debugPrintStackTrace

public static final void debugPrintStackTrace(java.lang.Throwable throwable,
                                              int level)
Print an throwable's stack trace, but only at a certain debug level

Parameters:
throwable - that is to be reported on
debugLevel - that STR must be at in order for throwable to be reported on deprecated Moved to Debugger classes