openfuture.util.misc
Class Trace

java.lang.Object
  |
  +--openfuture.util.misc.Trace

public abstract class Trace
extends java.lang.Object

The Trace class provides static methods that can be used in Java Applets and Applications to output trace messages to a trace device. Traces can be activated on a per class basis and for each class a combination of any of the following trace levels is possible: 0.ERROR: should be used in case of severe errors 1.WARNING: should be used in case of warnings and uncritical errors 2.IN: should be used as the first statement in a method 3.OUT: should be used before existing a method 4.PARAMETER: should be used to trace out method parameters 5.MESSAGE: should be used to trace out any message within the method body 6.USER-DEFINED: user defined trace level 7.EXCEPTION: should be used when an exception occurs (is not maskable) The trace mechanism is initialized via a config file that contains a bit mask for each class that uses traces, e.g. util.email.MailData: 0 util.email.MailSender: 0 jawa.fzbewertung.AufnahmeGUI: 255 jawa.fzbewertung.CICSData: 3 jawa.fzbewertung.CreateMapApplet: 3 The value corresponds to the combination of trace levels 0. - 6. where each trace level is activated by setting the appropriate bit to 1, e.g. a value of 3 (0000 0011 in binary mode) means that only ERRORS and WARNING are going to be traced for a given class. The config file can either be read via HTTP using the method readTraceConfig or directly from the local file system using the method readTraceConfigFromFile.

Version:
$Revision: 1.3 $
Author:
Stefan Balz

Field Summary
static int TD_ALL
           
static int TD_CONSOLE
           
static int TD_FILE
           
static int TL_LOW
           
static java.lang.String TL_LOW_STRING
           
static int TL_MEDIUM
           
static java.lang.String TL_MEDIUM_STRING
           
static int TL_OFF
           
static java.lang.String TL_OFF_STRING
           
static int TL_VERBOSE
           
static java.lang.String TL_VERBOSE_STRING
           
static int TT_DATE
           
static int TT_OFF
           
static int TT_TIME
           
static int TT_TIME_MS
           
 
Constructor Summary
Trace()
           
 
Method Summary
static void closeOutputFile()
          closes the outputStream in case of TD_FILE & TD_ALL
static void error(java.lang.Object theObject, java.lang.String msg)
          Describe 'error' method here.
static void error(java.lang.Object theObject, java.lang.String msg, int nRID)
          Describe 'error' method here.
static void exception(java.lang.Object theObject, java.lang.String msg)
          Describe 'exception' method here.
static void exception(java.lang.Object theObject, java.lang.String msg, int nRID)
          Describe 'exception' method here.
static java.lang.String getDetailedStatusString()
          is used to retrieve information about the config file that is currently in use.
static java.lang.String getStatusString()
          is used to retrieve information about the config file that is currently in use.
static void in(java.lang.Object theObject, java.lang.String msg)
          Describe 'in' method here.
static void message(java.lang.Object theObject, java.lang.String msg)
          Describe 'message' method here.
static void message(java.lang.Object theObject, java.lang.String msg, int nRID)
          Describe 'message' method here.
static void out(java.lang.Object theObject, java.lang.String msg)
          Describe 'out' method here.
static void param(java.lang.Object theObject, java.lang.String msg)
          Describe 'param' method here.
static java.lang.String printContent()
          is used to retrieve information about the config file that is currently in use.
static int readTraceConfig(java.lang.String urlPrefix, java.lang.String filename)
          tries to read the config file given as a parameter and sets up the internal hashtable.
static int readTraceConfigFromFile(java.lang.String filename)
          tries to read the config file given as a parameter and sets up the internal hashtable.
static void setDateAndTimeMode(int flag)
          determines if date and time (and eventually milliseconds) will be used as a prefix for the trace output.
static void setOutputMode(int flag, java.lang.String filename)
          determines the output mode.
static void setTraceMode(java.lang.Object theObject, int flag)
          sets the trace bit mask for a given class manually.
static void setTraceModeDefault(int flag)
          sets the trace default bit mask.
static void user(java.lang.Object theObject, java.lang.String msg)
          Describe 'user' method here.
static void user(java.lang.Object theObject, java.lang.String msg, int nRID)
          Describe 'user' method here.
static void user(java.lang.Object theObject, java.lang.String prefix, java.lang.String msg)
          Describe 'user' method here.
static void user(java.lang.Object theObject, java.lang.String prefix, java.lang.String msg, int nRID)
          Describe 'user' method here.
static void warning(java.lang.Object theObject, java.lang.String msg)
          Describe 'warning' method here.
static void warning(java.lang.Object theObject, java.lang.String msg, int nRID)
          Describe 'warning' method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TL_OFF

public static final int TL_OFF

TL_LOW

public static final int TL_LOW

TL_MEDIUM

public static final int TL_MEDIUM

TL_VERBOSE

public static final int TL_VERBOSE

TL_OFF_STRING

public static final java.lang.String TL_OFF_STRING

TL_LOW_STRING

public static final java.lang.String TL_LOW_STRING

TL_MEDIUM_STRING

public static final java.lang.String TL_MEDIUM_STRING

TL_VERBOSE_STRING

public static final java.lang.String TL_VERBOSE_STRING

TD_CONSOLE

public static final int TD_CONSOLE

TD_FILE

public static final int TD_FILE

TD_ALL

public static final int TD_ALL

TT_OFF

public static final int TT_OFF

TT_DATE

public static final int TT_DATE

TT_TIME

public static final int TT_TIME

TT_TIME_MS

public static final int TT_TIME_MS
Constructor Detail

Trace

public Trace()
Method Detail

error

public static void error(java.lang.Object theObject,
                         java.lang.String msg)
Describe 'error' method here.
Parameters:
theObject - a value of type 'Object'
msg - a value of type 'String'

error

public static void error(java.lang.Object theObject,
                         java.lang.String msg,
                         int nRID)
Describe 'error' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

exception

public static void exception(java.lang.Object theObject,
                             java.lang.String msg)
Describe 'exception' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

exception

public static void exception(java.lang.Object theObject,
                             java.lang.String msg,
                             int nRID)
Describe 'exception' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

in

public static void in(java.lang.Object theObject,
                      java.lang.String msg)
Describe 'in' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

message

public static void message(java.lang.Object theObject,
                           java.lang.String msg)
Describe 'message' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

message

public static void message(java.lang.Object theObject,
                           java.lang.String msg,
                           int nRID)
Describe 'message' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

out

public static void out(java.lang.Object theObject,
                       java.lang.String msg)
Describe 'out' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

param

public static void param(java.lang.Object theObject,
                         java.lang.String msg)
Describe 'param' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

user

public static void user(java.lang.Object theObject,
                        java.lang.String msg)
Describe 'user' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

user

public static void user(java.lang.Object theObject,
                        java.lang.String msg,
                        int nRID)
Describe 'user' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

user

public static void user(java.lang.Object theObject,
                        java.lang.String prefix,
                        java.lang.String msg)
Describe 'user' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
prefix - a value of type 'String'
msg - the trace output message

user

public static void user(java.lang.Object theObject,
                        java.lang.String prefix,
                        java.lang.String msg,
                        int nRID)
Describe 'user' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
prefix - a value of type 'String'
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

warning

public static void warning(java.lang.Object theObject,
                           java.lang.String msg)
Describe 'warning' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message

warning

public static void warning(java.lang.Object theObject,
                           java.lang.String msg,
                           int nRID)
Describe 'warning' method here.
Parameters:
theObject - object reference (this pointer) to the calling object
msg - the trace output message
nRID - a request ID used for identifying multiple instances of the same class

printContent

public static java.lang.String printContent()
is used to retrieve information about the config file that is currently in use. The method returns a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.
Returns:
a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.

readTraceConfig

public static int readTraceConfig(java.lang.String urlPrefix,
                                  java.lang.String filename)
tries to read the config file given as a parameter and sets up the internal hashtable.
Parameters:
urlPrefix - URL path pointing to the directory where the config file is stored.
filename - name the config file
Returns:
returns 0 upon success and -1 when something went wrong (Yep, I know I could have done this which some exceptions...)

readTraceConfigFromFile

public static int readTraceConfigFromFile(java.lang.String filename)
tries to read the config file given as a parameter and sets up the internal hashtable.
Parameters:
filename - complete path that points to the config file
Returns:
returns 0 upon success and -1 when something went wrong (Yep, I know I could have done this which some exceptions...)

getDetailedStatusString

public static java.lang.String getDetailedStatusString()
is used to retrieve information about the config file that is currently in use. The method returns a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.
Returns:
a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.

getStatusString

public static java.lang.String getStatusString()
is used to retrieve information about the config file that is currently in use. The method returns a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.
Returns:
a string containing the registred class names and the corresponding bit mask value in a somehow 'preformatted' way.

setDateAndTimeMode

public static void setDateAndTimeMode(int flag)
determines if date and time (and eventually milliseconds) will be used as a prefix for the trace output.
Parameters:
flag - a bitwise combination of TT_DATE, TT_TIME, TT_TIME_MS

setOutputMode

public static void setOutputMode(int flag,
                                 java.lang.String filename)
determines the output mode. It can either be a file or the console or both.
Parameters:
flag - the output mode flag. This is either TD_FILE, TD_CONSOLE or TD_ALL
filename - the name of the output file (if TD_FILE or TD_ALL is chosen)

closeOutputFile

public static void closeOutputFile()
closes the outputStream in case of TD_FILE & TD_ALL

setTraceMode

public static void setTraceMode(java.lang.Object theObject,
                                int flag)
sets the trace bit mask for a given class manually.
Parameters:
theObject - the object instance (upon which the class will be determined)
flag - the trace bit flag

setTraceModeDefault

public static void setTraceModeDefault(int flag)
sets the trace default bit mask. This bit mask is used if the trace mechanism encounters a class that has not yet been registered.
Parameters:
flag - the default trace bit flag


Copyright © 2000 -- 2003 openfuture.de. All Rights Reserved.