Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.gopas.rt.util
Class Message  view Message download Message.java

java.lang.Object
  extended bycom.gopas.rt.util.Message
All Implemented Interfaces:
RT
Direct Known Subclasses:
Msg

public class Message
extends java.lang.Object
implements RT

Message write several types of error messages and other messages some of them can be switched on/off and can throw Exceptions. Message is a Singleton. You can either use the static methods or a single Instance theMessage this version requires JDK1.2 Usage: you create and register(add) one or more instances of a Trace subclass. These instances do the real output, some of them to a Stream and otheres pop up messages. Each Trace object can be given separate thresholds for error messages (the interface RT contains some useful constants).


Nested Class Summary
 class Message.Threshold
          Convenience predicate class.
 
Field Summary
private static java.util.Set debugSet
           
private static Trace defaultTrace
          default trace to stdout
static boolean doDebugAll
           
private static java.util.Set msgSet
          set of messages already sent.
private static Functor repHostFunctor
          the functor used to represent message hosts
private static java.util.Set traceSet
          active trace set
 
Fields inherited from interface com.gopas.rt.util.RT
ACTIVATED_STATUS, ALL, CREATED_STATUS, DEBUG, DEBUG_MSG, DEBUG_ON, DEFAULT_DEBUG_LEVEL, DEFAULT_ERROR_LEVEL, DEFAULT_VERBOSE_LEVEL, DEFAULT_WARNING_LEVEL, DELETED_STATUS, EASY_ERR, ERROR_MSG, FORCE, GENERAL, MODIFIED_STATUS, nl, NORMAL_ERR, NOTE, NOTE1, NOTE2, NOTE3, NOTE4, NOTE5, OFF, PROGRESS, SEVERE_ERR, VERBOSE_MSG, WARNING, WARNING_MSG
 
Constructor Summary
protected Message()
          no instances of this class
 
Method Summary
static Trace add(Trace tr)
          Add/register trace to active trace set.
static DialogTrace addDialogTrace(java.awt.Component baseComp, Predicate pred)
          Create and register a trace which opens a dialog window.
static void addLogTrace(java.io.PrintWriter theWriter, Predicate pred)
          Create and register a trace which writes to a Writer object.
static DialogTrace createDialogTrace(java.awt.Component baseComp, Predicate pred)
          Create a trace which opens a dialog window.
static LogTrace createLogTrace(java.io.PrintWriter theWriter, Predicate pred)
          Create a trace which writes to a Writer object.
static void debug(java.lang.Object host, java.lang.String msg)
           
static void debug(java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add debug log entry.
static void debug(Predicate pred, java.lang.Object host, java.lang.String msg)
           
static void debug(Predicate pred, java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add debug log entry.
static void error(java.lang.Object host, java.lang.Exception ex, java.lang.String msg)
          Add error log entry.
static void error(java.lang.Object host, java.lang.String msg)
          Add error log entry.
static void error(java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add error log entry.
static void errorNoRepeat(java.lang.Object host, java.lang.Exception ex, java.lang.String msg)
          Add error log entry.
static void errorNoRepeat(java.lang.Object host, java.lang.String msg)
          Add error log entry.
static void errorNoRepeat(java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add error log entry.
static Functor getRepHostFunctor()
          Get the value of repHostFunctor.
private static void out(LogEntry entry)
          Send log entry to all traces in the active trace set.
static void remove(Trace tr)
          Remove trace from the active trace set.
static void setRepHostFunctor(Functor v)
          Set the value of repHostFunctor.
static boolean shouldDebug(java.lang.Class aClass)
           
static void shouldDebug(java.lang.Class aClass, boolean flag)
           
static void verbose(java.lang.Object host, java.lang.String msg)
           
static void verbose(java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add verbose log entry.
static void warning(java.lang.Object host, java.lang.String msg)
           
static void warning(java.lang.Object host, java.lang.String msg, java.lang.Object[] msgParm, int level, java.lang.Exception ex)
          Add warning log entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugSet

private static java.util.Set debugSet

repHostFunctor

private static Functor repHostFunctor
the functor used to represent message hosts


traceSet

private static final java.util.Set traceSet
active trace set


msgSet

private static final java.util.Set msgSet
set of messages already sent.


defaultTrace

private static final Trace defaultTrace
default trace to stdout


doDebugAll

public static boolean doDebugAll
Constructor Detail

Message

protected Message()
no instances of this class

Method Detail

createLogTrace

public static LogTrace createLogTrace(java.io.PrintWriter theWriter,
                                      Predicate pred)
Create a trace which writes to a Writer object.


addLogTrace

public static void addLogTrace(java.io.PrintWriter theWriter,
                               Predicate pred)
Create and register a trace which writes to a Writer object.


createDialogTrace

public static DialogTrace createDialogTrace(java.awt.Component baseComp,
                                            Predicate pred)
Create a trace which opens a dialog window.


addDialogTrace

public static DialogTrace addDialogTrace(java.awt.Component baseComp,
                                         Predicate pred)
Create and register a trace which opens a dialog window.


add

public static Trace add(Trace tr)
Add/register trace to active trace set.


remove

public static void remove(Trace tr)
Remove trace from the active trace set.


error

public static void error(java.lang.Object host,
                         java.lang.String msg)
Add error log entry.


errorNoRepeat

public static void errorNoRepeat(java.lang.Object host,
                                 java.lang.String msg)
Add error log entry.


error

public static void error(java.lang.Object host,
                         java.lang.Exception ex,
                         java.lang.String msg)
Add error log entry.


errorNoRepeat

public static void errorNoRepeat(java.lang.Object host,
                                 java.lang.Exception ex,
                                 java.lang.String msg)
Add error log entry.


error

public static void error(java.lang.Object host,
                         java.lang.String msg,
                         java.lang.Object[] msgParm,
                         int level,
                         java.lang.Exception ex)
Add error log entry.


errorNoRepeat

public static void errorNoRepeat(java.lang.Object host,
                                 java.lang.String msg,
                                 java.lang.Object[] msgParm,
                                 int level,
                                 java.lang.Exception ex)
Add error log entry.


warning

public static void warning(java.lang.Object host,
                           java.lang.String msg)

warning

public static void warning(java.lang.Object host,
                           java.lang.String msg,
                           java.lang.Object[] msgParm,
                           int level,
                           java.lang.Exception ex)
Add warning log entry.


debug

public static void debug(Predicate pred,
                         java.lang.Object host,
                         java.lang.String msg)

debug

public static void debug(java.lang.Object host,
                         java.lang.String msg)

debug

public static void debug(Predicate pred,
                         java.lang.Object host,
                         java.lang.String msg,
                         java.lang.Object[] msgParm,
                         int level,
                         java.lang.Exception ex)
Add debug log entry.


debug

public static void debug(java.lang.Object host,
                         java.lang.String msg,
                         java.lang.Object[] msgParm,
                         int level,
                         java.lang.Exception ex)
Add debug log entry.


verbose

public static void verbose(java.lang.Object host,
                           java.lang.String msg)

verbose

public static void verbose(java.lang.Object host,
                           java.lang.String msg,
                           java.lang.Object[] msgParm,
                           int level,
                           java.lang.Exception ex)
Add verbose log entry.


out

private static void out(LogEntry entry)
Send log entry to all traces in the active trace set. If the trace set is empty send log entry to stdout.


shouldDebug

public static boolean shouldDebug(java.lang.Class aClass)

shouldDebug

public static void shouldDebug(java.lang.Class aClass,
                               boolean flag)

getRepHostFunctor

public static Functor getRepHostFunctor()
Get the value of repHostFunctor.


setRepHostFunctor

public static void setRepHostFunctor(Functor v)
Set the value of repHostFunctor.