All LDAP Classes
Internal LDAP Classes

com.novell.ldap.client
Class Debug

java.lang.Object
  extended by com.novell.ldap.client.Debug

public abstract class Debug
extends java.lang.Object

The Debug class contains several useful debugging class (static) methods. It cannot be instantiated. Some methods give useful information, such as amount of memory used, enabling instruction tracing, displaying object hierarchy, and dumping the contents of a raw byte buffer.

Another type of debug supports two kinds of methods; those that inform whether a debug option is set or not; and those that output the specified string to the debugOut stream when the associated debug value is set.

The Debug class checks in the object returned by System.getProperties for the name ldap.debug which has the following valid values:

If multiple values are desired, they are separated by semicolon's, i.e.

The values are case insensitive. Invalid values are ignored.

The ldap_debug variable allows debug code to be excluded from a compile by codeing something like the following:

Version:
$OpenLDAP: pkg/jldap/com/novell/ldap/client/Debug.template,v 1.22 2004/04/15 04:49:37 sunilk Exp $
Author:
Steven F. Sonntag

Field Summary
static java.lang.String all
          The string value used to enable all debug tracing.
static java.lang.String apiRequests
          The string value used to enable debug tracing of API Requests
static java.lang.String asn1
          The string value used to enable debug tracing of ASN1 encode/decode
static java.lang.String bindSemaphore
          The string value used to enable debug tracing of the bind semaphore
static java.lang.String buffer
          The string value used to enable debug display of buffer dumps.
static java.lang.String connections
          The string value used to enable debug tracing of LDAP Connections.
static java.lang.String controls
          The string value used to enable debug tracing of Controls
private static java.io.PrintStream debugOut
           
static java.lang.String decoding
          The string value used to enable debug tracing of Ber Decoding.
private static boolean dumpBuffer
           
private static boolean dumpObject
           
private static boolean dumpObjectConstructors
           
private static boolean dumpObjectFields
           
private static boolean dumpObjectHierarchy
           
private static boolean dumpObjectMethods
           
static java.lang.String encoding
          The string value used to enable debug tracing of BER Encoding.
static java.lang.String EventsCalls
          The string value used to enable display of Events Calls.
(package private) static java.text.SimpleDateFormat formatter
           
static boolean LDAP_DEBUG
          The value for this variable is set during compile time TRUE = Debug build, FALSE = Release build
static java.lang.String messages
          The string value used to enable debug tracing of message processing
static java.lang.String objectConstructors
          The string value used to enable debug display of object constructor dumps.
static java.lang.String objectFields
          The string value used to enable debug display of object field dumps.
static java.lang.String objectHierarchy
          The string value used to enable debug display of object hierarchy dumps.
static java.lang.String objectMethods
          The string value used to enable debug display of object methods dumps.
static java.lang.String objects
          The string value used to enable debug display of object dumps.
private static java.util.Properties objprop
           
static java.lang.String rawInput
          The string value used to enable debug tracing of raw input.
static java.lang.String rawOutput
          The string value used to enable debug tracing of Raw Output.
static java.lang.String referrals
          The string value used to enable debug tracing of referral processing.
private static java.lang.Runtime run
           
static java.lang.String saslBind
          The string value used to enable debug tracing of Sasl Bind processing.
static java.lang.String TLS
          The string value used to enable display of TLS calls and info for startTLS and stopTLS.
private static boolean traceAPIRequests
           
private static boolean traceASN1
           
private static boolean traceBindSemaphore
           
private static boolean traceConnections
           
private static boolean traceControls
           
private static boolean traceDecoding
           
private static boolean traceEncoding
           
private static boolean traceevents
           
static java.lang.String traceInstructions
          The string value used to enable VM instruction trace.
private static boolean traceMessages
           
static java.lang.String traceMethodCalls
          The string value used to enable display VM method calls.
private static boolean traceRawInput
           
private static boolean traceRawOutput
           
private static boolean traceReferrals
           
private static boolean traceSaslBind
           
private static boolean traceTLS
           
private static boolean traceUrlParse
           
static java.lang.String urlParse
          The string value used to enable debug tracing of URL parsing.
private static boolean VMtraceInstructions
           
private static boolean VMtraceMethodCalls
           
 
Constructor Summary
private Debug()
           
 
Method Summary
static boolean dumpBuffer()
          Returns true if dumpBuffer is enabled
static void dumpBuffer(java.lang.String msg, byte[] inBuffer, int fileOffset, int length)
          Dumps a the specified portion of the byte array, as hexidecmal bytes and also intrepreted as ASCII.
private static void dumpClasses(java.lang.Class obj, int level)
           
private static void dumpInterfaces(java.lang.Class obj, int level)
           
private static void dumpLine(byte[] inBuffer, int offset, int length, int addrOffset)
           
static boolean dumpObject()
          Returns true if dumpObect is enabled
static void dumpObject(java.lang.Object obj)
          Displays information about an object.
static boolean dumpObjectConstructors()
          Returns true if dumpObectConstructors is enabled
static boolean dumpObjectFields()
          Returns true if dumpObjectFields is enabled
static boolean dumpObjectHierarchy()
          Returns true if dumpObjectHierarchy is enabled
static boolean dumpObjectMethods()
          Returns true if dumpObectMethods is enabled
static long freeMemory()
          Returns the free memory available in the virtual machine
static void setDumpBuffer(boolean val)
          Turns on or off debug dumpBuffer
static void setDumpObject(boolean val)
          Turns on or off debug dumpObject
static void setDumpObjectConstructors(boolean val)
          Turns on or off debug dumpObjectConstructors
static void setDumpObjectFields(boolean val)
          Turns on or off debug dumpObjectFields
static void setDumpObjectHierarchy(boolean val)
          Turns on or off debug dumpObjectHierarchy
static void setDumpObjectMethods(boolean val)
          Turns on or off debug dumpObjectMethods
static void setTrace(java.lang.String type, boolean val)
          Turns on or off debug printing
static void setTraceStream(java.io.PrintStream stream)
          Sets the output PrintStream used for debug output
private static boolean toggle(boolean b)
           
static long totalMemory()
          Returns the total memory available in the virtual machine
static boolean trace(java.lang.String type)
          Returns true if trace is enabled
static void trace(java.lang.String type, java.lang.String str)
          Displays the specified String str parameter to the print stream if trace is enabled.
static boolean VMtraceInstructions()
          Returns true if VMtraceInstructions is enabled
static void VMtraceInstructions(boolean onOff)
          Displays trace of each instruction executed in the virtual machine
static boolean VMtraceMethodCalls()
          Returns true if VMtraceMethodCalls is enabled
static void VMtraceMethodCalls(boolean onOff)
          Displays trace of each methods called
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formatter

static java.text.SimpleDateFormat formatter

LDAP_DEBUG

public static final boolean LDAP_DEBUG
The value for this variable is set during compile time TRUE = Debug build, FALSE = Release build

See Also:
Constant Field Values

all

public static final java.lang.String all
The string value used to enable all debug tracing.

See Also:
Constant Field Values

rawInput

public static final java.lang.String rawInput
The string value used to enable debug tracing of raw input.

See Also:
Constant Field Values

rawOutput

public static final java.lang.String rawOutput
The string value used to enable debug tracing of Raw Output.

See Also:
Constant Field Values

referrals

public static final java.lang.String referrals
The string value used to enable debug tracing of referral processing.

See Also:
Constant Field Values

messages

public static final java.lang.String messages
The string value used to enable debug tracing of message processing

See Also:
Constant Field Values

apiRequests

public static final java.lang.String apiRequests
The string value used to enable debug tracing of API Requests

See Also:
Constant Field Values

bindSemaphore

public static final java.lang.String bindSemaphore
The string value used to enable debug tracing of the bind semaphore

See Also:
Constant Field Values

controls

public static final java.lang.String controls
The string value used to enable debug tracing of Controls

See Also:
Constant Field Values

asn1

public static final java.lang.String asn1
The string value used to enable debug tracing of ASN1 encode/decode

See Also:
Constant Field Values

encoding

public static final java.lang.String encoding
The string value used to enable debug tracing of BER Encoding.

See Also:
Constant Field Values

decoding

public static final java.lang.String decoding
The string value used to enable debug tracing of Ber Decoding.

See Also:
Constant Field Values

connections

public static final java.lang.String connections
The string value used to enable debug tracing of LDAP Connections.

See Also:
Constant Field Values

saslBind

public static final java.lang.String saslBind
The string value used to enable debug tracing of Sasl Bind processing.

See Also:
Constant Field Values

TLS

public static final java.lang.String TLS
The string value used to enable display of TLS calls and info for startTLS and stopTLS.

See Also:
Constant Field Values

urlParse

public static final java.lang.String urlParse
The string value used to enable debug tracing of URL parsing.

See Also:
Constant Field Values

buffer

public static final java.lang.String buffer
The string value used to enable debug display of buffer dumps.

See Also:
Constant Field Values

objects

public static final java.lang.String objects
The string value used to enable debug display of object dumps. Displays hierarchy, constructors, fields, and methods.

See Also:
Constant Field Values

objectHierarchy

public static final java.lang.String objectHierarchy
The string value used to enable debug display of object hierarchy dumps.

See Also:
Constant Field Values

objectConstructors

public static final java.lang.String objectConstructors
The string value used to enable debug display of object constructor dumps.

See Also:
Constant Field Values

objectFields

public static final java.lang.String objectFields
The string value used to enable debug display of object field dumps.

See Also:
Constant Field Values

objectMethods

public static final java.lang.String objectMethods
The string value used to enable debug display of object methods dumps.

See Also:
Constant Field Values

traceInstructions

public static final java.lang.String traceInstructions
The string value used to enable VM instruction trace.

See Also:
Constant Field Values

traceMethodCalls

public static final java.lang.String traceMethodCalls
The string value used to enable display VM method calls.

See Also:
Constant Field Values

EventsCalls

public static final java.lang.String EventsCalls
The string value used to enable display of Events Calls.

See Also:
Constant Field Values

debugOut

private static java.io.PrintStream debugOut

dumpBuffer

private static boolean dumpBuffer

dumpObject

private static boolean dumpObject

dumpObjectHierarchy

private static boolean dumpObjectHierarchy

dumpObjectConstructors

private static boolean dumpObjectConstructors

dumpObjectFields

private static boolean dumpObjectFields

dumpObjectMethods

private static boolean dumpObjectMethods

VMtraceInstructions

private static boolean VMtraceInstructions

VMtraceMethodCalls

private static boolean VMtraceMethodCalls

traceControls

private static boolean traceControls

traceRawInput

private static boolean traceRawInput

traceRawOutput

private static boolean traceRawOutput

traceASN1

private static boolean traceASN1

traceEncoding

private static boolean traceEncoding

traceDecoding

private static boolean traceDecoding

traceReferrals

private static boolean traceReferrals

traceMessages

private static boolean traceMessages

traceBindSemaphore

private static boolean traceBindSemaphore

traceAPIRequests

private static boolean traceAPIRequests

traceUrlParse

private static boolean traceUrlParse

traceConnections

private static boolean traceConnections

traceTLS

private static boolean traceTLS

traceSaslBind

private static boolean traceSaslBind

traceevents

private static boolean traceevents

objprop

private static java.util.Properties objprop

run

private static java.lang.Runtime run
Constructor Detail

Debug

private Debug()
Method Detail

toggle

private static final boolean toggle(boolean b)

trace

public static final boolean trace(java.lang.String type)
Returns true if trace is enabled

Parameters:
type - The String value of the trace type to check.

setTraceStream

public static final void setTraceStream(java.io.PrintStream stream)
Sets the output PrintStream used for debug output

Parameters:
stream - The PrintStream used for debug output

setTrace

public static final void setTrace(java.lang.String type,
                                  boolean val)
Turns on or off debug printing

Parameters:
type - The String value of the trace type to enable or disable.
val - The boolean value to enable or disable trace.

trace

public static final void trace(java.lang.String type,
                               java.lang.String str)
Displays the specified String str parameter to the print stream if trace is enabled.

Parameters:
type - The String value of the trace type to print.
str - A string to display.
See Also:
setTraceStream(PrintStream)

VMtraceInstructions

public static final boolean VMtraceInstructions()
Returns true if VMtraceInstructions is enabled


VMtraceInstructions

public static final void VMtraceInstructions(boolean onOff)
Displays trace of each instruction executed in the virtual machine

Parameters:
onOff - A boolean that when set to true enables instruction tracing and when false disables instruction tracing.

VMtraceMethodCalls

public static final boolean VMtraceMethodCalls()
Returns true if VMtraceMethodCalls is enabled


VMtraceMethodCalls

public static void VMtraceMethodCalls(boolean onOff)
Displays trace of each methods called

Parameters:
onOff - A boolean that when set to true enables method call tracing and when false disables instruction tracing.

totalMemory

public static final long totalMemory()
Returns the total memory available in the virtual machine


freeMemory

public static final long freeMemory()
Returns the free memory available in the virtual machine


dumpObject

public static final boolean dumpObject()
Returns true if dumpObect is enabled


setDumpObject

public static final void setDumpObject(boolean val)
Turns on or off debug dumpObject

Parameters:
val - The boolean value to enable or disable dumpObject.

dumpObjectHierarchy

public static final boolean dumpObjectHierarchy()
Returns true if dumpObjectHierarchy is enabled


setDumpObjectHierarchy

public static final void setDumpObjectHierarchy(boolean val)
Turns on or off debug dumpObjectHierarchy

Parameters:
val - The boolean value to enable or disable dumpObjectHierarchy.

dumpObjectConstructors

public static final boolean dumpObjectConstructors()
Returns true if dumpObectConstructors is enabled


setDumpObjectConstructors

public static final void setDumpObjectConstructors(boolean val)
Turns on or off debug dumpObjectConstructors

Parameters:
val - The boolean value to enable or disable dumpObjectConstructors.

dumpObjectFields

public static final boolean dumpObjectFields()
Returns true if dumpObjectFields is enabled


setDumpObjectFields

public static final void setDumpObjectFields(boolean val)
Turns on or off debug dumpObjectFields

Parameters:
val - The boolean value to enable or disable dumpObjectFields.

dumpObjectMethods

public static final boolean dumpObjectMethods()
Returns true if dumpObectMethods is enabled


setDumpObjectMethods

public static final void setDumpObjectMethods(boolean val)
Turns on or off debug dumpObjectMethods

Parameters:
val - The boolean value to enable or disable dumpObjectMethods.

dumpObject

public static final void dumpObject(java.lang.Object obj)
Displays information about an object. The amount of information displayed is controlled by various environment variables or set methods. These are:
  • dumpObject - Displays all information about an object.
  • dumpObjectHierarchy - Displays object hierarchy
  • dumpObjectConstructors - Displays object constructors
  • dumpObjectFields - Displays object fields
  • dumpObjectMethods - Displays object methods

    Multiple environment values are separated by semicolon's, i.e.

      java -Dldap.debug=serverprogress;echodebug TServer -tree junk

      or

      java -Dldap.debug=TraceAll TServer -tree junk

    Parameters:
    obj - The object to dump

  • dumpInterfaces

    private static final void dumpInterfaces(java.lang.Class obj,
                                             int level)

    dumpClasses

    private static final void dumpClasses(java.lang.Class obj,
                                          int level)

    dumpBuffer

    public static final boolean dumpBuffer()
    Returns true if dumpBuffer is enabled


    setDumpBuffer

    public static final void setDumpBuffer(boolean val)
    Turns on or off debug dumpBuffer

    Parameters:
    val - The boolean value to enable or disable dumpBuffer.

    dumpBuffer

    public static final void dumpBuffer(java.lang.String msg,
                                        byte[] inBuffer,
                                        int fileOffset,
                                        int length)
    Dumps a the specified portion of the byte array, as hexidecmal bytes and also intrepreted as ASCII.

    Parameters:
    msg - The title to display before the buffer dump
    inBuffer - The byte arrary buffer to dump
    fileOffset - The address displayed is offset by this amount
    length - The number of bytes to display

    dumpLine

    private static final void dumpLine(byte[] inBuffer,
                                       int offset,
                                       int length,
                                       int addrOffset)

    All LDAP Classes
    Internal LDAP Classes

    Copyright ? 2002 Novell, Inc. All Rights Reserved.
    Novell, Inc.
    1800 South Novell Place
    Provo, Ut 84606
    Phone: (801) 861-5000