Search in sources :

Example 1 with SRM_SPACE_LIFETIME_EXPIRED

use of org.dcache.srm.v2_2.TStatusCode.SRM_SPACE_LIFETIME_EXPIRED in project dcache by dCache.

the class PutFileRequest method getTPutRequestFileStatus.

protected 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
    TReturnStatus returnStatus = getReturnStatus();
    String turlstring = getTurlString();
    if (turlstring != null && TStatusCode.SRM_SPACE_AVAILABLE.equals(returnStatus.getStatusCode())) {
        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);
    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;
}
Also used : TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) UnsignedLong(org.apache.axis.types.UnsignedLong) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) URI(java.net.URI) SRMInvalidRequestException(org.dcache.srm.SRMInvalidRequestException)

Aggregations

URI (java.net.URI)1 UnsignedLong (org.apache.axis.types.UnsignedLong)1 SRMInvalidRequestException (org.dcache.srm.SRMInvalidRequestException)1 TPutRequestFileStatus (org.dcache.srm.v2_2.TPutRequestFileStatus)1 TReturnStatus (org.dcache.srm.v2_2.TReturnStatus)1