org.ow2.jasmine.probe.manager.internal
Class JProbeManager

java.lang.Object
  extended by org.ow2.jasmine.probe.manager.internal.JProbeManager
All Implemented Interfaces:
org.ow2.jasmine.probe.JasmineProbeManager, org.ow2.jasmine.probe.JProbeManagerMXBean, org.ow2.jasmine.probe.probemanager.ProbeManager

public class JProbeManager
extends java.lang.Object
implements org.ow2.jasmine.probe.JasmineProbeManager, org.ow2.jasmine.probe.probemanager.ProbeManager, org.ow2.jasmine.probe.JProbeManagerMXBean

Implements the main service of the JasmineProbe module exposing the JasmineProbeManager interface to the JasmineProbe module's clients.

Author:
durieuxp

Field Summary
protected  org.ow2.jasmine.probe.probescheduler.SchedulerService jasmineProbeScheduler
           
protected  org.ow2.jonas.jmx.JmxService jmxService
           
protected static org.ow2.util.log.Log logger
           
 
Constructor Summary
JProbeManager()
           
 
Method Summary
 void addProbeListener(org.ow2.jasmine.probe.JasmineProbeListener listener)
          Register a ProbeListener in order to be notified by probe state changes.
protected  void bindAggregateService(org.ow2.jasmine.probe.collector.JasmineAggregateService jas, org.osgi.framework.ServiceReference sr)
           
protected  void bindCollectorService(org.ow2.jasmine.probe.collector.JasmineCollectorService jcs, org.osgi.framework.ServiceReference sr)
           
protected  void bindOuterService(org.ow2.jasmine.probe.outer.JasmineOuterService jos, org.osgi.framework.ServiceReference sr)
           
 void changeIndicator(org.ow2.jasmine.probe.JasmineIndicator indic)
          Change an indicator.
 void changeOutput(org.ow2.jasmine.probe.JasmineOutput output)
          Change an output.
 void changeProbe(org.ow2.jasmine.probe.JasmineProbe probe)
          Change a Probe with new parameters
 void changeTarget(org.ow2.jasmine.probe.JasmineTarget newtarget)
          Change a target.
 java.lang.String createIndicator(org.ow2.jasmine.probe.JasmineIndicator newindic)
          Create a new Indicator
 java.lang.String createOutput(org.ow2.jasmine.probe.JasmineOutput newoutput)
          Register a new Output in the ProbeManager A name is associated to the Output definition.
 java.lang.String createProbe(org.ow2.jasmine.probe.JasmineProbe probe)
          Create a new probe defined by its data
 java.lang.String createTarget(org.ow2.jasmine.probe.JasmineTarget newtarget)
          Create a new target
 org.ow2.jasmine.probe.collector.JasmineAggregateService getAggregate(java.lang.String key)
          Return the AggregateService for a given aggregate function
 java.util.List<java.lang.String> getAggregateFuntions()
           
 org.ow2.jasmine.probe.collector.JasmineCollector getCollector(java.lang.String indicatorName, int period, java.lang.String probeid)
          Get a Collector by its Indicator name
 org.ow2.jasmine.probe.JasmineIndicator getIndicator(java.lang.String id)
          Get an Indicator by its name
 java.util.Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getIndicatorPropertyInfos(java.lang.String type)
          get the list of possible properties for Indicator, depending of its type.
 java.util.Collection<org.ow2.jasmine.probe.JasmineIndicator> getIndicators()
          get the list of all defined indicators.
 java.util.Set<java.lang.String> getIndicatorTypes()
           
 org.ow2.jasmine.probe.JasmineOutput getOutput(java.lang.String id)
          Get an Output by its name
 java.util.Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getOutputPropertyInfos(java.lang.String type)
          get the list of possible properties for Output, depending of its type.
 java.util.Collection<org.ow2.jasmine.probe.JasmineOutput> getOutputs()
          get the list of all defined outputs.
 java.util.Set<java.lang.String> getOutputTypes()
           
 org.ow2.jasmine.probe.JasmineProbe getProbe(java.lang.String probeId)
          Get a Probe by its name
 java.util.Collection<org.ow2.jasmine.probe.JasmineProbe> getProbes()
           
 org.ow2.jasmine.probe.JasmineTarget getTarget(java.lang.String name)
          Get a JasmineTarget by its name
 java.util.Collection<org.ow2.jasmine.probe.JasmineTarget> getTargets()
          get the list of all defined targets.
 java.lang.String[] listIndicators()
           
 java.lang.String[] listOutputs()
           
 java.lang.String[] listProbes()
           
 java.lang.String[] listTargets()
           
 void loadConfig(java.lang.String path)
          Load the specified xml configuration file The configuration will be merged with the current one.
 void removeAllProbes()
          Remove all the managed probes.
 void removeIndicator(java.lang.String name)
          remove an indicator
 void removeOutput(java.lang.String name)
          remove an output.
 void removeProbe(java.lang.String probeId)
          Remove a probe.
 void removeTarget(java.lang.String name)
          remove a target
 void saveConfig(java.lang.String path)
          Save the current configuration in the specified xml file
 void start()
           
 void startAllProbes()
          Start all the managed probes.
 void startProbe(java.lang.String probeId)
          Start a probe.
 void stop()
           
 void stopAllProbes()
          Stop all the managed probes.
 void stopProbe(java.lang.String probeId)
          Stop a probe.
protected  void unbindAggregateService(org.ow2.jasmine.probe.collector.JasmineAggregateService jas, org.osgi.framework.ServiceReference sr)
           
protected  void unbindCollectorService(org.ow2.jasmine.probe.collector.JasmineCollectorService jcs, org.osgi.framework.ServiceReference sr)
           
protected  void unbindOuterService(org.ow2.jasmine.probe.outer.JasmineOuterService jos, org.osgi.framework.ServiceReference sr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.ow2.util.log.Log logger

jasmineProbeScheduler

protected org.ow2.jasmine.probe.probescheduler.SchedulerService jasmineProbeScheduler

jmxService

protected org.ow2.jonas.jmx.JmxService jmxService
Constructor Detail

JProbeManager

public JProbeManager()
Method Detail

start

public void start()

stop

public void stop()

bindOuterService

protected void bindOuterService(org.ow2.jasmine.probe.outer.JasmineOuterService jos,
                                org.osgi.framework.ServiceReference sr)

unbindOuterService

protected void unbindOuterService(org.ow2.jasmine.probe.outer.JasmineOuterService jos,
                                  org.osgi.framework.ServiceReference sr)

bindCollectorService

protected void bindCollectorService(org.ow2.jasmine.probe.collector.JasmineCollectorService jcs,
                                    org.osgi.framework.ServiceReference sr)

unbindCollectorService

protected void unbindCollectorService(org.ow2.jasmine.probe.collector.JasmineCollectorService jcs,
                                      org.osgi.framework.ServiceReference sr)

bindAggregateService

protected void bindAggregateService(org.ow2.jasmine.probe.collector.JasmineAggregateService jas,
                                    org.osgi.framework.ServiceReference sr)

unbindAggregateService

protected void unbindAggregateService(org.ow2.jasmine.probe.collector.JasmineAggregateService jas,
                                      org.osgi.framework.ServiceReference sr)

createProbe

public java.lang.String createProbe(org.ow2.jasmine.probe.JasmineProbe probe)
                             throws org.ow2.jasmine.probe.JasmineProbeException
Create a new probe defined by its data

Specified by:
createProbe in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
probe - probe description
Returns:
the Id to be used to reference this probe later.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

changeProbe

public void changeProbe(org.ow2.jasmine.probe.JasmineProbe probe)
                 throws org.ow2.jasmine.probe.JasmineProbeException
Change a Probe with new parameters

Specified by:
changeProbe in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
probe - probe description
Throws:
org.ow2.jasmine.probe.JasmineProbeException

removeProbe

public void removeProbe(java.lang.String probeId)
                 throws org.ow2.jasmine.probe.JasmineProbeException
Remove a probe.

Specified by:
removeProbe in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
probeId - probe identifier.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

removeAllProbes

public void removeAllProbes()
                     throws org.ow2.jasmine.probe.JasmineProbeException
Remove all the managed probes.

Specified by:
removeAllProbes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getProbes

public java.util.Collection<org.ow2.jasmine.probe.JasmineProbe> getProbes()
Specified by:
getProbes in interface org.ow2.jasmine.probe.JasmineProbeManager
Returns:
all the probe definitions

listProbes

public java.lang.String[] listProbes()
Specified by:
listProbes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
all the probe ids

getProbe

public org.ow2.jasmine.probe.JasmineProbe getProbe(java.lang.String probeId)
                                            throws org.ow2.jasmine.probe.JasmineProbeException
Get a Probe by its name

Specified by:
getProbe in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
probeId - probe identifier.
Returns:
the Probe definition
Throws:
org.ow2.jasmine.probe.JasmineProbeException

startProbe

public void startProbe(java.lang.String probeId)
                throws org.ow2.jasmine.probe.JasmineProbeException
Start a probe.

Specified by:
startProbe in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
probeId - probe identifier.
Throws:
org.ow2.jasmine.probe.JasmineProbeException - the probe could not be started.

stopProbe

public void stopProbe(java.lang.String probeId)
               throws org.ow2.jasmine.probe.JasmineProbeException
Stop a probe.

Specified by:
stopProbe in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
probeId - probe identifier.
Throws:
org.ow2.jasmine.probe.JasmineProbeException - the probe could not be stopped.

startAllProbes

public void startAllProbes()
                    throws org.ow2.jasmine.probe.JasmineProbeException
Start all the managed probes.

Specified by:
startAllProbes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Throws:
org.ow2.jasmine.probe.JasmineProbeException

stopAllProbes

public void stopAllProbes()
                   throws org.ow2.jasmine.probe.JasmineProbeException
Stop all the managed probes.

Specified by:
stopAllProbes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Throws:
org.ow2.jasmine.probe.JasmineProbeException

createOutput

public java.lang.String createOutput(org.ow2.jasmine.probe.JasmineOutput newoutput)
                              throws org.ow2.jasmine.probe.JasmineProbeException
Register a new Output in the ProbeManager A name is associated to the Output definition. This Output will be usable later in probes.

Specified by:
createOutput in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
newoutput - output description
Returns:
the Id to be used to reference this output later.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

changeOutput

public void changeOutput(org.ow2.jasmine.probe.JasmineOutput output)
                  throws org.ow2.jasmine.probe.JasmineProbeException
Change an output. The output must exist, otherwise an exception is thrown. The output must not be used by a probe, otherwise an exception is thrown.

Specified by:
changeOutput in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
output - output description
Throws:
org.ow2.jasmine.probe.JasmineProbeException - is thrown if the output does not exist, or if it is used by a running probe.

removeOutput

public void removeOutput(java.lang.String name)
                  throws org.ow2.jasmine.probe.JasmineProbeException
remove an output. The output must exist, otherwise an exception is thrown. The output must not be used by a probe, otherwise an exception is thrown.

Specified by:
removeOutput in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
name - ident of the output to remove
Throws:
org.ow2.jasmine.probe.JasmineProbeException - is thrown if the output does not exist, or if it is used by a running probe.

listOutputs

public java.lang.String[] listOutputs()
Specified by:
listOutputs in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
all the output names

getOutputs

public java.util.Collection<org.ow2.jasmine.probe.JasmineOutput> getOutputs()
get the list of all defined outputs.

Specified by:
getOutputs in interface org.ow2.jasmine.probe.JasmineProbeManager
Returns:
List of the outputs

getOutput

public org.ow2.jasmine.probe.JasmineOutput getOutput(java.lang.String id)
                                              throws org.ow2.jasmine.probe.JasmineProbeException
Get an Output by its name

Specified by:
getOutput in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
id - output identifier.
Returns:
the Output definition
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getOutputPropertyInfos

public java.util.Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getOutputPropertyInfos(java.lang.String type)
get the list of possible properties for Output, depending of its type.

Specified by:
getOutputPropertyInfos in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
type - type of the Output (console, file, ...)
Returns:
Collection of JasminePropertyInfo

getOutputTypes

public java.util.Set<java.lang.String> getOutputTypes()
Specified by:
getOutputTypes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
the available output types.

createIndicator

public java.lang.String createIndicator(org.ow2.jasmine.probe.JasmineIndicator newindic)
                                 throws org.ow2.jasmine.probe.JasmineProbeException
Create a new Indicator

Specified by:
createIndicator in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
newindic - indicator description
Returns:
the Id to be used to reference this indicator later.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

changeIndicator

public void changeIndicator(org.ow2.jasmine.probe.JasmineIndicator indic)
                     throws org.ow2.jasmine.probe.JasmineProbeException
Change an indicator. It must exist, otherwise an exception is thrown. The indicator must not be used by a probe, otherwise an exception is thrown.

Specified by:
changeIndicator in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
indic - indicator description
Throws:
org.ow2.jasmine.probe.JasmineProbeException - is thrown if the indicator does not exist, or if it is used by a running probe.

removeIndicator

public void removeIndicator(java.lang.String name)
                     throws org.ow2.jasmine.probe.JasmineProbeException
remove an indicator

Specified by:
removeIndicator in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
name - ident of the indicator to remove
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getIndicator

public org.ow2.jasmine.probe.JasmineIndicator getIndicator(java.lang.String id)
                                                    throws org.ow2.jasmine.probe.JasmineProbeException
Get an Indicator by its name

Specified by:
getIndicator in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
id - identifier.
Returns:
the definition
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getIndicators

public java.util.Collection<org.ow2.jasmine.probe.JasmineIndicator> getIndicators()
get the list of all defined indicators.

Specified by:
getIndicators in interface org.ow2.jasmine.probe.JasmineProbeManager
Returns:
List of the indicators

listIndicators

public java.lang.String[] listIndicators()
Specified by:
listIndicators in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
all the indicator names

getIndicatorPropertyInfos

public java.util.Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getIndicatorPropertyInfos(java.lang.String type)
get the list of possible properties for Indicator, depending of its type.

Specified by:
getIndicatorPropertyInfos in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
type - type of the Indicator (jmx, lewys, ...)
Returns:
Collection of JasminePropertyInfo

getIndicatorTypes

public java.util.Set<java.lang.String> getIndicatorTypes()
Specified by:
getIndicatorTypes in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
the available indicator types.

createTarget

public java.lang.String createTarget(org.ow2.jasmine.probe.JasmineTarget newtarget)
                              throws org.ow2.jasmine.probe.JasmineProbeException
Create a new target

Specified by:
createTarget in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
newtarget - target description
Returns:
the Id to be used to reference this target later.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

changeTarget

public void changeTarget(org.ow2.jasmine.probe.JasmineTarget newtarget)
                  throws org.ow2.jasmine.probe.JasmineProbeException
Change a target. It must exist, otherwise an exception is thrown.

Specified by:
changeTarget in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
newtarget - new target description
Throws:
org.ow2.jasmine.probe.JasmineProbeException - is thrown if the target does not exist.

removeTarget

public void removeTarget(java.lang.String name)
                  throws org.ow2.jasmine.probe.JasmineProbeException
remove a target

Specified by:
removeTarget in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
name - ident of the target to remove
Throws:
org.ow2.jasmine.probe.JasmineProbeException

listTargets

public java.lang.String[] listTargets()
Specified by:
listTargets in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Returns:
all the target names

getTargets

public java.util.Collection<org.ow2.jasmine.probe.JasmineTarget> getTargets()
get the list of all defined targets.

Specified by:
getTargets in interface org.ow2.jasmine.probe.JasmineProbeManager
Returns:
List of the targets

getTarget

public org.ow2.jasmine.probe.JasmineTarget getTarget(java.lang.String name)
Get a JasmineTarget by its name

Specified by:
getTarget in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Specified by:
getTarget in interface org.ow2.jasmine.probe.probemanager.ProbeManager
Parameters:
name -
Returns:
JasmineTarget definition

addProbeListener

public void addProbeListener(org.ow2.jasmine.probe.JasmineProbeListener listener)
Register a ProbeListener in order to be notified by probe state changes. Maybe other events will be considered...

Specified by:
addProbeListener in interface org.ow2.jasmine.probe.JasmineProbeManager
Parameters:
listener - object that treats the probe state change

saveConfig

public void saveConfig(java.lang.String path)
                throws org.ow2.jasmine.probe.JasmineProbeException
Save the current configuration in the specified xml file

Specified by:
saveConfig in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
path - the xml file, or null if saved in the default configuration file.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

loadConfig

public void loadConfig(java.lang.String path)
                throws org.ow2.jasmine.probe.JasmineProbeException
Load the specified xml configuration file The configuration will be merged with the current one.

Specified by:
loadConfig in interface org.ow2.jasmine.probe.JProbeManagerMXBean
Parameters:
path - the xml file.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getCollector

public org.ow2.jasmine.probe.collector.JasmineCollector getCollector(java.lang.String indicatorName,
                                                                     int period,
                                                                     java.lang.String probeid)
                                                              throws org.ow2.jasmine.probe.JasmineProbeException
Get a Collector by its Indicator name

Specified by:
getCollector in interface org.ow2.jasmine.probe.probemanager.ProbeManager
Parameters:
indicatorName - indicator name
period - the period of the probe using the indicator
probeid -
Returns:
The collector corresponding to an indicator.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getAggregateFuntions

public java.util.List<java.lang.String> getAggregateFuntions()
Specified by:
getAggregateFuntions in interface org.ow2.jasmine.probe.probemanager.ProbeManager
Returns:
If AggregateServices exist, return the functions these services implement (the values of aggregate.type properties). Else, return null.

getAggregate

public org.ow2.jasmine.probe.collector.JasmineAggregateService getAggregate(java.lang.String key)
Return the AggregateService for a given aggregate function

Specified by:
getAggregate in interface org.ow2.jasmine.probe.probemanager.ProbeManager
Parameters:
key - the aggregate function that is searched
Returns:
the AggregateService having aggregate.type equal to key. Else, return null.


Copyright © 2011 OW2 Consortium. All Rights Reserved.