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);
}
}
Aggregations