public class AnnexModemStatusBean extends SNMPRunBean implements java.util.Observer, javax.swing.tree.TreeNode
This bean is written for Remote Annex 2000 access server.
The server comes with the Xylogics specific MIBs, you can find them in the Annex software installation, I couldn't find them on the Web. I did not use them for this bean, however.
This bean uses the CHARACTER-MIB and RS-232-MIB.
This bean collects information about the modem status, connected to the server. It will only collect those modems (see charPortOperStatus) that are "up". It will then show if the modem is in use of not (see rs232InSigState).
You can get the data via the getModemIndexes() and getPortStatus(Long index) methods. This way you can visualise the data yourself.
You can also use the Swing JTree to visualise the modems. This bean implements the Swing TreeNode interface. The user has to set the setDefaultTreeModel, so this class can update all the nodes that are added, removed of changed. If this class is not the root of the JTree, you have to set the (TreeNode) parent of this class.
The properties in the parent classes should be set, before calling the action() method. Via a TreeModelEvent the application/applet will be notified.
We only have one Annex server, so I don't know how and if it works with more than 1. Please let us know if it doesn't work.
SNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
,
SNMPBean.setCommunityName(java.lang.String)
,
SNMPRunBean.setUpdateInterval(int)
,
SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener)
,
SNMPBean.action()
,
GetNextPdu_vec
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
charPortIndex
A unique value for each character port.
|
static java.lang.String |
charPortName
An administratively assigned name for the port, typically with
some local significance.
|
static java.lang.String |
charPortOperStatus
The port's actual, operational state, independent
of flow control.
|
static int |
DCD
One of rs232InSigName values.
|
static int |
portABSENT
charPortOperStatus absent.
|
static int |
portACTIVE
charPortOperStatus active.
|
static int |
portDOWN
charPortOperStatus down.
|
static int |
portMAINTENANCE
charPortOperStatus maintenance.
|
static int |
portUP
charPortOperStatus up.
|
static java.lang.String |
rs232InSigState
The current signal state.
|
static java.lang.String[] |
sig_state |
static int |
sigNONE
rs232InSigState none.
|
static int |
sigOFF
rs232InSigState off.
|
static int |
sigON
rs232InSigState on.
|
interval, me, running
bindAddr, community, context, host, message, port, propertyChangeListener, socketType
Constructor and Description |
---|
AnnexModemStatusBean()
The default constructor.
|
AnnexModemStatusBean(java.lang.String h,
int p)
The constructor that will set the host and the port no.
|
AnnexModemStatusBean(java.lang.String h,
int p,
java.lang.String b)
The constructor that will set the host, the port no and the local
bind address.
|
Modifier and Type | Method and Description |
---|---|
void |
action()
This method starts the action of the bean.
|
java.util.Enumeration |
children()
Returns the children of the reciever as an Enumeration.
|
protected void |
fireTreeModelChanged()
Fire the property event.
|
boolean |
getAllowsChildren()
Returns true if the receiver allows children.
|
javax.swing.tree.TreeNode |
getChildAt(int childIndex)
Returns the child
TreeNode at index
childIndex . |
int |
getChildCount()
Returns the number of children
TreeNode s the receiver
contains. |
int |
getIndex(javax.swing.tree.TreeNode node)
Returns the index of
node in the receivers children. |
java.util.Date |
getLastUpdateDate()
Returns the date of the moment when this bean was last updated.
|
int |
getModemCount()
Returns the number of voice modems in the table.
|
java.util.Enumeration |
getModemIndexes()
Returns the indexes (as Integers) of the voice modems that are
open.
|
javax.swing.tree.TreeNode |
getParent()
Returns the parent
TreeNode of the receiver. |
java.lang.String |
getPortName(java.lang.Long index)
Returns the name of the port.
|
int |
getPortStatus(java.lang.Long index)
Returns the status of the modem as an int.
|
java.lang.String |
getPortStatusString(java.lang.Long index)
Returns the String representation of the status of the modem.
|
boolean |
isLeaf()
Returns true if the receiver is a leaf.
|
void |
run()
Implements the running of the bean.
|
void |
setDefaultTreeModel(javax.swing.tree.DefaultTreeModel model)
Sets the DefaultTreeModel for this TreeNode.
|
void |
setParent(javax.swing.tree.TreeNode p)
Sets the parent for this TreeNode.
|
void |
update(java.util.Observable obs,
java.lang.Object ov)
This method is called when the Pdu response is received.
|
getUpdateInterval, isRunning, setRunning, setUpdateInterval, setUpdateInterval
addPropertyChangeListener, firePropertyChange, getBindAddress, getCommunityName, getHost, getMessage, getPort, getSocketType, isHostPortReachable, removePropertyChangeListener, setBindAddress, setCommunityName, setHost, setMessage, setPort, setPort, setSocketType
public static final java.lang.String charPortIndex
Syntax: INTEGER
See the CHARACTER-MIB.public static final java.lang.String charPortName
Syntax: DisplayString
See CHARACTER-MIB.public static final java.lang.String charPortOperStatus
'up' and 'active' correspond to ifOperStatus (rfc2863.mib) 'up'. 'down' and 'absent' correspond to ifOperStatus 'down'. 'maintenance' corresponds to ifOperStatus 'test'.
Syntax: INTEGER
See CHARACTER-MIB and IF-MIB-MIB.public static final java.lang.String rs232InSigState
Syntax: INTEGER
See RS-232-MIB.public static final int portUP
public static final int portDOWN
public static final int portMAINTENANCE
public static final int portABSENT
public static final int portACTIVE
public static final int DCD
public static final int sigNONE
public static final int sigON
public static final int sigOFF
public static final java.lang.String[] sig_state
public AnnexModemStatusBean()
public AnnexModemStatusBean(java.lang.String h, int p)
h
- the hostnamep
- the port noSNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
public AnnexModemStatusBean(java.lang.String h, int p, java.lang.String b)
h
- the hostnamep
- the port nob
- the local bind addressSNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
,
SNMPBean.setBindAddress(java.lang.String)
public java.util.Date getLastUpdateDate()
public java.util.Enumeration getModemIndexes()
public int getModemCount()
public java.lang.String getPortName(java.lang.Long index)
index
- The index of the portpublic int getPortStatus(java.lang.Long index)
index
- The index of the modemgetModemIndexes()
public java.lang.String getPortStatusString(java.lang.Long index)
index
- The index of the modemgetModemIndexes()
public java.util.Enumeration children()
children
in interface javax.swing.tree.TreeNode
public int getChildCount()
TreeNode
s the receiver
contains.getChildCount
in interface javax.swing.tree.TreeNode
public javax.swing.tree.TreeNode getChildAt(int childIndex)
TreeNode
at index
childIndex
.getChildAt
in interface javax.swing.tree.TreeNode
public int getIndex(javax.swing.tree.TreeNode node)
node
in the receivers children.
If the receiver does not contain node
, -1 will be
returned.getIndex
in interface javax.swing.tree.TreeNode
public javax.swing.tree.TreeNode getParent()
TreeNode
of the receiver.getParent
in interface javax.swing.tree.TreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface javax.swing.tree.TreeNode
public boolean isLeaf()
isLeaf
in interface javax.swing.tree.TreeNode
public void action()
public void run()
run
in interface java.lang.Runnable
run
in class SNMPRunBean
SNMPRunBean.isRunning()
public void update(java.util.Observable obs, java.lang.Object ov)
update
in interface java.util.Observer
public void setParent(javax.swing.tree.TreeNode p)
public void setDefaultTreeModel(javax.swing.tree.DefaultTreeModel model)
protected void fireTreeModelChanged()
DefaultTreeModel.nodeStructureChanged(javax.swing.tree.TreeNode)