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

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

public class JProbeManager
extends Object
implements JasmineProbeManager, ProbeManager, JProbeManagerMXBean

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

Author:
durieuxp, danesa

Field Summary
protected  SchedulerService jasmineProbeScheduler
           
protected  org.ow2.jonas.jmx.JmxService jmxService
           
protected static org.ow2.util.log.Log logger
           
 
Constructor Summary
JProbeManager()
           
 
Method Summary
 void addDefaultOutput(String name)
           
 void addProbeListener(JasmineProbeListener listener)
          Register a ProbeListener in order to be notified by probe state changes.
protected  void bindAggregateService(JasmineAggregateService jas, org.osgi.framework.ServiceReference sr)
           
protected  void bindCollectorService(JasmineCollectorService jcs, org.osgi.framework.ServiceReference sr)
           
protected  void bindOuterService(JasmineOuterService jos, org.osgi.framework.ServiceReference sr)
           
 void changeIndicator(JasmineIndicator newdef)
          Change an indicator.
 void changeOutput(JasmineOutput newdef)
          Change an output.
 void changeProbe(JasmineProbe newdef)
          Change a Probe with new parameters All parameters that are not supplied rest unchanged.
 void changeProbePeriod(String probeId, int period)
          Set a new value for probe period
 void changeTarget(JasmineTarget newdef)
          Change a target.
 String createIndicator(JasmineIndicator newindic)
          Create a new Indicator
 String createIndicatorInternal(JasmineIndicator newindic, boolean check)
          Create a new Indicator
 String createOutput(JasmineOutput newoutput)
          Register a new Output in the ProbeManager A name is associated to the Output definition.
 String createProbe(JasmineProbe probe)
          Create a new probe defined by its data
 String createTarget(JasmineTarget newtarget)
          Create a new target
 JasmineAggregateService getAggregate(String key)
          Return the AggregateService for a given aggregate function
 List<String> getAggregateFuntions()
           
 JasmineCollector getCollector(String indicatorName, String probeid)
          Get a Collector by its Indicator name
 JasmineCollectorService getCollectorService(String type)
          Get the CollectorService for a given type
 String getDomainName()
           
 JasmineIndicator getIndicator(String name)
          Get an Indicator by its name
 Set<String> getIndicatorCurrentUse(String name)
          Get the list of probes using this indicator
 List<JasmineIndicator> getIndicators()
          Get all the Indicator definitions in one operation.
 List<JasmineIndicator> getIndicators(String type)
          Get the list of indicators having a given type.
 JasmineCollectorInfo getIndicatorTypeInfo(String type)
          Get all infiormation about the type of indicator
 Set<String> getIndicatorTypes()
           
 JasmineOuterService getOuterService(String type)
          Get the OuterService for a given type
 JasmineOutput getOutput(String id)
          Get an Output by its name
 Set<String> getOutputCurrentUse(String name)
          Get the list of probes using this output
 List<JasminePropertyInfo> getOutputPropertyInfos(String type)
          get the list of possible properties for Output, depending of its type.
 List<JasmineOutput> getOutputs()
          Get all the Output definitions in one operation.
 List<JasmineOutput> getOutputs(String type)
          Get the list of all outputs of a given type.
 Set<String> getOutputTypes()
           
 JasmineProbe getProbe(String probeId)
          Get a Probe by its name
 List<JasmineProbe> getProbes()
          Get all the Probe definitions in one operation.
 SchedulerService getScheduler()
          return the scheduler
 String getServerName()
           
 JasmineTarget getTarget(String name)
          Get a JasmineTarget by its name
 List<JasminePropertyInfo> getTargetPropertyInfos(String type)
          get the list of possible properties for Target, depending of its type.
 List<JasmineTarget> getTargets()
          Get all the Target definitions in one operation.
 Set<String> getTargetTypes()
           
 String[] listDefaultOutputs()
           
 String[] listIndicators(String type)
           
 String[] listOutputs(String type)
          Get the list of all outputs or of outputs having a given type
 String[] listProbes()
           
 String[] listTargets()
           
 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 removeDefaultOutput(String name)
           
 void removeIndicator(String name)
          remove an indicator
 void removeOutput(String name)
          remove an output.
 void removeProbe(String probeId)
          Remove a probe.
 void removeProbeListener(JasmineProbeListener listener)
          Remove a ProbeListener previously registered.
 void removeTarget(String name)
          remove a target
 void saveConfig(String path)
          Save the current configuration in the specified xml file
 void setProbeState(JProbe running, int state, String message)
          Notify a state change for that probe
 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(JasmineAggregateService jas, org.osgi.framework.ServiceReference sr)
           
protected  void unbindCollectorService(JasmineCollectorService jcs, org.osgi.framework.ServiceReference sr)
           
protected  void unbindOuterService(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 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(JasmineOuterService jos,
                                org.osgi.framework.ServiceReference sr)

unbindOuterService

protected void unbindOuterService(JasmineOuterService jos,
                                  org.osgi.framework.ServiceReference sr)

bindCollectorService

protected void bindCollectorService(JasmineCollectorService jcs,
                                    org.osgi.framework.ServiceReference sr)

unbindCollectorService

protected void unbindCollectorService(JasmineCollectorService jcs,
                                      org.osgi.framework.ServiceReference sr)

bindAggregateService

protected void bindAggregateService(JasmineAggregateService jas,
                                    org.osgi.framework.ServiceReference sr)

unbindAggregateService

protected void unbindAggregateService(JasmineAggregateService jas,
                                      org.osgi.framework.ServiceReference sr)

getScheduler

public SchedulerService getScheduler()
return the scheduler

Returns:
referencee on the SchedulerService

getOuterService

public JasmineOuterService getOuterService(String type)
Get the OuterService for a given type


getCollectorService

public JasmineCollectorService getCollectorService(String type)
Get the CollectorService for a given type


createProbe

public String createProbe(JasmineProbe probe)
                   throws JasmineProbeException
Create a new probe defined by its data

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

removeProbe

public void removeProbe(String probeId)
                 throws JasmineProbeException
Remove a probe.

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

removeAllProbes

public void removeAllProbes()
                     throws JasmineProbeException
Remove all the managed probes. Stop probe running before.

Specified by:
removeAllProbes in interface JProbeManagerMXBean
Throws:
JasmineProbeException

getProbes

public List<JasmineProbe> getProbes()
Get all the Probe definitions in one operation.

Specified by:
getProbes in interface JProbeManagerMXBean
Returns:
all the probe definitions

listProbes

public String[] listProbes()
Specified by:
listProbes in interface JProbeManagerMXBean
Returns:
all the probe ids

getProbe

public JasmineProbe getProbe(String probeId)
                      throws JasmineProbeException
Get a Probe by its name

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

startProbe

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

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

stopProbe

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

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

startAllProbes

public void startAllProbes()
                    throws JasmineProbeException
Start all the managed probes.

Specified by:
startAllProbes in interface JProbeManagerMXBean
Throws:
JasmineProbeException

stopAllProbes

public void stopAllProbes()
                   throws JasmineProbeException
Stop all the managed probes.

Specified by:
stopAllProbes in interface JProbeManagerMXBean
Throws:
JasmineProbeException

changeProbe

public void changeProbe(JasmineProbe newdef)
                 throws JasmineProbeException
Change a Probe with new parameters All parameters that are not supplied rest unchanged.

Specified by:
changeProbe in interface JProbeManagerMXBean
Parameters:
newdef - partial probe description
Throws:
JasmineProbeException

changeProbePeriod

public void changeProbePeriod(String probeId,
                              int period)
                       throws JasmineProbeException
Set a new value for probe period

Specified by:
changeProbePeriod in interface JProbeManagerMXBean
Parameters:
probeId - probe identifier.
period - in seconds
Throws:
JasmineProbeException

createOutput

public String createOutput(JasmineOutput newoutput)
                    throws 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 JProbeManagerMXBean
Parameters:
newoutput - output description
Returns:
the Id to be used to reference this output later.
Throws:
JasmineProbeException

changeOutput

public void changeOutput(JasmineOutput newdef)
                  throws JasmineProbeException
Change an output. The output must exist.

Specified by:
changeOutput in interface JProbeManagerMXBean
Parameters:
newdef - output changes description
Throws:
JasmineProbeException - is thrown if the output does not exist.

removeOutput

public void removeOutput(String name)
                  throws 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 JProbeManagerMXBean
Parameters:
name - ident of the output to remove
Throws:
JasmineProbeException - is thrown if the output does not exist, or if it is used by a running probe.

listOutputs

public String[] listOutputs(String type)
Get the list of all outputs or of outputs having a given type

Specified by:
listOutputs in interface JProbeManagerMXBean
Parameters:
type - the given type. If null, get all the outputs.

getOutputs

public List<JasmineOutput> getOutputs()
Get all the Output definitions in one operation.

Specified by:
getOutputs in interface JProbeManagerMXBean
Returns:
all the output definitions

addDefaultOutput

public void addDefaultOutput(String name)
                      throws JasmineProbeException
Specified by:
addDefaultOutput in interface JProbeManagerMXBean
Throws:
JasmineProbeException

listDefaultOutputs

public String[] listDefaultOutputs()
Specified by:
listDefaultOutputs in interface JProbeManagerMXBean

removeDefaultOutput

public void removeDefaultOutput(String name)
                         throws JasmineProbeException
Specified by:
removeDefaultOutput in interface JProbeManagerMXBean
Throws:
JasmineProbeException

getOutputs

public List<JasmineOutput> getOutputs(String type)
Get the list of all outputs of a given type.

Parameters:
type - the given output type
Returns:
List of the outputs having that type

getOutput

public JasmineOutput getOutput(String id)
                        throws JasmineProbeException
Get an Output by its name

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

getOutputPropertyInfos

public List<JasminePropertyInfo> getOutputPropertyInfos(String type)
get the list of possible properties for Output, depending of its type.

Specified by:
getOutputPropertyInfos in interface JProbeManagerMXBean
Parameters:
type - type of the Output (console, file, ...)
Returns:
List of JasminePropertyInfo

getOutputTypes

public Set<String> getOutputTypes()
Specified by:
getOutputTypes in interface JProbeManagerMXBean
Returns:
the available output types.

getOutputCurrentUse

public Set<String> getOutputCurrentUse(String name)
                                throws JasmineProbeException
Get the list of probes using this output

Specified by:
getOutputCurrentUse in interface JProbeManagerMXBean
Parameters:
name - Output name
Returns:
list of probe ids
Throws:
JasmineProbeException - bad parameter

createIndicator

public String createIndicator(JasmineIndicator newindic)
                       throws JasmineProbeException
Create a new Indicator

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

changeIndicator

public void changeIndicator(JasmineIndicator newdef)
                     throws JasmineProbeException
Change an indicator. It must exist.

Specified by:
changeIndicator in interface JProbeManagerMXBean
Parameters:
newdef - indicator description
Throws:
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 JasmineProbeException
remove an indicator

Specified by:
removeIndicator in interface JProbeManagerMXBean
Parameters:
name - ident of the indicator to remove
Throws:
JasmineProbeException

getIndicator

public JasmineIndicator getIndicator(String name)
                              throws JasmineProbeException
Get an Indicator by its name

Specified by:
getIndicator in interface JProbeManagerMXBean
Parameters:
name - indicator name.
Returns:
the definition
Throws:
JasmineProbeException

getIndicators

public List<JasmineIndicator> getIndicators()
Get all the Indicator definitions in one operation.

Specified by:
getIndicators in interface JProbeManagerMXBean
Returns:
all the indicator definitions

getIndicators

public List<JasmineIndicator> getIndicators(String type)
Get the list of indicators having a given type.

Parameters:
type - the given indicator type
Returns:
List of the indicators having that type

listIndicators

public String[] listIndicators(String type)
Specified by:
listIndicators in interface JProbeManagerMXBean
Returns:
all the indicator names

getIndicatorTypeInfo

public JasmineCollectorInfo getIndicatorTypeInfo(String type)
Get all infiormation about the type of indicator

Specified by:
getIndicatorTypeInfo in interface JProbeManagerMXBean
Parameters:
type - type of the Indicator (Jmx, Lewys, ...)
Returns:
JasmineIndicatorTypeInfo

getIndicatorTypes

public Set<String> getIndicatorTypes()
Specified by:
getIndicatorTypes in interface JProbeManagerMXBean
Returns:
the available indicator types.

getIndicatorCurrentUse

public Set<String> getIndicatorCurrentUse(String name)
                                   throws JasmineProbeException
Get the list of probes using this indicator

Specified by:
getIndicatorCurrentUse in interface JProbeManagerMXBean
Parameters:
name - Indicator name
Returns:
list of probe ids
Throws:
JasmineProbeException - bad parameter

createTarget

public String createTarget(JasmineTarget newtarget)
                    throws JasmineProbeException
Create a new target

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

changeTarget

public void changeTarget(JasmineTarget newdef)
                  throws JasmineProbeException
Change a target. It must exist, otherwise an exception is thrown.

Specified by:
changeTarget in interface JProbeManagerMXBean
Parameters:
newdef - new target description
Throws:
JasmineProbeException - is thrown if the target does not exist.

removeTarget

public void removeTarget(String name)
                  throws JasmineProbeException
remove a target

Specified by:
removeTarget in interface JProbeManagerMXBean
Parameters:
name - ident of the target to remove
Throws:
JasmineProbeException

listTargets

public String[] listTargets()
Specified by:
listTargets in interface JProbeManagerMXBean
Returns:
all the target names

getTargets

public List<JasmineTarget> getTargets()
Get all the Target definitions in one operation.

Specified by:
getTargets in interface JProbeManagerMXBean
Returns:
all the target definitions

getTarget

public JasmineTarget getTarget(String name)
Get a JasmineTarget by its name

Specified by:
getTarget in interface JProbeManagerMXBean
Specified by:
getTarget in interface ProbeManager
Parameters:
name -
Returns:
JasmineTarget definition

getTargetPropertyInfos

public List<JasminePropertyInfo> getTargetPropertyInfos(String type)
get the list of possible properties for Target, depending of its type.

Specified by:
getTargetPropertyInfos in interface JProbeManagerMXBean
Parameters:
type - type of the Target (jmx, ...)
Returns:
List of JasminePropertyInfo

getTargetTypes

public Set<String> getTargetTypes()
Specified by:
getTargetTypes in interface JProbeManagerMXBean
Returns:
the available indicator types.

addProbeListener

public void addProbeListener(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 JasmineProbeManager
Parameters:
listener - object that treats the probe state change

removeProbeListener

public void removeProbeListener(JasmineProbeListener listener)
Remove a ProbeListener previously registered.

Specified by:
removeProbeListener in interface JasmineProbeManager
Parameters:
listener - object that treats the probe state change

saveConfig

public void saveConfig(String path)
                throws JasmineProbeException
Save the current configuration in the specified xml file

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

loadConfig

public void loadConfig(String path)
                throws JasmineProbeException
Load the specified xml configuration file The configuration will be merged with the current one.

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

getCollector

public JasmineCollector getCollector(String indicatorName,
                                     String probeid)
                              throws JasmineProbeException
Get a Collector by its Indicator name

Specified by:
getCollector in interface ProbeManager
Parameters:
probeid -
indicatorName - indicator name
Returns:
The collector corresponding to an indicator.
Throws:
JasmineProbeException

getAggregateFuntions

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

getAggregate

public JasmineAggregateService getAggregate(String key)
Return the AggregateService for a given aggregate function

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

getDomainName

public String getDomainName()
Specified by:
getDomainName in interface ProbeManager
Returns:
the current domain name.

getServerName

public String getServerName()
Specified by:
getServerName in interface ProbeManager
Returns:
the current server name.

createIndicatorInternal

public String createIndicatorInternal(JasmineIndicator newindic,
                                      boolean check)
                               throws JasmineProbeException
Create a new Indicator

Parameters:
newindic - indicator description
check - true if check properties against the Collector (that should be there)
Returns:
the Id to be used to reference this indicator later.
Throws:
JasmineProbeException

setProbeState

public void setProbeState(JProbe running,
                          int state,
                          String message)
Notify a state change for that probe

Parameters:
running - probe
state - See JasmineProbe.state
message - Error message


Copyright © 2013 OW2 Consortium. All Rights Reserved.