Search in sources :

Example 1 with TPutRequestFileStatus

use of org.dcache.srm.v2_2.TPutRequestFileStatus in project dcache by dCache.

the class PutRequest method getSrmStatusOfPutRequestResponse.

public final SrmStatusOfPutRequestResponse getSrmStatusOfPutRequestResponse(org.apache.axis.types.URI[] surls) throws SRMFileRequestNotFoundException, SRMInvalidRequestException {
    SrmStatusOfPutRequestResponse response = new SrmStatusOfPutRequestResponse();
    response.setReturnStatus(getTReturnStatus());
    TPutRequestFileStatus[] statusArray = getArrayOfTPutRequestFileStatus(surls);
    if (LOGGER.isDebugEnabled()) {
        StringBuilder s = new StringBuilder("getSrmStatusOfPutRequestResponse:");
        s.append(" StatusCode = ").append(response.getReturnStatus().getStatusCode());
        for (TPutRequestFileStatus fs : statusArray) {
            s.append(" FileStatusCode = ").append(fs.getStatus().getStatusCode());
        }
        LOGGER.debug(s.toString());
    }
    response.setArrayOfFileStatuses(new ArrayOfTPutRequestFileStatus(statusArray));
    response.setRemainingTotalRequestTime(getRemainingLifetimeIn(TimeUnit.SECONDS));
    return response;
}
Also used : TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus) SrmStatusOfPutRequestResponse(org.dcache.srm.v2_2.SrmStatusOfPutRequestResponse) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus)

Example 2 with TPutRequestFileStatus

use of org.dcache.srm.v2_2.TPutRequestFileStatus in project dcache by dCache.

the class SRMPutClientV2 method start.

@Override
public void start() throws Exception {
    try {
        copier = new Copier(configuration);
        new Thread(copier).start();
        int len = from.length;
        TPutFileRequest[] fileRequests = new TPutFileRequest[len];
        String[] SURLS = new String[len];
        for (int i = 0; i < len; ++i) {
            java.net.URI filesource = from[i];
            int filetype = SRMDispatcher.getUrlType(filesource);
            if ((filetype & SRMDispatcher.FILE_URL) == 0) {
                throw new IOException(" source is not file " + filesource);
            }
            if ((filetype & SRMDispatcher.DIRECTORY_URL) == SRMDispatcher.DIRECTORY_URL) {
                throw new IOException(" source is directory " + filesource);
            }
            if ((filetype & SRMDispatcher.CAN_READ_FILE_URL) == 0) {
                throw new IOException(" source is not readable " + filesource);
            }
            File f = new File(filesource.getPath());
            long filesize = f.length();
            SURLS[i] = to[i].toASCIIString();
            URI uri = new URI(SURLS[i]);
            fileRequests[i] = new TPutFileRequest();
            fileRequests[i].setExpectedFileSize(new UnsignedLong(filesize));
            fileRequests[i].setTargetSURL(uri);
            pendingSurlsToIndex.put(SURLS[i], i);
        }
        hook = new Thread(this);
        Runtime.getRuntime().addShutdownHook(hook);
        SrmPrepareToPutRequest srmPrepareToPutRequest = new SrmPrepareToPutRequest();
        srmPrepareToPutRequest.setUserRequestDescription(configuration.getUserRequestDescription());
        String storagetype = configuration.getStorageType();
        if (storagetype != null) {
            srmPrepareToPutRequest.setDesiredFileStorageType(FileStorageType.fromString(storagetype.toUpperCase()).toTFileStorageType());
        }
        srmPrepareToPutRequest.setDesiredTotalRequestTime((int) configuration.getRequestLifetime());
        srmPrepareToPutRequest.setArrayOfFileRequests(new ArrayOfTPutFileRequest(fileRequests));
        TAccessPattern ap = null;
        if (configuration.getAccessPattern() != null) {
            ap = TAccessPattern.fromString(configuration.getAccessPattern());
        }
        TConnectionType ct = null;
        if (configuration.getConnectionType() != null) {
            ct = TConnectionType.fromString(configuration.getConnectionType());
        }
        ArrayOfString protocolArray = null;
        if (configuration.getProtocols() != null) {
            protocolArray = new ArrayOfString(configuration.getProtocols());
        }
        ArrayOfString arrayOfClientNetworks = null;
        if (configuration.getArrayOfClientNetworks() != null) {
            arrayOfClientNetworks = new ArrayOfString(configuration.getArrayOfClientNetworks());
        }
        if (ap != null || ct != null || arrayOfClientNetworks != null || protocolArray != null) {
            srmPrepareToPutRequest.setTransferParameters(new TTransferParameters(ap, ct, arrayOfClientNetworks, protocolArray));
        }
        TRetentionPolicy rp = configuration.getRetentionPolicy() != null ? RetentionPolicy.fromString(configuration.getRetentionPolicy()).toTRetentionPolicy() : null;
        TAccessLatency al = configuration.getAccessLatency() != null ? AccessLatency.fromString(configuration.getAccessLatency()).toTAccessLatency() : null;
        if ((al != null) && (rp == null)) {
            throw new IllegalArgumentException("if access latency is specified, " + "then retention policy have to be specified as well");
        } else if (rp != null) {
            srmPrepareToPutRequest.setTargetFileRetentionPolicyInfo(new TRetentionPolicyInfo(rp, al));
        }
        if (configuration.getOverwriteMode() != null) {
            srmPrepareToPutRequest.setOverwriteOption(TOverwriteMode.fromString(configuration.getOverwriteMode()));
        }
        if (configuration.getSpaceToken() != null) {
            srmPrepareToPutRequest.setTargetSpaceToken(configuration.getSpaceToken());
        }
        configuration.getStorageSystemInfo().ifPresent(srmPrepareToPutRequest::setStorageSystemInfo);
        response = srm.srmPrepareToPut(srmPrepareToPutRequest);
        if (response == null) {
            throw new IOException(" null response");
        }
        TReturnStatus status = response.getReturnStatus();
        if (status == null) {
            throw new IOException(" null return status");
        }
        TStatusCode statusCode = status.getStatusCode();
        if (statusCode == null) {
            throw new IOException(" null status code");
        }
        if (RequestStatusTool.isFailedRequestStatus(status) && (statusCode != TStatusCode.SRM_FAILURE || response.getArrayOfFileStatuses() == null)) {
            String explanation = status.getExplanation();
            if (explanation != null) {
                throw new IOException("srmPrepareToPut submission failed, unexpected or failed status : " + statusCode + " explanation= " + explanation);
            } else {
                throw new IOException("srmPrepareToPut submission failed, unexpected or failed status : " + statusCode);
            }
        }
        requestToken = response.getRequestToken();
        dsay(" srm returned requestToken = " + requestToken);
        if (response.getArrayOfFileStatuses() == null) {
            throw new IOException("returned PutRequestFileStatuses is an empty array");
        }
        TPutRequestFileStatus[] putRequestFileStatuses = response.getArrayOfFileStatuses().getStatusArray();
        if (putRequestFileStatuses.length != len) {
            throw new IOException("incorrect number of GetRequestFileStatuses" + "in RequestStatus expected " + len + " received " + putRequestFileStatuses.length);
        }
        while (!pendingSurlsToIndex.isEmpty()) {
            long estimatedWaitInSeconds = 5;
            for (TPutRequestFileStatus putRequestFileStatus : putRequestFileStatuses) {
                URI surl = putRequestFileStatus.getSURL();
                if (surl == null) {
                    esay("invalid putRequestFileStatus, surl is null");
                    continue;
                }
                String surl_string = surl.toString();
                if (!pendingSurlsToIndex.containsKey(surl_string)) {
                    esay("invalid putRequestFileStatus, surl = " + surl_string + " not found");
                    continue;
                }
                TReturnStatus fileStatus = putRequestFileStatus.getStatus();
                if (fileStatus == null) {
                    throw new IOException(" null file return status");
                }
                TStatusCode fileStatusCode = fileStatus.getStatusCode();
                if (fileStatusCode == null) {
                    throw new IOException(" null file status code");
                }
                if (RequestStatusTool.isFailedFileRequestStatus(fileStatus)) {
                    String explanation = fileStatus.getExplanation();
                    String error = isNullOrEmpty(explanation) ? fileStatusCode.toString() : fileStatusCode + ": " + explanation;
                    say(error);
                    int indx = pendingSurlsToIndex.remove(surl_string);
                    setReportFailed(from[indx], to[indx], error);
                    continue;
                }
                if (putRequestFileStatus.getTransferURL() != null) {
                    java.net.URI globusTURL = new java.net.URI(putRequestFileStatus.getTransferURL().toString());
                    int indx = pendingSurlsToIndex.remove(surl_string);
                    setReportFailed(from[indx], to[indx], "received TURL, but did not complete transfer");
                    CopyJob job = new SRMV2CopyJob(from[indx], globusTURL, srm, requestToken, logger, to[indx], false, this);
                    copier.addCopyJob(job);
                    continue;
                }
                if (putRequestFileStatus.getEstimatedWaitTime() != null && putRequestFileStatus.getEstimatedWaitTime() < estimatedWaitInSeconds && putRequestFileStatus.getEstimatedWaitTime() >= 1) {
                    estimatedWaitInSeconds = putRequestFileStatus.getEstimatedWaitTime();
                }
            }
            if (pendingSurlsToIndex.isEmpty()) {
                dsay("no more pending transfers, breaking the loop");
                Runtime.getRuntime().removeShutdownHook(hook);
                break;
            }
            // do not wait longer then 60 seconds
            if (estimatedWaitInSeconds > 60) {
                estimatedWaitInSeconds = 60;
            }
            try {
                say("sleeping " + estimatedWaitInSeconds + " seconds ...");
                Thread.sleep(estimatedWaitInSeconds * 1000);
            } catch (InterruptedException ie) {
                logger.elog(ie.toString());
            }
            SrmStatusOfPutRequestRequest srmStatusOfPutRequestRequest = new SrmStatusOfPutRequestRequest();
            srmStatusOfPutRequestRequest.setRequestToken(requestToken);
            // if we do not have completed file requests
            // we want to get status for all files
            // we do not need to specify any surls
            int expectedResponseLength;
            // we do not know what to expect from the server when
            // no surls are specified int the status update request
            // so we always are sending the list of all pending srm urls
            String[] pendingSurlStrings = pendingSurlsToIndex.keySet().toArray(new String[pendingSurlsToIndex.size()]);
            expectedResponseLength = pendingSurlStrings.length;
            URI[] surlArray = new URI[expectedResponseLength];
            for (int i = 0; i < expectedResponseLength; ++i) {
                surlArray[i] = new URI(pendingSurlStrings[i]);
            }
            srmStatusOfPutRequestRequest.setArrayOfTargetSURLs(new ArrayOfAnyURI(surlArray));
            SrmStatusOfPutRequestResponse srmStatusOfPutRequestResponse = srm.srmStatusOfPutRequest(srmStatusOfPutRequestRequest);
            if (srmStatusOfPutRequestResponse == null) {
                throw new IOException(" null srmStatusOfPutRequestResponse");
            }
            if (srmStatusOfPutRequestResponse.getArrayOfFileStatuses() == null) {
                esay("putRequestFileStatuses == null");
                throw new IOException("putRequestFileStatuses == null");
            }
            putRequestFileStatuses = srmStatusOfPutRequestResponse.getArrayOfFileStatuses().getStatusArray();
            if (putRequestFileStatuses.length != expectedResponseLength) {
                esay("incorrect number of RequestFileStatuses");
                throw new IOException("incorrect number of RequestFileStatuses");
            }
            status = srmStatusOfPutRequestResponse.getReturnStatus();
            if (status == null) {
                throw new IOException(" null return status");
            }
            statusCode = status.getStatusCode();
            if (statusCode == null) {
                throw new IOException(" null status code");
            }
            if (RequestStatusTool.isFailedRequestStatus(status)) {
                String error = "srmPrepareToPut update failed, status : " + statusCode + " explanation=" + status.getExplanation();
                esay(error);
                for (int i = 0; i < expectedResponseLength; ++i) {
                    TReturnStatus frstatus = putRequestFileStatuses[i].getStatus();
                    if (frstatus != null) {
                        esay("PutFileRequest[" + putRequestFileStatuses[i].getSURL() + "] status=" + frstatus.getStatusCode() + " explanation=" + frstatus.getExplanation());
                        if (!RequestStatusTool.isTransientStateStatus(frstatus)) {
                            pendingSurlsToIndex.remove(putRequestFileStatuses[i].getSURL().toString());
                        }
                    }
                }
                throw new IOException(error);
            }
        }
    } catch (Exception e) {
        try {
            if (copier != null) {
                dsay("stopping copier" + e);
                copier.stop();
                abortAllPendingFiles();
            }
        } catch (Exception e1) {
            edsay(e1.toString());
        }
        throw e;
    } finally {
        if (copier != null) {
            copier.doneAddingJobs();
            try {
                copier.waitCompletion();
            } catch (Exception e1) {
                edsay(e1.toString());
            }
        }
        report.dumpReport();
        if (!report.everythingAllRight()) {
            report.reportErrors(System.err);
        }
    }
}
Also used : TAccessPattern(org.dcache.srm.v2_2.TAccessPattern) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) ArrayOfTPutFileRequest(org.dcache.srm.v2_2.ArrayOfTPutFileRequest) TPutFileRequest(org.dcache.srm.v2_2.TPutFileRequest) TTransferParameters(org.dcache.srm.v2_2.TTransferParameters) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) SrmStatusOfPutRequestRequest(org.dcache.srm.v2_2.SrmStatusOfPutRequestRequest) TRetentionPolicyInfo(org.dcache.srm.v2_2.TRetentionPolicyInfo) TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) SrmPrepareToPutRequest(org.dcache.srm.v2_2.SrmPrepareToPutRequest) TConnectionType(org.dcache.srm.v2_2.TConnectionType) UnsignedLong(org.apache.axis.types.UnsignedLong) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) TRetentionPolicy(org.dcache.srm.v2_2.TRetentionPolicy) SrmStatusOfPutRequestResponse(org.dcache.srm.v2_2.SrmStatusOfPutRequestResponse) IOException(java.io.IOException) ArrayOfTPutFileRequest(org.dcache.srm.v2_2.ArrayOfTPutFileRequest) TStatusCode(org.dcache.srm.v2_2.TStatusCode) IOException(java.io.IOException) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) TAccessLatency(org.dcache.srm.v2_2.TAccessLatency) File(java.io.File) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 3 with TPutRequestFileStatus

use of org.dcache.srm.v2_2.TPutRequestFileStatus in project dcache by dCache.

the class RemoteTurlPutterV2 method run.

@Override
public void run() {
    if (number_of_file_reqs == 0) {
        LOGGER.debug("number_of_file_reqs is 0, nothing to do");
        return;
    }
    try {
        int len = SURLs.length;
        if (srmPrepareToPutResponse == null) {
            throw new IOException(" null srmPrepareToPutResponse");
        }
        TReturnStatus status = srmPrepareToPutResponse.getReturnStatus();
        if (status == null) {
            throw new IOException(" null return status");
        }
        TStatusCode statusCode = status.getStatusCode();
        if (statusCode == null) {
            throw new IOException(" null status code");
        }
        if (RequestStatusTool.isFailedRequestStatus(status)) {
            throw new IOException("srmPrepareToPut submission failed, unexpected or failed status : " + statusCode + " explanation=" + status.getExplanation());
        }
        requestToken = srmPrepareToPutResponse.getRequestToken();
        LOGGER.debug(" srm returned requestToken = {} one of remote surls = {}", requestToken, SURLs[0]);
        ArrayOfTPutRequestFileStatus arrayOfTPutRequestFileStatus = srmPrepareToPutResponse.getArrayOfFileStatuses();
        if (arrayOfTPutRequestFileStatus == null) {
            throw new IOException("returned PutRequestFileStatuses is an empty array");
        }
        TPutRequestFileStatus[] putRequestFileStatuses = arrayOfTPutRequestFileStatus.getStatusArray();
        if (putRequestFileStatuses == null) {
            throw new IOException("returned PutRequestFileStatuses is an empty array");
        }
        if (putRequestFileStatuses.length != len) {
            throw new IOException("incorrect number of GetRequestFileStatuses" + "in RequestStatus expected " + len + " received " + putRequestFileStatuses.length);
        }
        boolean haveCompletedFileRequests = false;
        while (!pendingSurlsToIndex.isEmpty()) {
            long estimatedWaitInSeconds = Integer.MAX_VALUE;
            for (TPutRequestFileStatus putRequestFileStatus : putRequestFileStatuses) {
                URI surl = putRequestFileStatus.getSURL();
                if (surl == null) {
                    LOGGER.error("invalid putRequestFileStatus, surl is null");
                    continue;
                }
                String surl_string = surl.toString();
                if (!pendingSurlsToIndex.containsKey(surl_string)) {
                    LOGGER.error("invalid putRequestFileStatus, surl = {} not found", surl_string);
                    continue;
                }
                TReturnStatus fileStatus = putRequestFileStatus.getStatus();
                if (fileStatus == null) {
                    throw new IOException(" null file return status");
                }
                TStatusCode fileStatusCode = fileStatus.getStatusCode();
                if (fileStatusCode == null) {
                    throw new IOException(" null file status code");
                }
                if (RequestStatusTool.isFailedFileRequestStatus(fileStatus)) {
                    String error = "retreval of surl " + surl_string + " failed, status = " + fileStatusCode + " explanation=" + fileStatus.getExplanation();
                    LOGGER.error(error);
                    int indx = pendingSurlsToIndex.remove(surl_string);
                    notifyOfFailure(SURLs[indx], error, requestToken, null);
                    haveCompletedFileRequests = true;
                    continue;
                }
                if (putRequestFileStatus.getTransferURL() != null) {
                    String turl = putRequestFileStatus.getTransferURL().toString();
                    int indx = pendingSurlsToIndex.remove(surl_string);
                    // in case of put we do not need the size from the destination
                    notifyOfTURL(SURLs[indx], turl, requestToken, null, null);
                    continue;
                }
                if (putRequestFileStatus.getEstimatedWaitTime() != null && putRequestFileStatus.getEstimatedWaitTime() < estimatedWaitInSeconds && putRequestFileStatus.getEstimatedWaitTime() >= 1) {
                    estimatedWaitInSeconds = putRequestFileStatus.getEstimatedWaitTime();
                }
            }
            if (pendingSurlsToIndex.isEmpty()) {
                LOGGER.debug("no more pending transfers, breaking the loop");
                break;
            }
            // do not wait longer then 60 seconds
            if (estimatedWaitInSeconds > 60) {
                estimatedWaitInSeconds = 60;
            }
            try {
                LOGGER.debug("sleeping {} seconds ...", estimatedWaitInSeconds);
                Thread.sleep(estimatedWaitInSeconds * 1000);
            } catch (InterruptedException ie) {
            }
            SrmStatusOfPutRequestRequest srmStatusOfPutRequestRequest = new SrmStatusOfPutRequestRequest();
            srmStatusOfPutRequestRequest.setRequestToken(requestToken);
            // if we do not have completed file requests
            // we want to get status for all files
            // we do not need to specify any surls
            int expectedResponseLength;
            if (haveCompletedFileRequests) {
                String[] pendingSurlStrings = pendingSurlsToIndex.keySet().toArray(String[]::new);
                expectedResponseLength = pendingSurlStrings.length;
                URI[] surlArray = new URI[expectedResponseLength];
                for (int i = 0; i < expectedResponseLength; ++i) {
                    URI uri = new URI(pendingSurlStrings[i]);
                    surlArray[i] = uri;
                }
                srmStatusOfPutRequestRequest.setArrayOfTargetSURLs(new ArrayOfAnyURI(surlArray));
            } else {
                expectedResponseLength = SURLs.length;
                URI[] surlArray = new URI[expectedResponseLength];
                for (int i = 0; i < expectedResponseLength; ++i) {
                    URI surl = new URI(SURLs[i]);
                    surlArray[i] = surl;
                }
                srmStatusOfPutRequestRequest.setArrayOfTargetSURLs(new ArrayOfAnyURI(surlArray));
            }
            SrmStatusOfPutRequestResponse srmStatusOfPutRequestResponse = srmv2.srmStatusOfPutRequest(srmStatusOfPutRequestRequest);
            if (srmStatusOfPutRequestResponse == null) {
                throw new IOException(" null srmStatusOfPutRequestResponse");
            }
            arrayOfTPutRequestFileStatus = srmStatusOfPutRequestResponse.getArrayOfFileStatuses();
            if (arrayOfTPutRequestFileStatus == null) {
                throw new IOException("incorrect number of RequestFileStatuses");
            }
            putRequestFileStatuses = arrayOfTPutRequestFileStatus.getStatusArray();
            if (putRequestFileStatuses == null || putRequestFileStatuses.length != expectedResponseLength) {
                LOGGER.error("incorrect number of RequestFileStatuses");
                throw new IOException("incorrect number of RequestFileStatuses");
            }
            status = srmStatusOfPutRequestResponse.getReturnStatus();
            if (status == null) {
                throw new IOException(" null return status");
            }
            statusCode = status.getStatusCode();
            if (statusCode == null) {
                throw new IOException(" null status code");
            }
            if (RequestStatusTool.isFailedRequestStatus(status)) {
                throw new IOException("srmPrepareToPut update failed, unexpected or failed status : " + statusCode + " explanation=" + status.getExplanation());
            }
        }
    } catch (IOException ioe) {
        LOGGER.error(ioe.toString());
        notifyOfFailure(ioe);
    }
}
Also used : TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmStatusOfPutRequestResponse(org.dcache.srm.v2_2.SrmStatusOfPutRequestResponse) IOException(java.io.IOException) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) TStatusCode(org.dcache.srm.v2_2.TStatusCode) SrmStatusOfPutRequestRequest(org.dcache.srm.v2_2.SrmStatusOfPutRequestRequest) TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 4 with TPutRequestFileStatus

use of org.dcache.srm.v2_2.TPutRequestFileStatus 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)

Example 5 with TPutRequestFileStatus

use of org.dcache.srm.v2_2.TPutRequestFileStatus in project dcache by dCache.

the class PutRequest method getArrayOfTPutRequestFileStatus.

private TPutRequestFileStatus[] getArrayOfTPutRequestFileStatus(org.apache.axis.types.URI[] surls) throws SRMInvalidRequestException, SRMFileRequestNotFoundException {
    if (surls == null) {
        return getArrayOfTPutRequestFileStatus();
    }
    int len = surls.length;
    TPutRequestFileStatus[] putFileStatuses = new TPutRequestFileStatus[len];
    for (int i = 0; i < len; ++i) {
        URI surl = URI.create(surls[i].toString());
        putFileStatuses[i] = getFileRequestBySurl(surl).getTPutRequestFileStatus();
    }
    return putFileStatuses;
}
Also used : TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus) URI(java.net.URI)

Aggregations

TPutRequestFileStatus (org.dcache.srm.v2_2.TPutRequestFileStatus)5 ArrayOfTPutRequestFileStatus (org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus)3 SrmStatusOfPutRequestResponse (org.dcache.srm.v2_2.SrmStatusOfPutRequestResponse)3 TReturnStatus (org.dcache.srm.v2_2.TReturnStatus)3 IOException (java.io.IOException)2 URI (java.net.URI)2 URI (org.apache.axis.types.URI)2 UnsignedLong (org.apache.axis.types.UnsignedLong)2 ArrayOfAnyURI (org.dcache.srm.v2_2.ArrayOfAnyURI)2 ArrayOfString (org.dcache.srm.v2_2.ArrayOfString)2 SrmStatusOfPutRequestRequest (org.dcache.srm.v2_2.SrmStatusOfPutRequestRequest)2 TStatusCode (org.dcache.srm.v2_2.TStatusCode)2 File (java.io.File)1 SRMInvalidRequestException (org.dcache.srm.SRMInvalidRequestException)1 ArrayOfTPutFileRequest (org.dcache.srm.v2_2.ArrayOfTPutFileRequest)1 SrmPrepareToPutRequest (org.dcache.srm.v2_2.SrmPrepareToPutRequest)1 TAccessLatency (org.dcache.srm.v2_2.TAccessLatency)1 TAccessPattern (org.dcache.srm.v2_2.TAccessPattern)1 TConnectionType (org.dcache.srm.v2_2.TConnectionType)1 TPutFileRequest (org.dcache.srm.v2_2.TPutFileRequest)1