org.apache.openjpa.lib.instrumentation
Interface InstrumentationProvider

All Known Implementing Classes:
AbstractInstrumentationProvider, JMXProvider

public interface InstrumentationProvider

Pluggable instrumentation providers (ex. JMX) must implement this interface. It provides methods for controlling the provider and the instruments instrumented by the provider.


Method Summary
 void addInstrument(Instrument instrument)
          Adds an instrument to this providers list of managed instruments.
 Configuration getConfiguration()
          Gets the configuration associated with the instrumentation provider
 String getInstrument()
          Returns the string-based list of instruments directly configured by this provider via setInstrument.
 String[] getInstrumentAliases()
          Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider.
 Instrument getInstrumentByName(String name)
          Returns an instrument instrumented by this provider by name
 Set<Instrument> getInstruments()
          Gets all instruments instrumented by this provider
 String getOptions()
          Gets configuration options for this provider
 void initializeInstrument(Instrument instrument, Object context)
          Initializes an instrument within the provided context.
 void initializeInstrument(Instrument instrument, String options, Object context)
          Initializes an instrument within the provided options and context.
 boolean isStarted()
          Whether the instrumentation provider started
 void removeInstrumentByName(String name)
          Removes an instrument instrumented by this provider by name
 void setInstrument(String instruments)
          Used to associate one or more instruments to a provider.
 void setOptions(String options)
          Sets configuration options for this provider
 void start()
          Stops the instrumentation provider
 void startInstrument(Instrument instrument)
          Starts an instrument
 void startInstruments(InstrumentationLevel level, Object context)
          Starts all instruments of the specified instrumentation level and context.
 void stop()
          Starts the instrumentation provider
 void stopInstrument(Instrument instrument)
          Stops an instrument
 void stopInstrument(Instrument instrument, boolean force)
          Stops an instrument, forcing the stop, if necessary.
 void stopInstruments(InstrumentationLevel level, Object context)
          Stops all instruments of the specified instrumentation level and context.
 

Method Detail

isStarted

boolean isStarted()
Whether the instrumentation provider started

Returns:
true if the provider is started

stop

void stop()
Starts the instrumentation provider


start

void start()
Stops the instrumentation provider


getConfiguration

Configuration getConfiguration()
Gets the configuration associated with the instrumentation provider

Returns:
the configuration associated with the provider

setInstrument

void setInstrument(String instruments)
Used to associate one or more instruments to a provider. Instruments are specified by class name or alias. Multiple instruments must be specified as a comma separated list. example: DataCache,QueryCache,com.my.MyInstrument where DataCache and QueryCache have aliases and com.my.MyInstrument is a class implementing an Instrument.

Parameters:
instruments - one or more instrument class names or aliases

getInstrument

String getInstrument()
Returns the string-based list of instruments directly configured by this provider via setInstrument.

Returns:

setOptions

void setOptions(String options)
Sets configuration options for this provider

Parameters:
options -

getOptions

String getOptions()
Gets configuration options for this provider

Parameters:
options -

getInstrumentAliases

String[] getInstrumentAliases()
Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider. Example: {"DataCache", "org.apache.openjpa.instrumentation.DataCacheInstrument", "QueryCache", "org.apache.openjpa.instrumentation.QueryCacheInstrument"}

Returns:
a string array of identifier, class name pairs.

addInstrument

void addInstrument(Instrument instrument)
Adds an instrument to this providers list of managed instruments. The instrument will participate in context-based lifecycle routines, depending on the instrumentation level.

Parameters:
instrument -

stopInstruments

void stopInstruments(InstrumentationLevel level,
                     Object context)
Stops all instruments of the specified instrumentation level and context.

Parameters:
level - instrumentation level
context - instrumentation context (factory, broker, config)

startInstruments

void startInstruments(InstrumentationLevel level,
                      Object context)
Starts all instruments of the specified instrumentation level and context.

Parameters:
level - instrumentation level
context - instrumentation context (factory, broker, config)

initializeInstrument

void initializeInstrument(Instrument instrument,
                          Object context)
Initializes an instrument within the provided context.

Parameters:
instrument - an instrument
context - instrumentation context (factory, broker, config)

initializeInstrument

void initializeInstrument(Instrument instrument,
                          String options,
                          Object context)
Initializes an instrument within the provided options and context.

Parameters:
instrument - an instrument
options - configuration options to provide the instrument during initialization
context - instrumentation context (factory, broker, config)

getInstrumentByName

Instrument getInstrumentByName(String name)
Returns an instrument instrumented by this provider by name

Parameters:
name - the name of the instrument to return
Returns:
the instrument or null if not instrumented by this provider

removeInstrumentByName

void removeInstrumentByName(String name)
Removes an instrument instrumented by this provider by name

Parameters:
name - the name of the instrument to remove

getInstruments

Set<Instrument> getInstruments()
Gets all instruments instrumented by this provider

Returns:
instruments instrumented by this provider

startInstrument

void startInstrument(Instrument instrument)
Starts an instrument

Parameters:
instrument - this instrument to start

stopInstrument

void stopInstrument(Instrument instrument)
Stops an instrument

Parameters:
instrument - the instrument to stop

stopInstrument

void stopInstrument(Instrument instrument,
                    boolean force)
Stops an instrument, forcing the stop, if necessary.

Parameters:
instrument - the instrument to stop
force - forces the stop if the instrument does not stop gracefully.


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