/** * Initialize * * @param resourceName A file containing get/set mappings * @param server Our MBean-Server * @param log The logger we use * @param uptime The uptime of the snmp-agent subsystem. */ public void initialize(String resourceName, MBeanServer server, Logger log, Clock uptime) throws Exception { log.debug("initialize() with res=" + resourceName); super.initialize(resourceName, server, log, uptime); tableMapper = new TableMapper(server, log); attributeTableMapper = new AttributeTableMapper(server, log); if (resourceName != null) initializeBindings(); else log.warn("No RequestHandlerResName configured, disabling snmp-get"); initialized = true; }
/** * This method checks the existence of an object of a GET / SET request. * This is as opposed to a specific instance, which has a value tied to it. this method simply * returns a boolean. * * @param oid * @return * @throws NoSuchObjectException * @throws VariableTypeException */ private boolean checkObject(final OID oid) { // OID coid = oid; boolean exists = bindings.get(oid) != null; if(!exists) { //needed for table exists = tableMapper.belongsToTable(oid); if(!exists) { exists = attributeTableMapper.belongsToTables(oid); } } return exists; }
/** * Lookup a BindEntry on the given oid. * * @param oid The oid look up. * @return a bind entry or null. */ private BindEntry findBindEntryForOid(final OID oid) { //param probably not supposed to be OID type OID coid= new OID(oid); //add possible oid format checking //we should not be stripping off the last number if it's 0! that's the instance identifier, //and indicates that the given variable is a scalar value! (not part of a table.) /*if (coid.last() == 0) { coid.removeLast(); }*/ BindEntry be = (BindEntry)bindings.get(coid); if(be == null) { //needed for tables be = tableMapper.getTableBinding(coid); if(be == null) { be = attributeTableMapper.getTableBinding(coid, false); } } return be; }
attributeTableMapper.addTableMapping(mmb, ma); oidKeys.add(new OID(oid)); } else {
return ssy; ssy = attributeTableMapper.getIndexValue(oid); if(ssy != null) { return ssy;
attributeTableMapper.removeTableMapping(mmb, ma); oidKeys.remove(new OID(oid)); } else {
return nextOid; nextOid = attributeTableMapper.getNextTable(coid); if(nextOid != null) { return nextOid; return nextOid; nextOid = attributeTableMapper.getNextTable(roid); if(nextOid != null) { return nextOid;
attributeTableMapper.addTableMapping(mmb, ma); oidKeys.add(new OID(oid)); } else {
return ssy; ssy = attributeTableMapper.getIndexValue(oid); if(ssy != null) { return ssy;
attributeTableMapper.removeTableMapping(mmb, ma); oidKeys.remove(new OID(oid)); } else {
return nextOid; nextOid = attributeTableMapper.getNextTable(coid); if(nextOid != null) { return nextOid; return nextOid; nextOid = attributeTableMapper.getNextTable(roid); if(nextOid != null) { return nextOid;
/** * Lookup a BindEntry on the given oid. * * @param oid The oid look up. * @return a bind entry or null. */ private BindEntry findBindEntryForOid(final OID oid) { //param probably not supposed to be OID type OID coid= new OID(oid); //add possible oid format checking //we should not be stripping off the last number if it's 0! that's the instance identifier, //and indicates that the given variable is a scalar value! (not part of a table.) /*if (coid.last() == 0) { coid.removeLast(); }*/ BindEntry be = (BindEntry)bindings.get(coid); if(be == null) { //needed for tables be = tableMapper.getTableBinding(coid); if(be == null) { be = attributeTableMapper.getTableBinding(coid, false); } } return be; }
/** * Initialize * * @param resourceName A file containing get/set mappings * @param server Our MBean-Server * @param log The logger we use * @param uptime The uptime of the snmp-agent subsystem. */ public void initialize(String resourceName, MBeanServer server, Logger log, Clock uptime) throws Exception { log.debug("initialize() with res=" + resourceName); super.initialize(resourceName, server, log, uptime); tableMapper = new TableMapper(server, log); attributeTableMapper = new AttributeTableMapper(server, log); if (resourceName != null) initializeBindings(); else log.warn("No RequestHandlerResName configured, disabling snmp-get"); initialized = true; }
/** * This method checks the existence of an object of a GET / SET request. * This is as opposed to a specific instance, which has a value tied to it. this method simply * returns a boolean. * * @param oid * @return * @throws NoSuchObjectException * @throws VariableTypeException */ private boolean checkObject(final OID oid) { // OID coid = oid; boolean exists = bindings.get(oid) != null; if(!exists) { //needed for table exists = tableMapper.belongsToTable(oid); if(!exists) { exists = attributeTableMapper.belongsToTables(oid); } } return exists; }
BindEntry be = getTableBinding(currentOID, isRowEntry);
BindEntry be = getTableBinding(currentOID, isRowEntry);
public Variable getIndexValue(OID oid) { BindEntry be = getTableBinding(oid, true); Object val = null; if(be == null) {
public Variable getIndexValue(OID oid) { BindEntry be = getTableBinding(oid, true); Object val = null; if(be == null) {