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

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

public class JProbeManagerImpl
extends Object
implements org.ow2.jasmine.probe.JasmineProbeManager, org.ow2.jasmine.probe.probemanager.ProbeManager

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 static org.ow2.util.log.Log logger
           
 
Constructor Summary
JProbeManagerImpl()
           
 
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.
 String createIndicator(org.ow2.jasmine.probe.JasmineIndicator newindic)
          Create a new Indicator
 String createOutput(org.ow2.jasmine.probe.JasmineOutput newoutput)
          Register a new Output in the ProbeManager A name is associated to the Output definition.
 String createProbe(org.ow2.jasmine.probe.JasmineProbe probe)
          Create a new probe defined by its data
 String createTarget(org.ow2.jasmine.probe.JasmineTarget newtarget)
          Create a new target
 org.ow2.jasmine.probe.collector.JasmineAggregateService getAggregate(String key)
          Return the AggregateService for a given aggregate function
 List<String> getAggregateFuntions()
           
 org.ow2.jasmine.probe.collector.JasmineCollector getCollector(String indicatorName, int period, String probeid)
          Get a Collector by its Indicator name
 Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getIndicatorPropertyInfos(String type)
          get the list of possible properties for Indicator, depending of its type.
 Collection<org.ow2.jasmine.probe.JasmineIndicator> getIndicators()
          get the list of all defined indicators.
 org.ow2.jasmine.probe.JasmineOutput getOutput(String name)
          get a given output's definition
 Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getOutputPropertyInfos(String type)
          get the list of possible properties for Output, depending of its type.
 Collection<org.ow2.jasmine.probe.JasmineOutput> getOutputs()
          get the list of all defined outputs.
 Collection<org.ow2.jasmine.probe.JasmineProbe> getProbes()
           
 org.ow2.jasmine.probe.JasmineTarget getTarget(String name)
          Get a JasmineTarget by its name
 Collection<org.ow2.jasmine.probe.JasmineTarget> getTargets()
          get the list of all defined targets.
 void loadConfig(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(String name)
          remove an indicator
 void removeOutput(String name)
          remove an output.
 void removeProbe(String probeId)
          Remove a probe.
 void removeTarget(String name)
          remove a target
 void saveConfig(String path)
          Save the current configuration in the specified xml file
 void start()
           
 void startAllProbes()
          Start all the managed probes.
 void startProbe(String probeId)
          Start a probe.
 void stop()
           
 void stopAllProbes()
          Stop all the managed probes.
 void stopProbe(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
Constructor Detail

JProbeManagerImpl

public JProbeManagerImpl()
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 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.JasmineProbeManager
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(String probeId)
                 throws org.ow2.jasmine.probe.JasmineProbeException
Remove a probe.

Specified by:
removeProbe in interface org.ow2.jasmine.probe.JasmineProbeManager
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.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getProbes

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

startProbe

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

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

stopProbe

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

Specified by:
stopProbe in interface org.ow2.jasmine.probe.JasmineProbeManager
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.JasmineProbeManager
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.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.JasmineProbeException

createOutput

public 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.JasmineProbeManager
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(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.JasmineProbeManager
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.

getOutputs

public 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(String name)
                                              throws org.ow2.jasmine.probe.JasmineProbeException
get a given output's definition

Parameters:
name - the output's name
Returns:
the output's definition
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getOutputPropertyInfos

public Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getOutputPropertyInfos(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

createIndicator

public 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.JasmineProbeManager
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(String name)
                     throws org.ow2.jasmine.probe.JasmineProbeException
remove an indicator

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

getIndicators

public 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

getIndicatorPropertyInfos

public Collection<org.ow2.jasmine.probe.JasminePropertyInfo> getIndicatorPropertyInfos(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

createTarget

public 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.JasmineProbeManager
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(String name)
                  throws org.ow2.jasmine.probe.JasmineProbeException
remove a target

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

getTargets

public 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

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(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.JasmineProbeManager
Parameters:
path - the xml file, or null if saved in the default configuration file.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

loadConfig

public void loadConfig(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.JasmineProbeManager
Parameters:
path - the xml file, or null if load the default configuration file.
Throws:
org.ow2.jasmine.probe.JasmineProbeException

getCollector

public org.ow2.jasmine.probe.collector.JasmineCollector getCollector(String indicatorName,
                                                                     int period,
                                                                     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 List<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(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.

getTarget

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

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


Copyright © 2011 OW2 Consortium. All Rights Reserved.