org.apache.excalibur.instrument
Class AbstractInstrumentable

java.lang.Object
  extended byorg.apache.excalibur.instrument.AbstractInstrumentable
All Implemented Interfaces:
Instrumentable

public abstract class AbstractInstrumentable
extends java.lang.Object
implements Instrumentable

Utility class to ease the construction of components that can be instrumented.

Subclasses should call addInstrument or addChildInstrumentable as part of the component's initialization.

Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY
 
Constructor Summary
protected AbstractInstrumentable()
          Creates a new AbstractInstrumentable.
 
Method Summary
protected  void addChildInstrumentable(Instrumentable child)
          Adds a child Instrumentable to the list of child Instrumentables published by the component.
protected  void addInstrument(Instrument instrument)
          Adds an Instrument to the list of Instruments published by the component.
 Instrumentable[] getChildInstrumentables()
          Any Object which implements Instrumentable can also make use of other Instrumentable child objects.
 java.lang.String getInstrumentableName()
          Gets the name of the Instrumentable.
 Instrument[] getInstruments()
          Obtain a reference to all the Instruments that the Instrumentable object wishes to expose.
 void setInstrumentableName(java.lang.String name)
          Sets the name for the Instrumentable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInstrumentable

protected AbstractInstrumentable()
Creates a new AbstractInstrumentable.

Method Detail

addInstrument

protected void addInstrument(Instrument instrument)
Adds an Instrument to the list of Instruments published by the component. This method may not be called after the Instrumentable has been registered with the InstrumentManager.

Parameters:
instrument - Instrument to publish.

addChildInstrumentable

protected void addChildInstrumentable(Instrumentable child)
Adds a child Instrumentable to the list of child Instrumentables published by the component. This method may not be called after the Instrumentable has been registered with the InstrumentManager.

Note that Child Instrumentables must be named by the caller using the setInstrumentableName method.

Parameters:
child - Child Instrumentable to publish.

getInstrumentableName

public final java.lang.String getInstrumentableName()
Gets the name of the Instrumentable.

Specified by:
getInstrumentableName in interface Instrumentable
Returns:
The name used to identify a Instrumentable.

setInstrumentableName

public final void setInstrumentableName(java.lang.String name)
Sets the name for the Instrumentable. The Instrumentable Name is used to uniquely identify the Instrumentable during the configuration of the InstrumentManager and to gain access to an InstrumentableDescriptor through the InstrumentManager. The value should be a string which does not contain spaces or periods.

This value may be set by a parent Instrumentable, or by the InstrumentManager using the value of the 'instrumentable' attribute in the configuration of the component.

Specified by:
setInstrumentableName in interface Instrumentable
Parameters:
name - The name used to identify a Instrumentable.

getChildInstrumentables

public final Instrumentable[] getChildInstrumentables()
Any Object which implements Instrumentable can also make use of other Instrumentable child objects. This method is used to tell the InstrumentManager about them.

Specified by:
getChildInstrumentables in interface Instrumentable
Returns:
An array of child Instrumentables. This method should never return null. If there are no child Instrumentables, then EMPTY_INSTRUMENTABLE_ARRAY can be returned.

getInstruments

public final Instrument[] getInstruments()
Obtain a reference to all the Instruments that the Instrumentable object wishes to expose. All sampling is done directly through the Instruments as opposed to the Instrumentable interface.

Specified by:
getInstruments in interface Instrumentable
Returns:
An array of the Instruments available for profiling. Should never be null. If there are no Instruments, then EMPTY_INSTRUMENT_ARRAY can be returned. This should never be the case though unless there are child Instrumentables with Instruments.


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