[jboss-cvs] JBossAS SVN: r112202 - branches/JBPAPP_5_1/varia/src/main/org/jboss/jmx/adaptor/snmp/agent.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Sep 6 06:14:23 EDT 2011


Author: mmusaji
Date: 2011-09-06 06:14:23 -0400 (Tue, 06 Sep 2011)
New Revision: 112202

Modified:
   branches/JBPAPP_5_1/varia/src/main/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java
Log:
JBPAPP-6504 Added system property jboss.snmp.use64bit to allow 64bit types to be returned by the snmp adaptor. Default value is false for backward compatibility

Modified: branches/JBPAPP_5_1/varia/src/main/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java
===================================================================
--- branches/JBPAPP_5_1/varia/src/main/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java	2011-09-06 05:35:32 UTC (rev 112201)
+++ branches/JBPAPP_5_1/varia/src/main/org/jboss/jmx/adaptor/snmp/agent/RequestHandlerImpl.java	2011-09-06 10:14:23 UTC (rev 112202)
@@ -22,6 +22,7 @@
 package org.jboss.jmx.adaptor.snmp.agent;
 
 import java.io.InputStream;
+import java.math.BigInteger;
 import java.net.InetAddress;
 import java.util.Iterator;
 import java.util.List;
@@ -58,6 +59,7 @@
 
 	private static final String NO_ENTRY_FOUND_FOR_OID = "No entry found for oid ";
 	private static final String SKIP_ENTRY = " - skipping entry";
+	private static final String USE_TYPE_64 = "jboss.snmp.use64bit";
 
 
 	/** Bindings from oid to mbean */
@@ -466,9 +468,14 @@
 
 				if (val instanceof Long)
             {
+				   String return64bitType = System.getProperty(USE_TYPE_64, "false");
 					Long uin = (Long) val;
+					if(return64bitType.equals("true")) {
+					   ssy = new SnmpCounter64(uin);
+					}else { //default return 32bit
 					ssy = new SnmpUInt32(uin);
 				}
+				}
             else if (val instanceof String)
             {
 					String in = (String) val;
@@ -548,6 +555,11 @@
             {
 					val = new Long(((SnmpUInt32)newVal).getValue());
 				}
+            else if (newVal instanceof SnmpCounter64)
+            {
+               BigInteger bi = BigInteger.ZERO;
+               val = bi.add(((SnmpCounter64)newVal).getValue()); //add newVal to ZERO
+				}
 				// TODO do more mumbo jumbo for type casting / changing
 				
 				if (val != null)



More information about the jboss-cvs-commits mailing list