Search in sources :

Example 1 with SrmRmRequest

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

the class SRMRmClientV2 method start.

@Override
public void start() throws Exception {
    checkCredentialValid();
    SrmRmRequest req = new SrmRmRequest();
    URI[] uris = new URI[surls.length];
    for (int i = 0; i < surls.length; ++i) {
        uris[i] = new URI(surl_strings[i]);
    }
    req.setArrayOfSURLs(new ArrayOfAnyURI(uris));
    configuration.getStorageSystemInfo().ifPresent(req::setStorageSystemInfo);
    SrmRmResponse resp = srm.srmRm(req);
    TReturnStatus rs = resp.getReturnStatus();
    if (rs.getStatusCode() != TStatusCode.SRM_SUCCESS) {
        TStatusCode rc = rs.getStatusCode();
        StringBuilder sb = new StringBuilder();
        sb.append("Return code: ").append(rc.toString()).append("\n");
        sb.append("Explanation: ").append(rs.getExplanation()).append("\n");
        if (resp.getArrayOfFileStatuses() != null) {
            TSURLReturnStatus[] arrayOfStatuses = resp.getArrayOfFileStatuses().getStatusArray();
            if (arrayOfStatuses != null) {
                for (int i = 0; i < arrayOfStatuses.length; i++) {
                    if (arrayOfStatuses[i] != null) {
                        sb.append("file#").append(i).append(" : ");
                        if (arrayOfStatuses[i].getSurl() != null) {
                            sb.append(arrayOfStatuses[i].getSurl());
                        }
                        if (arrayOfStatuses[i].getStatus() != null) {
                            sb.append(", ");
                            sb.append(arrayOfStatuses[i].getStatus().getStatusCode());
                            sb.append(", \"");
                            sb.append(arrayOfStatuses[i].getStatus().getExplanation());
                            sb.append("\"");
                        }
                        sb.append('\n');
                    }
                }
            }
        }
        System.out.println(sb.toString());
        System.exit(1);
    }
}
Also used : TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) TSURLReturnStatus(org.dcache.srm.v2_2.TSURLReturnStatus) SrmRmResponse(org.dcache.srm.v2_2.SrmRmResponse) URI(org.apache.axis.types.URI) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) SrmRmRequest(org.dcache.srm.v2_2.SrmRmRequest) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Aggregations

URI (org.apache.axis.types.URI)1 ArrayOfAnyURI (org.dcache.srm.v2_2.ArrayOfAnyURI)1 SrmRmRequest (org.dcache.srm.v2_2.SrmRmRequest)1 SrmRmResponse (org.dcache.srm.v2_2.SrmRmResponse)1 TReturnStatus (org.dcache.srm.v2_2.TReturnStatus)1 TSURLReturnStatus (org.dcache.srm.v2_2.TSURLReturnStatus)1 TStatusCode (org.dcache.srm.v2_2.TStatusCode)1