Search in sources :

Example 21 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class HttpPoolMgrEngineV3 method runRestoreCollector.

private void runRestoreCollector() throws NoRouteToCellException, InterruptedException {
    List<RestoreHandlerInfo> infos = _receiver.getAllRequests();
    List<Object[]> agedList = new ArrayList<>();
    for (RestoreHandlerInfo info : infos) {
        try {
            Object[] a = new Object[3];
            a[0] = info;
            String name = info.getName();
            String pnfsId = name.substring(0, name.indexOf('@'));
            // 
            // collect the paths
            // 
            String path = (String) _pnfsPathMap.get(pnfsId);
            if (path == null) {
                path = getPathByPnfsId(pnfsId);
            }
            if (path == null) {
                a[1] = pnfsId;
            } else {
                _pnfsPathMap.put(pnfsId, a[1] = path);
            }
            // 
            if (_addStorageInfo) {
                FileAttributes fileAttributes = (FileAttributes) _fileAttributesMap.get(pnfsId);
                if (fileAttributes == null) {
                    fileAttributes = getFileAttributesByPnfsId(pnfsId);
                }
                if (fileAttributes != null) {
                    StorageInfo storageInfo = fileAttributes.getStorageInfo();
                    if (_siDetails != null) {
                        // allows to select items
                        if (fileAttributes.isDefined(FileAttribute.SIZE)) {
                            storageInfo.setKey("size", String.valueOf(fileAttributes.getSize()));
                        }
                        storageInfo.setKey("new", String.valueOf(storageInfo.isCreatedOnly()));
                        storageInfo.setKey("stored", String.valueOf(storageInfo.isStored()));
                        storageInfo.setKey("sClass", fileAttributes.getStorageClass());
                        storageInfo.setKey("cClass", fileAttributes.getCacheClass());
                        storageInfo.setKey("hsm", fileAttributes.getHsm());
                    }
                    _fileAttributesMap.put(pnfsId, a[2] = storageInfo);
                }
            }
            agedList.add(a);
        } catch (Exception e) {
            LOGGER.warn(e.toString(), e);
        }
    }
    _lazyRestoreList = agedList;
}
Also used : PoolManagerGetRestoreHandlerInfo(org.dcache.poolmanager.PoolManagerGetRestoreHandlerInfo) RestoreHandlerInfo(diskCacheV111.vehicles.RestoreHandlerInfo) ArrayList(java.util.ArrayList) StorageInfo(diskCacheV111.vehicles.StorageInfo) FileAttributes(org.dcache.vehicles.FileAttributes) PnfsGetFileAttributes(org.dcache.vehicles.PnfsGetFileAttributes) HttpException(dmg.util.HttpException) CacheException(diskCacheV111.util.CacheException) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException)

Example 22 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class UpdateQoSJob method doRun.

@Override
protected void doRun() {
    if (arguments == null) {
        setError(new IllegalArgumentException("no target qos given."));
        return;
    }
    String targetQos = arguments.get(TARGET_QOS.getName());
    if (targetQos == null) {
        setError(new IllegalArgumentException("no target qos given."));
        return;
    }
    QoSTransitionEngine engine = new QoSTransitionEngine(poolManager, poolMonitor, pnfsHandler, pinManager);
    replyHandler = new QoSJobReplyHandler(executorService);
    engine.setReplyHandler(replyHandler);
    try {
        engine.adjustQoS(path, targetQos, NetworkUtils.getCanonicalHostName());
    } catch (URISyntaxException | CacheException | NoRouteToCellException e) {
        setError(e);
        return;
    } catch (InterruptedException e) {
        errorObject = e;
        setState(State.CANCELLED);
        completionHandler.jobInterrupted(this);
        LOGGER.trace("doRun interrupted.");
        return;
    }
    if (replyHandler.done()) {
        setState(State.COMPLETED);
    } else {
        setState(State.WAITING);
    }
}
Also used : CacheException(diskCacheV111.util.CacheException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) QoSTransitionEngine(org.dcache.qos.QoSTransitionEngine) URISyntaxException(java.net.URISyntaxException)

Example 23 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class SrmHandler method handleRequest.

public Object handleRequest(String requestName, Object request) throws RemoteException {
    long startTimeStamp = System.currentTimeMillis();
    // requestName values all start "srm".  This is redundant, so may
    // be removed when creating the session id.  The initial character is
    // converted to lowercase, so "srmPrepareToPut" becomes "prepareToPut".
    String session = "srm2:" + Character.toLowerCase(requestName.charAt(3)) + requestName.substring(4);
    try (JDC ignored = JDC.createSession(session)) {
        for (RequestLogger logger : loggers) {
            logger.request(requestName, request);
        }
        Subject user = Subject.getSubject(AccessController.getContext());
        Object response;
        if (requestName.equals("srmPing")) {
            // Ping is special as it isn't authenticated and unable to return a failure
            response = new SrmPingResponse("v2.2", pingExtraInfo);
        } else {
            try {
                response = dispatch(user, requestName, request);
            } catch (SRMInternalErrorException e) {
                LOGGER.error(e.getMessage());
                response = getFailedResponse(requestName, e.getStatusCode(), "Authentication failed (server log contains additional information).");
            } catch (SRMAuthorizationException e) {
                LOGGER.info(e.getMessage());
                response = getFailedResponse(requestName, e.getStatusCode(), "Permission denied.");
            } catch (SRMAuthenticationException e) {
                LOGGER.warn(e.getMessage());
                response = getFailedResponse(requestName, e.getStatusCode(), "Authentication failed (server log contains additional information).");
            } catch (SRMException e) {
                response = getFailedResponse(requestName, e.getStatusCode(), e.getMessage());
            } catch (PermissionDeniedCacheException e) {
                response = getFailedResponse(requestName, TStatusCode.SRM_AUTHORIZATION_FAILURE, e.getMessage());
            } catch (CacheException e) {
                response = getFailedResponse(requestName, TStatusCode.SRM_INTERNAL_ERROR, e.getMessage());
            } catch (InterruptedException e) {
                response = getFailedResponse(requestName, TStatusCode.SRM_FATAL_INTERNAL_ERROR, "Server shutdown.");
            } catch (NoRouteToCellException e) {
                LOGGER.error(e.getMessage());
                response = getFailedResponse(requestName, TStatusCode.SRM_INTERNAL_ERROR, "SRM backend serving this request is currently offline.");
            }
        }
        long time = System.currentTimeMillis() - startTimeStamp;
        for (RequestLogger logger : loggers) {
            logger.response(requestName, request, response, user, time);
        }
        return response;
    }
}
Also used : SRMAuthorizationException(org.dcache.srm.SRMAuthorizationException) CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) JDC(org.dcache.srm.util.JDC) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) SrmPingResponse(org.dcache.srm.v2_2.SrmPingResponse) Subject(javax.security.auth.Subject) SRMInternalErrorException(org.dcache.srm.SRMInternalErrorException) SRMAuthenticationException(org.dcache.srm.SRMAuthenticationException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) SRMException(org.dcache.srm.SRMException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException)

Example 24 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class SrmHandler method dispatch.

private Object dispatch(Subject subject, String requestName, Object request) throws CacheException, InterruptedException, SRMException, NoRouteToCellException {
    X509Credential credential = Axis.getDelegatedCredential().orElse(null);
    String remoteIP = Axis.getRemoteAddress();
    String remoteHost = isClientDNSLookup ? InetAddresses.forUriString(remoteIP).getCanonicalHostName() : remoteIP;
    Set<LoginAttribute> loginAttributes = AuthenticationHandler.getLoginAttributes(Axis.getHttpServletRequest());
    Function<Object, SrmRequest> toMessage = req -> new SrmRequest(subject, loginAttributes, credential, remoteHost, requestName, req);
    try {
        switch(requestName) {
            case "srmGetRequestTokens":
                return dispatch((SrmGetRequestTokensRequest) request, toMessage);
            case "srmGetRequestSummary":
                return dispatch((SrmGetRequestSummaryRequest) request, toMessage);
            case "srmReleaseFiles":
                return dispatch((SrmReleaseFilesRequest) request, toMessage);
            case "srmExtendFileLifeTime":
                // special processing.
                return dispatch(request, toMessage);
            default:
                return dispatch(request, toMessage);
        }
    } catch (ExecutionException e) {
        Throwables.propagateIfInstanceOf(e.getCause(), SRMException.class);
        Throwables.propagateIfInstanceOf(e.getCause(), CacheException.class);
        Throwables.propagateIfInstanceOf(e.getCause(), NoRouteToCellException.class);
        Throwables.throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : SrmExtendFileLifeTimeRequest(org.dcache.srm.v2_2.SrmExtendFileLifeTimeRequest) TCopyFileRequest(org.dcache.srm.v2_2.TCopyFileRequest) SRM_PARTIAL_SUCCESS(org.dcache.srm.v2_2.TStatusCode.SRM_PARTIAL_SUCCESS) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) Map(java.util.Map) SrmStatusOfReserveSpaceRequestRequest(org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestRequest) SrmExtendFileLifeTimeResponse(org.dcache.srm.v2_2.SrmExtendFileLifeTimeResponse) SRMException(org.dcache.srm.SRMException) OidcSubjectPrincipal(org.dcache.auth.OidcSubjectPrincipal) CellInfo(dmg.cells.nucleus.CellInfo) TPutRequestFileStatus(org.dcache.srm.v2_2.TPutRequestFileStatus) SrmGetRequestSummaryRequest(org.dcache.srm.v2_2.SrmGetRequestSummaryRequest) TPutFileRequest(org.dcache.srm.v2_2.TPutFileRequest) SrmRmRequest(org.dcache.srm.v2_2.SrmRmRequest) Stream(java.util.stream.Stream) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) SRM_AUTHENTICATION_FAILURE(org.dcache.srm.v2_2.TStatusCode.SRM_AUTHENTICATION_FAILURE) TStatusCode(org.dcache.srm.v2_2.TStatusCode) LoginAttribute(org.dcache.auth.attributes.LoginAttribute) SrmBringOnlineResponse(org.dcache.srm.v2_2.SrmBringOnlineResponse) ArrayOfTCopyRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTCopyRequestFileStatus) SrmPrepareToPutResponse(org.dcache.srm.v2_2.SrmPrepareToPutResponse) TReturnStatus(org.dcache.srm.v2_2.TReturnStatus) NetLoggerBuilder(org.dcache.util.NetLoggerBuilder) Constructor(java.lang.reflect.Constructor) SrmLsRequest(org.dcache.srm.v2_2.SrmLsRequest) Strings(com.google.common.base.Strings) CellStub(org.dcache.cells.CellStub) SrmReleaseSpaceResponse(org.dcache.srm.v2_2.SrmReleaseSpaceResponse) SrmResumeRequestRequest(org.dcache.srm.v2_2.SrmResumeRequestRequest) TRequestSummary(org.dcache.srm.v2_2.TRequestSummary) SrmGetSpaceMetaDataResponse(org.dcache.srm.v2_2.SrmGetSpaceMetaDataResponse) Throwables(com.google.common.base.Throwables) IOException(java.io.IOException) SRM_NON_EMPTY_DIRECTORY(org.dcache.srm.v2_2.TStatusCode.SRM_NON_EMPTY_DIRECTORY) Field(java.lang.reflect.Field) FutureCallback(com.google.common.util.concurrent.FutureCallback) ExecutionException(java.util.concurrent.ExecutionException) TBringOnlineRequestFileStatus(org.dcache.srm.v2_2.TBringOnlineRequestFileStatus) SrmMvResponse(org.dcache.srm.v2_2.SrmMvResponse) TSURLReturnStatus(org.dcache.srm.v2_2.TSURLReturnStatus) SrmExtendFileLifeTimeInSpaceResponse(org.dcache.srm.v2_2.SrmExtendFileLifeTimeInSpaceResponse) SrmAbortRequestResponse(org.dcache.srm.v2_2.SrmAbortRequestResponse) SrmStatusOfBringOnlineRequestRequest(org.dcache.srm.v2_2.SrmStatusOfBringOnlineRequestRequest) SrmSetPermissionResponse(org.dcache.srm.v2_2.SrmSetPermissionResponse) SRM_EXCEED_ALLOCATION(org.dcache.srm.v2_2.TStatusCode.SRM_EXCEED_ALLOCATION) SRM_FILE_BUSY(org.dcache.srm.v2_2.TStatusCode.SRM_FILE_BUSY) SrmRmResponse(org.dcache.srm.v2_2.SrmRmResponse) SrmStatusOfChangeSpaceForFilesRequestResponse(org.dcache.srm.v2_2.SrmStatusOfChangeSpaceForFilesRequestResponse) SrmAbortFilesResponse(org.dcache.srm.v2_2.SrmAbortFilesResponse) SrmCopyResponse(org.dcache.srm.v2_2.SrmCopyResponse) TExtraInfo(org.dcache.srm.v2_2.TExtraInfo) SettableFuture(com.google.common.util.concurrent.SettableFuture) ArrayOfTGetFileRequest(org.dcache.srm.v2_2.ArrayOfTGetFileRequest) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Collectors.toMap(java.util.stream.Collectors.toMap) SRM_FILE_LIFETIME_EXPIRED(org.dcache.srm.v2_2.TStatusCode.SRM_FILE_LIFETIME_EXPIRED) SrmSetPermissionRequest(org.dcache.srm.v2_2.SrmSetPermissionRequest) RequestCounters(org.dcache.commons.stats.RequestCounters) Method(java.lang.reflect.Method) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) SrmGetPermissionResponse(org.dcache.srm.v2_2.SrmGetPermissionResponse) SrmMkdirResponse(org.dcache.srm.v2_2.SrmMkdirResponse) JwtJtiPrincipal(org.dcache.auth.JwtJtiPrincipal) SrmGetPermissionRequest(org.dcache.srm.v2_2.SrmGetPermissionRequest) RemoteException(java.rmi.RemoteException) CacheLoader(com.google.common.cache.CacheLoader) TMetaDataPathDetail(org.dcache.srm.v2_2.TMetaDataPathDetail) ArrayOfTPutRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTPutRequestFileStatus) SrmPrepareToGetRequest(org.dcache.srm.v2_2.SrmPrepareToGetRequest) CuratorFramework(org.apache.curator.framework.CuratorFramework) SrmMvRequest(org.dcache.srm.v2_2.SrmMvRequest) SrmReleaseSpaceRequest(org.dcache.srm.v2_2.SrmReleaseSpaceRequest) SRM_NO_FREE_SPACE(org.dcache.srm.v2_2.TStatusCode.SRM_NO_FREE_SPACE) SRM_INVALID_PATH(org.dcache.srm.v2_2.TStatusCode.SRM_INVALID_PATH) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) SrmExtendFileLifeTimeInSpaceRequest(org.dcache.srm.v2_2.SrmExtendFileLifeTimeInSpaceRequest) Function(java.util.function.Function) SrmGetRequestTokensResponse(org.dcache.srm.v2_2.SrmGetRequestTokensResponse) SrmPutDoneRequest(org.dcache.srm.v2_2.SrmPutDoneRequest) SRMAuthenticationException(org.dcache.srm.SRMAuthenticationException) SrmResponse(org.dcache.srm.SrmResponse) ArrayOfTPutFileRequest(org.dcache.srm.v2_2.ArrayOfTPutFileRequest) SrmStatusOfLsRequestResponse(org.dcache.srm.v2_2.SrmStatusOfLsRequestResponse) SrmRmdirRequest(org.dcache.srm.v2_2.SrmRmdirRequest) SRMInvalidRequestException(org.dcache.srm.SRMInvalidRequestException) SrmStatusOfLsRequestRequest(org.dcache.srm.v2_2.SrmStatusOfLsRequestRequest) SRM_INTERNAL_ERROR(org.dcache.srm.v2_2.TStatusCode.SRM_INTERNAL_ERROR) SrmGetRequestSummaryResponse(org.dcache.srm.v2_2.SrmGetRequestSummaryResponse) Logger(org.slf4j.Logger) SrmResumeRequestResponse(org.dcache.srm.v2_2.SrmResumeRequestResponse) URI(org.apache.axis.types.URI) SrmStatusOfGetRequestResponse(org.dcache.srm.v2_2.SrmStatusOfGetRequestResponse) ArrayOfTSURLReturnStatus(org.dcache.srm.v2_2.ArrayOfTSURLReturnStatus) Subject(javax.security.auth.Subject) TGetRequestFileStatus(org.dcache.srm.v2_2.TGetRequestFileStatus) SRM_TOO_MANY_RESULTS(org.dcache.srm.v2_2.TStatusCode.SRM_TOO_MANY_RESULTS) Collectors.toList(java.util.stream.Collectors.toList) Required(org.springframework.beans.factory.annotation.Required) SrmSuspendRequestRequest(org.dcache.srm.v2_2.SrmSuspendRequestRequest) LoadingCache(com.google.common.cache.LoadingCache) SrmReserveSpaceResponse(org.dcache.srm.v2_2.SrmReserveSpaceResponse) Subjects(org.dcache.auth.Subjects) SRM_SPACE_LIFETIME_EXPIRED(org.dcache.srm.v2_2.TStatusCode.SRM_SPACE_LIFETIME_EXPIRED) SRM_AUTHORIZATION_FAILURE(org.dcache.srm.v2_2.TStatusCode.SRM_AUTHORIZATION_FAILURE) SrmPingRequest(org.dcache.srm.v2_2.SrmPingRequest) SrmAbortFilesRequest(org.dcache.srm.v2_2.SrmAbortFilesRequest) SRM_FAILURE(org.dcache.srm.v2_2.TStatusCode.SRM_FAILURE) SrmCheckPermissionRequest(org.dcache.srm.v2_2.SrmCheckPermissionRequest) ArrayOfTRequestSummary(org.dcache.srm.v2_2.ArrayOfTRequestSummary) CertificateFactories(org.dcache.util.CertificateFactories) SrmPurgeFromSpaceRequest(org.dcache.srm.v2_2.SrmPurgeFromSpaceRequest) PrintWriter(java.io.PrintWriter) SrmPurgeFromSpaceResponse(org.dcache.srm.v2_2.SrmPurgeFromSpaceResponse) TRequestTokenReturn(org.dcache.srm.v2_2.TRequestTokenReturn) TTransferParameters(org.dcache.srm.v2_2.TTransferParameters) SrmLsResponse(org.dcache.srm.v2_2.SrmLsResponse) Set(java.util.Set) SrmReserveSpaceRequest(org.dcache.srm.v2_2.SrmReserveSpaceRequest) InvocationTargetException(java.lang.reflect.InvocationTargetException) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TCopyRequestFileStatus(org.dcache.srm.v2_2.TCopyRequestFileStatus) SrmSuspendRequestResponse(org.dcache.srm.v2_2.SrmSuspendRequestResponse) SrmStatusOfPutRequestRequest(org.dcache.srm.v2_2.SrmStatusOfPutRequestRequest) AccessController(java.security.AccessController) SrmUpdateSpaceResponse(org.dcache.srm.v2_2.SrmUpdateSpaceResponse) SRM_DUPLICATION_ERROR(org.dcache.srm.v2_2.TStatusCode.SRM_DUPLICATION_ERROR) SrmPingResponse(org.dcache.srm.v2_2.SrmPingResponse) SrmStatusOfReserveSpaceRequestResponse(org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestResponse) ArrayOfAnyURI(org.dcache.srm.v2_2.ArrayOfAnyURI) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) SRM_NOT_SUPPORTED(org.dcache.srm.v2_2.TStatusCode.SRM_NOT_SUPPORTED) SrmChangeSpaceForFilesResponse(org.dcache.srm.v2_2.SrmChangeSpaceForFilesResponse) ArrayList(java.util.ArrayList) SrmStatusOfCopyRequestRequest(org.dcache.srm.v2_2.SrmStatusOfCopyRequestRequest) SrmGetSpaceTokensResponse(org.dcache.srm.v2_2.SrmGetSpaceTokensResponse) BiConsumer(java.util.function.BiConsumer) SrmCopyRequest(org.dcache.srm.v2_2.SrmCopyRequest) ReturnStatuses.getSummaryReturnStatus(org.dcache.srm.handler.ReturnStatuses.getSummaryReturnStatus) ArrayOfTCopyFileRequest(org.dcache.srm.v2_2.ArrayOfTCopyFileRequest) SrmReleaseFilesResponse(org.dcache.srm.v2_2.SrmReleaseFilesResponse) SrmGetSpaceMetaDataRequest(org.dcache.srm.v2_2.SrmGetSpaceMetaDataRequest) SrmGetTransferProtocolsResponse(org.dcache.srm.v2_2.SrmGetTransferProtocolsResponse) SrmMkdirRequest(org.dcache.srm.v2_2.SrmMkdirRequest) Futures(com.google.common.util.concurrent.Futures) InetAddresses(com.google.common.net.InetAddresses) SrmBringOnlineRequest(org.dcache.srm.v2_2.SrmBringOnlineRequest) ArrayOfTExtraInfo(org.dcache.srm.v2_2.ArrayOfTExtraInfo) CertificateFactory(java.security.cert.CertificateFactory) SRM_FILE_UNAVAILABLE(org.dcache.srm.v2_2.TStatusCode.SRM_FILE_UNAVAILABLE) LoggerFactory(org.slf4j.LoggerFactory) SRM_CUSTOM_STATUS(org.dcache.srm.v2_2.TStatusCode.SRM_CUSTOM_STATUS) PreDestroy(javax.annotation.PreDestroy) AuthenticationHandler(org.dcache.http.AuthenticationHandler) SrmStatusOfUpdateSpaceRequestResponse(org.dcache.srm.v2_2.SrmStatusOfUpdateSpaceRequestResponse) Collectors.toSet(java.util.stream.Collectors.toSet) SRM_INVALID_REQUEST(org.dcache.srm.v2_2.TStatusCode.SRM_INVALID_REQUEST) SRM_NO_USER_SPACE(org.dcache.srm.v2_2.TStatusCode.SRM_NO_USER_SPACE) SrmPrepareToGetResponse(org.dcache.srm.v2_2.SrmPrepareToGetResponse) ImmutableMap(com.google.common.collect.ImmutableMap) SRM_FATAL_INTERNAL_ERROR(org.dcache.srm.v2_2.TStatusCode.SRM_FATAL_INTERNAL_ERROR) SrmGetRequestTokensRequest(org.dcache.srm.v2_2.SrmGetRequestTokensRequest) SrmStatusOfBringOnlineRequestResponse(org.dcache.srm.v2_2.SrmStatusOfBringOnlineRequestResponse) Axis(org.dcache.srm.util.Axis) List(java.util.List) SrmStatusOfChangeSpaceForFilesRequestRequest(org.dcache.srm.v2_2.SrmStatusOfChangeSpaceForFilesRequestRequest) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) CacheBuilder(com.google.common.cache.CacheBuilder) CellPath(dmg.cells.nucleus.CellPath) X509Credential(eu.emi.security.authn.x509.X509Credential) SrmAbortRequestRequest(org.dcache.srm.v2_2.SrmAbortRequestRequest) SrmPrepareToPutRequest(org.dcache.srm.v2_2.SrmPrepareToPutRequest) CellInfoProvider(dmg.cells.nucleus.CellInfoProvider) ArrayOfTGetRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTGetRequestFileStatus) SrmStatusOfPutRequestResponse(org.dcache.srm.v2_2.SrmStatusOfPutRequestResponse) SRMInternalErrorException(org.dcache.srm.SRMInternalErrorException) SrmStatusOfGetRequestRequest(org.dcache.srm.v2_2.SrmStatusOfGetRequestRequest) HashMap(java.util.HashMap) SrmStatusOfUpdateSpaceRequestRequest(org.dcache.srm.v2_2.SrmStatusOfUpdateSpaceRequestRequest) SrmCheckPermissionResponse(org.dcache.srm.v2_2.SrmCheckPermissionResponse) TGetFileRequest(org.dcache.srm.v2_2.TGetFileRequest) ArrayOfTBringOnlineRequestFileStatus(org.dcache.srm.v2_2.ArrayOfTBringOnlineRequestFileStatus) SrmStatusOfCopyRequestResponse(org.dcache.srm.v2_2.SrmStatusOfCopyRequestResponse) CacheException(diskCacheV111.util.CacheException) SRM_FILE_LOST(org.dcache.srm.v2_2.TStatusCode.SRM_FILE_LOST) SRM_REQUEST_TIMED_OUT(org.dcache.srm.v2_2.TStatusCode.SRM_REQUEST_TIMED_OUT) SrmPutDoneResponse(org.dcache.srm.v2_2.SrmPutDoneResponse) CuratorFrameworkAware(org.dcache.cells.CuratorFrameworkAware) JDC(org.dcache.srm.util.JDC) SrmChangeSpaceForFilesRequest(org.dcache.srm.v2_2.SrmChangeSpaceForFilesRequest) SrmReleaseFilesRequest(org.dcache.srm.v2_2.SrmReleaseFilesRequest) SrmUpdateSpaceRequest(org.dcache.srm.v2_2.SrmUpdateSpaceRequest) RequestExecutionTimeGauges(org.dcache.commons.stats.RequestExecutionTimeGauges) SRMAuthorizationException(org.dcache.srm.SRMAuthorizationException) SRM_ABORTED(org.dcache.srm.v2_2.TStatusCode.SRM_ABORTED) SRM_SUCCESS(org.dcache.srm.v2_2.TStatusCode.SRM_SUCCESS) ArrayOfTMetaDataPathDetail(org.dcache.srm.v2_2.ArrayOfTMetaDataPathDetail) US_ASCII(java.nio.charset.StandardCharsets.US_ASCII) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) SrmRmdirResponse(org.dcache.srm.v2_2.SrmRmdirResponse) SrmGetSpaceTokensRequest(org.dcache.srm.v2_2.SrmGetSpaceTokensRequest) SrmRequest(org.dcache.srm.SrmRequest) PathChildrenCache(org.apache.curator.framework.recipes.cache.PathChildrenCache) ArrayOfTRequestTokenReturn(org.dcache.srm.v2_2.ArrayOfTRequestTokenReturn) SrmGetTransferProtocolsRequest(org.dcache.srm.v2_2.SrmGetTransferProtocolsRequest) LoginAttribute(org.dcache.auth.attributes.LoginAttribute) CacheException(diskCacheV111.util.CacheException) PermissionDeniedCacheException(diskCacheV111.util.PermissionDeniedCacheException) ArrayOfString(org.dcache.srm.v2_2.ArrayOfString) SrmRequest(org.dcache.srm.SrmRequest) X509Credential(eu.emi.security.authn.x509.X509Credential) SRMException(org.dcache.srm.SRMException) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) ExecutionException(java.util.concurrent.ExecutionException)

Example 25 with NoRouteToCellException

use of dmg.cells.nucleus.NoRouteToCellException in project dcache by dCache.

the class ProbeResponseEngine method queryUrl.

@Override
public void queryUrl(HttpRequest request) throws HttpException {
    try {
        String[] urlItems = request.getRequestTokens();
        if (urlItems.length < 2) {
            throw new HttpException(404, "No such property");
        }
        /* urlItems[0] is the mount point.
             */
        BeanQueryMessage queryMessage = (urlItems.length == 3) ? new BeanQuerySinglePropertyMessage(urlItems[2]) : new BeanQueryAllPropertiesMessage();
        BeanQueryMessage queryReply = stub.sendAndWait(new CellPath(urlItems[1]), queryMessage);
        request.setContentType("application/json; charset=utf-8");
        Writer writer = new OutputStreamWriter(request.getOutputStream(), UTF_8);
        writer.append(new GsonBuilder().serializeSpecialFloatingPointValues().setPrettyPrinting().disableHtmlEscaping().create().toJson(queryReply.getResult()));
        writer.flush();
    } catch (NoRouteToCellException e) {
        throw new HttpException(503, "The cell was unreachable, suspect trouble.");
    } catch (TimeoutCacheException e) {
        throw new HttpException(503, "The cell took too long to reply, suspect trouble.");
    } catch (InvalidMessageCacheException e) {
        throw new HttpException(404, "No such property");
    } catch (CacheException | IOException e) {
        throw new HttpException(500, e.getMessage());
    } catch (InterruptedException e) {
        throw new HttpException(503, "Received interrupt whilst processing data. Please try again later.");
    }
}
Also used : CellPath(dmg.cells.nucleus.CellPath) GsonBuilder(com.google.gson.GsonBuilder) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException) CacheException(diskCacheV111.util.CacheException) InvalidMessageCacheException(diskCacheV111.util.InvalidMessageCacheException) InvalidMessageCacheException(diskCacheV111.util.InvalidMessageCacheException) IOException(java.io.IOException) BeanQueryMessage(org.dcache.vehicles.BeanQueryMessage) BeanQueryAllPropertiesMessage(org.dcache.vehicles.BeanQueryAllPropertiesMessage) NoRouteToCellException(dmg.cells.nucleus.NoRouteToCellException) HttpException(dmg.util.HttpException) BeanQuerySinglePropertyMessage(org.dcache.vehicles.BeanQuerySinglePropertyMessage) OutputStreamWriter(java.io.OutputStreamWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) TimeoutCacheException(diskCacheV111.util.TimeoutCacheException)

Aggregations

NoRouteToCellException (dmg.cells.nucleus.NoRouteToCellException)67 CacheException (diskCacheV111.util.CacheException)55 TimeoutCacheException (diskCacheV111.util.TimeoutCacheException)25 PermissionDeniedCacheException (diskCacheV111.util.PermissionDeniedCacheException)22 FileNotFoundCacheException (diskCacheV111.util.FileNotFoundCacheException)19 ArrayList (java.util.ArrayList)15 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 Produces (javax.ws.rs.Produces)14 BadRequestException (javax.ws.rs.BadRequestException)13 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)13 Path (javax.ws.rs.Path)13 CellPath (dmg.cells.nucleus.CellPath)11 ExecutionException (java.util.concurrent.ExecutionException)11 ForbiddenException (javax.ws.rs.ForbiddenException)11 GET (javax.ws.rs.GET)11 FsPath (diskCacheV111.util.FsPath)10 PnfsId (diskCacheV111.util.PnfsId)10 SRMException (org.dcache.srm.SRMException)10 SRMInternalErrorException (org.dcache.srm.SRMInternalErrorException)10