@Override
  public void startRequest(final OSDRequest rq) {
    final xtreemfs_rwr_auth_stateRequest args =
        (xtreemfs_rwr_auth_stateRequest) rq.getRequestArgs();

    if (Logging.isDebug()) {
      Logging.logMessage(
          Logging.LEVEL_DEBUG, this, "RWR auth state request for file %s", args.getFileId());
    }

    getLocalReplicaState(rq, args);
  }
  @Override
  public ErrorResponse parseRPCMessage(OSDRequest rq) {
    try {
      xtreemfs_rwr_auth_stateRequest rpcrq = (xtreemfs_rwr_auth_stateRequest) rq.getRequestArgs();
      rq.setFileId(rpcrq.getFileId());
      rq.setCapability(new Capability(rpcrq.getFileCredentials().getXcap(), sharedSecret));
      rq.setLocationList(new XLocations(rpcrq.getFileCredentials().getXlocs(), localUUID));

      return null;
    } catch (InvalidXLocationsException ex) {
      return ErrorUtils.getErrorResponse(
          ErrorType.ERRNO, POSIXErrno.POSIX_ERROR_EINVAL, ex.toString());
    } catch (Throwable ex) {
      return ErrorUtils.getInternalServerError(ex);
    }
  }
  private void startFetch(final OSDRequest rq, final ReplicaStatus localState) {
    final String fileId = rq.getFileId();
    final XLocations xloc = rq.getLocationList();
    final xtreemfs_rwr_auth_stateRequest args =
        (xtreemfs_rwr_auth_stateRequest) rq.getRequestArgs();

    master
        .getRWReplicationStage()
        .fetchInvalidated(
            fileId,
            args.getState(),
            localState,
            args.getFileCredentials(),
            xloc,
            new RWReplicationCallback() {

              @Override
              public void success(long newObjectVersion) {
                rq.sendSuccess(emptyResponse.getDefaultInstance(), null);
              }

              @Override
              public void failed(ErrorResponse ex) {
                rq.sendError(ex);
              }

              @Override
              public void redirect(String redirectTo) {
                // Not used in fetchInvalidated
                rq.sendError(
                    ErrorUtils.getErrorResponse(
                        ErrorType.INTERNAL_SERVER_ERROR,
                        POSIXErrno.POSIX_ERROR_NONE,
                        "FetchInvalidated called the redirect method. This should never happen"));
              }
            },
            rq);
  }
  @Override
  public void startRequest(final OSDRequest rq) {
    final xtreemfs_rwr_auth_stateRequest args =
        (xtreemfs_rwr_auth_stateRequest) rq.getRequestArgs();

    master
        .getPreprocStage()
        .invalidateXLocSet(
            rq,
            args.getFileCredentials(),
            false,
            new InvalidateXLocSetCallback() {

              @Override
              public void invalidateComplete(LeaseState leaseState, ErrorResponse error) {
                if (error != null) {
                  rq.sendError(error);
                } else {
                  postInvalidation(rq);
                }
              }
            });
  }