[jboss-cvs] JBossAS SVN: r111600 - branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 13 16:55:49 EDT 2011


Author: thauser at redhat.com
Date: 2011-06-13 16:55:49 -0400 (Mon, 13 Jun 2011)
New Revision: 111600

Modified:
   branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerSupport.java
Log:
refactoring

Modified: branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerSupport.java
===================================================================
--- branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerSupport.java	2011-06-13 20:55:10 UTC (rev 111599)
+++ branches/snmp4j-int/varia/src/main/java/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerSupport.java	2011-06-13 20:55:49 UTC (rev 111600)
@@ -29,6 +29,7 @@
 import org.snmp4j.PDU;
 import org.snmp4j.Snmp;
 import org.snmp4j.smi.OctetString;
+import java.util.SortedMap;
 
 /**
  * Implement RequestHandler with simple tracing of incoming requests.
@@ -55,6 +56,8 @@
    /** the agent clock */
    protected Clock clock;
    
+   private SortedMap bindings;
+   
    // Constructors --------------------------------------------------
    
    /**
@@ -67,6 +70,7 @@
    
    // RequestHandler Implementation ---------------------------------
    
+   public SortedMap getBindings(){return this.bindings;}
    /**
     * Initialize
     */
@@ -98,53 +102,8 @@
 	   return null;
    }
    public PDU snmpReceivedGet(PDU pdu)
-   {return null;
-//      SnmpPduRequest response = null;
-//      int pduLength = pdu.getLength();
-//      
-//      log.debug("requestId=" + pdu.getRequestId() + ", pduLength="  + pduLength);
-//   
-//      SnmpVarBind[] vblist  = new SnmpVarBind[pduLength];
-//      int errorStatus = SnmpPduPacket.ErrNoError;
-//      int errorIndex = 0;
-//
-//      //Process for each varibind in the request
-//      for (int i = 0; i < pduLength ; i++ )
-//      {
-//         SnmpVarBind vb = pdu.getVarBindAt(i);
-//         SnmpObjectId oid = vb.getName();
-//         if (getNext) 
-//         {
-//            log.debug(
-//               "Should call getNextOid() to find out what is the next valid OID " +
-//               "instance in the supported MIB tree. Assign that OID to the VB List " +
-//               "and then proceed same as that of get request" );
-//         }
-//         vblist[i] = new SnmpVarBind(oid);
-//         
-//         log.debug("oid=" + oid.toString());
-//    
-//         log.debug("Should call the respective interface to retrieve current value for this OID" );
-//
-//         SnmpSyntax result = null;
-//         
-//         if (result == null)
-//         {
-//            errorStatus = SnmpPduPacket.ErrNoSuchName;
-//            errorIndex = i + 1;
-//            //log.debug("Error Occured " + vb.getName().toString());
-//         }
-//         else
-//         {
-//            vblist[i].setValue(result);
-//            log.debug("Varbind[" + i + "] := " + vblist[i].getName().toString());
-//            log.debug(" --> " + vblist[i].getValue().toString());       
-//         }
-//      }
-//      response = new SnmpPduRequest(SnmpPduPacket.RESPONSE, vblist);
-//      response.setErrorStatus(errorStatus);
-//      response.setErrorIndex(errorIndex);
-//      return response;
+   {
+	   return null;
    }
 
    /**
@@ -159,40 +118,8 @@
     * NOTE: this might be changed to throw an exception.
     */
    public PDU snmpReceivedSet(PDU pdu) 
-   { 
-	   
+   {
 	   return null;
-//      SnmpPduRequest response = null;
-//      int errorStatus = SnmpPduPacket.ErrNoError;
-//      int errorIndex = 0;
-//      int k = pdu.getLength();
-//      SnmpVarBind[] vblist  = new SnmpVarBind[k];
-//     
-//      for (int i = 0; i < k ; i++ )
-//      {
-//         SnmpVarBind vb = pdu.getVarBindAt(i);
-//         vblist[i] = new SnmpVarBind(vb);
-//         SnmpObjectId oid = vb.getName();
-//         
-//         SnmpSyntax result = null;
-//         log.debug("Should call the respective interface to assign a value for this OID" );
-//          
-//         if (result != null)
-//         {
-//            errorStatus = SnmpPduPacket.ErrReadOnly;
-//            errorIndex = i + 1;
-//            log.debug("Error occured " + vb.getName().toString());
-//         }
-//         
-//         log.debug("Varbind[" + i + "] := " + vb.getName().toString());
-//         log.debug(" --> " + vb.getValue().toString());     
-//      }
-//     
-//      response = new SnmpPduRequest(SnmpPduPacket.RESPONSE, vblist);
-//      response.setErrorStatus(errorStatus);
-//      response.setErrorIndex(errorIndex);
-//
-//      return response;
    }
  
    /**
@@ -211,9 +138,7 @@
    public void snmpReceivedPdu(Snmp session, InetAddress manager, int port,
                                OctetString community, PDU pdu)
    {
-//      log.error("Message from manager " + manager.toString() + " on port " + port);
-//      int cmd = pdu.getCommand();
-//      log.error("Unsupported PDU command......... " + cmd);
+	   
    }
  
    /**
@@ -238,19 +163,6 @@
     */
    public void SnmpAgentSessionError(Snmp session, int error, Object ref)
    {
-//      log.error("An error occured in the trap session");
-//      log.error("Session error code = " + error);
-//      if(ref != null)
-//      {
-//         log.error("Session error reference: " + ref.toString());
-//      }
-//     
-//      if(error == SnmpAgentSession.ERROR_EXCEPTION)
-//      {
-//         synchronized(session)
-//         {
-//            session.notify(); // close the session
-//         }
-//      }
+
    }
 }



More information about the jboss-cvs-commits mailing list