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

java.lang.Object
  |
  +--uk.org.iscream.cms.server.filter.ServiceCheckSkeleton
All Implemented Interfaces:
PluginServiceCheck
Direct Known Subclasses:
FTP__ServiceCheck, IMAP__ServiceCheck, POP3__ServiceCheck, SMTP__ServiceCheck, SSH__ServiceCheck, Telnet__ServiceCheck

public abstract class ServiceCheckSkeleton
extends Object
implements PluginServiceCheck

A skeleton class for Service Checks to extend.

Version:
$Id: ServiceCheckSkeleton.java,v 1.7 2002/05/21 16:47:17 tdb Exp $
Author:
$Author: tdb $

Constructor Summary
ServiceCheckSkeleton()
           
 
Method Summary
protected  String checkService(String hostname, int port, String expectedSubString, String XMLTag)
          Checks if a service is returning a valid response, and constructs suitable XML for inclusion in a packet.
protected  String connectToService(String hostname, int port)
          Connects to a service and returns the first line of text.
abstract  String getDescription()
          Used to query the Service Check to see what it does.
abstract  String runServiceCheck(String hostname)
          Runs a service check on a given hostname.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceCheckSkeleton

public ServiceCheckSkeleton()
Method Detail

runServiceCheck

public abstract String runServiceCheck(String hostname)
Runs a service check on a given hostname.

Specified by:
runServiceCheck in interface PluginServiceCheck
Parameters:
hostname - The hostname to check
Returns:
the XML containing results from the check

checkService

protected String checkService(String hostname,
                              int port,
                              String expectedSubString,
                              String XMLTag)
Checks if a service is returning a valid response, and constructs suitable XML for inclusion in a packet.

Parameters:
hostname - The hostname to query
port - The port to query
expectedSubString - The String to look for in the response
XMLTag - The name of the tag to be put in the XML
Returns:
The String of XML with the response information

connectToService

protected String connectToService(String hostname,
                                  int port)
                           throws IOException
Connects to a service and returns the first line of text.

Parameters:
hostname - The hostname of the service to check
port - The port of the service to check
Returns:
The first line of text given
Throws:
IOException - if the connection fails for some reason

getDescription

public abstract String getDescription()
Used to query the Service Check to see what it does.

Specified by:
getDescription in interface PluginServiceCheck
Returns:
the String representation of what the Service Check does


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