Class AbstractInstrumentationProvider
java.lang.Object
org.apache.openjpa.lib.instrumentation.AbstractInstrumentationProvider
- All Implemented Interfaces:
Configurable
,InstrumentationProvider
- Direct Known Subclasses:
JMXProvider
public abstract class AbstractInstrumentationProvider
extends Object
implements InstrumentationProvider, Configurable
Specialized instrumentation providers can extend this class to get basic
provider state and capabilities. It implements Configurable so it can
be used within the configuration framework to participate in automatic
configuration.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addInstrument
(Instrument instrument) Adds an instrument to this providers list of managed instruments.void
Invoked upon completion of bean property configuration for this object.Gets the configuration associated with the instrumentation providerReturns the string-based list of instruments directly configured by this provider via setInstrument.String[]
Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider.getInstrumentByName
(String name) Returns an instrument instrumented by this provider by nameGets all instruments instrumented by this providerGets configuration options for this providervoid
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
Whether the instrumentation provider startedvoid
removeInstrumentByName
(String name) Removes an instrument instrumented by this provider by namevoid
Invoked prior to setting bean properties.void
setInstrument
(String instrument) Used to associate one or more instruments to a provider.void
setOptions
(String options) Sets configuration options for this providerprotected void
setStarted
(boolean started) abstract void
start()
Stops the instrumentation providervoid
Invoked before bean property configuration is begun on this object.void
startInstruments
(InstrumentationLevel level, Object context) Starts all instruments of the specified instrumentation level and context.abstract void
stop()
Starts the instrumentation providervoid
stopInstrument
(Instrument instrument) Stops an instrumentvoid
stopInstruments
(InstrumentationLevel level, Object context) Stops all instruments of the specified instrumentation level and context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.openjpa.lib.instrumentation.InstrumentationProvider
startInstrument, stopInstrument
-
Constructor Details
-
AbstractInstrumentationProvider
public AbstractInstrumentationProvider()
-
-
Method Details
-
setConfiguration
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
getConfiguration
Description copied from interface:InstrumentationProvider
Gets the configuration associated with the instrumentation provider- Specified by:
getConfiguration
in interfaceInstrumentationProvider
- Returns:
- the configuration associated with the provider
-
startConfiguration
public void startConfiguration()Description copied from interface:Configurable
Invoked before bean property configuration is begun on this object.- Specified by:
startConfiguration
in interfaceConfigurable
-
endConfiguration
public void endConfiguration()Description copied from interface:Configurable
Invoked upon completion of bean property configuration for this object.- Specified by:
endConfiguration
in interfaceConfigurable
-
setInstrument
Description copied from interface:InstrumentationProvider
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.- Specified by:
setInstrument
in interfaceInstrumentationProvider
- Parameters:
instrument
- one or more instrument class names or aliases
-
getInstrument
Description copied from interface:InstrumentationProvider
Returns the string-based list of instruments directly configured by this provider via setInstrument.- Specified by:
getInstrument
in interfaceInstrumentationProvider
-
setOptions
Description copied from interface:InstrumentationProvider
Sets configuration options for this provider- Specified by:
setOptions
in interfaceInstrumentationProvider
-
getOptions
Description copied from interface:InstrumentationProvider
Gets configuration options for this provider- Specified by:
getOptions
in interfaceInstrumentationProvider
-
addInstrument
Description copied from interface:InstrumentationProvider
Adds an instrument to this providers list of managed instruments. The instrument will participate in context-based lifecycle routines, depending on the instrumentation level.- Specified by:
addInstrument
in interfaceInstrumentationProvider
-
initializeInstrument
Description copied from interface:InstrumentationProvider
Initializes an instrument within the provided context.- Specified by:
initializeInstrument
in interfaceInstrumentationProvider
- Parameters:
instrument
- an instrumentcontext
- instrumentation context (factory, broker, config)
-
initializeInstrument
Description copied from interface:InstrumentationProvider
Initializes an instrument within the provided options and context.- Specified by:
initializeInstrument
in interfaceInstrumentationProvider
- Parameters:
instrument
- an instrumentoptions
- configuration options to provide the instrument during initializationcontext
- instrumentation context (factory, broker, config)
-
getInstrumentByName
Description copied from interface:InstrumentationProvider
Returns an instrument instrumented by this provider by name- Specified by:
getInstrumentByName
in interfaceInstrumentationProvider
- Parameters:
name
- the name of the instrument to return- Returns:
- the instrument or null if not instrumented by this provider
-
getInstruments
Description copied from interface:InstrumentationProvider
Gets all instruments instrumented by this provider- Specified by:
getInstruments
in interfaceInstrumentationProvider
- Returns:
- instruments instrumented by this provider
-
stopInstruments
Description copied from interface:InstrumentationProvider
Stops all instruments of the specified instrumentation level and context.- Specified by:
stopInstruments
in interfaceInstrumentationProvider
- Parameters:
level
- instrumentation levelcontext
- instrumentation context (factory, broker, config)
-
startInstruments
Description copied from interface:InstrumentationProvider
Starts all instruments of the specified instrumentation level and context.- Specified by:
startInstruments
in interfaceInstrumentationProvider
- Parameters:
level
- instrumentation levelcontext
- instrumentation context (factory, broker, config)
-
stopInstrument
Description copied from interface:InstrumentationProvider
Stops an instrument- Specified by:
stopInstrument
in interfaceInstrumentationProvider
- Parameters:
instrument
- the instrument to stop
-
removeInstrumentByName
Description copied from interface:InstrumentationProvider
Removes an instrument instrumented by this provider by name- Specified by:
removeInstrumentByName
in interfaceInstrumentationProvider
- Parameters:
name
- the name of the instrument to remove
-
isStarted
public boolean isStarted()Description copied from interface:InstrumentationProvider
Whether the instrumentation provider started- Specified by:
isStarted
in interfaceInstrumentationProvider
- Returns:
- true if the provider is started
-
setStarted
protected void setStarted(boolean started) -
getInstrumentAliases
Description copied from interface:InstrumentationProvider
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"}- Specified by:
getInstrumentAliases
in interfaceInstrumentationProvider
- Returns:
- a string array of identifier, class name pairs.
-
start
public abstract void start()Description copied from interface:InstrumentationProvider
Stops the instrumentation provider- Specified by:
start
in interfaceInstrumentationProvider
-
stop
public abstract void stop()Description copied from interface:InstrumentationProvider
Starts the instrumentation provider- Specified by:
stop
in interfaceInstrumentationProvider
-