SNMP Stack 4_12

uk.co.westhawk.snmp.beans
Class SNMPRunBean

java.lang.Object
  |
  +--uk.co.westhawk.snmp.beans.SNMPBean
        |
        +--uk.co.westhawk.snmp.beans.SNMPRunBean
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AnnexModemStatusBean, AscendActiveSessionBean, DialogChannelStatusBean, InterfaceIndexesBean, NTPrintQBean, NTServiceNamesBean, NTSharedResBean, NTUserNamesBean, OneInterfaceBean, OneNTPrintQBean, OneNTServiceBean, OneNTSharedResBean

public abstract class SNMPRunBean
extends SNMPBean
implements java.lang.Runnable

This bean forms the base of the Runnable SNMP beans. It extends the SNMPBean class.

This bean is used when SNMP requests have to be send continuously, instead of just once. For that purpose the update interval setUpdateInterval() can be set. The default value is 2000, ie 2 msec.

When implementing an extention of this class, the method action() should be implemented. It should somehow start the run by calling setRunning(true). Stopping the thread might be called by the application or applet.

Version:
$Revision: 1.6 $ $Date: 2002/10/10 15:13:56 $
Author:
Birgit Arkesteijn
See Also:
OneInterfaceBean, InterfaceIndexesBean

Field Summary
protected  int interval
           
protected  java.lang.Thread me
           
protected  boolean running
           
 
Fields inherited from class uk.co.westhawk.snmp.beans.SNMPBean
community, context, host, message, port, propertyChangeListener
 
Constructor Summary
SNMPRunBean()
          The default constructor
 
Method Summary
 int getUpdateInterval()
          Returns the update interval.
 boolean isRunning()
          Returns if the bean is running.
abstract  void run()
          Method according to the Runnable interface.
 void setRunning(boolean b)
          Starts or stops the thread.
 void setUpdateInterval(int i)
          Sets the update interval.
 void setUpdateInterval(java.lang.String i)
          Sets the update interval as String.
 
Methods inherited from class uk.co.westhawk.snmp.beans.SNMPBean
action, 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
 

Field Detail

interval

protected int interval

me

protected java.lang.Thread me

running

protected boolean running
Constructor Detail

SNMPRunBean

public SNMPRunBean()
The default constructor
Method Detail

run

public abstract void run()
Method according to the Runnable interface. This method should provide the continuous sending of a Pdu, with a sleeping interval set by setUpdateInterval().
Specified by:
run in interface java.lang.Runnable
See Also:
setUpdateInterval(int), setRunning(boolean)

getUpdateInterval

public int getUpdateInterval()
Returns the update interval. This is the interval that the bean will sleep between 2 requests.
Returns:
the update interval in msec
See Also:
setUpdateInterval(int), setUpdateInterval(String)

setUpdateInterval

public void setUpdateInterval(int i)
Sets the update interval. This is the interval that the bean will sleep between 2 requests. The default will be 2000 (= 2 sec).
Parameters:
i - the interval in msec
See Also:
getUpdateInterval(), setUpdateInterval(String)

setUpdateInterval

public void setUpdateInterval(java.lang.String i)
Sets the update interval as String.
Parameters:
i - the interval in msec as String
See Also:
getUpdateInterval(), setUpdateInterval(int)

isRunning

public boolean isRunning()
Returns if the bean is running.
Returns:
the running mode
See Also:
setRunning(boolean)

setRunning

public void setRunning(boolean b)
Starts or stops the thread. Starting this thread should be a result of calling the action() method, so should be implemented in the action method of any child class. Stopping this thread may be called by the application of applet. This method does NOT call Thread.stop() anymore. Every run() method should check isRunning(), so that when setRunning(false) is called, the run() method will stop running!!
See Also:
isRunning(), SNMPBean.action()

SNMP Stack 4_12