Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 4_12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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 RFC 1658 (CHARACTER-MIB module) and RFC 1659 (RS-232-MIB module).

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.16 $ $Date: 2002/10/29 14:44:38 $
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`, `OneGetPdu`

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
`community, context, host, message, port, propertyChangeListener`

Constructor Summary
`AnnexModemStatusBean()` The default constructor.
`AnnexModemStatusBean(java.lang.String h, int p)` The constructor that will set the host and the port no.

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

### 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 rfc1658.mib .

### charPortName

    public static final java.lang.String charPortName

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

  Syntax: DisplayString

  See the rfc1658.mib .

### 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 the rfc1658.mib .

### rs232InSigState

    public static final java.lang.String rs232InSigState

  The current signal state.

  Syntax: INTEGER

  See the rfc1659.mib .

### portUP

    public static final int portUP

  charPortOperStatus up.

### portDOWN

    public static final int portDOWN

  charPortOperStatus down.

### portMAINTENANCE

    public static final int portMAINTENANCE

  charPortOperStatus maintenance.

### portABSENT

    public static final int portABSENT

  charPortOperStatus absent.

### portACTIVE

    public static final int portACTIVE

  charPortOperStatus active.

### DCD

    public static final int DCD

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

### sigNONE

    public static final int sigNONE

  rs232InSigState none.

### sigON

    public static final int sigON

  rs232InSigState on.

### sigOFF

    public static final int sigOFF

  rs232InSigState off.

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

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.
  Overrides:
    `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.
  Overrides:
    `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 4_12
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD