MySnmpCrawler API

snmp.mbean
Class GenericMBean

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--snmp.mbean.GenericMBean
All Implemented Interfaces:
javax.management.NotificationBroadcaster
Direct Known Subclasses:
DemoSystem

public abstract class GenericMBean
extends javax.management.NotificationBroadcasterSupport

The GenericMBean class is the super class to all MBean subclasses. It stores the information about the ObjectName, MBeanMeta, and NotificationFilter for the MBean objects. It sends out the notification to the registered listeners when the MBean attribute is updated.

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:54 $
Author:
Scott Cheng

Nested Class Summary
 
Nested classes inherited from class javax.management.NotificationBroadcasterSupport
 
Field Summary
private  java.lang.String mbeanClassName
           
private  MBeanMeta mbeanMeta
           
private  long noficationSeqNo
           
private  javax.management.ObjectName objectName
           
 
Fields inherited from class javax.management.NotificationBroadcasterSupport
 
Constructor Summary
protected GenericMBean()
          Constructs the GenericMBean object by using the DefaultMBeanMeta class which provides the getter and setter methods to access the MBean attributes.
protected GenericMBean(MBeanMeta mbeanMeta, MBeanListener listener, javax.management.NotificationFilter filter)
          Constructs the GenericMMBean object with the passed MBeanMeta object and the notification listener.
 
Method Summary
 void addNotificationListener(MBeanListener listener, javax.management.NotificationFilter filter)
          Adds a listener.
(package private) static GenericMBean createMBean(java.lang.String mbeanClassName)
          Creates the MBean object dynamically with the passed class name.
private  javax.management.AttributeChangeNotification getAttributeChangeNotification(java.lang.String attr, java.lang.Object oldVal, java.lang.Object newVal)
           
 java.lang.String getMBeanClassName()
          Gets the class name of the MBean.
 MBeanMeta getMBeanMeta()
          Gets the MBeanMeta object of the MBean.
 javax.management.ObjectName getMBeanObjectName()
          Gets the ObjectName that maps the MBean in the JMX server.
private static void loadMBean(GenericMBean mbean)
          Loads the MBean object into the JMX MBean server.
protected  void sendAttrChangeNotification(java.lang.String attr, java.lang.Object oldVal, java.lang.Object newVal)
          Sends the attribute-change-notification to the registered listeners.
private  void setup(MBeanMeta mbeanMeta)
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noficationSeqNo

private long noficationSeqNo

mbeanClassName

private java.lang.String mbeanClassName

objectName

private javax.management.ObjectName objectName

mbeanMeta

private MBeanMeta mbeanMeta
Constructor Detail

GenericMBean

protected GenericMBean()
                throws SnmpException
Constructs the GenericMBean object by using the DefaultMBeanMeta class which provides the getter and setter methods to access the MBean attributes.

Throws:
SnmpException - Thrown when any error occurs during the object intantiation.

GenericMBean

protected GenericMBean(MBeanMeta mbeanMeta,
                       MBeanListener listener,
                       javax.management.NotificationFilter filter)
                throws SnmpException
Constructs the GenericMMBean object with the passed MBeanMeta object and the notification listener.

Parameters:
mbeanMeta - The MBeanMeta object provides the mechanism to get and set the MBean attribute.
listener - The listener to receive notifications.
filter - The filter object to filter notifications.
Throws:
SnmpException - Thrown when any error occurs during the object intantiation.
Method Detail

addNotificationListener

public void addNotificationListener(MBeanListener listener,
                                    javax.management.NotificationFilter filter)
Adds a listener.

Parameters:
listener - The listener to receive notifications.
filter - The filter object to filter notifications.

getMBeanClassName

public java.lang.String getMBeanClassName()
Gets the class name of the MBean.

Returns:
The MBean class name.

getMBeanObjectName

public javax.management.ObjectName getMBeanObjectName()
                                               throws SnmpException
Gets the ObjectName that maps the MBean in the JMX server.

Returns:
The object of the ObjectName.
Throws:
SnmpException - Thrown when ObjectName instance cannot be created correctly.

getMBeanMeta

public MBeanMeta getMBeanMeta()
Gets the MBeanMeta object of the MBean.

Returns:
The MBeanMeta object.

sendAttrChangeNotification

protected void sendAttrChangeNotification(java.lang.String attr,
                                          java.lang.Object oldVal,
                                          java.lang.Object newVal)
Sends the attribute-change-notification to the registered listeners.

Parameters:
attr - The attribute name.
oldVal - The old value of the attribute.
newVal - The new value of the attribute.

getAttributeChangeNotification

private javax.management.AttributeChangeNotification getAttributeChangeNotification(java.lang.String attr,
                                                                                    java.lang.Object oldVal,
                                                                                    java.lang.Object newVal)

setup

private void setup(MBeanMeta mbeanMeta)
            throws SnmpException
SnmpException

createMBean

static GenericMBean createMBean(java.lang.String mbeanClassName)
                         throws SnmpException
Creates the MBean object dynamically with the passed class name.

Parameters:
mbeanClassName - The MBean class anme.
Returns:
The GenericMBean object that is created dynamically.
Throws:
SnmpException - Thrown when GenericMBean cannot be created correctly.

loadMBean

private static void loadMBean(GenericMBean mbean)
                       throws SnmpException
Loads the MBean object into the JMX MBean server.

Parameters:
mbean - The MBean to be loaded.
Throws:
SnmpException - Thrown when any error occurs during the loading.

MySnmpCrawler API