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 java.lang.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
Constructors Constructor Description AbstractInstrumentationProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addInstrument(Instrument instrument)
Adds an instrument to this providers list of managed instruments.void
endConfiguration()
Invoked upon completion of bean property configuration for this object.Configuration
getConfiguration()
Gets the configuration associated with the instrumentation providerjava.lang.String
getInstrument()
Returns the string-based list of instruments directly configured by this provider via setInstrument.java.lang.String[]
getInstrumentAliases()
Returns an string array of identifier to class name aliases for instruments known to the instrumentation provider.Instrument
getInstrumentByName(java.lang.String name)
Returns an instrument instrumented by this provider by namejava.util.Set<Instrument>
getInstruments()
Gets all instruments instrumented by this providerjava.lang.String
getOptions()
Gets configuration options for this providervoid
initializeInstrument(Instrument instrument, java.lang.Object context)
Initializes an instrument within the provided context.void
initializeInstrument(Instrument instrument, java.lang.String options, java.lang.Object context)
Initializes an instrument within the provided options and context.boolean
isStarted()
Whether the instrumentation provider startedvoid
removeInstrumentByName(java.lang.String name)
Removes an instrument instrumented by this provider by namevoid
setConfiguration(Configuration conf)
Invoked prior to setting bean properties.void
setInstrument(java.lang.String instrument)
Used to associate one or more instruments to a provider.void
setOptions(java.lang.String options)
Sets configuration options for this providerprotected void
setStarted(boolean started)
abstract void
start()
Stops the instrumentation providervoid
startConfiguration()
Invoked before bean property configuration is begun on this object.void
startInstruments(InstrumentationLevel level, java.lang.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, java.lang.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
-
-
-
-
Method Detail
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
getConfiguration
public Configuration 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
public void setInstrument(java.lang.String instrument)
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
public java.lang.String 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
public void setOptions(java.lang.String options)
Description copied from interface:InstrumentationProvider
Sets configuration options for this provider- Specified by:
setOptions
in interfaceInstrumentationProvider
-
getOptions
public java.lang.String getOptions()
Description copied from interface:InstrumentationProvider
Gets configuration options for this provider- Specified by:
getOptions
in interfaceInstrumentationProvider
-
addInstrument
public void addInstrument(Instrument instrument)
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
public void initializeInstrument(Instrument instrument, java.lang.Object context)
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
public void initializeInstrument(Instrument instrument, java.lang.String options, java.lang.Object context)
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
public Instrument getInstrumentByName(java.lang.String name)
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
public java.util.Set<Instrument> 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
public void stopInstruments(InstrumentationLevel level, java.lang.Object context)
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
public void startInstruments(InstrumentationLevel level, java.lang.Object context)
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
public void stopInstrument(Instrument instrument)
Description copied from interface:InstrumentationProvider
Stops an instrument- Specified by:
stopInstrument
in interfaceInstrumentationProvider
- Parameters:
instrument
- the instrument to stop
-
removeInstrumentByName
public void removeInstrumentByName(java.lang.String name)
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
public java.lang.String[] 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
-
-