wt.util
Class DebugProperties

java.lang.Object
  extended bywt.util.DebugProperties
All Implemented Interfaces:
Serializable

public class DebugProperties
extends Object
implements Serializable

This utility class provides access to all the properties that are used to configure information capture to aid in debugging. It gets initialized from the debug.properties file.

Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
private static class DebugProperties.ElementSetFlag
           
private static class DebugProperties.GroupMember
           
private static class DebugProperties.TargetDefinition
           
 
Field Summary
private static String CLASSNAME
           
private static String DEBUG_KEY
           
private static DebugWriter defaultWriter
           
private static Vector elementSets
           
private static String FLAG_DELIMITER
           
private static Hashtable flagSets
           
private static String GROUP_KEY
           
private static Hashtable groups
           
private static String LOAD_DELIMITER
           
private static String LOG_KEY
           
private static String RESOURCE
           
private static int SYSTEM_DEBUG
           
private static boolean VERBOSE
           
private static Hashtable writer
           
private static WTProperties wtProperties
           
 
Constructor Summary
DebugProperties()
           
 
Method Summary
private static DebugWriter createWriter(String name, String file_name, boolean append, boolean tee, int iterations, String date_format, boolean add_thread, boolean verbose)
           
private static int getConstantValue(String constant_name)
           
static boolean getFlag(int flag, Object target)
          Determines if a particular flag is set, for a particular object.
static boolean getFlag(int flag, Object target, String qualifier)
          Determines if a particular flag is set, for a particular object, qualified by the qualifier.
private static Vector getGroupMembership(String target)
           
private static Properties getProperties()
           
static DebugWriter getWriter(String classname)
          Gets the object for the association that plays role: writer.
private static BitSet initializeFlagSet(String target)
           
static boolean isData(Object target)
          Determines if the DATA flag is set, for a particular object.
static boolean isData(Object target, String qualifier)
          Determines if the DATA flag is set, for a particular object, qualified by the qualifier.
private static boolean isDebug(String classname)
           
private static boolean isDebugKey(String key)
           
static boolean isDebugOn(String target)
          Flag that specifies if any debug capture can take place for a specific target.
private static boolean isDescendent(String descendent, String ancestor)
           
private static boolean isEmpty(String string)
           
static boolean isException(Object target)
          Determines if the EXCEPTION flag is set, for a particular object.
static boolean isException(Object target, String qualifier)
          Determines if the EXCEPTION flag is set, for a particular object, qualified by the qualifier.
private static boolean isGroupKey(String key)
           
private static boolean isGroupMember(String classname, String group_name, boolean recurse)
           
private static boolean isLogKey(String key)
           
private static boolean isMember(String classname, DebugProperties.TargetDefinition target_def, boolean recurse)
           
private static boolean isPackageMember(String classname, String packageName, boolean recurse)
           
private static boolean isPrimaryLogKey(String key)
           
static boolean isReport(Object target)
          Determines if the REPORT flag is set, for a particular object.
static boolean isReport(Object target, String qualifier)
          Determines if the REPORT flag is set, for a particular object, qualified by the qualifier.
static boolean isStackTrace(Object target)
          Determines if the STACK_TRACE flag is set, for a particular object.
static boolean isStackTrace(Object target, String qualifier)
          Determines if the STACK_TRACE flag is set, for a particular object, qualified by the qualifier.
static boolean isTrace(Object target)
          Determines if the TRACE flag is set, for a particular object.
static boolean isTrace(Object target, String qualifier)
          Determines if the TRACE flag is set, for a particular object, qualified by the qualifier.
private static void loadFlags(Properties properties)
           
private static void loadGroups(Properties properties)
           
private static void loadWriters(Properties properties)
           
private static BitSet makeFlagSet(int flag, boolean value)
           
private static void processGroup(int flag, String target, String qualifier, boolean value)
           
private static void processMembers(DebugProperties.ElementSetFlag elementSetFlag)
           
private static void setAllFlags(String target, DebugType target_type, String qualifier, boolean value)
           
private static void setFlag(BitSet flagSet, int flag, boolean value)
           
static void setFlag(int flag, String target, DebugType target_type, String qualifier, boolean value)
          Sets the flag, for a particular target, which may be qualified by the qualifier.
private static void storeGroup(String group_name, String group_list)
           
private static BitSet updateFlag(int flag, String target, boolean value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

writer

private static Hashtable writer

wtProperties

private static WTProperties wtProperties

defaultWriter

private static DebugWriter defaultWriter

flagSets

private static Hashtable flagSets

groups

private static Hashtable groups

elementSets

private static Vector elementSets

SYSTEM_DEBUG

private static final int SYSTEM_DEBUG

FLAG_DELIMITER

private static final String FLAG_DELIMITER
See Also:
Constant Field Values

LOAD_DELIMITER

private static final String LOAD_DELIMITER
See Also:
Constant Field Values

DEBUG_KEY

private static final String DEBUG_KEY
See Also:
Constant Field Values

GROUP_KEY

private static final String GROUP_KEY
See Also:
Constant Field Values

LOG_KEY

private static final String LOG_KEY
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE
Constructor Detail

DebugProperties

public DebugProperties()
Method Detail

getWriter

public static DebugWriter getWriter(String classname)
Gets the object for the association that plays role: writer.

Supported API: false

Parameters:
classname -
Returns:
DebugWriter

isDebugOn

public static boolean isDebugOn(String target)
Flag that specifies if any debug capture can take place for a specific target.

Supported API: true

Parameters:
target -
Returns:
boolean

isData

public static boolean isData(Object target)
Determines if the DATA flag is set, for a particular object.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object)

isData

public static boolean isData(Object target,
                             String qualifier)
Determines if the DATA flag is set, for a particular object, qualified by the qualifier.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object,String)

isException

public static boolean isException(Object target)
Determines if the EXCEPTION flag is set, for a particular object.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object)

isException

public static boolean isException(Object target,
                                  String qualifier)
Determines if the EXCEPTION flag is set, for a particular object, qualified by the qualifier.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object,String)

isReport

public static boolean isReport(Object target)
Determines if the REPORT flag is set, for a particular object.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object)

isReport

public static boolean isReport(Object target,
                               String qualifier)
Determines if the REPORT flag is set, for a particular object, qualified by the qualifier.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object,String)

isStackTrace

public static boolean isStackTrace(Object target)
Determines if the STACK_TRACE flag is set, for a particular object.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object)

isStackTrace

public static boolean isStackTrace(Object target,
                                   String qualifier)
Determines if the STACK_TRACE flag is set, for a particular object, qualified by the qualifier.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object,String)

isTrace

public static boolean isTrace(Object target)
Determines if the TRACE flag is set, for a particular object.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object)

isTrace

public static boolean isTrace(Object target,
                              String qualifier)
Determines if the TRACE flag is set, for a particular object, qualified by the qualifier.

Supported API: true

Parameters:
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
getFlag(int,Object,String)

getFlag

public static boolean getFlag(int flag,
                              Object target)
Determines if a particular flag is set, for a particular object.
 Determination is made based on the following algorithm for finding
 a flag configuration that best matches the target:
 

1) classname/target.toString()/current thread 2) classname/target.toString() 3) classname/current thread 4) classname



Supported API: true

Parameters:
flag - the flag to be checked
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
Returns:
true, if the flag is set, otherwise false.
See Also:
DebugFlag

getFlag

public static boolean getFlag(int flag,
                              Object target,
                              String qualifier)
Determines if a particular flag is set, for a particular object, qualified by the qualifier.
 Determination is made based on the following algorithm for finding
 a flag configuration that best matches the target:
 

1) classname/target.toString()/current thread 2) classname/target.toString() 3) classname/qualifier 4) classname/current thread 5) classname



Supported API: true

Parameters:
flag - the flag to be checked
target - an object that is the target of the flag; the object can be an instance of a Class, or a Class, so that it can be used from instance methods or static methods
qualifier - a string that provides an open end qualification for the target
Returns:
true, if the flag is set, otherwise false.
See Also:
DebugFlag

setFlag

public static void setFlag(int flag,
                           String target,
                           DebugType target_type,
                           String qualifier,
                           boolean value)
Sets the flag, for a particular target, which may be qualified by the qualifier.

Supported API: true

Parameters:
flag - the flag to be checked
target - a String that is the key for a target. If target is a Class, it is the classname. If target is an instance of a Class, it is the classname +"/"+ instance.toString(). If target is a package, it is the package name. If target is a defined group, it is the name of the group.
target_type - one of the predefined DebugTypes
qualifier - a string that provides an open end qualification for the target
value - true, if the flag is to be be set; false if the flag is to be cleared
See Also:
DebugFlag

storeGroup

private static void storeGroup(String group_name,
                               String group_list)

processGroup

private static void processGroup(int flag,
                                 String target,
                                 String qualifier,
                                 boolean value)

getGroupMembership

private static Vector getGroupMembership(String target)

processMembers

private static void processMembers(DebugProperties.ElementSetFlag elementSetFlag)

initializeFlagSet

private static BitSet initializeFlagSet(String target)

isGroupMember

private static boolean isGroupMember(String classname,
                                     String group_name,
                                     boolean recurse)

isMember

private static boolean isMember(String classname,
                                DebugProperties.TargetDefinition target_def,
                                boolean recurse)

isPackageMember

private static boolean isPackageMember(String classname,
                                       String packageName,
                                       boolean recurse)

isDescendent

private static boolean isDescendent(String descendent,
                                    String ancestor)

updateFlag

private static BitSet updateFlag(int flag,
                                 String target,
                                 boolean value)

makeFlagSet

private static BitSet makeFlagSet(int flag,
                                  boolean value)

setFlag

private static void setFlag(BitSet flagSet,
                            int flag,
                            boolean value)

isEmpty

private static boolean isEmpty(String string)

getProperties

private static Properties getProperties()
                                 throws WTException
Throws:
WTException

loadGroups

private static void loadGroups(Properties properties)
                        throws WTException
Throws:
WTException

isGroupKey

private static boolean isGroupKey(String key)

loadWriters

private static void loadWriters(Properties properties)
                         throws WTException
Throws:
WTException

isLogKey

private static boolean isLogKey(String key)

isPrimaryLogKey

private static boolean isPrimaryLogKey(String key)

isDebugKey

private static boolean isDebugKey(String key)

loadFlags

private static void loadFlags(Properties properties)
                       throws WTException
Throws:
WTException

getConstantValue

private static int getConstantValue(String constant_name)
                             throws WTException
Throws:
WTException

createWriter

private static DebugWriter createWriter(String name,
                                        String file_name,
                                        boolean append,
                                        boolean tee,
                                        int iterations,
                                        String date_format,
                                        boolean add_thread,
                                        boolean verbose)

setAllFlags

private static void setAllFlags(String target,
                                DebugType target_type,
                                String qualifier,
                                boolean value)

isDebug

private static boolean isDebug(String classname)