com.novell.nds.dirxml.driver.xds.util
Class DriverTrace

java.lang.Object
  extended bycom.novell.nds.dirxml.driver.xds.util.DriverTrace

public class DriverTrace
extends Object

A DSTrace wrapper that allows buffering of trace messages before outputting them. NOTE: indenting is per object (i.e., per thread if one instance per thread)


Field Summary
static int LEVEL_NONE
          Don't trace
 
Constructor Summary
DriverTrace()
          Creates a new instance.
DriverTrace(com.novell.nds.dirxml.driver.Trace someTrace)
          Creates a new DriverTrace object.
 
Method Summary
 DriverTrace buffer(boolean b)
          Buffers a boolean to be traced.
 DriverTrace buffer(double d)
          Buffers a double to be traced.
 DriverTrace buffer(int i)
          Buffers an int to be traced.
 DriverTrace buffer(long l)
          Buffers a long to be traced.
 DriverTrace buffer(Object object)
          Buffers an Object to be traced.
 DriverTrace buffer(String string)
          Buffers a String to be traced.
 void clear()
          Clears the internal buffer.
 String flush()
          Flushes the buffer.
 StringBuffer getBuffer()
          Returns the internal buffer.
 com.novell.nds.dirxml.driver.Trace getImpl()
          Returns the trace implementation.
 void indent()
          Increments the number of indentations by 1.
 void indent(int noOfTabs)
          Sets the number of indentations to the passed value.
 void outdent()
          Decrements the number of indentations by 1.
 void resetIndent()
          Sets the number of indentations to 0.
 void setBufferLevel(int someLevel)
          Sets the trace level for the internal trace buffer.
 void sleepInterval(long interval, int level)
          Traces a sleep interval.
 void trace(String aMessage)
          Traces a message.
 void trace(String aMessage, int aLevel)
          Traces a message at the specified trace level.
 void trace(Throwable t, int aLevel)
          Traces a Throwable.
 void trace(com.novell.nds.dirxml.driver.XmlDocument xml, int level)
          Traces a XmlDocument.
 boolean willTrace(int level)
          Will messages at the specififed level be traced?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEVEL_NONE

public static final int LEVEL_NONE
Don't trace

See Also:
Constant Field Values
Constructor Detail

DriverTrace

public DriverTrace()
Creates a new instance. Use this constructor to create a trace object to run code inside or outside of an IDM engine environment.


DriverTrace

public DriverTrace(com.novell.nds.dirxml.driver.Trace someTrace)
Creates a new DriverTrace object. Use this constructor to create a trace object to run inside an IDM engine environment.

Parameters:
someTrace - the trace implementation; must not be null
Method Detail

getImpl

public com.novell.nds.dirxml.driver.Trace getImpl()
Returns the trace implementation.

Returns:
may return null

resetIndent

public void resetIndent()
Sets the number of indentations to 0.


indent

public void indent(int noOfTabs)
Sets the number of indentations to the passed value.

Parameters:
noOfTabs - the number of indentations

indent

public void indent()
Increments the number of indentations by 1.


outdent

public void outdent()
Decrements the number of indentations by 1.


willTrace

public boolean willTrace(int level)
Will messages at the specififed level be traced?

Parameters:
level - the level in question
Returns:
true if it will; false otherwise

trace

public void trace(String aMessage,
                  int aLevel)
Traces a message at the specified trace level.

Parameters:
aMessage - the message to trace
aLevel - the trace level

trace

public void trace(String aMessage)
Traces a message.

Parameters:
aMessage - the message to trace

trace

public void trace(Throwable t,
                  int aLevel)
Traces a Throwable.

Parameters:
t - the Throwable;
aLevel - the trace level

trace

public void trace(com.novell.nds.dirxml.driver.XmlDocument xml,
                  int level)
Traces a XmlDocument.

Parameters:
xml - the XmlDocument
level - the trace level

sleepInterval

public void sleepInterval(long interval,
                          int level)
Traces a sleep interval.

Parameters:
interval - the interval
level - the trace level

setBufferLevel

public void setBufferLevel(int someLevel)
Sets the trace level for the internal trace buffer.

Parameters:
someLevel - the trace level

buffer

public DriverTrace buffer(String string)
Buffers a String to be traced.

Parameters:
string - the String to buffer
Returns:
this object

buffer

public DriverTrace buffer(Object object)
Buffers an Object to be traced.

Parameters:
object - the Object to buffer
Returns:
this object

buffer

public DriverTrace buffer(double d)
Buffers a double to be traced.

Parameters:
d - the double to buffer
Returns:
this object

buffer

public DriverTrace buffer(long l)
Buffers a long to be traced.

Parameters:
l - the long to buffer
Returns:
this object

buffer

public DriverTrace buffer(int i)
Buffers an int to be traced.

Parameters:
i - the int to buffer
Returns:
this object

buffer

public DriverTrace buffer(boolean b)
Buffers a boolean to be traced.

Parameters:
b - the boolean to buffer
Returns:
this object

flush

public String flush()
Flushes the buffer. All contents are traced and the buffer is cleared.

Returns:
the String that was traced

getBuffer

public StringBuffer getBuffer()
Returns the internal buffer.

Returns:
the internal buffer

clear

public void clear()
Clears the internal buffer.