public void sendResult(final OSDRequest rq, InternalObjectData response, ErrorResponse error) {

    if (error != null) {
      rq.sendError(error);
    } else {
      // only locally
      rq.sendSuccess(response.getMetadata(), response.getData());
    }
  }
Beispiel #2
0
  @Override
  public void startRequest(OSDRequest rq) {

    // check password to ensure that user is authorized
    Auth authData = rq.getRPCRequest().getHeader().getRequestHeader().getAuthData();
    if (master.getConfig().getAdminPassword().length() > 0
        && !master.getConfig().getAdminPassword().equals(authData.getAuthPasswd())) {
      rq.sendError(
          ErrorType.ERRNO,
          POSIXErrno.POSIX_ERROR_EACCES,
          "this operation requires an admin password");
      return;
    }

    try {
      rq.sendSuccess(null, null);
      Thread.sleep(100);
      master.asyncShutdown();
    } catch (Throwable thr) {
      Logging.logMessage(Logging.LEVEL_ERROR, this, "exception during shutdown");
      Logging.logError(Logging.LEVEL_ERROR, this, thr);
    }
  }
 public void sendResponse(OSDRequest rq, InternalObjectData result) {
   rq.sendSuccess(result.getMetadata(), null);
 }