SNMP Stack 4_12

uk.co.westhawk.snmp.beans
Class OneInterfaceBean

java.lang.Object
  |
  +--uk.co.westhawk.snmp.beans.SNMPBean
        |
        +--uk.co.westhawk.snmp.beans.SNMPRunBean
              |
              +--uk.co.westhawk.snmp.beans.OneInterfaceBean
All Implemented Interfaces:
java.util.Observer, java.lang.Runnable

public class OneInterfaceBean
extends SNMPRunBean
implements java.util.Observer

This bean collects information about one interface.

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.11 $ $Date: 2002/10/10 15:13:56 $
Author:
Birgit Arkesteijn
See Also:
SNMPBean.setHost(java.lang.String), SNMPBean.setPort(int), SNMPBean.setCommunityName(java.lang.String), SNMPRunBean.setUpdateInterval(int), setIndex(int), SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener), SNMPBean.action(), InterfacePdu, InterfaceIndexesBean

Fields inherited from class uk.co.westhawk.snmp.beans.SNMPRunBean
interval, me, running
 
Fields inherited from class uk.co.westhawk.snmp.beans.SNMPBean
community, context, host, message, port, propertyChangeListener
 
Constructor Summary
OneInterfaceBean()
          The default constructor.
OneInterfaceBean(java.lang.String h, int p)
          The constructor that will set the host and the port no.
 
Method Summary
 void action()
          This method starts sending the SNMP request.
 java.lang.String getDescription()
          Returns the description of the interface.
 int getIndex()
          Returns the index of the interface.
 java.util.Date getLastUpdateDate()
          Returns the date of the moment when this bean was last updated.
 java.lang.String getOperStatusString()
          Returns the operation state of the interface.
 long getSpeed()
          Returns the speed (bits per second) of the interface.
 void run()
          The run method according to the Runnable interface.
 void setIndex(int i)
          Sets the index of the interface that will be requested.
 void update(java.util.Observable obs, java.lang.Object ov)
          The update method according to the Observer interface, it will be called when the Pdu response is received.
 
Methods inherited from class uk.co.westhawk.snmp.beans.SNMPRunBean
getUpdateInterval, isRunning, setRunning, setUpdateInterval, setUpdateInterval
 
Methods inherited from class uk.co.westhawk.snmp.beans.SNMPBean
addPropertyChangeListener, firePropertyChange, getCommunityName, getHost, getMessage, getPort, isHostPortReachable, removePropertyChangeListener, setCommunityName, setHost, setMessage, setPort, setPort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneInterfaceBean

public OneInterfaceBean()
The default constructor.

OneInterfaceBean

public OneInterfaceBean(java.lang.String h,
                        int p)
The constructor that will set the host and the port no.
Parameters:
h - the hostname
p - the port no
See Also:
SNMPBean.setHost(java.lang.String), SNMPBean.setPort(int)
Method Detail

setIndex

public void setIndex(int i)
Sets the index of the interface that will be requested.
Parameters:
i - the index
See Also:
getIndex()

getIndex

public int getIndex()
Returns the index of the interface.
Returns:
the index
See Also:
setIndex(int)

getDescription

public java.lang.String getDescription()
Returns the description of the interface.
Returns:
the description

getOperStatusString

public java.lang.String getOperStatusString()
Returns the operation state of the interface.
Returns:
the operation state

getSpeed

public long getSpeed()
Returns the speed (bits per second) of the interface.
Returns:
the speed

getLastUpdateDate

public java.util.Date getLastUpdateDate()
Returns the date of the moment when this bean was last updated. This might be null when the first time the update was not finished.
Returns:
the last update date

action

public void action()
This method starts sending the SNMP request. All properties should be set before this method is called. The actual sending will take place in the run method. It makes a new snmp context and initialises all variables before starting.
Overrides:
action in class SNMPBean

run

public void run()
The run method according to the Runnable interface. This method will send the Pdu request, if the previous one is not still in flight.
Overrides:
run in class SNMPRunBean
See Also:
SNMPRunBean.isRunning()

update

public void update(java.util.Observable obs,
                   java.lang.Object ov)
The update method according to the Observer interface, it will be called when the Pdu response is received. The speed is calculated with the previous answer, after that the property change event is fired.
Specified by:
update in interface java.util.Observer
See Also:
SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener)

SNMP Stack 4_12