MySnmpCrawler API

snmp.mbean
Class DefaultMBeanMeta

java.lang.Object
  |
  +--snmp.mbean.MBeanMeta
        |
        +--snmp.mbean.DefaultMBeanMeta
All Implemented Interfaces:
java.io.Serializable, SnmpMBean
Direct Known Subclasses:
DemoSystemMBeanMeta

public class DefaultMBeanMeta
extends MBeanMeta

This class uses JMX MBean server as a default implementation in getting and setting the MBean attribut. You can extend this class to override the mechanism in getting and setting the MBean attribute.

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:53 $
Author:
Scott Cheng
See Also:
Serialized Form

Field Summary
 
Fields inherited from class snmp.mbean.MBeanMeta
mbean
 
Fields inherited from interface snmp.mbean.SnmpMBean
ACCESS_BY_ATTR_NAME, ACCESS_BY_OID
 
Constructor Summary
protected DefaultMBeanMeta()
          The default constructor.
 
Method Summary
protected  MBeanAttribute getAttrByName(java.lang.String attr)
          Gets the MBeanAttribute object that matches to the attribute name in the MBean.
protected  MBeanAttribute getAttrByOid(java.lang.String oid)
          Gets the MBeanAttribute object that matches to the object identifier string in the MBean.
private static MBeanAttribute getMBeanAttribute(java.lang.String attr, DefaultMBeanMeta meta)
          Gets the MBean attribute value that matches to the attribute name in the MBean.
protected  MBeanAttribute setAttrByName(java.lang.String name, MBeanAttribute attr)
          Sets the MBeanAttribute object that matches to the attribute name in the MBean.
protected  MBeanAttribute setAttrByOid(java.lang.String oid, MBeanAttribute attr)
          Sets the MBeanAttribute object that matches to the object identifier string into the MBean.
private static MBeanAttribute setMBeanAttribute(MBeanAttribute attr, DefaultMBeanMeta meta)
          Sets the MBean attribute value that matches to the attribute name into the MBean.
 
Methods inherited from class snmp.mbean.MBeanMeta
get, getMBeanClassName, getMBeanMeta, getMBeanObjectName, set, setupMBeanMeta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMBeanMeta

protected DefaultMBeanMeta()
                    throws SnmpException
The default constructor.

Throws:
SnmpException - Thrown when the instance of the DefaultMBeanMeta cannot be constructed correctly.
Method Detail

getAttrByOid

protected MBeanAttribute getAttrByOid(java.lang.String oid)
                               throws SnmpException
Gets the MBeanAttribute object that matches to the object identifier string in the MBean.

Specified by:
getAttrByOid in class MBeanMeta
Parameters:
oid - The string represents the object identifier.
Returns:
The MBeanAttribute object associating to the object identifier.
Throws:
SnmpException - Thrown when any error occurs.

getAttrByName

protected MBeanAttribute getAttrByName(java.lang.String attr)
                                throws SnmpException
Gets the MBeanAttribute object that matches to the attribute name in the MBean.

Specified by:
getAttrByName in class MBeanMeta
Parameters:
attr - The string represents the attribute name.
Returns:
The MBeanAttribute object associating to the attribute name.
Throws:
SnmpException - Thrown when any error occurs.

setAttrByOid

protected MBeanAttribute setAttrByOid(java.lang.String oid,
                                      MBeanAttribute attr)
                               throws SnmpException
Sets the MBeanAttribute object that matches to the object identifier string into the MBean.

Specified by:
setAttrByOid in class MBeanMeta
Parameters:
oid - The string represents the object identifier.
attr - The MBeanAttribute object that contains the data to be set into the MBean object.
Returns:
The MBeanAttribute object associating to the object identifier.
Throws:
SnmpException - Thrown when any error occurs.

setAttrByName

protected MBeanAttribute setAttrByName(java.lang.String name,
                                       MBeanAttribute attr)
                                throws SnmpException
Sets the MBeanAttribute object that matches to the attribute name in the MBean.

Specified by:
setAttrByName in class MBeanMeta
Parameters:
name - The name of the attribute.
attr - The MBeanAttribute object that contains the data to set into the MBean object.
Returns:
The MBeanAttribute object associating to the attribute name.
Throws:
SnmpException - Thrown when any error occurs.

getMBeanAttribute

private static MBeanAttribute getMBeanAttribute(java.lang.String attr,
                                                DefaultMBeanMeta meta)
                                         throws SnmpException
Gets the MBean attribute value that matches to the attribute name in the MBean. The MBeanMeta object provides an unique object name that we can use to retrieve the right MBean from the JMX server.

Parameters:
attr - The string represents the attribute name.
Returns:
The MBeanAttribute object associating to the attribute name.
Throws:
SnmpException - Thrown when any error occurs.

setMBeanAttribute

private static MBeanAttribute setMBeanAttribute(MBeanAttribute attr,
                                                DefaultMBeanMeta meta)
                                         throws SnmpException
Sets the MBean attribute value that matches to the attribute name into the MBean. The MBeanMeta object provides an unique object name that we can use to retrieve the right MBean from the JMX server.

Parameters:
attr - The MBeanAttribute object that contains the data to be set into the MBean object.
Returns:
The MBeanAttribute object associating to the attribute name.
Throws:
SnmpException - Thrown when any error occurs.

MySnmpCrawler API