SNMP Stack 4_12

uk.co.westhawk.snmp.beans
Class NcdPerfDataBean

java.lang.Object
  |
  +--uk.co.westhawk.snmp.beans.SNMPBean
        |
        +--uk.co.westhawk.snmp.beans.NcdPerfDataBean
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener

public class NcdPerfDataBean
extends SNMPBean
implements java.beans.PropertyChangeListener

This bean collects information about a IBM Network Computer.

A message will be set if some of the data is not available

This class uses the NCDware v3.2 MIB, which was very kindly provided to me by Network Computing Devices, inc (NCD). This MIB is an extention of the older versions of the MIB

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.10 $ $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), setUpdateInterval(int), setUpdateInterval(String), SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener), SNMPBean.action()

Field Summary
static java.lang.String memoryPropertyName
          Used as propertyName when a propertyChangeEvent is fired because the memory was updated
static java.lang.String messagePropertyName
          Used as propertyName when a propertyChangeEvent is fired because a message was set
static java.lang.String noLogin
          Used as name when no one is logged in.
static java.lang.String noName
          Used as name when the name is not available.
static java.lang.String speedPropertyName
          Used as propertyName when a propertyChangeEvent is fired because the speed was updated
static java.lang.String userPropertyName
          Used as propertyName when a propertyChangeEvent is fired because the user name was updated
 
Fields inherited from class uk.co.westhawk.snmp.beans.SNMPBean
community, context, host, message, port, propertyChangeListener
 
Constructor Summary
NcdPerfDataBean()
          The default constructor.
 
Method Summary
 void action()
          This method starts sending the SNMP request.
 java.util.Date getLastUpdateDate()
          Returns the date of the moment when this bean was last updated.
 long getMemory()
          Returns the amount of RAM memory in bytes which is currently available.
 long getSpeed()
          Returns the speed (bits per second) of the ethernet card interface.
 int getUpdateInterval()
          Returns the update interval.
 java.lang.String getUserName()
          Returns the login name of the user that is logged in.
 void propertyChange(java.beans.PropertyChangeEvent e)
          This method is called when a new value of the speed, memory, user or message is available.
protected  void setMessage(java.lang.String st)
          Returns the message (if any).
 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
addPropertyChangeListener, firePropertyChange, getCommunityName, getHost, getMessage, getPort, isHostPortReachable, removePropertyChangeListener, setCommunityName, setHost, setPort, setPort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

speedPropertyName

public static final java.lang.String speedPropertyName
Used as propertyName when a propertyChangeEvent is fired because the speed was updated

memoryPropertyName

public static final java.lang.String memoryPropertyName
Used as propertyName when a propertyChangeEvent is fired because the memory was updated

userPropertyName

public static final java.lang.String userPropertyName
Used as propertyName when a propertyChangeEvent is fired because the user name was updated

messagePropertyName

public static final java.lang.String messagePropertyName
Used as propertyName when a propertyChangeEvent is fired because a message was set

noLogin

public static final java.lang.String noLogin
Used as name when no one is logged in.

noName

public static final java.lang.String noName
Used as name when the name is not available.
Constructor Detail

NcdPerfDataBean

public NcdPerfDataBean()
The default constructor.
Method Detail

getSpeed

public long getSpeed()
Returns the speed (bits per second) of the ethernet card interface.
Returns:
the speed (b/s)

getMemory

public long getMemory()
Returns the amount of RAM memory in bytes which is currently available.
Returns:
the memory in bytes

getUserName

public java.lang.String getUserName()
Returns the login name of the user that is logged in.
Returns:
the user name
See Also:
noLogin, noName

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 3000 (= 3 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)

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

setMessage

protected void setMessage(java.lang.String st)
Description copied from class: SNMPBean
Returns the message (if any). The message is used to give the user feedback if anything is happened (usualy when something went wrong) with the connection.
Overrides:
setMessage in class SNMPBean
Following copied from class: uk.co.westhawk.snmp.beans.SNMPBean
Parameters:
st - the message string
See Also:
SNMPBean.getMessage()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
This method is called when a new value of the speed, memory, user or message is available. It will propagate this event to any listeners.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
See Also:
speedPropertyName, memoryPropertyName, userPropertyName, messagePropertyName

SNMP Stack 4_12