org.apache.excalibur.instrument
Class AbstractInstrument

java.lang.Object
  extended byorg.apache.excalibur.instrument.AbstractInstrument
All Implemented Interfaces:
Instrument
Direct Known Subclasses:
CounterInstrument, ValueInstrument

public abstract class AbstractInstrument
extends java.lang.Object
implements Instrument

The AbstractInstrument class can be used by an class wishing to implement the Instruement interface.

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:28 $
Author:
Avalon Development Team

Constructor Summary
protected AbstractInstrument(java.lang.String name)
          Creates a new AbstractInstrument.
 
Method Summary
 java.lang.String getInstrumentName()
          Gets the name for the Instrument.
protected  InstrumentProxy getInstrumentProxy()
          Returns the InstrumentProxy object assigned to the instrument by the InstrumentManager.
 boolean isActive()
          Used by classes being profiled so that they can avoid unnecessary code when the data from an Instrument is not being used.
 void setInstrumentProxy(InstrumentProxy proxy)
          When the InstrumentManager is present, an InstrumentProxy will be set to enable the Instrument to communicate with the InstrumentManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInstrument

protected AbstractInstrument(java.lang.String name)
Creates a new AbstractInstrument.

Parameters:
name - The name of the Instrument. The value should be a string which does not contain spaces or periods.
Method Detail

getInstrumentName

public java.lang.String getInstrumentName()
Gets the name for the Instrument. When an Instrumentable publishes more than one Instrument, this name makes it possible to identify each Instrument. The value should be a string which does not contain spaces or periods.

Specified by:
getInstrumentName in interface Instrument
Returns:
The name of the Instrument.

setInstrumentProxy

public void setInstrumentProxy(InstrumentProxy proxy)
When the InstrumentManager is present, an InstrumentProxy will be set to enable the Instrument to communicate with the InstrumentManager. Once the InstrumentProxy is set, it should never be changed or set back to null. This restriction removes the need for synchronization within the Instrument classes. Which in turn makes them more efficient.

Parameters:
proxy - Proxy object used to communicate with the InstrumentManager.

isActive

public boolean isActive()
Used by classes being profiled so that they can avoid unnecessary code when the data from an Instrument is not being used.

Returns:
True if an InstrumentProxy has been set and is active.

getInstrumentProxy

protected InstrumentProxy getInstrumentProxy()
Returns the InstrumentProxy object assigned to the instrument by the InstrumentManager.

Returns:
Proxy object used to communicate with the InstrumentManager.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.