com.gargoylesoftware.base.trace
Class TraceChannel

java.lang.Object
  extended bycom.gargoylesoftware.base.trace.TraceChannel

public class TraceChannel
extends Object

This class represents a "channel" that diagnostic messages can be written to. The channel will contain zero or more TraceWriters which will be responsible for handling the messages.

Version:
$Revision: 1.4 $
Author:
Mike Bowler

Constructor Summary
TraceChannel(String name)
          Create a trace channel with the specified name.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener.
 void addTraceWriter(TraceWriter writer)
          Add a trace writer.
protected  void assertNotNull(String fieldName, Object fieldValue)
          Verify that the specified value is not null.
 String getName()
          Return the name of this trace channel.
 boolean isEnabled()
          Return true if this channel is enabled.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a property change listener.
 void removeTraceWriter(TraceWriter writer)
          Remove a trace writer.
 void setEnabled(boolean isEnabled)
          Set whether or not this channel is enabled.
 String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TraceChannel

public TraceChannel(String name)
Create a trace channel with the specified name.

Parameters:
name - The name of the channel.
Method Detail

getName

public final String getName()
Return the name of this trace channel.

Returns:
the name.

toString

public String toString()
Return a string representation of this object.

Returns:
a string representation of this object.

setEnabled

public void setEnabled(boolean isEnabled)
Set whether or not this channel is enabled. If it is not enabled then any requests sent to this channel will be discarded.

Parameters:
isEnabled - true if this channel should be enabled.

isEnabled

public boolean isEnabled()
Return true if this channel is enabled.

Returns:
true if this channel is enabled.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener.

Parameters:
listener - The new listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener.

Parameters:
listener - The listener to remove

addTraceWriter

public void addTraceWriter(TraceWriter writer)
Add a trace writer.

Parameters:
writer - A trace writer

removeTraceWriter

public void removeTraceWriter(TraceWriter writer)
Remove a trace writer.

Parameters:
writer - A trace writer

assertNotNull

protected final void assertNotNull(String fieldName,
                                   Object fieldValue)
                            throws DetailedNullPointerException
Verify that the specified value is not null. If it is then throw an exception

Parameters:
fieldName - The name of the field to check
fieldValue - The value of the field to check
Throws:
DetailedNullPointerException - If fieldValue is null


Copyright © 1998-2005 Gargoyle Software Inc.. All Rights Reserved.