Package org.openbel.framework.ws.core

Examples of org.openbel.framework.ws.core.RequestException


            throw new MissingRequest(FIND_PATHS_REQUEST);
        }

        final List<KamNode> sources = request.getSources();
        if (noItems(sources)) {
            throw new RequestException("Sources payload are missing");
        }

        final List<KamNode> targets = request.getTargets();
        if (noItems(targets)) {
            throw new RequestException("Targets payload are missing");
        }

        final int maxSearchDepth = request.getMaxDepth();

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());

        Kam kam;
        try {
            // read kam from first source node
            kam =
                    lookupKam(sources.get(0), dialect,
                            "Error retreving KAM associated with node");
        } catch (KamCacheServiceException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        } catch (InvalidIdException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        }

        try {
            final List<SimplePath> paths = pathFindService.findPaths(kam,
                    sources, targets, maxSearchDepth);

            final FindPathsResponse findPathsResponse = new FindPathsResponse();
            findPathsResponse.getPaths().addAll(paths);

            return findPathsResponse;
        } catch (PathFindServiceException e) {
            throw new RequestException(e.getMessage());
        }
    }
View Full Code Here


            throw new MissingRequest(SCAN_REQUEST);
        }

        final List<KamNode> sources = request.getSources();
        if (noItems(sources)) {
            throw new RequestException("Sources payload are missing");
        }

        final int maxSearchDepth = request.getMaxDepth();

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());

        Kam kam;
        try {
            // read kam from first source node
            kam =
                    lookupKam(sources.get(0), dialect,
                            "Error retreving KAM associated with node");
        } catch (KamCacheServiceException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        } catch (InvalidIdException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        }

        try {
            final List<SimplePath> paths = pathFindService.scan(kam,
                    sources, maxSearchDepth);

            final ScanResponse scanResponse = new ScanResponse();
            scanResponse.getPaths().addAll(paths);

            return scanResponse;
        } catch (PathFindServiceException e) {
            final String msg = "error in pathfind scan";
            throw new RequestException(msg, e);
        }
    }
View Full Code Here

            throw new MissingRequest(INTERCONNECT_REQUEST);
        }

        final List<KamNode> sources = request.getSources();
        if (noItems(sources)) {
            throw new RequestException("Sources payload are missing");
        }

        final int maxSearchDepth = request.getMaxDepth();

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());

        Kam kam;
        try {
            // read kam from first source node
            kam =
                    lookupKam(sources.get(0), dialect,
                            "Error retreving KAM associated with node");
        } catch (KamCacheServiceException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        } catch (InvalidIdException e) {
            throw new RequestException(
                    "Error retreving KAM associated with node", e);
        }

        try {
            final List<SimplePath> paths = pathFindService.interconnect(kam,
                    sources, maxSearchDepth);

            final InterconnectResponse interconnectResponse =
                    new InterconnectResponse();
            interconnectResponse.getPaths().addAll(paths);

            return interconnectResponse;
        } catch (PathFindServiceException e) {
            final String msg = "error in pathfind interconnect";
            throw new RequestException(msg, e);
        }
    }
View Full Code Here

                dialectCacheService.getDialect(dialectHandle.getHandle());

        if (dialect == null) {
            final String fmt = DIALECT_REQUEST_NO_DIALECT_FOR_HANDLE;
            final String msg = format(fmt, dialectHandle.getHandle());
            throw new RequestException(msg);
        }

        return dialect;
    }
View Full Code Here

        KamStoreObjectRef kamNodeRef = Converter.decodeNode(kamNode);
        KamInfo kamInfo = null;
        try {
            kamInfo = kamCatalogDao.getKamInfoById(kamNodeRef.getKamInfoId());
        } catch (SQLException e) {
            throw new RequestException(errorMsg, e);
        }
        if (kamInfo == null) {
            throw new InvalidIdException(kamNodeRef.getEncodedString());
        }
        final Kam kam = kamCacheService.getKam(kamInfo.getName());
View Full Code Here

        }

        // Make sure a Kam was specified in the request
        KamHandle kamHandle = request.getHandle();
        if (null == kamHandle) {
            throw new RequestException("Kam payload is missing");
        }

        CitationType citationType = request.getCitationType();
        if (null == citationType) {
            throw new RequestException("citationType payload is missing");
        }

        List<String> referenceIds = request.getReferenceIds();

        // Get the optional BelDocument
        BelDocument belDocument = request.getDocument();

        // Create the response

        GetCitationsResponse response = OBJECT_FACTORY
                .createGetCitationsResponse();
        try {
            for (Citation citation : kamStoreService.getCitations(kamHandle,
                    citationType, referenceIds, belDocument)) {
                response.getCitations().add(citation);
            }
        } catch (KamStoreServiceException e) {
            final String msg = "error getting citations";
            throw new RequestException(msg, e);
        }

        return response;
    }
View Full Code Here

        }

        // Sanity check the full request payload
        KamHandle kamHandle = request.getHandle();
        if (kamHandle == null || kamHandle.getHandle() == null) {
            throw new RequestException(KAM_REQUEST_NO_HANDLE);
        }

        List<BelDocument> documents;
        try {
            documents = kamStoreService.getBelDocuments(kamHandle);
        } catch (KamStoreServiceException e) {
            String msg = "getting BEL documents:";
            throw new RequestException(msg, e);
        }

        GetBelDocumentsResponse response = OBJECT_FACTORY
                .createGetBelDocumentsResponse();
        for (BelDocument document : documents) {
View Full Code Here

        }

        // validate kam
        final KamHandle handle = req.getHandle();
        if (handle == null || handle.getHandle() == null) {
            throw new RequestException("KamHandle is missing");
        }
        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(req.getDialect());
        final org.openbel.framework.api.Kam kam = getKam(
                handle, dialect);

        final Namespace ns = req.getNamespace();
        if (ns == null) {
            throw new RequestException("Namespace is missing");
        }

        final List<String> values = req.getValues();
        if (values.isEmpty()) {
            throw new RequestException("Values are missing");
        }

        // read optional filter
        final NodeFilter nf = req.getNodeFilter();

        // convert namespace/values to NamespaceValue objects for delegation
        List<NamespaceValue> nvs = new ArrayList<NamespaceValue>(values.size());
        for (String s : values) {
            NamespaceValue nv = OBJECT_FACTORY.createNamespaceValue();
            nv.setNamespace(ns);
            nv.setValue(s);
            nvs.add(nv);
        }

        // delegate to findKamNodesByNamespaceValues
        List<org.openbel.framework.api.Kam.KamNode> nodes;
        try {
            nodes =
                    KamEndPoint.findKamNodesByNamespacevalues(nvs, nf, kam,
                            kAMStore,
                            equivalencer);
        } catch (EquivalencerException e) {
            throw new RequestException("Error mapping data", e);
        } catch (KAMStoreException e) {
            throw new RequestException("Error mapping data", e);
        }

        KamInfo kamInfo = kam.getKamInfo();
        final MapDataResponse res = OBJECT_FACTORY.createMapDataResponse();
        for (org.openbel.framework.api.Kam.KamNode kn : nodes) {
View Full Code Here

                .getHandle());

        if (dialect == null) {
            final String fmt = DIALECT_REQUEST_NO_DIALECT_FOR_HANDLE;
            final String msg = format(fmt, dialectHandle.getHandle());
            throw new RequestException(msg);
        }

        return dialect;
    }
View Full Code Here

        objKam = kamCacheService.getKam(kamHandle.getHandle());

        if (objKam == null) {
            final String fmt = KAM_REQUEST_NO_KAM_FOR_HANDLE;
            final String msg = format(fmt, kamHandle.getHandle());
            throw new RequestException(msg);
        }
        return dialect == null ? objKam : new KamDialect(objKam, dialect);
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.ws.core.RequestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.