Example #1
0
 @Override
 public boolean next(TreeEvent event) {
   if (!finished) {
     SnmpUriResponse response = createResponse(event);
     finished |= callback.onResponse(response, url, event.getUserObject());
   }
   return !finished;
 }
Example #2
0
 @Override
 public void finished(TreeEvent event) {
   if (!finished) {
     SnmpUriResponse response = createResponse(event);
     if (response.getResponseType() == SnmpUriResponse.Type.NEXT) {
       response.setResponseType(SnmpUriResponse.Type.FINAL);
     }
     callback.onResponse(response, url, event.getUserObject());
     finished = true;
   }
 }
Example #3
0
 @Override
 public void onResponse(ResponseEvent event) {
   SnmpUriResponse response = new SnmpUriResponse(SnmpUriResponse.Type.TIMEOUT);
   PDU responsePDU = event.getResponse();
   if (responsePDU != null) {
     if (responsePDU.getErrorStatus() != PDU.noError) {
       response = new SnmpUriResponse(responsePDU.getErrorStatus());
     } else {
       response =
           new SnmpUriResponse(
               Collections.singletonList(
                   responsePDU
                       .getVariableBindings()
                       .toArray(new VariableBinding[responsePDU.size()])));
     }
   }
   callback.onResponse(response, url, event.getUserObject());
 }