com.adventnet.services.proxy
Class JmxProxy

java.lang.Object
  |
  +--com.adventnet.services.proxy.JmxProxy

public class JmxProxy
extends java.lang.Object

This class acts as the delegate class for doing the SNMP proxy for a particular MBean. This will be used when you want to expose the existing Snmp Agent through Multiple Protocols.


Constructor Summary
JmxProxy()
          Default Constructor.
JmxProxy(MBeanServer server)
          Constructor that takes the MBeanServer as the parameter.
JmxProxy(MBeanServer server, java.util.Hashtable trapListenFwdHash)
          Constructor that takes the MBeanServer as the parameter with the trapListener and Forwarding details
 
Method Summary
 void deRegister()
          This method de-registers the JMXProxy instance.
 java.lang.Object doScalarSnmpGetOper(ObjectName source, java.lang.String attribute)
          This method does the proxy Get operations for Scalar groups.
 java.lang.Object doScalarSnmpOper(java.lang.Object source, java.lang.String attribute, byte command, java.lang.String value)
          This method does the proxy operations for Scalar groups.
 java.lang.Object doScalarSnmpSetOper(ObjectName source, java.lang.String attribute, java.lang.String value)
          This method does the proxy Set operations for Scalar groups.
 java.util.Vector doTableSnmpGetOper(java.lang.Object source, java.lang.String attribute, java.lang.String[][] value, java.lang.String entryName)
          This method does the proxy operations for Get Requests for Tables.
 void doTableSnmpSetOper(java.lang.Object source, java.lang.String attribute, CompositeData comp, java.lang.String[] indexNames, java.lang.String key)
          This method does the proxy operations for Set Request for Tables.
 java.util.Hashtable getProxyTable()
          Getter for the ProxyInfo objects
 void register(ObjectName name, java.lang.String host, int port, java.lang.String community)
          This method registers the particular MBean with the JmxProxy with details about the SubAgent.
 void register(ObjectName name, java.lang.String host, int port, java.lang.String community, java.lang.String version)
          This method registers the particular MBean with the JmxProxy with details about the SubAgent.
 void startListenerAndForwarder(java.lang.Integer port)
          Method to start the TrapListenerAndForwarder to listen for the SubAgent Traps.
 void tableAddRow(ObjectName objName, java.lang.Object[] indexObjects, CompositeData entry)
          When the manager is trying to add a row in the table, this method will be called.
 void tableDeleteRow(ObjectName objName, java.lang.Object[] indexObjects)
          When the manager is trying to delete a row in the table, this method will be called.
 java.util.List tableGetEntries(ObjectName objName, 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 tableGetEntry(ObjectName objName, java.lang.Object[] indexObjects)
          To get the entry for the given row (identified by the instance)
 CompositeData tableGetFirstEntry(ObjectName objName)
          To get the first entry in the table
 CompositeData tableGetNextEntry(ObjectName objName, java.lang.Object[] indexObjects)
          To get the next entry for the given row (identified by the instance)
 void tableModifyRow(ObjectName objName, java.lang.Object[] indexObjects, CompositeData entry)
          When the manager is trying to modify a row in the table, this method will be called.
 int tableTotalRows(ObjectName objName)
          This method gives the total number of rows in the table.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxProxy

public JmxProxy()
Default Constructor.

JmxProxy

public JmxProxy(MBeanServer server)
Constructor that takes the MBeanServer as the parameter.
Parameters:
server - the instance of the MBeanServer.

JmxProxy

public JmxProxy(MBeanServer server,
                java.util.Hashtable trapListenFwdHash)
Constructor that takes the MBeanServer as the parameter with the trapListener and Forwarding details
Parameters:
server - the instance of the MBeanServer.
trapListenFwdHash - the Hashtable which contains the Trap Listening and Forwarding details
Method Detail

register

public void register(ObjectName name,
                     java.lang.String host,
                     int port,
                     java.lang.String community)
This method registers the particular MBean with the JmxProxy with details about the SubAgent.
Parameters:
name - the ObjectName of the interested MBean
host - the SubAgent host Name
port - the SubAgent port number
community - the community with which the Proxy should be done.

register

public void register(ObjectName name,
                     java.lang.String host,
                     int port,
                     java.lang.String community,
                     java.lang.String version)
This method registers the particular MBean with the JmxProxy with details about the SubAgent.
Parameters:
name - the ObjectName of the interested MBean
host - the SubAgent host Name
port - the SubAgent port number
community - the community with which the Proxy should be done.
version - the SNMP version with which the Proxy should be done.

doScalarSnmpOper

public java.lang.Object doScalarSnmpOper(java.lang.Object source,
                                         java.lang.String attribute,
                                         byte command,
                                         java.lang.String value)
This method does the proxy operations for Scalar groups. This method will be called from the XXXInstrument files generated by the AgentToolkit.
Parameters:
source - the Managed Resource that calls this method.
attribute - the attribute of MBean for which proxy needs to be done
command - value indicating the type of the SNMP message, get/getnext/set request.
value -  
Returns:
object representing the value from the SubAgent. If the SubAgent times out or there is no response from the agent, returns null.

getProxyTable

public java.util.Hashtable getProxyTable()
Getter for the ProxyInfo objects
Returns:
Hashtable containing the ProxyInfo objects

doTableSnmpGetOper

public java.util.Vector doTableSnmpGetOper(java.lang.Object source,
                                           java.lang.String attribute,
                                           java.lang.String[][] value,
                                           java.lang.String entryName)
This method does the proxy operations for Get Requests for Tables. This method will be called from the XXXTable files generated by the AgentToolkit.
Parameters:
source - the Managed Resource that calls this method.
attribute - the attribute of MBean for which proxy needs to be done
value -  
entryName - The entry name of the Table
Returns:
Vector representing the value from the SubAgent. If the SubAgent times out or there is no response from the agent, returns null.

doTableSnmpSetOper

public void doTableSnmpSetOper(java.lang.Object source,
                               java.lang.String attribute,
                               CompositeData comp,
                               java.lang.String[] indexNames,
                               java.lang.String key)
                        throws AgentException
This method does the proxy operations for Set Request for Tables. This method will be called from the XXXTable files generated by the AgentToolkit.
Parameters:
source - the Managed Resource that calls this method.
attribute - the attribute of MBean for which proxy needs to be done times out or there is no response from the agent, returns null.
comp - The composite data corresponding to the the value to be set
indexNames - The String array representing the index Names
key - The key value

tableGetEntry

public CompositeData tableGetEntry(ObjectName objName,
                                   java.lang.Object[] indexObjects)
To get the entry for the given row (identified by the instance)
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.

tableGetNextEntry

public CompositeData tableGetNextEntry(ObjectName objName,
                                       java.lang.Object[] indexObjects)
To get the next entry for the given row (identified by the instance)
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.

tableGetFirstEntry

public CompositeData tableGetFirstEntry(ObjectName objName)
To get the first entry in the table
Returns:
instance of javax.jmx.openmbean.CompositeData with the entry information. Otherwise null.

tableAddRow

public void tableAddRow(ObjectName objName,
                        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.
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.

tableDeleteRow

public void tableDeleteRow(ObjectName objName,
                           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.
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.

tableModifyRow

public void tableModifyRow(ObjectName objName,
                           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.
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.

tableTotalRows

public int tableTotalRows(ObjectName objName)
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.
Returns:
int specifying the number of rows in the Table.

tableGetEntries

public java.util.List tableGetEntries(ObjectName objName,
                                      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.
Returns:
List of the instances of the CompositeData.

doScalarSnmpGetOper

public java.lang.Object doScalarSnmpGetOper(ObjectName source,
                                            java.lang.String attribute)
This method does the proxy Get operations for Scalar groups.
Parameters:
source - the ObjectName of the MBean.
attribute - the attribute of MBean for which proxy needs to be done
Returns:
object representing the value from the SubAgent. If the SubAgent times out or there is no response from the agent, returns null.

doScalarSnmpSetOper

public java.lang.Object doScalarSnmpSetOper(ObjectName source,
                                            java.lang.String attribute,
                                            java.lang.String value)
This method does the proxy Set operations for Scalar groups.
Parameters:
source - the ObjectName of the MBean.
attribute - the attribute of MBean for which proxy needs to be done
Returns:
object representing the value from the SubAgent. If the SubAgent times out or there is no response from the agent, returns null.

deRegister

public void deRegister()
This method de-registers the JMXProxy instance. This inturn closes all the API Threads instantiated by this.

startListenerAndForwarder

public void startListenerAndForwarder(java.lang.Integer port)
Method to start the TrapListenerAndForwarder to listen for the SubAgent Traps.
Parameters:
port - The port value where the Listener is to be opened.