Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.co.westhawk.snmp.beans
Class AnnexModemStatusBean

    java.lang.Object
      |
      +--uk.co.westhawk.snmp.beans.SNMPBean
            |
            +--uk.co.westhawk.snmp.beans.SNMPRunBean
                  |
                  +--uk.co.westhawk.snmp.beans.AnnexModemStatusBean

All Implemented Interfaces:
  java.util.Observer, java.lang.Runnable, javax.swing.tree.TreeNode

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.

Version:
  $Revision: 1.22 $ $Date: 2006/03/23 14:54:09 $
Author:
  Birgit Arkesteijn
See Also:
  `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`

Field Summary
`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.

Fields inherited from class uk.co.westhawk.snmp.beans.SNMPRunBean
`interval, me, running`

Fields inherited from class uk.co.westhawk.snmp.beans.SNMPBean
`bindAddr, community, context, host, message, port, propertyChangeListener, socketType`

Constructor Summary
`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.

Method Summary
`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.

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, getBindAddress, getCommunityName, getHost, getMessage, getPort, getSocketType, isHostPortReachable, removePropertyChangeListener, setBindAddress, setCommunityName, setHost, setMessage, setPort, setPort, setSocketType`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### charPortIndex

    public static final java.lang.String charPortIndex

  A unique value for each character port. This perhaps corresponding to the same value of ifIndex when the character port is associated with a hardware port represented by an ifIndex.

  Syntax: INTEGER

  See the CHARACTER-MIB.

  See Also:
    Constant Field Values

### charPortName

    public static final java.lang.String charPortName

  An administratively assigned name for the port, typically with some local significance.

  Syntax: DisplayString

  See CHARACTER-MIB.

  See Also:
    Constant Field Values

### charPortOperStatus

    public static final java.lang.String charPortOperStatus

  The port's actual, operational state, independent of flow control.
  1. 'up' indicates able to function normally.
  2. 'down' indicates inability to function for administrative or operational reasons.
  3. 'maintenance' indicates a maintenance mode, exclusive of normal operation, such as running a test.
  4. 'absent' indicates that port hardware is not present.
  5. 'active' indicates up with a user present (e.g. logged in).

  '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.

  See Also:
    Constant Field Values

### rs232InSigState

    public static final java.lang.String rs232InSigState

  The current signal state.

  Syntax: INTEGER

  See RS-232-MIB.

  See Also:
    Constant Field Values

### portUP

    public static final int portUP

  charPortOperStatus up.

  See Also:
    Constant Field Values

### portDOWN

    public static final int portDOWN

  charPortOperStatus down.

  See Also:
    Constant Field Values

### portMAINTENANCE

    public static final int portMAINTENANCE

  charPortOperStatus maintenance.

  See Also:
    Constant Field Values

### portABSENT

    public static final int portABSENT

  charPortOperStatus absent.

  See Also:
    Constant Field Values

### portACTIVE

    public static final int portACTIVE

  charPortOperStatus active.

  See Also:
    Constant Field Values

### DCD

    public static final int DCD

  One of rs232InSigName values. If the dcd of rs232InSigState is on, that means that there is contact.

  See Also:
    Constant Field Values

### sigNONE

    public static final int sigNONE

  rs232InSigState none.

  See Also:
    Constant Field Values

### sigON

    public static final int sigON

  rs232InSigState on.

  See Also:
    Constant Field Values

### sigOFF

    public static final int sigOFF

  rs232InSigState off.

  See Also:
    Constant Field Values

### sig_state

    public static final java.lang.String[] sig_state

Constructor Detail

### AnnexModemStatusBean

    public AnnexModemStatusBean()

  The default constructor.

### AnnexModemStatusBean

    public AnnexModemStatusBean(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)`

### AnnexModemStatusBean

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

Parameters:
  `h` - the hostname
  `p` - the port no
  `b` - the local bind address
Since:
  4_14
See Also:
  `SNMPBean.setHost(java.lang.String)`, `SNMPBean.setPort(int)`, `SNMPBean.setBindAddress(java.lang.String)`

Method Detail

### 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

### getModemIndexes

    public java.util.Enumeration getModemIndexes()

  Returns the indexes (as Integers) of the voice modems that are open. Only the open voice modems of the card are saved. Use getPortStatus() or getPortStatusString() to get the status of the modem.

  See Also:
    `getPortStatus(java.lang.Long)`, `getPortStatusString(java.lang.Long)`

### getModemCount

    public int getModemCount()

  Returns the number of voice modems in the table.

### getPortName

    public java.lang.String getPortName(java.lang.Long index)

  Returns the name of the port.

  Parameters:
    `index` - The index of the port
  Returns:
    The name

### getPortStatus

    public int getPortStatus(java.lang.Long index)

  Returns the status of the modem as an int.

  Parameters:
    `index` - The index of the modem
  Returns:
    The status
  See Also:
    `getModemIndexes()`

### getPortStatusString

    public java.lang.String getPortStatusString(java.lang.Long index)

  Returns the String representation of the status of the modem.

  Parameters:
    `index` - The index of the modem
  Returns:
    The status
  See Also:
    `getModemIndexes()`

### children

    public java.util.Enumeration children()

  Returns the children of the reciever as an Enumeration.

  Specified by:
    `children` in interface `javax.swing.tree.TreeNode`

### getChildCount

    public int getChildCount()

  Returns the number of children `TreeNode`s the receiver contains.

  Specified by:
    `getChildCount` in interface `javax.swing.tree.TreeNode`

### getChildAt

    public javax.swing.tree.TreeNode getChildAt(int childIndex)

  Returns the child `TreeNode` at index `childIndex`.

  Specified by:
    `getChildAt` in interface `javax.swing.tree.TreeNode`

### getIndex

    public int getIndex(javax.swing.tree.TreeNode node)

  Returns the index of `node` in the receivers children. If the receiver does not contain `node`, -1 will be returned.

  Specified by:
    `getIndex` in interface `javax.swing.tree.TreeNode`

### getParent

    public javax.swing.tree.TreeNode getParent()

  Returns the parent `TreeNode` of the receiver.

  Specified by:
    `getParent` in interface `javax.swing.tree.TreeNode`

### getAllowsChildren

    public boolean getAllowsChildren()

  Returns true if the receiver allows children.

  Specified by:
    `getAllowsChildren` in interface `javax.swing.tree.TreeNode`

### isLeaf

    public boolean isLeaf()

  Returns true if the receiver is a leaf.

  Specified by:
    `isLeaf` in interface `javax.swing.tree.TreeNode`

### action

    public void action()

  This method starts the action of the bean. It will initialises all variables before starting.

  Specified by:
    `action` in class `SNMPBean`

### run

    public void run()

  Implements the running of the bean. It will send the Pdu, if the previous one is not still in flight.

  Specified by:
    `run` in interface `java.lang.Runnable`
  Specified by:
    `run` in class `SNMPRunBean`
  See Also:
    `SNMPRunBean.isRunning()`

### update

    public void update(java.util.Observable obs,
                       java.lang.Object ov)

  This method is called when the Pdu response is received. When all answers are received it will fire the property change event.

  Specified by:
    `update` in interface `java.util.Observer`

### setParent

    public void setParent(javax.swing.tree.TreeNode p)

  Sets the parent for this TreeNode. If the parent is not set, this class should be the root of the TreeModel.

### setDefaultTreeModel

    public void setDefaultTreeModel(javax.swing.tree.DefaultTreeModel model)

  Sets the DefaultTreeModel for this TreeNode. The tree model is used for notifying when any of the nodes were added, removed or changed.

### fireTreeModelChanged

    protected void fireTreeModelChanged()

  Fire the property event.

  See Also:
    `DefaultTreeModel.nodeStructureChanged(javax.swing.tree.TreeNode)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD