Exemple #1
0
  public static URI scopedNameToURI(ImmutableScopedName sn) {

    try {
      return new URI(sn.getNameScope() + "/" + sn.getLocalName());
    } catch (URI.MalformedURIException e) {
      e.printStackTrace();
    }

    return null;
  }
Exemple #2
0
  public TPutRequestFileStatus getTPutRequestFileStatus() throws SRMInvalidRequestException {
    TPutRequestFileStatus fileStatus = new TPutRequestFileStatus();
    fileStatus.setFileSize(((getSize() == null) ? null : new UnsignedLong(getSize())));

    org.apache.axis.types.URI anSurl;
    try {
      anSurl = new org.apache.axis.types.URI(getSurlString());
    } catch (org.apache.axis.types.URI.MalformedURIException e) {
      logger.error(e.toString());
      throw new SRMInvalidRequestException("wrong surl format");
    }
    fileStatus.setSURL(anSurl);
    // fileStatus.set

    String turlstring = getTurlString();
    if (turlstring != null) {
      org.apache.axis.types.URI transferURL;
      try {
        transferURL = new org.apache.axis.types.URI(turlstring);
      } catch (org.apache.axis.types.URI.MalformedURIException e) {
        logger.error("Generated broken TURL \"{}\": {}", turlstring, e);
        throw new SRMInvalidRequestException("wrong turl format");
      }
      fileStatus.setTransferURL(transferURL);
    }
    fileStatus.setEstimatedWaitTime(getContainerRequest().getRetryDeltaTime());
    fileStatus.setRemainingPinLifetime((int) getRemainingLifetime() / 1000);
    TReturnStatus returnStatus = getReturnStatus();
    if (TStatusCode.SRM_SPACE_LIFETIME_EXPIRED.equals(returnStatus.getStatusCode())) {
      // SRM_SPACE_LIFETIME_EXPIRED is illeal on the file level,
      // but we use it to correctly calculate the request level status
      // so we do the translation here
      returnStatus = new TReturnStatus(TStatusCode.SRM_FAILURE, null);
    }

    fileStatus.setStatus(returnStatus);

    return fileStatus;
  }