use of org.dcache.srm.v2_2.TStatusCode in project dcache by dCache.
the class LsFileRequest method getReturnStatus.
@Override
protected TReturnStatus getReturnStatus() {
String description = latestHistoryEvent();
TStatusCode statusCode = getStatusCode();
if (statusCode != null) {
return new TReturnStatus(statusCode, description);
}
switch(getState()) {
case DONE:
case READY:
return new TReturnStatus(TStatusCode.SRM_SUCCESS, null);
case FAILED:
return new TReturnStatus(TStatusCode.SRM_FAILURE, description);
case CANCELED:
return new TReturnStatus(TStatusCode.SRM_ABORTED, description);
case INPROGRESS:
case RQUEUED:
return new TReturnStatus(TStatusCode.SRM_REQUEST_INPROGRESS, description);
default:
return new TReturnStatus(TStatusCode.SRM_REQUEST_QUEUED, description);
}
}
use of org.dcache.srm.v2_2.TStatusCode in project dcache by dCache.
the class PutFileRequest method getReturnStatus.
@Override
protected TReturnStatus getReturnStatus() {
String description = latestHistoryEvent();
TStatusCode statusCode = getStatusCode();
if (statusCode != null) {
if (statusCode == TStatusCode.SRM_SUCCESS || statusCode == TStatusCode.SRM_SPACE_AVAILABLE) {
description = null;
}
return new TReturnStatus(statusCode, description);
}
switch(getState()) {
case UNSCHEDULED:
case QUEUED:
return new TReturnStatus(TStatusCode.SRM_REQUEST_QUEUED, description);
case READY:
case TRANSFERRING:
return new TReturnStatus(TStatusCode.SRM_SPACE_AVAILABLE, null);
case DONE:
// REVISIT: Spec doesn't allow this for statusOfPut
return new TReturnStatus(TStatusCode.SRM_SUCCESS, null);
case CANCELED:
return new TReturnStatus(TStatusCode.SRM_ABORTED, description);
case FAILED:
return new TReturnStatus(TStatusCode.SRM_FAILURE, description);
default:
return new TReturnStatus(TStatusCode.SRM_REQUEST_INPROGRESS, description);
}
}
use of org.dcache.srm.v2_2.TStatusCode in project dcache by dCache.
the class PutFileRequest method toString.
@Override
public void toString(StringBuilder sb, String padding, boolean longformat) {
sb.append(padding);
if (padding.isEmpty()) {
sb.append("Put ");
}
sb.append("file id:").append(getId());
State state = getState();
sb.append(" state:").append(state);
if (longformat) {
sb.append('\n');
sb.append(padding).append(" SURL: ").append(getSurlString()).append('\n');
sb.append(padding).append(" TURL: ").append(getTurlString()).append('\n');
if (getSize() != null) {
sb.append(padding).append(" Size: ").append(getSize()).append('\n');
}
TAccessLatency al = getAccessLatency();
if (al != null) {
sb.append(padding).append(" Access latency: ").append(al).append('\n');
}
TRetentionPolicy rp = getRetentionPolicy();
if (rp != null) {
sb.append(padding).append(" Retention policy: ").append(rp).append('\n');
}
String space = getSpaceReservationId();
if (space != null) {
sb.append(padding).append(" Space reservation: ").append(space).append('\n');
}
TStatusCode status = getStatusCode();
if (status != null) {
sb.append(padding).append(" Status:").append(status).append('\n');
}
sb.append(padding).append(" History:\n");
sb.append(getHistory(padding + " "));
}
}
use of org.dcache.srm.v2_2.TStatusCode in project dcache by dCache.
the class ReserveSpaceRequest method toString.
@Override
public void toString(StringBuilder sb, boolean longformat) {
sb.append("Reserve space id:").append(getClientRequestId());
sb.append(" state:").append(getState());
TStatusCode code = getStatusCode();
if (code != null) {
sb.append(" status:").append(code);
}
if (!longformat) {
sb.append(" description:").append(getSpaceToken());
}
sb.append(" by:").append(getUser().getDisplayName());
if (longformat) {
sb.append('\n');
sb.append(" Description: ").append(getSpaceToken()).append('\n');
long now = System.currentTimeMillis();
sb.append(" Submitted: ").append(relativeTimestamp(getCreationTime(), now)).append('\n');
sb.append(" Expires: ").append(relativeTimestamp(getCreationTime() + getLifetime(), now)).append('\n');
sb.append(" Reservation lifetime: ").append(describeReservationLifetime()).append('\n');
TAccessLatency al = getAccessLatency();
if (al != null) {
sb.append(" AccessLatency: ").append(al).append('\n');
}
sb.append(" RetentionPolicy: ").append(getRetentionPolicy()).append('\n');
sb.append(" History:\n");
sb.append(getHistory(" "));
}
}
use of org.dcache.srm.v2_2.TStatusCode 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);
}
}
Aggregations