com.cisco.services.tracing.implementation
Class TraceWriterManagerImpl

java.lang.Object
  extended by com.cisco.services.tracing.implementation.TraceWriterManagerImpl
All Implemented Interfaces:
TraceWriter, TraceWriterManager

public class TraceWriterManagerImpl
extends java.lang.Object
implements TraceWriterManager

TraceWriterManager contains the list of TraceWriter objects that are used to implement the tracing. The list is populated at startup from the switches in a .ini file. A LogFileTraceWriter, a ConsoleTraceWriter, and a SyslogTraceWriter are available. Users can override the existing TraceWriters by setting a user implemented TraceWriter[] or adding to the existing TraceWriters. This makes it possible to add other traceWriters that can function along with exisiting trace writers.


Constructor Summary
TraceWriterManagerImpl()
          creates a TraceWriterManagerImpl with a zero length TraceWriter array
 
Method Summary
 void addTraceWriter(TraceWriter tw)
          Add this TraceWriter to the array of trace writers
 void close()
          Releases any resources associated by this TraceWriter.
 void flush()
          Forces output of any messages that have been printed using the println method
 java.lang.String getDescription()
           
 boolean getEnabled()
          returns true if any one of the underlying TraceWriter is enabled, else returns false
 java.lang.String getName()
           
 int[] getTraceLevels()
          The TraceWriterManager returns a null, as the traceLevel is maintained at the individual TraceWriter
 TraceWriter[] getTraceWriters()
          Return the array of TraceWriters currently in use
 void println(java.lang.String message, int severity)
          All traces invoke this method.
 void removeTraceWriter(TraceWriter tw)
          Remove the Tracewriter from the array of trace writers
 void setTraceLevels(int[] levels)
          The TraceWriterManager does nothing for this method
 void setTraceWriters(TraceWriter[] traceWriters)
          Override the existing TraceWriters with a new user supplied set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceWriterManagerImpl

public TraceWriterManagerImpl()
creates a TraceWriterManagerImpl with a zero length TraceWriter array

Method Detail

setTraceWriters

public void setTraceWriters(TraceWriter[] traceWriters)
Override the existing TraceWriters with a new user supplied set

Specified by:
setTraceWriters in interface TraceWriterManager
Parameters:
traceWriters - An array of TraceWriters.

getTraceWriters

public TraceWriter[] getTraceWriters()
Return the array of TraceWriters currently in use

Specified by:
getTraceWriters in interface TraceWriterManager
Returns:
the array of TraceWriters in the manager

addTraceWriter

public void addTraceWriter(TraceWriter tw)
Add this TraceWriter to the array of trace writers

Specified by:
addTraceWriter in interface TraceWriterManager
Parameters:
tw - TraceWriter to be added to the list

removeTraceWriter

public void removeTraceWriter(TraceWriter tw)
Remove the Tracewriter from the array of trace writers

Specified by:
removeTraceWriter in interface TraceWriterManager

println

public void println(java.lang.String message,
                    int severity)
All traces invoke this method. A trace supplies its severity along with the message. Traces below the threshold severity of the TraceWriter are allowed. Eg. If the Threshhold severity is set to INFORMATIONAL (level = 6) DEBUG traces will not be passed by the TraceWriter. The severity level is set in the constructor of the TraceWriter

Specified by:
println in interface TraceWriter
Parameters:
message - The string to print
severity - The severity of the trace.
See Also:
Trace

flush

public void flush()
Description copied from interface: TraceWriter
Forces output of any messages that have been printed using the println method

Specified by:
flush in interface TraceWriter

close

public void close()
Description copied from interface: TraceWriter
Releases any resources associated by this TraceWriter.

Specified by:
close in interface TraceWriter

getEnabled

public boolean getEnabled()
returns true if any one of the underlying TraceWriter is enabled, else returns false

Specified by:
getEnabled in interface TraceWriter
Returns:
true if this TraceWriter is enabled, false if not

getName

public java.lang.String getName()
Specified by:
getName in interface TraceWriter
Returns:
the name of this TraceWriter

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface TraceWriter
Returns:
a short description of this TraceWriter

setTraceLevels

public void setTraceLevels(int[] levels)
The TraceWriterManager does nothing for this method

Specified by:
setTraceLevels in interface TraceWriter
Parameters:
levels - Array of trace levels
See Also:
Trace

getTraceLevels

public int[] getTraceLevels()
The TraceWriterManager returns a null, as the traceLevel is maintained at the individual TraceWriter

Specified by:
getTraceLevels in interface TraceWriter
Returns:
null