org.apache.excalibur.instrument.manager.impl
Class InstrumentDescriptorImpl

java.lang.Object
  extended byorg.apache.excalibur.instrument.manager.impl.InstrumentDescriptorImpl
All Implemented Interfaces:
InstrumentDescriptor

public class InstrumentDescriptorImpl
extends java.lang.Object
implements InstrumentDescriptor

Describes a Instrument and acts as a Proxy to protect the original Instrument.

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

Method Summary
 void addCounterInstrumentListener(CounterInstrumentListener listener)
          Adds a CounterInstrumentListener to the list of listeners which will receive updates of the value of the Instrument.
 void addValueInstrumentListener(ValueInstrumentListener listener)
          Adds a ValueInstrumentListener to the list of listeners which will receive updates of the value of the Instrument.
 InstrumentSampleDescriptor createInstrumentSample(java.lang.String sampleDescription, long sampleInterval, int sampleSize, long sampleLease, int sampleType)
          Returns a InstrumentSampleDescriptor based on its name.
 java.lang.String getDescription()
          Gets the description of the Instrument.
 InstrumentableDescriptor getInstrumentableDescriptor()
          Returns a reference to the descriptor of the Instrumentable of the instrument.
 InstrumentSampleDescriptor getInstrumentSampleDescriptor(java.lang.String instrumentSampleName)
          Returns a InstrumentSampleDescriptor based on its name.
 InstrumentSampleDescriptor[] getInstrumentSampleDescriptors()
          Returns an array of Descriptors for the InstrumentSamples configured for this Instrument.
 java.lang.String getName()
          Gets the name for the Instrument.
 int getStateVersion()
          Returns the stateVersion of the instrument.
 int getType()
          Returns the type of the Instrument.
 boolean isConfigured()
          Returns true if the Instrument was configured in the instrumentables section of the configuration.
 boolean isRegistered()
          Returns true if the Instrument was registered with the Instrument Manager.
 void removeCounterInstrumentListener(CounterInstrumentListener listener)
          Removes a InstrumentListener from the list of listeners which will receive profile events.
 void removeValueInstrumentListener(ValueInstrumentListener listener)
          Removes a InstrumentListener from the list of listeners which will receive profile events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isConfigured

public boolean isConfigured()
Returns true if the Instrument was configured in the instrumentables section of the configuration.

Specified by:
isConfigured in interface InstrumentDescriptor
Returns:
True if configured.

isRegistered

public boolean isRegistered()
Returns true if the Instrument was registered with the Instrument Manager.

Specified by:
isRegistered in interface InstrumentDescriptor
Returns:
True if registered.

getName

public java.lang.String getName()
Gets the name for the Instrument. The Instrument Name is used to uniquely identify the Instrument during the configuration of the Profiler. The value should be a string which does not contain spaces or periods.

Specified by:
getName in interface InstrumentDescriptor
Returns:
The name used to identify a Instrument.

getDescription

public java.lang.String getDescription()
Gets the description of the Instrument.

Specified by:
getDescription in interface InstrumentDescriptor
Returns:
The description of the Instrument.

getType

public int getType()
Returns the type of the Instrument. Possible values include InstrumentManagerClient.INSTRUMENT_TYPE_COUNTER, InstrumentManagerClient.INSTRUMENT_TYPE_VALUE or InstrumentManagerClient.INSTRUMENT_TYPE_NONE, if the type was never set.

Specified by:
getType in interface InstrumentDescriptor
Returns:
The type of the Instrument.

getInstrumentableDescriptor

public InstrumentableDescriptor getInstrumentableDescriptor()
Returns a reference to the descriptor of the Instrumentable of the instrument.

Specified by:
getInstrumentableDescriptor in interface InstrumentDescriptor
Returns:
A reference to the descriptor of the Instrumentable of the instrument.

addCounterInstrumentListener

public void addCounterInstrumentListener(CounterInstrumentListener listener)
Adds a CounterInstrumentListener to the list of listeners which will receive updates of the value of the Instrument.

Specified by:
addCounterInstrumentListener in interface InstrumentDescriptor
Parameters:
listener - CounterInstrumentListener which will start receiving profile updates.
Throws:
java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.PROFILE_POINT_TYPE_COUNTER.

removeCounterInstrumentListener

public void removeCounterInstrumentListener(CounterInstrumentListener listener)
Removes a InstrumentListener from the list of listeners which will receive profile events.

Specified by:
removeCounterInstrumentListener in interface InstrumentDescriptor
Parameters:
listener - InstrumentListener which will stop receiving profile events.
Throws:
java.lang.IllegalStateException - If the Instrument's type is not InstrumentManager.PROFILE_POINT_TYPE_COUNTER.

addValueInstrumentListener

public void addValueInstrumentListener(ValueInstrumentListener listener)
Adds a ValueInstrumentListener to the list of listeners which will receive updates of the value of the Instrument.

Specified by:
addValueInstrumentListener in interface InstrumentDescriptor
Parameters:
listener - ValueInstrumentListener which will start receiving profile updates.
Throws:
java.lang.IllegalStateException - If the Instrument's type is not DefaultInstrumentManager.INSTRUMENT_TYPE_VALUE.

removeValueInstrumentListener

public void removeValueInstrumentListener(ValueInstrumentListener listener)
Removes a InstrumentListener from the list of listeners which will receive profile events.

Specified by:
removeValueInstrumentListener in interface InstrumentDescriptor
Parameters:
listener - InstrumentListener which will stop receiving profile events.
Throws:
java.lang.IllegalStateException - If the Instrument's type is not DefaultInstrumentManager.INSTRUMENT_TYPE_VALUE.

getInstrumentSampleDescriptor

public InstrumentSampleDescriptor getInstrumentSampleDescriptor(java.lang.String instrumentSampleName)
                                                         throws NoSuchInstrumentSampleException
Returns a InstrumentSampleDescriptor based on its name.

Specified by:
getInstrumentSampleDescriptor in interface InstrumentDescriptor
Parameters:
instrumentSampleName - Name of the InstrumentSample being requested.
Returns:
A Descriptor of the requested InstrumentSample.
Throws:
NoSuchInstrumentSampleException - If the specified InstrumentSample does not exist.

createInstrumentSample

public InstrumentSampleDescriptor createInstrumentSample(java.lang.String sampleDescription,
                                                         long sampleInterval,
                                                         int sampleSize,
                                                         long sampleLease,
                                                         int sampleType)
Returns a InstrumentSampleDescriptor based on its name. If the requested sample is invalid in any way, then an expired Descriptor will be returned.

Specified by:
createInstrumentSample in interface InstrumentDescriptor
Parameters:
sampleDescription - Description to assign to the new Sample.
sampleInterval - Sample interval to use in the new Sample.
sampleLease - Requested lease time for the new Sample in milliseconds. The InstrumentManager may grant a lease which is shorter or longer than the requested period.
sampleType - Type of sample to request. Must be one of the following: InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_COUNTER, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MINIMUM, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MAXIMUM, InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MEAN.
Returns:
A Descriptor of the requested InstrumentSample.
Throws:
NoSuchInstrumentSampleException - If the specified InstrumentSample does not exist.

getInstrumentSampleDescriptors

public InstrumentSampleDescriptor[] getInstrumentSampleDescriptors()
Returns an array of Descriptors for the InstrumentSamples configured for this Instrument.

Specified by:
getInstrumentSampleDescriptors in interface InstrumentDescriptor
Returns:
An array of Descriptors for the InstrumentSamples configured for this Instrument.

getStateVersion

public int getStateVersion()
Returns the stateVersion of the instrument. The state version will be incremented each time any of the configuration of the instrument or any of its children is modified. Clients can use this value to tell whether or not anything has changed without having to do an exhaustive comparison.

Specified by:
getStateVersion in interface InstrumentDescriptor
Returns:
The state version of the instrument.


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