org.apache.openjpa.lib.instrumentation
Class AbstractInstrumentationProvider

java.lang.Object
  extended by 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
AbstractInstrumentationProvider()
           
 
Method Summary
 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 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 setConfiguration(Configuration conf)
          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 provider
protected  void setStarted(boolean started)
           
abstract  void start()
          Stops the instrumentation provider
 void startConfiguration()
          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 provider
 void stopInstrument(Instrument instrument)
          Stops an instrument
 void 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 Detail

AbstractInstrumentationProvider

public AbstractInstrumentationProvider()
Method Detail

setConfiguration

public void setConfiguration(Configuration conf)
Description copied from interface: Configurable
Invoked prior to setting bean properties.

Specified by:
setConfiguration in interface Configurable

getConfiguration

public Configuration getConfiguration()
Description copied from interface: InstrumentationProvider
Gets the configuration associated with the instrumentation provider

Specified by:
getConfiguration in interface InstrumentationProvider
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 interface Configurable

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.

Specified by:
endConfiguration in interface Configurable

setInstrument

public void setInstrument(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 interface InstrumentationProvider
Parameters:
instrument - one or more instrument class names or aliases

getInstrument

public 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 interface InstrumentationProvider
Returns:

setOptions

public void setOptions(String options)
Description copied from interface: InstrumentationProvider
Sets configuration options for this provider

Specified by:
setOptions in interface InstrumentationProvider

getOptions

public String getOptions()
Description copied from interface: InstrumentationProvider
Gets configuration options for this provider

Specified by:
getOptions in interface InstrumentationProvider

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 interface InstrumentationProvider

initializeInstrument

public void initializeInstrument(Instrument instrument,
                                 Object context)
Description copied from interface: InstrumentationProvider
Initializes an instrument within the provided context.

Specified by:
initializeInstrument in interface InstrumentationProvider
Parameters:
instrument - an instrument
context - instrumentation context (factory, broker, config)

initializeInstrument

public void initializeInstrument(Instrument instrument,
                                 String options,
                                 Object context)
Description copied from interface: InstrumentationProvider
Initializes an instrument within the provided options and context.

Specified by:
initializeInstrument in interface InstrumentationProvider
Parameters:
instrument - an instrument
options - configuration options to provide the instrument during initialization
context - instrumentation context (factory, broker, config)

getInstrumentByName

public Instrument getInstrumentByName(String name)
Description copied from interface: InstrumentationProvider
Returns an instrument instrumented by this provider by name

Specified by:
getInstrumentByName in interface InstrumentationProvider
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: InstrumentationProvider
Gets all instruments instrumented by this provider

Specified by:
getInstruments in interface InstrumentationProvider
Returns:
instruments instrumented by this provider

stopInstruments

public void stopInstruments(InstrumentationLevel level,
                            Object context)
Description copied from interface: InstrumentationProvider
Stops all instruments of the specified instrumentation level and context.

Specified by:
stopInstruments in interface InstrumentationProvider
Parameters:
level - instrumentation level
context - instrumentation context (factory, broker, config)

startInstruments

public void startInstruments(InstrumentationLevel level,
                             Object context)
Description copied from interface: InstrumentationProvider
Starts all instruments of the specified instrumentation level and context.

Specified by:
startInstruments in interface InstrumentationProvider
Parameters:
level - instrumentation level
context - instrumentation context (factory, broker, config)

stopInstrument

public void stopInstrument(Instrument instrument)
Description copied from interface: InstrumentationProvider
Stops an instrument

Specified by:
stopInstrument in interface InstrumentationProvider
Parameters:
instrument - the instrument to stop

removeInstrumentByName

public void removeInstrumentByName(String name)
Description copied from interface: InstrumentationProvider
Removes an instrument instrumented by this provider by name

Specified by:
removeInstrumentByName in interface InstrumentationProvider
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 interface InstrumentationProvider
Returns:
true if the provider is started

setStarted

protected void setStarted(boolean started)

getInstrumentAliases

public 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 interface InstrumentationProvider
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 interface InstrumentationProvider

stop

public abstract void stop()
Description copied from interface: InstrumentationProvider
Starts the instrumentation provider

Specified by:
stop in interface InstrumentationProvider


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