|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.bb.dp.capsd.plugin.TestForHttpServer
This class is designed to be used by the capabilities daemon to test for the existance of an HTTP server on remote interfaces. The class implements the CapsdPlugin interface that allows it to be used along with other plugins by the daemon.
Field Summary | |
private static String |
CAPABILITY_NAME
The capability name for this class. |
private static int[] |
DEFAULT_PORTS
The port on which the host is checked to see if it supports HTTP. |
Constructor Summary | |
TestForHttpServer()
The default constructor for the test object. |
Method Summary | |
String |
getCapabilityName()
Returns the capability name of the plugin poller. |
private String |
getLine(InputStream istream)
Reads a single line at a time from the input stream. |
boolean |
isProtocolSupported(InetAddress host)
Returns true if the host supports HTTP. |
boolean |
isProtocolSupported(InetAddress host,
int port)
Returns true if the host supports HTTP on the port specified. |
boolean |
isProtocolSupported(InetAddress host,
int port,
String capName)
Returns true if the host supports HTTP on the port specified and the capability specified is 'isHttp'. |
boolean |
isProtocolSupported(InetAddress host,
String capName)
Returns true if the host supports HTTP and the capability specified is 'isHttp'. |
private boolean |
isServer(InetAddress host,
int port)
Test to see if the passed host-port pair is the endpoint for an HTTP server. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int[] DEFAULT_PORTS
The port on which the host is checked to see if it supports HTTP.
private static final String CAPABILITY_NAME
The capability name for this class.
Constructor Detail |
public TestForHttpServer()
The default constructor for the test object. Currently this constructor does nothing since there is no data to initialize in the class.
Method Detail |
private String getLine(InputStream istream) throws IOException
Reads a single line at a time from the input stream. Each line is terminated by the sequence '\r\n'. For more information on the format of the line see the FTP RFC.
If the end of file condition is reached before the cariage-return line-feed sequence then the received buffer is returned, or a string of zero length.
NOTE: The \r\n sequence is stripped from the returned line.
istream
- The input stream from which characters are to be read.java.lang.IOException
- Thrown if an error occurs reading
the data from the stream.private boolean isServer(InetAddress host, int port)
Test to see if the passed host-port pair is the endpoint for an HTTP server. If there is an HTTP server at that destination then a value of true is returned from the method. Otherwise a false value is returned to the caller.
host
- The remote host to connect to.port
- The remote port to connect to.public boolean isProtocolSupported(InetAddress host)
Returns true if the host supports HTTP.
isProtocolSupported
in interface CapsdPlugin
host
- The InetAddress which is to be
checked for HTTP support on all well known ports for http.public boolean isProtocolSupported(InetAddress host, int port)
Returns true if the host supports HTTP on the port specified.
host
- The InetAddress which is to be checked for HTTP support.port
- The port on which the HTTP test is to be done.public boolean isProtocolSupported(InetAddress host, String capName) throws UnsupportedProtocolException
Returns true if the host supports HTTP and the capability specified is 'isHttp'.
isProtocolSupported
in interface CapsdPlugin
host
- The InetAddress which is to be checked for HTTP support.capName
- The capability whose suport is to be checked for.org.opennms.bb.db.capsd.plugin.UnsupportedProtocolException
- Thrown
if capability specified is not 'isHttp'public boolean isProtocolSupported(InetAddress host, int port, String capName) throws UnsupportedProtocolException
Returns true if the host supports HTTP on the port specified and the capability specified is 'isHttp'.
host
- The InetAddress which is to be checked for HTTP support.port
- The port number to be used for the HTTP support.capName
- The capability whose suport is to be checked for.org.opennms.bb.dp.capsd.pluing.UnsupportedProtocolException
- Thrown
if capability specified is not 'isHttp'.public String getCapabilityName()
Returns the capability name of the plugin poller. In this instance it will be the string "isHTTP".
getCapabilityName
in interface CapsdPlugin
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |