use of org.dcache.srm.v2_2.TStatusCode.SRM_AUTHORIZATION_FAILURE in project dcache by dCache.
the class SrmHandler method mapReleaseFilesResponse.
private SrmReleaseFilesResponse mapReleaseFilesResponse(SrmReleaseFilesRequest request, List<SrmResponse> responses) {
Map<URI, TSURLReturnStatus> map = new HashMap<>();
for (SrmResponse srmResponse : responses) {
SrmReleaseFilesResponse response = (SrmReleaseFilesResponse) srmResponse.getResponse();
for (TSURLReturnStatus status : response.getArrayOfFileStatuses().getStatusArray()) {
if (status.getStatus().getStatusCode() == SRM_SUCCESS) {
map.put(status.getSurl(), status);
} else if (status.getStatus().getStatusCode() == SRM_INVALID_PATH) {
// no entry
} else if (status.getStatus().getStatusCode() == SRM_AUTHORIZATION_FAILURE) {
map.putIfAbsent(status.getSurl(), status);
} else if (status.getStatus().getStatusCode() == SRM_FILE_LIFETIME_EXPIRED) {
map.putIfAbsent(status.getSurl(), status);
} else if (status.getStatus().getStatusCode() == SRM_FAILURE) {
map.putIfAbsent(status.getSurl(), status);
}
}
}
TSURLReturnStatus[] statuses = Stream.of(request.getArrayOfSURLs().getUrlArray()).map(surl -> {
TSURLReturnStatus status = map.get(surl);
return (status != null) ? status : new TSURLReturnStatus(surl, new TReturnStatus(SRM_INVALID_PATH, "File not found"));
}).toArray(TSURLReturnStatus[]::new);
return new SrmReleaseFilesResponse(getSummaryReturnStatus(statuses), new ArrayOfTSURLReturnStatus(statuses));
}
Aggregations