SNMP Stack 4_12

uk.co.westhawk.snmp.beans
Class DialogChannelStatusBean

java.lang.Object
  |
  +--uk.co.westhawk.snmp.beans.SNMPBean
        |
        +--uk.co.westhawk.snmp.beans.SNMPRunBean
              |
              +--uk.co.westhawk.snmp.beans.DialogChannelStatusBean
All Implemented Interfaces:
java.util.Observer, java.lang.Runnable, javax.swing.tree.TreeNode

public class DialogChannelStatusBean
extends SNMPRunBean
implements java.util.Observer, javax.swing.tree.TreeNode

This bean is written for a Dialogic card. The Dialogic MIBs come with their BoardWatch package. You will have to fill in a form before downloading it.

This bean collects information about the voice channel status of the Dialogic card. It will only collect those channels that are open.

You can get the data via the getChannelIndexes() and getChannelStatus(Integer index) methods. This way you can visualise the data yourself.

You can also use the Swing JTree to visualise the channels. 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 (1) Dialogics card, so I don't know how and if it works with more than 1 card. Please let us know if it doesn't work.

Version:
$Revision: 1.14 $ $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), SNMPRunBean.setUpdateInterval(int), SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener), SNMPBean.action(), GetNextPdu_vec

Field Summary
static int betweenFAXPages
           
static int blocked
           
static int callProgess
           
static int dialing
           
static java.lang.String dlgR4DeviceIndex
          A unique value for each R4 device contained by the host.
static java.lang.String dlgR4DeviceName
          Release 4 Device Name.
static java.lang.String dlgR4DeviceOpenCount
          An indication of how many instances of this device is currently opened.
static java.lang.String dlgR4DeviceType
          An indication of the type of the device.
static java.lang.String dlgR4VoiceChannelStatus
          Indicates current activity status on the (voice) channel.
static int dti
           
static int gettingDigits
           
static int gettingR2MF
           
static int hookState
           
static int idle
           
static int isdn
           
static int msi
           
static int playing
           
static int playTone
           
static int receivingFax
           
static int recording
           
static int sendingFax
           
static int unknown
           
static java.lang.String[] vch_status
           
static int voice
           
static int winking
           
 
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
DialogChannelStatusBean()
          The default constructor.
DialogChannelStatusBean(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.
 int getChannelCount()
          Returns the number of voice channels in the table.
 java.util.Enumeration getChannelIndexes()
          Returns the indexes (as Integers) of the voice channels that are open.
 java.lang.String getChannelName(java.lang.Integer index)
          Returns the name of the channel.
 int getChannelStatus(java.lang.Integer index)
          Returns the status of the channel as an int.
 java.lang.String getChannelStatusString(java.lang.Integer index)
          Returns the String representation of the status of the channel.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
 int getChildCount()
          Returns the number of children TreeNodes 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.
 javax.swing.tree.TreeNode getParent()
          Returns the parent TreeNode of the receiver.
 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

dlgR4DeviceIndex

public static final java.lang.String dlgR4DeviceIndex
A unique value for each R4 device contained by the host. The value for each R4 device must remain constant at least from one re-initialization of the agent to the next re-initialization. See the dlgr4dev.mib.

dlgR4DeviceName

public static final java.lang.String dlgR4DeviceName
Release 4 Device Name. This is the name the application will use when opening the device (e.g. dxxxB1C1, dtiB1T1, msiB1C1) See the dlgr4dev.mib.

dlgR4DeviceType

public static final java.lang.String dlgR4DeviceType
An indication of the type of the device.
  1. other - some other type of device unknown to the agent.
  2. voice - A voice channel device. An entry exits in the dlgR4VoiceTable for this device.
  3. dti - A DTI timeslot device. An entry exits in the dlgR4DTITable for this device.
  4. isdn - An ISDN B-Channel device. An entry exits in the dlgR4ISDNTable for this device.
  5. msi - An MSI station set device. An entry exits in the dlgR4MSITable for this device.
See the dlgr4dev.mib.

dlgR4DeviceOpenCount

public static final java.lang.String dlgR4DeviceOpenCount
An indication of how many instances of this device is currently opened. See the dlgr4dev.mib.

dlgR4VoiceChannelStatus

public static final java.lang.String dlgR4VoiceChannelStatus
Indicates current activity status on the (voice) channel. See the dlgr4dev.mib.

unknown

public static final int unknown

voice

public static final int voice

dti

public static final int dti

isdn

public static final int isdn

msi

public static final int msi

idle

public static final int idle

playing

public static final int playing

recording

public static final int recording

gettingDigits

public static final int gettingDigits

blocked

public static final int blocked

dialing

public static final int dialing

playTone

public static final int playTone

sendingFax

public static final int sendingFax

receivingFax

public static final int receivingFax

betweenFAXPages

public static final int betweenFAXPages

hookState

public static final int hookState

winking

public static final int winking

callProgess

public static final int callProgess

gettingR2MF

public static final int gettingR2MF

vch_status

public static final java.lang.String[] vch_status
Constructor Detail

DialogChannelStatusBean

public DialogChannelStatusBean()
The default constructor.

DialogChannelStatusBean

public DialogChannelStatusBean(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

getChannelIndexes

public java.util.Enumeration getChannelIndexes()
Returns the indexes (as Integers) of the voice channels that are open. Only the open voice channels of the card are saved. Use getChannelStatus() or getChannelStatusString() to get the status of the channel.
See Also:
getChannelStatus(java.lang.Integer), getChannelStatusString(java.lang.Integer)

getChannelCount

public int getChannelCount()
Returns the number of voice channels in the table.

getChannelName

public java.lang.String getChannelName(java.lang.Integer index)
Returns the name of the channel.
Parameters:
index - The index of the channel
Returns:
The name

getChannelStatus

public int getChannelStatus(java.lang.Integer index)
Returns the status of the channel as an int.
Parameters:
index - The index of the channel
Returns:
The status
See Also:
getChannelIndexes()

getChannelStatusString

public java.lang.String getChannelStatusString(java.lang.Integer index)
Returns the String representation of the status of the channel.
Parameters:
index - The index of the channel
Returns:
The status
See Also:
getChannelIndexes()

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 TreeNodes 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)

SNMP Stack 4_12