Class AbstractInstrumentationProvider
- java.lang.Object
-
- org.apache.openjpa.lib.instrumentation.AbstractInstrumentationProvider
-
- All Implemented Interfaces:
Configurable,InstrumentationProvider
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
Constructors Constructor Description AbstractInstrumentationProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddInstrument(Instrument instrument)Adds an instrument to this providers list of managed instruments.voidendConfiguration()Invoked upon completion of bean property configuration for this object.ConfigurationgetConfiguration()Gets the configuration associated with the instrumentation providerStringgetInstrument()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.InstrumentgetInstrumentByName(String name)Returns an instrument instrumented by this provider by nameSet<Instrument>getInstruments()Gets all instruments instrumented by this providerStringgetOptions()Gets configuration options for this providervoidinitializeInstrument(Instrument instrument, Object context)Initializes an instrument within the provided context.voidinitializeInstrument(Instrument instrument, String options, Object context)Initializes an instrument within the provided options and context.booleanisStarted()Whether the instrumentation provider startedvoidremoveInstrumentByName(String name)Removes an instrument instrumented by this provider by namevoidsetConfiguration(Configuration conf)Invoked prior to setting bean properties.voidsetInstrument(String instrument)Used to associate one or more instruments to a provider.voidsetOptions(String options)Sets configuration options for this providerprotected voidsetStarted(boolean started)abstract voidstart()Stops the instrumentation providervoidstartConfiguration()Invoked before bean property configuration is begun on this object.voidstartInstruments(InstrumentationLevel level, Object context)Starts all instruments of the specified instrumentation level and context.abstract voidstop()Starts the instrumentation providervoidstopInstrument(Instrument instrument)Stops an instrumentvoidstopInstruments(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
-
-
-
-
Method Detail
-
setConfiguration
public void setConfiguration(Configuration conf)
Description copied from interface:ConfigurableInvoked prior to setting bean properties.- Specified by:
setConfigurationin interfaceConfigurable
-
getConfiguration
public Configuration getConfiguration()
Description copied from interface:InstrumentationProviderGets the configuration associated with the instrumentation provider- Specified by:
getConfigurationin interfaceInstrumentationProvider- Returns:
- the configuration associated with the provider
-
startConfiguration
public void startConfiguration()
Description copied from interface:ConfigurableInvoked before bean property configuration is begun on this object.- Specified by:
startConfigurationin interfaceConfigurable
-
endConfiguration
public void endConfiguration()
Description copied from interface:ConfigurableInvoked upon completion of bean property configuration for this object.- Specified by:
endConfigurationin interfaceConfigurable
-
setInstrument
public void setInstrument(String instrument)
Description copied from interface:InstrumentationProviderUsed 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:
setInstrumentin interfaceInstrumentationProvider- Parameters:
instrument- one or more instrument class names or aliases
-
getInstrument
public String getInstrument()
Description copied from interface:InstrumentationProviderReturns the string-based list of instruments directly configured by this provider via setInstrument.- Specified by:
getInstrumentin interfaceInstrumentationProvider
-
setOptions
public void setOptions(String options)
Description copied from interface:InstrumentationProviderSets configuration options for this provider- Specified by:
setOptionsin interfaceInstrumentationProvider
-
getOptions
public String getOptions()
Description copied from interface:InstrumentationProviderGets configuration options for this provider- Specified by:
getOptionsin interfaceInstrumentationProvider
-
addInstrument
public void addInstrument(Instrument instrument)
Description copied from interface:InstrumentationProviderAdds 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:
addInstrumentin interfaceInstrumentationProvider
-
initializeInstrument
public void initializeInstrument(Instrument instrument, Object context)
Description copied from interface:InstrumentationProviderInitializes an instrument within the provided context.- Specified by:
initializeInstrumentin interfaceInstrumentationProvider- Parameters:
instrument- an instrumentcontext- instrumentation context (factory, broker, config)
-
initializeInstrument
public void initializeInstrument(Instrument instrument, String options, Object context)
Description copied from interface:InstrumentationProviderInitializes an instrument within the provided options and context.- Specified by:
initializeInstrumentin interfaceInstrumentationProvider- Parameters:
instrument- an instrumentoptions- configuration options to provide the instrument during initializationcontext- instrumentation context (factory, broker, config)
-
getInstrumentByName
public Instrument getInstrumentByName(String name)
Description copied from interface:InstrumentationProviderReturns an instrument instrumented by this provider by name- Specified by:
getInstrumentByNamein interfaceInstrumentationProvider- Parameters:
name- the name of the instrument to return- Returns:
- the instrument or null if not instrumented by this provider
-
getInstruments
public Set<Instrument> getInstruments()
Description copied from interface:InstrumentationProviderGets all instruments instrumented by this provider- Specified by:
getInstrumentsin interfaceInstrumentationProvider- Returns:
- instruments instrumented by this provider
-
stopInstruments
public void stopInstruments(InstrumentationLevel level, Object context)
Description copied from interface:InstrumentationProviderStops all instruments of the specified instrumentation level and context.- Specified by:
stopInstrumentsin interfaceInstrumentationProvider- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
startInstruments
public void startInstruments(InstrumentationLevel level, Object context)
Description copied from interface:InstrumentationProviderStarts all instruments of the specified instrumentation level and context.- Specified by:
startInstrumentsin interfaceInstrumentationProvider- Parameters:
level- instrumentation levelcontext- instrumentation context (factory, broker, config)
-
stopInstrument
public void stopInstrument(Instrument instrument)
Description copied from interface:InstrumentationProviderStops an instrument- Specified by:
stopInstrumentin interfaceInstrumentationProvider- Parameters:
instrument- the instrument to stop
-
removeInstrumentByName
public void removeInstrumentByName(String name)
Description copied from interface:InstrumentationProviderRemoves an instrument instrumented by this provider by name- Specified by:
removeInstrumentByNamein interfaceInstrumentationProvider- Parameters:
name- the name of the instrument to remove
-
isStarted
public boolean isStarted()
Description copied from interface:InstrumentationProviderWhether the instrumentation provider started- Specified by:
isStartedin interfaceInstrumentationProvider- Returns:
- true if the provider is started
-
setStarted
protected void setStarted(boolean started)
-
getInstrumentAliases
public String[] getInstrumentAliases()
Description copied from interface:InstrumentationProviderReturns 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:
getInstrumentAliasesin interfaceInstrumentationProvider- Returns:
- a string array of identifier, class name pairs.
-
start
public abstract void start()
Description copied from interface:InstrumentationProviderStops the instrumentation provider- Specified by:
startin interfaceInstrumentationProvider
-
stop
public abstract void stop()
Description copied from interface:InstrumentationProviderStarts the instrumentation provider- Specified by:
stopin interfaceInstrumentationProvider
-
-