1 10 package com.sun.jmx.snmp.agent; 11 12 import java.io.Serializable ; 15 import java.util.Hashtable ; 16 import java.util.Enumeration ; 17 import java.util.Vector ; 18 19 import com.sun.jmx.snmp.SnmpOid; 22 import com.sun.jmx.snmp.SnmpValue; 23 import com.sun.jmx.snmp.SnmpVarBind; 24 import com.sun.jmx.snmp.SnmpStatusException; 25 26 29 55 56 public class SnmpStandardObjectServer implements Serializable { 57 58 102 public void get(SnmpStandardMetaServer meta, SnmpMibSubRequest req, 103 int depth) 104 throws SnmpStatusException { 105 106 final Object data = req.getUserData(); 107 108 for (Enumeration e= req.getElements(); e.hasMoreElements();) { 109 final SnmpVarBind var= (SnmpVarBind) e.nextElement(); 110 try { 111 final long id = var.oid.getOidArc(depth); 112 var.value = meta.get(id, data); 113 } catch(SnmpStatusException x) { 114 req.registerGetException(var,x); 115 } 116 } 117 } 118 119 163 public void set(SnmpStandardMetaServer meta, SnmpMibSubRequest req, 164 int depth) 165 throws SnmpStatusException { 166 167 final Object data = req.getUserData(); 168 169 for (Enumeration e= req.getElements(); e.hasMoreElements();) { 170 SnmpVarBind var = null; 171 var = (SnmpVarBind) e.nextElement(); 172 try { 173 final long id = var.oid.getOidArc(depth); 177 var.value = meta.set(var.value, id, data); 178 } catch(SnmpStatusException x) { 179 req.registerSetException(var,x); 180 } 181 } 182 } 183 184 229 public void check(SnmpStandardMetaServer meta, SnmpMibSubRequest req, 230 int depth) 231 throws SnmpStatusException { 232 233 final Object data = req.getUserData(); 234 235 for (Enumeration e= req.getElements(); e.hasMoreElements();) { 236 final SnmpVarBind var = (SnmpVarBind) e.nextElement(); 237 try { 238 final long id = var.oid.getOidArc(depth); 242 meta.check(var.value,id,data); 243 } catch(SnmpStatusException x) { 244 req.registerCheckException(var,x); 245 } 246 } 247 } 248 } 249 | Popular Tags |