Class AbstractInstrument
java.lang.Object
org.apache.openjpa.lib.instrumentation.AbstractInstrument
- All Implemented Interfaces:
Instrument
- Direct Known Subclasses:
AbstractDataCacheInstrument,AbstractPreparedQueryCacheInstrument,AbstractQueryCacheInstrument
Provides a base for creating instruments. Specialized instruments can
extend this class to get base instrument capabilities and then add their
own specialized functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the context of the instrument.getLevel()Gets the instrumentation level of this instrument.abstract StringgetName()Returns the name of the instrument.Returns the options specified for the instrument in string form.Gets the instrumentation provider for the instrument.abstract voidInitializes the instrument.booleanReturns true if the instrument is started.voidrestart()Restarts the instrument.voidsetContext(Object context) Sets the context of the instrument.voidsetOptions(String options) Sets options to specify for the instrument in standard string form.voidsetProvider(InstrumentationProvider provider) Sets the instrumentation provider for the instrument.voidsetStarted(boolean started) Sets whether the instrument is an available state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.openjpa.lib.instrumentation.Instrument
start, stop
-
Constructor Details
-
AbstractInstrument
public AbstractInstrument()
-
-
Method Details
-
getContext
Description copied from interface:InstrumentGets the context of the instrument. Typically, a reference to a broker or broker factory.- Specified by:
getContextin interfaceInstrument- Returns:
- the context associated with the instrument.
-
setContext
Description copied from interface:InstrumentSets the context of the instrument. Typically, a reference to a broker or broker factory.- Specified by:
setContextin interfaceInstrument
-
getOptions
Description copied from interface:InstrumentReturns the options specified for the instrument in string form.- Specified by:
getOptionsin interfaceInstrument- Returns:
- options configuration options for the instrument
-
setOptions
Description copied from interface:InstrumentSets options to specify for the instrument in standard string form. ex. DataCache(Options='Start=true')- Specified by:
setOptionsin interfaceInstrument- Parameters:
options- options
-
isStarted
public boolean isStarted()Description copied from interface:InstrumentReturns true if the instrument is started.- Specified by:
isStartedin interfaceInstrument
-
setStarted
public void setStarted(boolean started) Description copied from interface:InstrumentSets whether the instrument is an available state.- Specified by:
setStartedin interfaceInstrument
-
restart
public void restart()Description copied from interface:InstrumentRestarts the instrument. Typically this will be performed through the provider, but in some cases an instrument will have its own specialized restart.- Specified by:
restartin interfaceInstrument
-
setProvider
Description copied from interface:InstrumentSets the instrumentation provider for the instrument.- Specified by:
setProviderin interfaceInstrument- Parameters:
provider- instrumentation provider of the instrument
-
getProvider
Description copied from interface:InstrumentGets the instrumentation provider for the instrument.- Specified by:
getProviderin interfaceInstrument- Returns:
- instrumentation provider of the instrument
-
getLevel
Description copied from interface:InstrumentGets the instrumentation level of this instrument. The instrumentation level determines if and when the instrument will automatically start and stop.- Specified by:
getLevelin interfaceInstrument- Returns:
- the instrumentation level of the instrument
-
getName
Description copied from interface:InstrumentReturns the name of the instrument. Must be unique per-provider.- Specified by:
getNamein interfaceInstrument
-
initialize
public abstract void initialize()Description copied from interface:InstrumentInitializes the instrument. Depending on the instrument, the provider, options, and various options may need to be set before calling this method.- Specified by:
initializein interfaceInstrument
-