com.adventnet.services.proxy
Class JMXSnmpProxyModelMBean

java.lang.Object
  |
  +--javax.management.modelmbean.RequiredModelMBean
        |
        +--com.adventnet.services.proxy.JMXSnmpProxyModelMBean

public class JMXSnmpProxyModelMBean
extends RequiredModelMBean
implements JmxTableModelListener, MBeanRegistration


Inner classes inherited from class javax.management.modelmbean.RequiredModelMBean
RequiredModelMBean.UpdateTimer
 
Fields inherited from class javax.management.modelmbean.RequiredModelMBean
adsValueTable, attrbroadcaster, attrFilterMapTable, clazz, confDirName, confFile, confFileName, confFileTable, mbeanInfo, notifbroadcaster, notiffields1, notiffields2, object, objectType, prints, registered
 
Constructor Summary
JMXSnmpProxyModelMBean(java.util.Hashtable propertyHash, JmxProxy proxy)
           
 
Method Summary
 void addRow(java.lang.Object[] indexObjects, CompositeData entry)
          When the manager is trying to add a row in the table, this method will be called.
 void deleteRow(java.lang.Object[] indexObjects)
          When the manager is trying to delete a row in the table, this method will be called.
 java.lang.Object getAttribute(java.lang.String attribute)
          Gets the value of a specific attribute of this MBean.
 java.util.List getEntries(int startIndex, int endIndex)
          This method gives an List of the CompositeData instances in this table starting from the startIndex through till the EndIndex.
 CompositeData getEntry(java.lang.Object[] indexObjects)
          To get the entry for the given row (identified by the instance)
 CompositeData getFirstEntry()
          To get the first entry in the table
 java.lang.String[] getIndexNames()
           
 CompositeData getNextEntry(java.lang.Object[] indexObjects)
          To get the next entry for the given row (identified by the instance)
 java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)
          Invokes a method on or through a RequiredModelMBean and returns the result of the method execution.
 void modifyRow(java.lang.Object[] indexObjects, CompositeData entry)
          When the manager is trying to modify a row in the table, this method will be called.
 void postDeregister()
          Allows the MBean to perform any operations needed after having been de-registered in the MBeanServer.
 void postRegister(java.lang.Boolean registrationDone)
          Allows the MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
 void preDeregister()
          Allows the MBean to perform any operations it needs before being de-registered by the MBeanServer.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations it needs before being registered in the MBeanServer.
 void setAttribute(Attribute attribute)
          Sets the value of a specific attribute of this MBean.
 void setCommunity(java.lang.String community)
           
 void setHost(java.lang.String host)
           
 void setIndexNames(java.lang.String indexNames)
           
 void setJmxProxy(JmxProxy proxy)
           
 void setModelMBeanInfo(ModelMBeanInfo mbi)
          Initializes a ModelMBean object using ModelMBeanInfo passed in.
 void setObjectName(java.lang.String objectName)
           
 void setPort(java.lang.String port)
           
 void setSNMPVersion(java.lang.String version)
           
 int totalRows()
          This method gives the total number of rows in the table.
 
Methods inherited from class javax.management.modelmbean.RequiredModelMBean
addAttributeChangeNotificationListener, addNotificationListener, getAttribute, getAttributes, getClassLoaderRepository, getMBeanInfo, getNotificationInfo, load, removeAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttributes, setManagedResource, store
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMXSnmpProxyModelMBean

public JMXSnmpProxyModelMBean(java.util.Hashtable propertyHash,
                              JmxProxy proxy)
                       throws MBeanException,
                              RuntimeOperationsException
Method Detail

setObjectName

public void setObjectName(java.lang.String objectName)

setHost

public void setHost(java.lang.String host)

setPort

public void setPort(java.lang.String port)

setIndexNames

public void setIndexNames(java.lang.String indexNames)

getIndexNames

public java.lang.String[] getIndexNames()

setSNMPVersion

public void setSNMPVersion(java.lang.String version)

setCommunity

public void setCommunity(java.lang.String community)

setJmxProxy

public void setJmxProxy(JmxProxy proxy)

getEntry

public CompositeData getEntry(java.lang.Object[] indexObjects)
To get the entry for the given row (identified by the instance)
Specified by:
getEntry in interface JmxTableModelListener
Parameters:
indexObjects - the object array with index objects which identifies the row
Returns:
instance of javax.jmx.openmbean.CompositeData with the entry information. Otherwise null.

getNextEntry

public CompositeData getNextEntry(java.lang.Object[] indexObjects)
To get the next entry for the given row (identified by the instance)
Specified by:
getNextEntry in interface JmxTableModelListener
Parameters:
indexObjects - the object array with index objects which identifies the row
Returns:
instance of javax.jmx.openmbean.CompositeData with the entry information. Otherwise null.

getFirstEntry

public CompositeData getFirstEntry()
To get the first entry in the table
Specified by:
getFirstEntry in interface JmxTableModelListener
Returns:
instance of javax.jmx.openmbean.CompositeData with the entry information. Otherwise null.

addRow

public void addRow(java.lang.Object[] indexObjects,
                   CompositeData entry)
            throws java.lang.Exception
When the manager is trying to add a row in the table, this method will be called.
Specified by:
addRow in interface JmxTableModelListener
Parameters:
indexObjects - the object array with index objects which identifies the row to be added.
entry - the entry value as javax.jmx.openmbean.CompositeData instance.

deleteRow

public void deleteRow(java.lang.Object[] indexObjects)
               throws java.lang.Exception
When the manager is trying to delete a row in the table, this method will be called.
Specified by:
deleteRow in interface JmxTableModelListener
Parameters:
indexObjects - the object array with index objects which identifies the row to be deleted.
entry - the entry value as javax.jmx.openmbean.CompositeData instance.

modifyRow

public void modifyRow(java.lang.Object[] indexObjects,
                      CompositeData entry)
               throws java.lang.Exception
When the manager is trying to modify a row in the table, this method will be called.
Specified by:
modifyRow in interface JmxTableModelListener
Parameters:
indexObjects - the object array with index objects which identifies the row to be modified.
entry - the entry value as javax.jmx.openmbean.CompositeData instance.

totalRows

public int totalRows()
This method gives the total number of rows in the table. This method will be used by the HTML and TL1 adaptors. Users who wish to have only Snmp interface need not implement this method.
Specified by:
totalRows in interface JmxTableModelListener
Returns:
int specifying the number of rows in the Table.

getEntries

public java.util.List getEntries(int startIndex,
                                 int endIndex)
This method gives an List of the CompositeData instances in this table starting from the startIndex through till the EndIndex. This method will be used by the HTML and TL1 adaptors. Users who wish to have only Snmp interface need not implement this method. For example: If the 1st 5 rows have to be retrieved, then the start index will be 1 and the end index will be 5.
Specified by:
getEntries in interface JmxTableModelListener
Returns:
List of the instances of the CompositeData.

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws AttributeNotFoundException,
                                     MBeanException,
                                     ReflectionException
Description copied from class: RequiredModelMBean
Gets the value of a specific attribute of this MBean.
Overrides:
getAttribute in class RequiredModelMBean
Tags copied from class: RequiredModelMBean
Parameters:
attribute - A String specifying the name of the attribute to be retrieved.
Returns:
The value of the retrieved attribute.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Description copied from class: RequiredModelMBean
Sets the value of a specific attribute of this MBean.
Overrides:
setAttribute in class RequiredModelMBean
Tags copied from class: RequiredModelMBean
Parameters:
attribute - The identification of the attribute to be set and the value it is to be set to.
Throws:
AttributeNotFoundException - - The specified attribute is not accessible in the MBean.
InvalidAttributeValueException - - The specified value for the attribute is not valid.
MBeanException - - Wraps an exception thrown by the MBean's setter.
ReflectionException - - Wraps an java.lang.Exception thrown while trying to invoke the setter.
RuntimeOperationsException - - Wraps an IllegalArgumentException: The object name in parameter is null or the attribute in parameter is null.

setModelMBeanInfo

public void setModelMBeanInfo(ModelMBeanInfo mbi)
                       throws MBeanException,
                              RuntimeOperationsException
Description copied from class: RequiredModelMBean
Initializes a ModelMBean object using ModelMBeanInfo passed in. This method makes it possible to set a customized ModelMBeanInfo on the ModelMBean as long as it is not registered with the MBeanServer.
Once the ModelMBean's ModelMBeanInfo (with Descriptors) are customized and set on the ModelMBean, the ModelMBean be registered with the MBeanServer.

If the ModelMBean is currently registered, this method throws a RuntimeOperationsException wrapping an IllegalStateException

If the given inModelMBeanInfo does not contain any ModelMBeanNotificationInfo for the GENERIC or ATTRIBUTE_CHANGE notifications, then the RequiredModelMBean will supply its own default ModelMBeanNotificationInfos for those missing notifications.

Overrides:
setModelMBeanInfo in class RequiredModelMBean
Tags copied from class: RequiredModelMBean
Parameters:
mbi - The ModelMBeanInfo object to be used by the ModelMBean.
Throws:
MBeanException - Wraps a distributed communication Exception.
RuntimeOperationsException -
  • Wraps an IllegalArgumentException if the MBeanInfo passed in parameter is null.
  • Wraps an IllegalStateException if the ModelMBean is currently registered in the MBeanServer.

invoke

public java.lang.Object invoke(java.lang.String actionName,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
                        throws MBeanException,
                               ReflectionException
Description copied from class: RequiredModelMBean
Invokes a method on or through a RequiredModelMBean and returns the result of the method execution.

If the given method to be invoked, together with the provided signature, matches one of RequiredModelMbean accessible methods, this one will be call. Otherwise the call to the given method will be tried on the managed ressource.

The last value returned by an operation may be cached in the operation's descriptor which is in the ModelMBeanOperationInfo's descriptor. The valid value will be in the 'value' field if there is one. If the 'currencyTimeLimit' field in the descriptor is:

Overrides:
invoke in class RequiredModelMBean
Tags copied from class: RequiredModelMBean
Parameters:
opName - The name of the method to be invoked. The name can be the fully qualified method name including the classname, or just the method name if the classname is defined in the 'class' field of the operation descriptor.
opArgs - An array containing the parameters to be set when the operation is invoked
sig - An array containing the signature of the operation. The class objects will be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked.
Returns:
The object returned by the method, which represents the result of invoking the method on the specified managed resource.
Throws:
MBeanException - Wraps one of the following Exceptions:
  • An Exception thrown by the managed object's invoked method.
  • ServiceNotFoundException: No ModelMBeanOperationInfo or no descriptor defined for the specified operation or the managed resource is null.
  • InvalidTargetObjectTypeException: The 'targetType' field value is not 'objectReference'.
ReflectionException - Wraps an Exception thrown while trying to invoke the method.
RuntimeOperationsException - Wraps an IllegalArgumentException Method name is null.

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Allows the MBean to perform any operations it needs before being registered in the MBeanServer. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBeanServer.
Specified by:
preRegister in interface MBeanRegistration
Overrides:
preRegister in class RequiredModelMBean
Parameters:
server - The MBeanServer in which the MBean will be registered.
name - The object name of the MBean.
Returns:
The name of the MBean registered.
Throws:
java.lang.Exception - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Allows the MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
Specified by:
postRegister in interface MBeanRegistration
Overrides:
postRegister in class RequiredModelMBean
Parameters:
registrationDone - Indicates whether or not the MBean has been successfully registered in the MBeanServer. The value false means that either the registration phase has failed.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Allows the MBean to perform any operations it needs before being de-registered by the MBeanServer.
Specified by:
preDeregister in interface MBeanRegistration
Overrides:
preDeregister in class RequiredModelMBean
Throws:
java.lang.Exception - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Allows the MBean to perform any operations needed after having been de-registered in the MBeanServer.
Specified by:
postDeregister in interface MBeanRegistration
Overrides:
postDeregister in class RequiredModelMBean