uk.org.iscream.cms.server.filter
Class PluginServiceCheckManager

java.lang.Object
  extended by uk.org.iscream.cms.server.filter.PluginServiceCheckManager

 class PluginServiceCheckManager
extends Object

This class setups up and manages Plugins for performing service checks. When asked to run some service checks it runs the checks on the service check pipeline for that host. If the pipleline does not exist it creates a new one. This is a singleton class. ### This does not fully manage the pipelines, it should check if a host has not heartbeated for a while and thus remove the pipeline. At the moment it does not. A suggestions for doing this is to use the getCreated() method on the PluginServiceCheckPipeline. This tells you when according to the system time the pipeline was created. You could then have a thread that periodically checks to see if a host has not run its pipeline in say two heartbeats, and thus this indicates that it is no longer running. The pipeline could then be removed from the hashmap and thus be eligable for gc. ###

Version:
$Id: PluginServiceCheckManager.java,v 1.10 2004/08/01 10:40:59 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  HashMap _hostPipelines
          A hash map containing host pipelines
private static PluginServiceCheckManager _instance
          A reference to the single instance of this class
private  HashMap _loadedServiceChecks
          A hash map containing host pipelines
private  Logger _logger
          This holds a reference to the system logger that is being used.
private  String _name
          This is the friendly identifier of the component this class is running in.
private  ReferenceManager _refman
          A reference to the reference manager in use
private  String _suffix
          file name suffix for plugin service check classes:
 String REVISION
          The current CVS revision of this class
 
Constructor Summary
private PluginServiceCheckManager()
          Private Constructor - this part creates the filter pipeline This is a singleton class, btw.
 
Method Summary
static PluginServiceCheckManager getInstance()
          Return a reference to the singleton class.
 PluginServiceCheck getServiceCheck(String className)
          Returns a reference to the specified service check.
 String runServiceChecks(String hostname)
          run all registered service checks on a given host, returning XML data with information about the check.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

_suffix

private final String _suffix
file name suffix for plugin service check classes:

See Also:
Constant Field Values

_hostPipelines

private HashMap _hostPipelines
A hash map containing host pipelines


_loadedServiceChecks

private HashMap _loadedServiceChecks
A hash map containing host pipelines


_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_logger

private Logger _logger
This holds a reference to the system logger that is being used.


_refman

private ReferenceManager _refman
A reference to the reference manager in use


_instance

private static PluginServiceCheckManager _instance
A reference to the single instance of this class

Constructor Detail

PluginServiceCheckManager

private PluginServiceCheckManager()
Private Constructor - this part creates the filter pipeline This is a singleton class, btw.

Method Detail

getInstance

public static PluginServiceCheckManager getInstance()
Return a reference to the singleton class. Construct it if it does not already exist, otherwise just return the reference.


runServiceChecks

public String runServiceChecks(String hostname)
run all registered service checks on a given host, returning XML data with information about the check.

Parameters:
hostname - the host to run service checks for
Returns:
the xml output from the service checks

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.util.NameFormat class to format the toString()

Overrides:
toString in class Object
Returns:
the name of this class and its CVS revision

getServiceCheck

public PluginServiceCheck getServiceCheck(String className)
Returns a reference to the specified service check. This method takes the name of the class that contains a service check implementation. It then checks to see if it has loaded that class before. If it has it returns a reference to it, if not, it loads it for the first time, remembers it, then returns that.

Parameters:
className - the PluginServiceCheck to be loaded
Returns:
the requested PluginServiceCheck


Copyright © 2000-2003 i-scream. All Rights Reserved.