ca.idms.io
Class AbstractTraceOutput

java.lang.Object
  extended by ca.idms.io.AbstractTraceOutput
All Implemented Interfaces:
TraceOutput
Direct Known Subclasses:
TraceStream, TraceWriter

public abstract class AbstractTraceOutput
extends java.lang.Object
implements TraceOutput

This class provides common behavior for classes that implement the TraceOutput interface used for trace and logging infomation. Derived classes need only provide a constructor to encapsulate a PrintStream or PrintWriter and implement the TraceOutput.println(String) method. Each line in the resulting trace can optionally be identified with a prefix containing a product identifier, timestamp, and thread id.

Since:
CA IDMS Server 5.0
Version:
1.00, 09/26/02
Author:
Dave Ross

Field Summary
protected  boolean identify
          Indicates whether an identifying prefix should be prepended to each line.
protected  java.lang.StringBuffer line
          Holds print line with an identifying prefix.
protected static java.lang.String product
          Product prefix to start each identifier.
 
Constructor Summary
AbstractTraceOutput()
           
 
Method Summary
protected  java.lang.String format(java.lang.String s)
          Formats a trace message with an identifying prefix.
 void println(java.lang.Object o)
          Writes an object to the trace stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.idms.io.TraceOutput
println
 

Field Detail

product

protected static java.lang.String product
Product prefix to start each identifier.

See Also:
TraceObject.TRACE_PRODUCT

identify

protected boolean identify
Indicates whether an identifying prefix should be prepended to each line. Constructors for derived classes should set this appropriately.


line

protected java.lang.StringBuffer line
Holds print line with an identifying prefix.

See Also:
format(String)
Constructor Detail

AbstractTraceOutput

public AbstractTraceOutput()
Method Detail

println

public void println(java.lang.Object o)
Description copied from interface: TraceOutput
Writes an object to the trace stream.

Specified by:
println in interface TraceOutput
Parameters:
o - Object to write.

format

protected java.lang.String format(java.lang.String s)
Formats a trace message with an identifying prefix. The {link TraceOutput#println(String)} method in the derived class should use this method to format the print line before writing it to the output stream or writer. When identify is true this method will use a StringBuffer to prepend the trace string with the product identifier, the current timestamp, and the current thread id. Otherwise it just returns the input string.

Parameters:
s - message to print
Returns:
the prefixed, or original, trace message.


Copyright © 2009 CA, All rights reserved