Ejemplo n.º 1
0
  private SrmRmdirResponse srmRmdir() throws SRMException {
    URI surl = URI.create(request.getSURL().toString());
    String path = getPath(surl);

    /* If surl is a prefix to any active upload, then we report the directory as
     * non-empty. This is not strictly required by the SRM spec, however S2 tests
     * (usecase.RmdirBeingPutInto) check for this behaviour.
     */
    for (PutFileRequest putFileRequest : Job.getActiveJobs(PutFileRequest.class)) {
      String requestPath = getPath(putFileRequest.getSurl());
      if (path.equals(requestPath)) {
        throw new SRMInvalidPathException("Not a directory");
      }
      if (requestPath.startsWith(path)) {
        throw new SRMNonEmptyDirectoryException("Directory is not empty");
      }
    }

    storage.removeDirectory(user, surl, request.getRecursive() != null && request.getRecursive());
    return new SrmRmdirResponse(new TReturnStatus(TStatusCode.SRM_SUCCESS, null));
  }
Ejemplo n.º 2
0
 @Override
 public synchronized void add(Job job) {
   stack.addLast(job.getId());
 }