org.apache.openjpa.lib.instrumentation
Interface Instrument

All Known Subinterfaces:
JMXInstrument
All Known Implementing Classes:
AbstractDataCacheInstrument, AbstractInstrument, AbstractPreparedQueryCacheInstrument, AbstractQueryCacheInstrument, DataCacheJMXInstrument, PreparedQueryCacheJMXInstrument, QueryCacheJMXInstrument

public interface Instrument

Interface that must be implemented by instruments.


Method Summary
 Object getContext()
          Gets the context of the instrument.
 InstrumentationLevel getLevel()
          Gets the instrumentation level of this instrument.
 String getName()
          Returns the name of the instrument.
 String getOptions()
          Returns the options specified for the instrument in string form.
 InstrumentationProvider getProvider()
          Gets the instrumentation provider for the instrument.
 void initialize()
          Initializes the instrument.
 boolean isStarted()
          Returns true if the instrument is started.
 void restart()
          Restarts the instrument.
 void setContext(Object context)
          Sets the context of the instrument.
 void setOptions(String options)
          Sets options to specify for the instrument in standard string form.
 void setProvider(InstrumentationProvider provider)
          Sets the instrumentation provider for the instrument.
 void setStarted(boolean started)
          Sets whether the instrument is an available state.
 void start()
          Starts the instrument.
 void stop()
          Starts the instrument.
 

Method Detail

getName

String getName()
Returns the name of the instrument. Must be unique per-provider.


getOptions

String getOptions()
Returns the options specified for the instrument in string form.

Returns:
options configuration options for the instrument

setOptions

void setOptions(String options)
Sets options to specify for the instrument in standard string form. ex. DataCache(Options='Start=true')

Parameters:
options - options

getContext

Object getContext()
Gets the context of the instrument. Typically, a reference to a broker or broker factory.

Returns:
the context associated with the instrument.

setContext

void setContext(Object context)
Sets the context of the instrument. Typically, a reference to a broker or broker factory.


setProvider

void setProvider(InstrumentationProvider provider)
Sets the instrumentation provider for the instrument.

Parameters:
provider - instrumentation provider of the instrument

getProvider

InstrumentationProvider getProvider()
Gets the instrumentation provider for the instrument.

Returns:
instrumentation provider of the instrument

initialize

void initialize()
Initializes the instrument. Depending on the instrument, the provider, options, and various options may need to be set before calling this method.


getLevel

InstrumentationLevel getLevel()
Gets the instrumentation level of this instrument. The instrumentation level determines if and when the instrument will automatically start and stop.

Returns:
the instrumentation level of the instrument

isStarted

boolean isStarted()
Returns true if the instrument is started.

Returns:

setStarted

void setStarted(boolean started)
Sets whether the instrument is an available state.

Parameters:
started -

start

void start()
Starts the instrument. Typically this will be performed through the provider, but in some cases an instrument will have its own specialized startup.


stop

void stop()
Starts the instrument. Typically this will be performed through the provider, but in some cases an instrument will have its own specialized shutdown.


restart

void restart()
Restarts the instrument. Typically this will be performed through the provider, but in some cases an instrument will have its own specialized restart.



Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.