Search in sources :

Example 1 with SrmAbortFilesRequest

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

the class SRMPutClientV2 method abortAllPendingFiles.

private void abortAllPendingFiles() throws Exception {
    if (pendingSurlsToIndex.isEmpty()) {
        return;
    }
    if (response != null) {
        requestToken = response.getRequestToken();
        if (requestToken != null) {
            String[] surl_strings = pendingSurlsToIndex.keySet().toArray(new String[pendingSurlsToIndex.size()]);
            int len = surl_strings.length;
            say("Releasing all remaining file requests");
            URI[] surlArray = new URI[len];
            for (int i = 0; i < len; ++i) {
                surlArray[i] = new URI(surl_strings[i]);
            }
            SrmAbortFilesRequest srmAbortFilesRequest = new SrmAbortFilesRequest();
            srmAbortFilesRequest.setRequestToken(requestToken);
            srmAbortFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
            SrmAbortFilesResponse srmAbortFilesResponse = srm.srmAbortFiles(srmAbortFilesRequest);
            if (srmAbortFilesResponse == null) {
                logger.elog(" srmAbortFilesResponse is null");
            } else {
                TReturnStatus returnStatus = srmAbortFilesResponse.getReturnStatus();
                if (returnStatus == null) {
                    esay("srmAbortFiles return status is null");
                    return;
                }
                say("srmAbortFiles status code=" + returnStatus.getStatusCode());
            }
        } else {
            if (response.getArrayOfFileStatuses() != null) {
                if (response.getArrayOfFileStatuses().getStatusArray() != null) {
                    for (int i = 0; i < response.getArrayOfFileStatuses().getStatusArray().length; i++) {
                        URI surl = response.getArrayOfFileStatuses().getStatusArray(i).getSURL();
                        TReturnStatus fst = response.getArrayOfFileStatuses().getStatusArray(i).getStatus();
                        esay("SURL[" + i + "]=" + surl.toString() + " status=" + fst.getStatusCode() + " explanation=" + fst.getExplanation());
                    }
                }
            }
        }
    }
}
Also used : SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 2 with SrmAbortFilesRequest

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

the class SRMV2CopyJob method done.

@Override
public void done(boolean success, String error) {
    synchronized (this) {
        if (isDone) {
            return;
        }
        isDone = true;
    }
    try {
        URI[] surlArray = new URI[] { new URI(surl.toASCIIString()) };
        if (!success) {
            SrmAbortFilesRequest srmAbortFilesRequest = new SrmAbortFilesRequest();
            srmAbortFilesRequest.setRequestToken(requestToken);
            srmAbortFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
            SrmAbortFilesResponse srmAbortFilesResponse = srm.srmAbortFiles(srmAbortFilesRequest);
            if (srmAbortFilesResponse == null) {
                logger.elog("srmAbortFilesResponse is null");
            } else {
                TReturnStatus returnStatus = srmAbortFilesResponse.getReturnStatus();
                if (returnStatus == null) {
                    logger.elog("srmAbortFiles return status is null");
                } else {
                    logger.log("srmAbortFiles status code=" + returnStatus.getStatusCode());
                }
            }
        } else if (isSrmPrepareToGet) {
            SrmReleaseFilesRequest srmReleaseFilesRequest = new SrmReleaseFilesRequest();
            srmReleaseFilesRequest.setRequestToken(requestToken);
            srmReleaseFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
            SrmReleaseFilesResponse srmReleaseFilesResponse = srm.srmReleaseFiles(srmReleaseFilesRequest);
            TReturnStatus returnStatus = srmReleaseFilesResponse.getReturnStatus();
            if (returnStatus == null) {
                success = false;
                error = "srmReleaseFilesResponse return status is null";
            } else {
                logger.log("srmReleaseFilesResponse status code=" + returnStatus.getStatusCode());
            }
        } else {
            SrmPutDoneRequest srmPutDoneRequest = new SrmPutDoneRequest();
            srmPutDoneRequest.setRequestToken(requestToken);
            srmPutDoneRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
            SrmPutDoneResponse srmPutDoneResponse = srm.srmPutDone(srmPutDoneRequest);
            TReturnStatus returnStatus = srmPutDoneResponse.getReturnStatus();
            if (returnStatus == null) {
                success = false;
                error = "srmPutDone return status is null";
            } else if (returnStatus.getStatusCode() != TStatusCode.SRM_SUCCESS) {
                success = false;
                ArrayOfTSURLReturnStatus arrayOfFileStatuses = srmPutDoneResponse.getArrayOfFileStatuses();
                if (arrayOfFileStatuses != null && arrayOfFileStatuses.getStatusArray() != null && arrayOfFileStatuses.getStatusArray().length > 0 && arrayOfFileStatuses.getStatusArray()[0].getStatus().getStatusCode() != TStatusCode.SRM_SUCCESS && !Strings.isNullOrEmpty(arrayOfFileStatuses.getStatusArray()[0].getStatus().getExplanation())) {
                    error = arrayOfFileStatuses.getStatusArray()[0].getStatus().getExplanation();
                } else {
                    error = returnStatus.getExplanation();
                }
            }
        }
    } catch (URI.MalformedURIException | RemoteException e) {
        if (success) {
            success = false;
            error = e.toString();
        } else {
            logger.elog(e.toString());
        }
    } finally {
        if (success) {
            if (isSrmPrepareToGet) {
                client.setReportSucceeded(surl, null);
            } else {
                client.setReportSucceeded(null, surl);
            }
        } else {
            error = "received TURL but failed to copy: " + error;
            if (isSrmPrepareToGet) {
                client.setReportFailed(surl, null, error);
            } else {
                client.setReportFailed(null, surl, error);
            }
        }
    }
}
Also used : SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmReleaseFilesRequest(org.dcache.srm.v2_2.SrmReleaseFilesRequest) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) SrmPutDoneRequest(org.dcache.srm.v2_2.SrmPutDoneRequest) SrmReleaseFilesResponse(org.dcache.srm.v2_2.SrmReleaseFilesResponse) SrmPutDoneResponse(org.dcache.srm.v2_2.SrmPutDoneResponse) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) ArrayOfTSURLReturnStatus(org.dcache.srm.v2_2.ArrayOfTSURLReturnStatus) RemoteException(java.rmi.RemoteException) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 3 with SrmAbortFilesRequest

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

the class SRMBringOnlineClientV2 method abortAllPendingFiles.

private void abortAllPendingFiles() throws Exception {
    if (pendingSurlsToIndex.isEmpty()) {
        return;
    }
    if (requestToken != null) {
        String[] surl_strings = pendingSurlsToIndex.keySet().toArray(new String[pendingSurlsToIndex.size()]);
        int len = surl_strings.length;
        say("Releasing all remaining file requests");
        URI[] surlArray = new URI[len];
        for (int i = 0; i < len; ++i) {
            surlArray[i] = new URI(surl_strings[i]);
        }
        SrmAbortFilesRequest srmAbortFilesRequest = new SrmAbortFilesRequest();
        srmAbortFilesRequest.setRequestToken(requestToken);
        srmAbortFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
        SrmAbortFilesResponse srmAbortFilesResponse = srm.srmAbortFiles(srmAbortFilesRequest);
        if (srmAbortFilesResponse == null) {
            logger.elog(" srmAbortFilesResponse is null");
        } else {
            TReturnStatus returnStatus = srmAbortFilesResponse.getReturnStatus();
            if (returnStatus == null) {
                esay("srmAbortFiles return status is null");
                return;
            }
            say("srmAbortFiles status code=" + returnStatus.getStatusCode());
        }
    }
}
Also used : SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 4 with SrmAbortFilesRequest

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

the class SRMCopyClientV2 method abortAllPendingFiles.

private void abortAllPendingFiles() throws Exception {
    if (pendingSurlsMap.isEmpty()) {
        return;
    }
    if (requestToken == null) {
        return;
    }
    java.net.URI[] surl_strings = pendingSurlsMap.keySet().toArray(new java.net.URI[pendingSurlsMap.size()]);
    int len = surl_strings.length;
    say("Releasing all remaining file requests");
    URI[] surlArray = new URI[len];
    for (int i = 0; i < len; ++i) {
        URI uri = new URI(surl_strings[i].toASCIIString());
        surlArray[i] = uri;
    }
    SrmAbortFilesRequest srmAbortFilesRequest = new SrmAbortFilesRequest();
    srmAbortFilesRequest.setRequestToken(requestToken);
    srmAbortFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
    SrmAbortFilesResponse srmAbortFilesResponse = srm.srmAbortFiles(srmAbortFilesRequest);
    if (srmAbortFilesResponse == null) {
        logger.elog(" srmAbortFilesResponse is null");
    } else {
        TReturnStatus returnStatus = srmAbortFilesResponse.getReturnStatus();
        if (returnStatus == null) {
            esay("srmAbortFiles return status is null");
            return;
        }
        say("srmAbortFiles status code=" + returnStatus.getStatusCode());
    }
}
Also used : SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Example 5 with SrmAbortFilesRequest

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

the class SRMGetClientV2 method abortAllPendingFiles.

private void abortAllPendingFiles() throws Exception {
    if (pendingSurlsToIndex.isEmpty()) {
        return;
    }
    if (requestToken != null) {
        String[] surl_strings = pendingSurlsToIndex.keySet().toArray(new String[pendingSurlsToIndex.size()]);
        int len = surl_strings.length;
        say("Releasing all remaining file requests");
        URI[] surlArray = new URI[len];
        for (int i = 0; i < len; ++i) {
            surlArray[i] = new URI(surl_strings[i]);
        }
        SrmAbortFilesRequest srmAbortFilesRequest = new SrmAbortFilesRequest();
        srmAbortFilesRequest.setRequestToken(requestToken);
        srmAbortFilesRequest.setArrayOfSURLs(new ArrayOfAnyURI(surlArray));
        SrmAbortFilesResponse srmAbortFilesResponse = srm.srmAbortFiles(srmAbortFilesRequest);
        if (srmAbortFilesResponse == null) {
            logger.elog(" srmAbortFilesResponse is null");
        } else {
            TReturnStatus returnStatus = srmAbortFilesResponse.getReturnStatus();
            if (returnStatus == null) {
                esay("srmAbortFiles return status is null");
                return;
            }
            say("srmAbortFiles status code=" + returnStatus.getStatusCode());
        }
    }
}
Also used : SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI)

Aggregations

URI (org.apache.axis.types.URI)6 ArrayOfAnyURI (org.dcache.srm.v2_2.ArrayOfAnyURI)6 SrmAbortFilesRequest (org.dcache.srm.v2_2.SrmAbortFilesRequest)6 SrmAbortFilesResponse (org.dcache.srm.v2_2.SrmAbortFilesResponse)6 TReturnStatus (org.dcache.srm.v2_2.TReturnStatus)6 ArrayOfString (org.dcache.srm.v2_2.ArrayOfString)3 IOException (java.io.IOException)1 RemoteException (java.rmi.RemoteException)1 ArrayOfTSURLReturnStatus (org.dcache.srm.v2_2.ArrayOfTSURLReturnStatus)1 SrmPutDoneRequest (org.dcache.srm.v2_2.SrmPutDoneRequest)1 SrmPutDoneResponse (org.dcache.srm.v2_2.SrmPutDoneResponse)1 SrmReleaseFilesRequest (org.dcache.srm.v2_2.SrmReleaseFilesRequest)1 SrmReleaseFilesResponse (org.dcache.srm.v2_2.SrmReleaseFilesResponse)1 TSURLReturnStatus (org.dcache.srm.v2_2.TSURLReturnStatus)1