Class IsHostReachableBean

java.lang.Object
uk.co.westhawk.snmp.beans.SNMPBean
uk.co.westhawk.snmp.beans.IsHostReachableBean
All Implemented Interfaces:
Observer

public class IsHostReachableBean extends SNMPBean implements 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 Details

  • Method Details

    • getUpSinceDate

      public Date 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

      public void waitForSelfAction() throws PduException, IOException
      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

      public void action() throws PduException, IOException
      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 class SNMPBean
      Throws:
      PduException
      IOException
      See Also:
    • update

      public void update(Observable obs, Object ov)
      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.
      Specified by:
      update in interface Observer
    • freeResources

      public void freeResources()
      Destroys the context.
      Since:
      4_14