org.apache.avalon.excalibur.component.example_im
Class DefaultExampleInstrumentable

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.excalibur.component.example_im.DefaultExampleInstrumentable
All Implemented Interfaces:
Component, ExampleInstrumentable, Instrumentable, LogEnabled, java.lang.Runnable, Startable

public class DefaultExampleInstrumentable
extends AbstractLogEnabled
implements ExampleInstrumentable, Startable, java.lang.Runnable, Instrumentable

This example application creates a component which registers several Instruments for the example. Note, this code ignores exceptions to keep the code simple.

Since:
4.1
Version:
CVS $Revision: 1.1 $ $Date: 2004/03/17 13:22:37 $
Author:
Avalon Development Team

Field Summary
static java.lang.String INSTRUMENT_COUNTER_QUICK_NAME
           
static java.lang.String INSTRUMENT_COUNTER_RANDOM_NAME
           
static java.lang.String INSTRUMENT_COUNTER_SLOW_NAME
           
static java.lang.String INSTRUMENT_DOACTION_NAME
           
static java.lang.String INSTRUMENT_RANDOM_QUICK_NAME
           
static java.lang.String INSTRUMENT_RANDOM_RANDOM_NAME
           
static java.lang.String INSTRUMENT_RANDOM_SLOW_NAME
           
 
Fields inherited from interface org.apache.avalon.excalibur.component.example_im.ExampleInstrumentable
ROLE
 
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY
 
Constructor Summary
DefaultExampleInstrumentable()
           
 
Method Summary
 void doAction()
          Example action method.
 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 run()
          Runner thread which is responsible for sending data to the Profiler via the various random Profile Points.
 void setInstrumentableName(java.lang.String name)
          Sets the name for the Instrumentable.
 void start()
          Start the component.
 void stop()
          Stop the component.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTRUMENT_RANDOM_QUICK_NAME

public static final java.lang.String INSTRUMENT_RANDOM_QUICK_NAME
See Also:
Constant Field Values

INSTRUMENT_RANDOM_SLOW_NAME

public static final java.lang.String INSTRUMENT_RANDOM_SLOW_NAME
See Also:
Constant Field Values

INSTRUMENT_RANDOM_RANDOM_NAME

public static final java.lang.String INSTRUMENT_RANDOM_RANDOM_NAME
See Also:
Constant Field Values

INSTRUMENT_COUNTER_QUICK_NAME

public static final java.lang.String INSTRUMENT_COUNTER_QUICK_NAME
See Also:
Constant Field Values

INSTRUMENT_COUNTER_SLOW_NAME

public static final java.lang.String INSTRUMENT_COUNTER_SLOW_NAME
See Also:
Constant Field Values

INSTRUMENT_COUNTER_RANDOM_NAME

public static final java.lang.String INSTRUMENT_COUNTER_RANDOM_NAME
See Also:
Constant Field Values

INSTRUMENT_DOACTION_NAME

public static final java.lang.String INSTRUMENT_DOACTION_NAME
See Also:
Constant Field Values
Constructor Detail

DefaultExampleInstrumentable

public DefaultExampleInstrumentable()
Method Detail

doAction

public void doAction()
Example action method.

Specified by:
doAction in interface ExampleInstrumentable

start

public void start()
Start the component.

Specified by:
start in interface Startable

stop

public void stop()
Stop the component.

Specified by:
stop in interface Startable

run

public void run()
Runner thread which is responsible for sending data to the Profiler via the various random Profile Points.

Specified by:
run in interface java.lang.Runnable

setInstrumentableName

public 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.

getInstrumentableName

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

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

getInstruments

public 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.

getChildInstrumentables

public 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.


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