com.adventnet.adaptors.snmp
Class SNMPEnableTable

java.lang.Object
  |
  +--com.adventnet.adaptors.snmp.SNMPEnableTable

public class SNMPEnableTable
extends java.lang.Object
implements JmxTableModelListener, MBeanRegistration

This class acts as the Managed Resource of the RequiredModelMBean. For each TableMBean ,that is deployed in the cluster server, an instance of this class is created and is registered in the admin MBean server. This MBean gives a consolidated view of the data present in the cluster MBeans.

Since:
1.0
See Also:
JmxTableModelListener

Field Summary
static java.lang.String INTERNAL_INDEX
           
protected  MBeanServer server
           
 
Constructor Summary
SNMPEnableTable()
          The constructor for this class.
 
Method Summary
 void addRow(java.lang.Object[] indexObjects, CompositeData cd)
          Implementation of JmxTableModelListener interface.
 void deleteRow(java.lang.Object[] indexObjects)
          Implementation of JmxTableModelListener interface.
 java.util.List getEntries(int startIndex, int endIndex)
          Implementation of JmxTableModelListener interface.
 CompositeData getEntry(java.lang.Object[] indexObjects)
          Implementation of JmxTableModelListener interface.
 CompositeData getFirstEntry()
          Implementation of JmxTableModelListener interface.
 java.lang.String[] getIndexNames()
          The method to return index column Names of this table MBean.
 CompositeData getNextEntry(java.lang.Object[] indexObjects)
          Implementation of JmxTableModelListener interface.
 java.util.List getRows(int i, int j)
           
 TabularData getSNMPEnableTable()
           
 TabularData getTabularData()
           
protected  java.lang.Object getValue(ObjectName oname, java.lang.String className, java.lang.String columnName)
           
protected  void initialise(ModelMBeanInfo mbai)
           
 void modifyRow(java.lang.Object[] indexObjects, CompositeData cd)
          Implementation of JmxTableModelListener interface.
 void postDeregister()
          Allows the MBean to perform any operations needed after having been unregistered in the MBean server.
 void postRegister(java.lang.Boolean b)
          Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.
 void preDeregister()
          Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations it needs before being registered in the MBean server.
 void setClassName(MBeanServer server, java.lang.String wsClassName, ModelMBeanInfo minfo)
           
 void setClassNames(MBeanServer server, java.lang.String[] wsClassNames, ModelMBeanInfo minfo)
           
 void setClassNames(java.lang.String[] wsClassNames)
           
 void setObjectName(MBeanServer server, java.lang.String wsObjectName, ModelMBeanInfo minfo)
           
 void setRefreshInterval(int interval)
          Method to set the refresh interval.
 void setSNMPEnableTable(TabularData data)
           
 void setTabularData(TabularData data)
           
 int totalRows()
          Implementation of JmxTableModelListener interface.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected MBeanServer server

INTERNAL_INDEX

public static final java.lang.String INTERNAL_INDEX
Constructor Detail

SNMPEnableTable

public SNMPEnableTable()
The constructor for this class. Creates a new MasterTableMBean instance.
Parameters:
clusterName - the name of the cluster where the table mbeans reside.
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
Description copied from interface: MBeanRegistration
Allows the MBean to perform any operations it needs before being registered in the MBean server. 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 MBean server.
Specified by:
preRegister in interface MBeanRegistration
Tags copied from interface: MBeanRegistration
Parameters:
server - The MBean server in which the MBean will be registered.
name - The object name of the MBean. This name is null if the name parameter to one of the createMBean or registerMBean methods in the MBeanServer interface is null. In that case, this method must return a non-null ObjectName for the new MBean.
Returns:
The name under which the MBean is to be registered. This value must not be null. If the name parameter is not null, it will usually but not necessarily be the returned value.
Throws:
java.lang.Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException or a RuntimeMBeanException.

postRegister

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

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration
Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
Specified by:
preDeregister in interface MBeanRegistration
Tags copied from interface: MBeanRegistration
Throws:
java.lang.Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException or a RuntimeMBeanException.

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration
Allows the MBean to perform any operations needed after having been unregistered in the MBean server.
Specified by:
postDeregister in interface MBeanRegistration

setClassName

public void setClassName(MBeanServer server,
                         java.lang.String wsClassName,
                         ModelMBeanInfo minfo)

setClassNames

public void setClassNames(MBeanServer server,
                          java.lang.String[] wsClassNames,
                          ModelMBeanInfo minfo)

setClassNames

public void setClassNames(java.lang.String[] wsClassNames)

setObjectName

public void setObjectName(MBeanServer server,
                          java.lang.String wsObjectName,
                          ModelMBeanInfo minfo)

initialise

protected void initialise(ModelMBeanInfo mbai)

getTabularData

public TabularData getTabularData()

setTabularData

public void setTabularData(TabularData data)

getSNMPEnableTable

public TabularData getSNMPEnableTable()

setSNMPEnableTable

public void setSNMPEnableTable(TabularData data)

setRefreshInterval

public void setRefreshInterval(int interval)
Method to set the refresh interval. Based on this refresh interval the managed servers would be queried to get the data and the cache would be updated. The refresh interval would be checked for each query to this MBean.
Parameters:
interval - an int value

getIndexNames

public java.lang.String[] getIndexNames()
The method to return index column Names of this table MBean.

getEntry

public CompositeData getEntry(java.lang.Object[] indexObjects)
Implementation of JmxTableModelListener interface. 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)
Implementation of JmxTableModelListener interface. 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()
Implementation of JmxTableModelListener interface. 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 cd)
            throws java.lang.Exception
Implementation of JmxTableModelListener interface. 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.
cd - the entry value as javax.jmx.openmbean.CompositeData instance.

deleteRow

public void deleteRow(java.lang.Object[] indexObjects)
               throws java.lang.Exception
Implementation of JmxTableModelListener interface. 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.
indexObjects - the entry value as javax.jmx.openmbean.CompositeData instance.

modifyRow

public void modifyRow(java.lang.Object[] indexObjects,
                      CompositeData cd)
               throws java.lang.Exception
Implementation of JmxTableModelListener interface. 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.
cd - the entry value as javax.jmx.openmbean.CompositeData instance.

totalRows

public int totalRows()
Implementation of JmxTableModelListener interface. 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)
Implementation of JmxTableModelListener interface. 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.

getValue

protected java.lang.Object getValue(ObjectName oname,
                                    java.lang.String className,
                                    java.lang.String columnName)

getRows

public java.util.List getRows(int i,
                              int j)