Package uk.co.westhawk.snmp.beans
Class IsHostReachableBean
java.lang.Object
uk.co.westhawk.snmp.beans.SNMPBean
uk.co.westhawk.snmp.beans.IsHostReachableBean
- All Implemented Interfaces:
Observer
This bean will determine whether the host+port is up, by sending an UpSincePdu.
The properties in the parent classes should be set, before calling the action() method. Via a PropertyChangeEvent the application/applet will be notified.
- Version:
- $Revision: 1.14 $ $Date: 2006/01/26 12:38:59 $
- Author:
- Birgit Arkesteijn
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionThe default constructor.IsHostReachableBean
(String h, int p) The constructor that will set the host and the port no.IsHostReachableBean
(String h, int p, String b) The constructor that will set the host, the port no and the local bind address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
action()
This method actually performs the request.void
Destroys the context.Returns the date when the host went up.boolean
Indicates whether the host + port is reachable.void
update
(Observable obs, Object ov) The update method according to the Observer interface, it will be called when the Pdu response is received.void
This method performs the request and wait for it.Methods inherited from class uk.co.westhawk.snmp.beans.SNMPBean
addPropertyChangeListener, getBindAddress, getCommunityName, getHost, getMessage, getPort, getSocketType, removePropertyChangeListener, setBindAddress, setCommunityName, setHost, setPort, setPort, setSocketType
-
Constructor Details
-
IsHostReachableBean
public IsHostReachableBean()The default constructor. -
IsHostReachableBean
The constructor that will set the host and the port no.- Parameters:
h
- the hostnamep
- the port no- See Also:
-
IsHostReachableBean
The constructor that will set the host, the port no and the local bind address.- Parameters:
h
- the hostnamep
- the port nob
- the local bind address- Since:
- 4_14
- See Also:
-
-
Method Details
-
getUpSinceDate
Returns the date when the host went up. This might be null is no answer is received yet.- Returns:
- the date
- See Also:
-
isReachable
public boolean isReachable()Indicates whether the host + port is reachable. The host + port is reachable if a valid response is received from a UpSincePdu request.- Returns:
- is the host + port + community name valid
- See Also:
-
waitForSelfAction
This method performs the request and wait for it. It is not recommended to use the waitForSelf option, preferred is the action() method. Use it if it is really necessary to wait.- Throws:
PduException
IOException
- See Also:
-
action
This method actually performs the request. All properties should be set before this method is called. This will create a new SnmpContext and send a UpSincePdu SNMP request. If the connection fails, the reachable property will be set to false.- Specified by:
action
in classSNMPBean
- Throws:
PduException
IOException
- See Also:
-
update
The update method according to the Observer interface, it will be called when the Pdu response is received. If there is no error it means that the host is reachable. If it is not reachable the message will contain the type of error, if it is reachable the message will say since when the host is up. -
freeResources
public void freeResources()Destroys the context.- Since:
- 4_14
-