MySnmpCrawler API

snmp.mbean
Class MBeanMeta

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

public abstract class MBeanMeta
extends java.lang.Object
implements SnmpMBean, java.io.Serializable

The MBeanMeta contains the reference to the MBean object. It also provides the generic behavior such as attribute locking when getting and setting the MBean attribute.

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

Field Summary
private  java.util.HashMap attrLock
           
protected  GenericMBean mbean
           
private static java.util.ArrayList mbeanMetaList
           
 
Fields inherited from interface snmp.mbean.SnmpMBean
ACCESS_BY_ATTR_NAME, ACCESS_BY_OID
 
Constructor Summary
protected MBeanMeta()
          The default constructor.
protected MBeanMeta(GenericMBean mbean)
          Constructs the MBeanMeta object that is associated with GenericMBean object.
 
Method Summary
 MBeanAttribute get(java.lang.String identifier, int accessType)
          Gets the MBeanAttribute object that matches to the passed identifier in the MBean.
protected abstract  MBeanAttribute getAttrByName(java.lang.String attr)
          Gets the MBeanAttribute object that matches to the attribute name in the MBean.
protected abstract  MBeanAttribute getAttrByOid(java.lang.String oid)
          Gets the MBeanAttribute object that matches to the object identifier string in the MBean.
 java.lang.String getMBeanClassName()
          Gets the class name of the MBean that associates with the MBeanMeta object.
static MBeanMeta getMBeanMeta(java.lang.String mbeanName)
          Gets the MBeanMeta object from the MBeanMeta list with the passed MBean name.
 javax.management.ObjectName getMBeanObjectName()
          Gets the ObjectName of the MBean that associates with the MBeanMeta object.
 MBeanAttribute set(java.lang.String identifier, int accessType, MBeanAttribute attr)
          Sets the MBeanAttribute object that matches to the passed identifier into the MBean.
protected abstract  MBeanAttribute setAttrByName(java.lang.String oid, MBeanAttribute attr)
          Sets the MBeanAttribute object that matches to the attribute name into the MBean.
protected abstract  MBeanAttribute setAttrByOid(java.lang.String oid, MBeanAttribute attr)
          Sets the MBeanAttribute object that matches to the object identifier string into the MBean.
(package private)  void setupMBeanMeta(GenericMBean mbean)
          Setups the required objects for the MBeanMeta to work properly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mbeanMetaList

private static java.util.ArrayList mbeanMetaList

mbean

protected GenericMBean mbean

attrLock

private java.util.HashMap attrLock
Constructor Detail

MBeanMeta

protected MBeanMeta()
             throws SnmpException
The default constructor.

Throws:
SnmpException - Thrown when the instance of the MBeanMeta cannot be constructed correctly.

MBeanMeta

protected MBeanMeta(GenericMBean mbean)
             throws SnmpException
Constructs the MBeanMeta object that is associated with GenericMBean object.

Parameters:
mbean - The associated GenericMBean object.
Throws:
SnmpException - Thrown when the instance of the MBeanMeta cannot be constructed correctly.
Method Detail

get

public MBeanAttribute get(java.lang.String identifier,
                          int accessType)
                   throws SnmpException
Gets the MBeanAttribute object that matches to the passed identifier in the MBean. The method obtains the read lock for the attribute before accessing and releases the lock when it's done.

Specified by:
get in interface SnmpMBean
Parameters:
identifier - The identifier string.
accessType - Either ACCESS_BY_OID or ACCESS_BY_ATTR_NAME.
Returns:
The associated MBeanAttribute object.
Throws:
SnmpException - Thrown when any error occurs.

set

public MBeanAttribute set(java.lang.String identifier,
                          int accessType,
                          MBeanAttribute attr)
                   throws SnmpException
Sets the MBeanAttribute object that matches to the passed identifier into the MBean. The method obtains the write lock for the attribute before accessing and releases the lock when it's done.

Specified by:
set in interface SnmpMBean
Parameters:
identifier - The identifier string.
accessType - Either ACCESS_BY_OID or ACCESS_BY_ATTR_NAME.
attr - The MBeanAttribute object that contains the data to be set into the MBean object.
Returns:
The associated MBeanAttribute object.
Throws:
SnmpException - Thrown when any error occurs.

getMBeanObjectName

public javax.management.ObjectName getMBeanObjectName()
                                               throws SnmpException
Gets the ObjectName of the MBean that associates with the MBeanMeta object.

Returns:
The ObjectName of the MBean.
Throws:
SnmpException - Thrown when there is an error in getting the ObjectName of the MBean.

getMBeanClassName

public java.lang.String getMBeanClassName()
Gets the class name of the MBean that associates with the MBeanMeta object.

Returns:
The class name of the MBean.

setupMBeanMeta

void setupMBeanMeta(GenericMBean mbean)
              throws SnmpException
Setups the required objects for the MBeanMeta to work properly.

Parameters:
mbean - The GenericMBean object associates with MBeanMeta.
Throws:
SnmpException - Thrown when any error occurs during the setup.

getMBeanMeta

public static MBeanMeta getMBeanMeta(java.lang.String mbeanName)
Gets the MBeanMeta object from the MBeanMeta list with the passed MBean name.

Parameters:
mbeanName - The string represents the MBean name.
Returns:
The matched MBeanMeta object .

getAttrByOid

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

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 abstract MBeanAttribute getAttrByName(java.lang.String attr)
                                         throws SnmpException
Gets the MBeanAttribute object that matches to the attribute name in the MBean.

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 abstract MBeanAttribute setAttrByOid(java.lang.String oid,
                                               MBeanAttribute attr)
                                        throws SnmpException
Sets the MBeanAttribute object that matches to the object identifier string into the MBean.

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 abstract MBeanAttribute setAttrByName(java.lang.String oid,
                                                MBeanAttribute attr)
                                         throws SnmpException
Sets the MBeanAttribute object that matches to the attribute name into the MBean.

Parameters:
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.

MySnmpCrawler API