/** * Creates a variable binding with the supplied object instance identifier * and a {@link Null} value. * @param oid * the OID for the new variable binding. */ public VariableBinding(OID oid) { setOid(oid); this.variable = Null.instance; }
/** * Creates a variable binding with the supplied object instance identifier * and a {@link Null} value. * @param oid * the OID for the new variable binding. */ public VariableBinding(OID oid) { setOid(oid); this.variable = Null.instance; }
/** * Creates a variable binding with the supplied object instance identifier * and a {@link Null} value. * @param oid * the OID for the new variable binding. */ public VariableBinding(OID oid) { setOid(oid); this.variable = Null.instance; }
/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
/** * Creates a variable binding with the supplied OID and value. * @param oid * the OID for the new variable binding (must not be <code>null</code>). * @param variable * the value for the new variable binding (must not be <code>null</code>). */ public VariableBinding(OID oid, Variable variable) { setOid(oid); setVariable(variable); }
public boolean next(SubRequest request) { MOScope scope = request.getQuery().getScope(); SortedMap<OID, Variable> tail = vbs.tailMap(scope.getLowerBound()); OID first = tail.firstKey(); if (scope.getLowerBound().equals(first) && (!scope.isLowerIncluded())) { if (tail.size() > 1) { Iterator<OID> it = tail.keySet().iterator(); it.next(); first = it.next(); } else { return false; } } if (first != null) { Variable vb = vbs.get(first); if (vb == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); } request.getVariableBinding().setOid(first); request.getVariableBinding().setVariable(vb); request.completed(); return true; } return false; }
public boolean next(SubRequest request) { MOScope scope = request.getQuery().getScope(); SortedMap tail = vbs.tailMap(scope.getLowerBound()); OID first = (OID) tail.firstKey(); if (scope.getLowerBound().equals(first) && (!scope.isLowerIncluded())) { if (tail.size() > 1) { Iterator it = tail.keySet().iterator(); it.next(); first = (OID)it.next(); } else { return false; } } if (first != null) { Variable vb = (Variable) vbs.get(first); if (vb == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); } request.getVariableBinding().setOid(first); request.getVariableBinding().setVariable(vb); request.completed(); return true; } return false; }
private void getVariable(final SubRequest request, final OID oid) { try { final Variable value = findValueForOID(oid); final VariableBinding vb = request.getVariableBinding(); vb.setOid(oid); vb.setVariable(value == null ? Null.noSuchObject : value); request.completed(); } catch (SnmpErrorStatusException e) { request.setErrorStatus(e.getErrorStatus()); request.completed(); } }
private void getVariable(final SubRequest request, final OID oid) { try { final Variable value = findValueForOID(oid); final VariableBinding vb = request.getVariableBinding(); vb.setOid(oid); vb.setVariable(value == null ? Null.noSuchObject : value); request.completed(); } catch (SnmpErrorStatusException e) { request.setErrorStatus(e.getErrorStatus()); request.completed(); } }
/** * Checks whether the request is within the scope of this scalar or not. * @param request * a SubRequest. * @return * <code>true</code> if the request is within scope and <code>false</code> * otherwise. In the latter case, the variable of the request is set * to {@link Null#noSuchInstance} and the request is marked completed. */ protected boolean checkRequestScope(SubRequest request) { if (!request.getVariableBinding().getOid().equals(oid)) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable(Null.noSuchInstance); request.completed(); return false; } return true; }
/** * Checks whether the request is within the scope of this scalar or not. * * @param request a SubRequest. * @return {@code true} if the request is within scope and {@code false} * otherwise. In the latter case, the variable of the request is set * to {@link Null#noSuchInstance} and the request is marked completed. */ protected boolean checkRequestScope(SubRequest request) { if (!request.getVariableBinding().getOid().equals(oid)) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable(Null.noSuchInstance); request.completed(); return false; } return true; }
public void get(SubRequest request) { RequestStatus status = request.getStatus(); if (checkRequestScope(request)) { if (access.isAccessibleForRead()) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable((Variable) getValue().clone()); request.completed(); } else { status.setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } } }
public void get(SubRequest request) { RequestStatus status = request.getStatus(); if (checkRequestScope(request)) { if (access.isAccessibleForRead()) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); Variable variable = getValue(); if (variable == null) { vb.setVariable(Null.noSuchObject); } else { vb.setVariable((Variable) variable.clone()); } request.completed(); } else { status.setErrorStatus(SnmpConstants.SNMP_ERROR_NO_ACCESS); } } }
public void updateNextRepetition() { if (!isBulkRequest()) { return; } this.query = null; SubRequestIterator repetitions = repetitions(true); // skip this one repetitions.next(); while (repetitions.hasNext()) { SnmpSubRequest nsreq = (SnmpSubRequest) repetitions.nextSubRequest(); if ((getStatus().getErrorStatus() == PDU.noError) && (!this.vb.isException())) { nsreq.query = null; nsreq.scope = getNextScope(this.vb.getOid()); nsreq.getVariableBinding().setOid(this.vb.getOid()); } else if (this.vb.isException()) { nsreq.query = null; nsreq.getVariableBinding().setOid(this.vb.getOid()); nsreq.getVariableBinding().setVariable(this.vb.getVariable()); nsreq.getStatus().setPhaseComplete(true); } } }
public void updateNextRepetition() { if (!isBulkRequest()) { return; } this.query = null; SubRequestIterator repetitions = repetitions(true); // skip this one if there is any if (repetitions.hasNext()) { repetitions.next(); } while (repetitions.hasNext()) { SnmpSubRequest nsreq = (SnmpSubRequest) repetitions.next(); if ((getStatus().getErrorStatus() == PDU.noError) && (!this.vb.isException())) { nsreq.query = null; nsreq.scope = getNextScope(this.vb.getOid()); nsreq.getVariableBinding().setOid(this.vb.getOid()); } else if (this.vb.isException()) { nsreq.query = null; nsreq.getVariableBinding().setOid(this.vb.getOid()); nsreq.getVariableBinding().setVariable(this.vb.getVariable()); nsreq.getStatus().setPhaseComplete(true); } } }
public boolean next(SubRequest request) { if (access.isAccessibleForRead() && (request.getScope().isCovered(getSingleInstanceScope()))) { VariableBinding vb = request.getVariableBinding(); vb.setOid(getOid()); vb.setVariable((Variable)getValue().clone()); request.completed(); if (logger.isDebugEnabled()) { logger.debug("Processed GETNEXT/BULK request '"+request+"' by '"+ getOid()); } return true; } if (logger.isDebugEnabled()) { logger.debug("Skipped '"+ getOid()+"' for GETNEXT/BULK request '"+request+"'"); } return false; }
public boolean next(SubRequest request) { MOScope scope = request.getQuery().getScope(); OID requestedOid = scope.getLowerBound(); OID nextOid = find(scope); if (nextOid == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpNextFailed(request.getRequest().getContext(), requestedOid); } return false; } request.getVariableBinding().setOid(nextOid); request.getVariableBinding().setVariable(get(nextOid)); request.completed(); if (enableSnmpAccessStatisticsGatherer) { snmpAccessStatisticsGatherer .snmpNextSucceeded(request.getRequest().getContext(), requestedOid); } return true; }