org.esupportail.cas.server.util.log
Class Debug

java.lang.Object
  extended by org.esupportail.cas.server.util.log.Debug
Direct Known Subclasses:
BasicHandler, Server

public abstract class Debug
extends java.lang.Object

This class implements a basic object owning debugging features.

Author:
Pascal Aubry

Field Summary
private  boolean debug
          A debugging flag.
 
Constructor Summary
protected Debug(boolean d)
          Constructor.
 
Method Summary
protected  java.lang.Class checkClass(java.lang.String classname)
          Check that a class is present
static boolean elementDebugValue(org.dom4j.Element element, boolean defaultValue)
          A convenient method to get debugging mode with a default value.
 boolean isDebug()
          Tell if the handler is in debugging mode or not.
 void setDebug(boolean d)
          Set deubgging mode.
protected  void trace(java.lang.Object obj)
          Debugging.
protected  void trace(java.lang.String str)
          Debugging.
protected  void traceBegin()
          Debugging (at the beginning of the execution of a method).
protected  void traceEnd()
          Debugging (at the end of the execution of a method).
protected  void traceEnd(java.lang.Object obj)
          Debugging (at the end of the execution of a method).
protected  void traceEnd(java.lang.String str)
          Debugging (at the end of the execution of a method).
protected  void traceThrow(java.lang.Exception e)
          Debugging (throwing an exception).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

private boolean debug
A debugging flag.

Constructor Detail

Debug

protected Debug(boolean d)
Constructor.

Parameters:
d - true to set debugging mode, false otherwise.
Method Detail

checkClass

protected final java.lang.Class checkClass(java.lang.String classname)
                                    throws java.lang.Exception
Check that a class is present

Parameters:
classname - the name of the class
Returns:
the corresponding class
Throws:
java.lang.Exception - Exception

elementDebugValue

public static boolean elementDebugValue(org.dom4j.Element element,
                                        boolean defaultValue)
A convenient method to get debugging mode with a default value.

Parameters:
element - an XML element having a debug attribute ("on", "off" or "default")
defaultValue - the value to return when str equals to "default"
Returns:
a boolean.

isDebug

public final boolean isDebug()
Tell if the handler is in debugging mode or not.

Returns:
true when the handler is in debugging mode, false otherwise.

setDebug

public final void setDebug(boolean d)
Set deubgging mode.

Parameters:
d - a boolean

trace

protected final void trace(java.lang.Object obj)
Debugging.

Parameters:
obj - an object

trace

protected final void trace(java.lang.String str)
Debugging.

Parameters:
str - a string

traceBegin

protected final void traceBegin()
Debugging (at the beginning of the execution of a method).


traceEnd

protected final void traceEnd()
Debugging (at the end of the execution of a method).


traceEnd

protected final void traceEnd(java.lang.Object obj)
Debugging (at the end of the execution of a method).

Parameters:
obj - an object

traceEnd

protected final void traceEnd(java.lang.String str)
Debugging (at the end of the execution of a method).

Parameters:
str - a string

traceThrow

protected final void traceThrow(java.lang.Exception e)
                         throws java.lang.Exception
Debugging (throwing an exception).

Parameters:
e - the exception to throw
Throws:
java.lang.Exception - Exception