|
||||||||||
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.TestForSmtpServer
This class is designed to be used by the capabilities daemon to test for the existance of an SMTP 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 the plugin. |
private static int |
DEFAULT_PORT
The port on which the host is checked to see if it supports SMTP. |
Constructor Summary | |
TestForSmtpServer()
The default constructor for the 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 SMTP. |
boolean |
isProtocolSupported(InetAddress host,
int port)
Returns true if the host supports SMTP on the port specified. |
boolean |
isProtocolSupported(InetAddress host,
int port,
String capName)
Returns true if the host supports SMTP on the specified port and the capability specified is 'isSMTP' |
boolean |
isProtocolSupported(InetAddress host,
String capName)
Returns true if the host supports the classes protocol. |
private boolean |
isServer(InetAddress host,
int port)
Test to see if the passed host-port pair is the endpoint for an SMTP server. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final int DEFAULT_PORT
The port on which the host is checked to see if it supports SMTP.
private static final String CAPABILITY_NAME
The capability name for the plugin.
Constructor Detail |
public TestForSmtpServer()
The default constructor for the object. There is currently no data to be initialized in the constructor. It is present for completeness.
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 SMTP 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 SMTP server. If there is an SMTP 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 on the host.public boolean isProtocolSupported(InetAddress host)
Returns true if the host supports SMTP.
isProtocolSupported
in interface CapsdPlugin
host
- The InetAddress which is to be checked for SMTP supportpublic boolean isProtocolSupported(InetAddress host, int port)
Returns true if the host supports SMTP on the port specified.
host
- The InetAddress which is to be checked for SMTP support.port
- The port on which the SMTP test is to be done.public boolean isProtocolSupported(InetAddress host, String capName) throws UnsupportedProtocolException
Returns true if the host supports the classes protocol. If the protocl passed to the method is not supported by this instance the an exception is thrown to the caller.
isProtocolSupported
in interface CapsdPlugin
host
- The InetAddress which is to be checked for SMTP supportcapName
- The capability whose suport is to be checked forUnsupportedProtocolException
- Thrown
if capability specified is not supported by this instance.public boolean isProtocolSupported(InetAddress host, int port, String capName) throws UnsupportedProtocolException
Returns true if the host supports SMTP on the specified port and the capability specified is 'isSMTP'
host
- The InetAddress which is to be checked for SMTP supportport
- The port number to be used for the SMTP supportcapName
- The capability whose suport is to be checked forUnsupportedProtocolException
- Thrown
if capability specified is not supported by the instance.public String getCapabilityName()
Returns the capability name of the plugin poller. In this instance it will be the string "isSMTP".
getCapabilityName
in interface CapsdPlugin
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |