org.ow2.jasmine.monitoring.mbeancmd.osgi.internal
Class ProbeServiceImpl

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.osgi.internal.ProbeServiceImpl
All Implemented Interfaces:
org.ow2.jasmine.probe.api.JasmineProbeManager

public class ProbeServiceImpl
extends java.lang.Object
implements org.ow2.jasmine.probe.api.JasmineProbeManager

This class exposes an OSGi service bundle that implements the JasmineProbeManager interface. It reads its configuration in a probe-config.xml file. Called today by the jasmine-eos module ProbeManager. It replaces the former part embedded in the jasmine eventswitch.

Author:
Philippe Durieux

Constructor Summary
ProbeServiceImpl(org.osgi.framework.BundleContext bc)
          Inject the BundleContext in the IPojo
 
Method Summary
 void addProbeListener(org.ow2.jasmine.probe.api.JasmineProbeListener listener)
          Register a ProbeListener in order to be notified by probe state changes.
 void changeOutput(org.ow2.jasmine.probe.api.JasmineOutput newoutput)
           
 void changeProbe(org.ow2.jasmine.probe.api.JasmineProbe newprobe)
           
 void changeTarget(org.ow2.jasmine.probe.api.JasmineTarget newtarget)
           
 void createOutput(org.ow2.jasmine.probe.api.JasmineOutput newoutput)
          Create a new Output
 int createProbe(org.ow2.jasmine.probe.api.JasmineProbe probe)
          Create a Probe defined by a JasmineProbe object value
 void createTarget(org.ow2.jasmine.probe.api.JasmineTarget newtarget)
          Create a new Target
 java.util.Collection<java.lang.String> execCommand(org.ow2.jasmine.probe.api.JasmineCommand command)
          Execute a command.
 java.util.Collection<java.lang.String> execMbeanCommand(org.ow2.jasmine.probe.api.JasmineMbeanCommand command)
          Execute a JasmineMbeanCommand
 org.ow2.jasmine.probe.api.JasmineOutput findOutput(java.lang.String name)
          Get an OutputProbe by its Id
 org.ow2.jasmine.probe.api.JasmineTarget findTarget(java.lang.String targetId)
          Get a TargetProbe by its Id
 java.util.Collection<org.ow2.jasmine.probe.api.JasmineOutput> getOutputs()
           
 java.util.Collection<org.ow2.jasmine.probe.api.JasmineProbe> getProbes()
           
 java.util.Collection<org.ow2.jasmine.probe.api.JasmineTarget> getTargets()
           
 void loadConfig(java.lang.String path)
          Load configuration from the specified file
 void publishChange(org.ow2.jasmine.probe.api.JasmineProbe probe)
           
 void removeAllProbes()
          Remove all probes
 void removeOutput(java.lang.String name)
          remove an output
 void removeProbe(int probeId)
           
 void removeTarget(java.lang.String name)
          remove an target
 void saveConfig(java.lang.String path)
          Save back configuration in probe-config.xml
 void start()
          Read the configuration when module is set.
 void startAllProbes()
          Start all the probes Continues starting probe even if one is in error (maybe already started)
 void startProbe(int probeId)
           
 void stop()
          module is invalidated.
 void stopAllProbes()
          Stop all the probes Continues stopping probe even if one is in error
 void stopProbe(int probeId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbeServiceImpl

public ProbeServiceImpl(org.osgi.framework.BundleContext bc)
Inject the BundleContext in the IPojo

Parameters:
bc -
Method Detail

start

public void start()
Read the configuration when module is set.


stop

public void stop()
module is invalidated.


createOutput

public void createOutput(org.ow2.jasmine.probe.api.JasmineOutput newoutput)
                  throws org.ow2.jasmine.probe.api.JasmineProbeException
Create a new Output

Specified by:
createOutput in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
newoutput - output description
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

changeOutput

public void changeOutput(org.ow2.jasmine.probe.api.JasmineOutput newoutput)
                  throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
changeOutput in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

removeOutput

public void removeOutput(java.lang.String name)
                  throws org.ow2.jasmine.probe.api.JasmineProbeException
remove an output

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

findOutput

public org.ow2.jasmine.probe.api.JasmineOutput findOutput(java.lang.String name)
Get an OutputProbe by its Id

Specified by:
findOutput in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
name - ident of the output

getOutputs

public java.util.Collection<org.ow2.jasmine.probe.api.JasmineOutput> getOutputs()
                                                                         throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
getOutputs in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

createTarget

public void createTarget(org.ow2.jasmine.probe.api.JasmineTarget newtarget)
                  throws org.ow2.jasmine.probe.api.JasmineProbeException
Create a new Target

Specified by:
createTarget in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
newtarget - target description
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

changeTarget

public void changeTarget(org.ow2.jasmine.probe.api.JasmineTarget newtarget)
                  throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
changeTarget in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

removeTarget

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

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

findTarget

public org.ow2.jasmine.probe.api.JasmineTarget findTarget(java.lang.String targetId)
Get a TargetProbe by its Id

Specified by:
findTarget in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
targetId - ident of the target

getTargets

public java.util.Collection<org.ow2.jasmine.probe.api.JasmineTarget> getTargets()
Specified by:
getTargets in interface org.ow2.jasmine.probe.api.JasmineProbeManager

createProbe

public int createProbe(org.ow2.jasmine.probe.api.JasmineProbe probe)
                throws org.ow2.jasmine.probe.api.JasmineProbeException
Create a Probe defined by a JasmineProbe object value

Specified by:
createProbe in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
probe - the object value
Returns:
allocated probe id
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

changeProbe

public void changeProbe(org.ow2.jasmine.probe.api.JasmineProbe newprobe)
                 throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
changeProbe in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

removeProbe

public void removeProbe(int probeId)
                 throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
removeProbe in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

removeAllProbes

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

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

startProbe

public void startProbe(int probeId)
                throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
startProbe in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

stopProbe

public void stopProbe(int probeId)
               throws org.ow2.jasmine.probe.api.JasmineProbeException
Specified by:
stopProbe in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

stopAllProbes

public void stopAllProbes()
                   throws org.ow2.jasmine.probe.api.JasmineProbeException
Stop all the probes Continues stopping probe even if one is in error

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

startAllProbes

public void startAllProbes()
                    throws org.ow2.jasmine.probe.api.JasmineProbeException
Start all the probes Continues starting probe even if one is in error (maybe already started)

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

getProbes

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

saveConfig

public void saveConfig(java.lang.String path)
                throws org.ow2.jasmine.probe.api.JasmineProbeException
Save back configuration in probe-config.xml

Specified by:
saveConfig in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
path - LATER: path where configuration will be saved.
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

loadConfig

public void loadConfig(java.lang.String path)
                throws org.ow2.jasmine.probe.api.JasmineProbeException
Load configuration from the specified file

Specified by:
loadConfig in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
path - File where config will be loaded
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException

execCommand

public java.util.Collection<java.lang.String> execCommand(org.ow2.jasmine.probe.api.JasmineCommand command)
                                                   throws org.ow2.jasmine.probe.api.JasmineProbeException
Execute a command.

Specified by:
execCommand in interface org.ow2.jasmine.probe.api.JasmineProbeManager
Parameters:
command - command definition containing the command's arguments
Returns:
the command's result if any, null otherwise.
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException - ..

addProbeListener

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

publishChange

public void publishChange(org.ow2.jasmine.probe.api.JasmineProbe probe)

execMbeanCommand

public java.util.Collection<java.lang.String> execMbeanCommand(org.ow2.jasmine.probe.api.JasmineMbeanCommand command)
                                                        throws org.ow2.jasmine.probe.api.JasmineProbeException
Execute a JasmineMbeanCommand

Parameters:
command - command definition containing the command's arguments
Returns:
the command's result if any, null otherwise.
Throws:
org.ow2.jasmine.probe.api.JasmineProbeException - ..


Copyright © 2011 OW2 Consortium. All Rights Reserved.