use of org.dcache.srm.v2_2.SrmMvResponse in project dcache by dCache.
the class SRMMvClientV2 method start.
@Override
public void start() throws Exception {
checkCredentialValid();
SrmMvRequest req = new SrmMvRequest();
req.setFromSURL(new URI(surl_strings[0]));
req.setToSURL(new URI(surl_strings[1]));
configuration.getStorageSystemInfo().ifPresent(req::setStorageSystemInfo);
SrmMvResponse resp = srm.srmMv(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");
System.out.println(sb.toString());
System.exit(1);
}
}
use of org.dcache.srm.v2_2.SrmMvResponse in project dcache by dCache.
the class AxisSrmFileSystem method mv.
@Override
public void mv(URI fromSurl, URI toSurl) throws RemoteException, SRMException {
SrmMvResponse response = srm.srmMv(new SrmMvRequest(null, fromSurl, toSurl, null));
checkSuccess(response.getReturnStatus());
}
use of org.dcache.srm.v2_2.SrmMvResponse in project dcache by dCache.
the class SrmMv method srmMv.
private SrmMvResponse srmMv() {
TReturnStatus returnStatus;
try {
URI to_surl = URI.create(request.getToSURL().toString());
URI from_surl = URI.create(request.getFromSURL().toString());
// SURL is busy.
if (srm.isFileBusy(from_surl)) {
returnStatus = new TReturnStatus(TStatusCode.SRM_FILE_BUSY, "The source SURL is being used by another client.");
} else if (srm.isFileBusy(to_surl)) {
returnStatus = new TReturnStatus(TStatusCode.SRM_DUPLICATION_ERROR, "The target SURL is being used by another client.");
} else {
storage.moveEntry(user, from_surl, to_surl);
returnStatus = new TReturnStatus(TStatusCode.SRM_SUCCESS, null);
}
} catch (SRMDuplicationException e) {
returnStatus = new TReturnStatus(TStatusCode.SRM_DUPLICATION_ERROR, e.getMessage());
} catch (SRMInternalErrorException e) {
LOGGER.error(e.toString());
returnStatus = new TReturnStatus(TStatusCode.SRM_INTERNAL_ERROR, e.getMessage());
} catch (SRMInvalidPathException e) {
returnStatus = new TReturnStatus(TStatusCode.SRM_INVALID_PATH, e.getMessage());
} catch (SRMAuthorizationException e) {
LOGGER.warn(e.toString());
returnStatus = new TReturnStatus(TStatusCode.SRM_AUTHORIZATION_FAILURE, e.getMessage());
} catch (SRMException e) {
LOGGER.error(e.toString());
returnStatus = new TReturnStatus(TStatusCode.SRM_FAILURE, e.getMessage());
}
return new SrmMvResponse(returnStatus);
}
use of org.dcache.srm.v2_2.SrmMvResponse in project dcache by dCache.
the class SrmMv method getFailedResponse.
public static final SrmMvResponse getFailedResponse(String error, TStatusCode statusCode) {
SrmMvResponse response = new SrmMvResponse();
response.setReturnStatus(new TReturnStatus(statusCode, error));
return response;
}
Aggregations