当前位置: 首页>>代码示例>>Java>>正文


Java SubRequest.completed方法代码示例

本文整理汇总了Java中org.snmp4j.agent.request.SubRequest.completed方法的典型用法代码示例。如果您正苦于以下问题:Java SubRequest.completed方法的具体用法?Java SubRequest.completed怎么用?Java SubRequest.completed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.snmp4j.agent.request.SubRequest的用法示例。


在下文中一共展示了SubRequest.completed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
public void get(SubRequest request) {
  OID oid = request.getVariableBinding().getOid();

  Variable var = get(oid);
  if (var == null) {
    request.getVariableBinding().setVariable(Null.noSuchInstance);
    request.completed();

    if (enableSnmpAccessStatisticsGatherer) {
      snmpAccessStatisticsGatherer
        .snmpGetFailed(request.getRequest().getContext(), oid);
    }

    return;
  }
  request.getVariableBinding().setVariable(var);
  request.completed();

  if (enableSnmpAccessStatisticsGatherer) {
    snmpAccessStatisticsGatherer
      .snmpGetSucceeded(request.getRequest().getContext(), oid);
  }
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:24,代码来源:MutableStaticMOGroup.java

示例2: commit

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
/**
 * commit
 * @param request
 *    a request to process commit SET request for.
 */
public void commit(SubRequest request) {
  Variable variable = request.getVariableBinding().getVariable();
  OID oid = request.getVariableBinding().getOid();

  synchronized (variableBindings) {
    request.setUndoValue(variableBindings.get(oid));
    variableBindings.put(oid, variable);
  }

  if (enableSnmpAccessStatisticsGatherer) {
    snmpAccessStatisticsGatherer.snmpSetSucceeded(request.getRequest().getContext(), oid);
  }

  request.completed();
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:21,代码来源:MutableStaticMOGroup.java

示例3: undo

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
/**
 * undo
 * @param request
 *    a request to process undo SET request for.
 */
public void undo(SubRequest request) {
  RequestStatus status = request.getStatus();
  if (
       (request.getUndoValue() != null)
    && (request.getUndoValue() instanceof Variable)
  ) {
    synchronized (variableBindings) {
      variableBindings.put(
        request.getVariableBinding().getOid(),
        (Variable)request.getUndoValue()
      );
    }

    status.setErrorStatus(SnmpConstants.SNMP_ERROR_SUCCESS);
    request.completed();
  }
  else {
    synchronized (variableBindings) {
      variableBindings.remove(request.getVariableBinding().getOid());
    }
    status.setErrorStatus(SnmpConstants.SNMP_ERROR_SUCCESS);
    request.completed();
  }
  // TODO mibAccessStatisticsもundo?
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:31,代码来源:MutableStaticMOGroup.java

示例4: getVariable

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
private void getVariable(final SubRequest request, final OID oid) {
    Variable value = findValueForOID(oid);
    VariableBinding vb = request.getVariableBinding();
    vb.setOid(oid);
    vb.setVariable(value == null ? Null.noSuchObject : value);
    request.completed();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:8,代码来源:PropertiesBackedManagedObject.java

示例5: next

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
public boolean next(SubRequest request) {
//    if (!request.getScope().equals(request.getQuery().getScope())) {
//      System.out.println("Never get here.");
//    }
    MOScope scope = request.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;
  }
 
开发者ID:kaitoy,项目名称:sneo,代码行数:32,代码来源:MutableStaticMOGroup.java

示例6: prepare

import org.snmp4j.agent.request.SubRequest; //导入方法依赖的package包/类
/**
 * Prepare
 * @param request
 *    a request to process prepare SET request for.
 */
public void prepare(SubRequest request) {
  RequestStatus status = request.getStatus();
  MOScope scp = request.getQuery().getScope();
  Variable variable = request.getVariableBinding().getVariable();
  OID oid = request.getVariableBinding().getOid();

  if (!scope.isCovered(scp)) {
    status.setErrorStatus(SnmpConstants.SNMP_ERROR_NO_CREATION);

    if (enableSnmpAccessStatisticsGatherer) {
      snmpAccessStatisticsGatherer.snmpSetFailed(request.getRequest().getContext(), oid);
    }

    return;
  }

  synchronized (variableBindings) {
    if (variableBindings.containsKey(oid)) {
      if (
        variable.getSyntax()
          != variableBindings.get(oid).getSyntax()
      ) {
        status.setErrorStatus(SnmpConstants.SNMP_ERROR_WRONG_TYPE);

        if (enableSnmpAccessStatisticsGatherer) {
          snmpAccessStatisticsGatherer.snmpSetFailed(request.getRequest().getContext(), oid);
        }

        return;
      }

      //int valueOK = isValueOK(request);
      //status.setErrorStatus(valueOK);
      status.setErrorStatus(SnmpConstants.SNMP_ERROR_SUCCESS);

      request.completed();
    }
    else {
      status.setErrorStatus(SnmpConstants.SNMP_ERROR_SUCCESS);
      request.completed();
    }
  }
}
 
开发者ID:kaitoy,项目名称:sneo,代码行数:49,代码来源:MutableStaticMOGroup.java


注:本文中的org.snmp4j.agent.request.SubRequest.completed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。