Search in sources :

Example 1 with TStatusCode

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);
    }
}
Also used : TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Example 2 with TStatusCode

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);
    }
}
Also used : TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Example 3 with TStatusCode

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 + "   "));
    }
}
Also used : State(org.dcache.srm.scheduler.State) TRetentionPolicy(org.dcache.srm.v2_2.TRetentionPolicy) TAccessLatency(org.dcache.srm.v2_2.TAccessLatency) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Example 4 with TStatusCode

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("   "));
    }
}
Also used : TAccessLatency(org.dcache.srm.v2_2.TAccessLatency) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Example 5 with TStatusCode

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);
    }
}
Also used : SrmMvResponse(org.dcache.srm.v2_2.SrmMvResponse) SrmMvRequest(org.dcache.srm.v2_2.SrmMvRequest) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) URI(org.apache.axis.types.URI) TStatusCode(org.dcache.srm.v2_2.TStatusCode)

Aggregations

TReturnStatus (org.dcache.srm.v2_2.TReturnStatus)54 TStatusCode (org.dcache.srm.v2_2.TStatusCode)34 URI (org.apache.axis.types.URI)14 ArrayOfAnyURI (org.dcache.srm.v2_2.ArrayOfAnyURI)10 IOException (java.io.IOException)7 ArrayOfString (org.dcache.srm.v2_2.ArrayOfString)7 TAccessLatency (org.dcache.srm.v2_2.TAccessLatency)7 TRetentionPolicy (org.dcache.srm.v2_2.TRetentionPolicy)6 TRetentionPolicyInfo (org.dcache.srm.v2_2.TRetentionPolicyInfo)5 State (org.dcache.srm.scheduler.State)4 SRMAuthorizationException (org.dcache.srm.SRMAuthorizationException)3 SRMException (org.dcache.srm.SRMException)3 SRMInvalidRequestException (org.dcache.srm.SRMInvalidRequestException)3 IllegalStateTransition (org.dcache.srm.scheduler.IllegalStateTransition)3 UnsignedLong (org.apache.axis.types.UnsignedLong)2 SRMDuplicationException (org.dcache.srm.SRMDuplicationException)2 SRMInternalErrorException (org.dcache.srm.SRMInternalErrorException)2 SRMInvalidPathException (org.dcache.srm.SRMInvalidPathException)2 SRMTooManyResultsException (org.dcache.srm.SRMTooManyResultsException)2 SrmBringOnlineResponse (org.dcache.srm.v2_2.SrmBringOnlineResponse)2