Examples of SiteException


Examples of org.apache.lenya.cms.site.SiteException

    }

    public Link getLink(String language) throws SiteException {
        Link link = getLinkInternal(language);
        if (link == null) {
            throw new SiteException("The node [" + this + "] doesn't contain the language ["
                    + language + "].");
        }
        return link;
    }
View Full Code Here

Examples of org.apache.lenya.cms.site.SiteException

    }

    public Link add(String path, Document doc) throws SiteException {

        if (containsByUuid(doc.getUUID(), doc.getLanguage())) {
            throw new SiteException("The document [" + doc + "] is already contained!");
        }

        TreeNodeImpl node;
        if (contains(path)) {
            node = getTreeNode(path);
            if (node.getUuid() == null) {
                node.setUuid(doc.getUUID());
            } else if (!node.getUuid().equals(doc.getUUID())) {
                throw new SiteException("The node already has a different UUID!");
            }
        } else {
            node = (TreeNodeImpl) add(path);
            node.setUuid(doc.getUUID());
        }
View Full Code Here

Examples of org.apache.lenya.cms.site.SiteException

    public SiteNode add(String path, String followingSiblingPath) throws SiteException {
        String parentPath = getParentPath(path);
        String nodeName = path.substring(parentPath.length() + 1);

        if (!followingSiblingPath.startsWith(parentPath + "/")) {
            throw new SiteException("Invalid following sibling path [" + followingSiblingPath + "]");
        }

        String followingNodeName = followingSiblingPath.substring(parentPath.length() + 1);

        if (!contains(parentPath)) {
View Full Code Here

Examples of org.apache.lenya.cms.site.SiteException

    public Link getByUuid(String uuid, String language) throws SiteException {
        Assert.notNull("uuid", uuid);
        Assert.notNull("language", language);
        String key = getKey(uuid, language);
        if (!getUuidLanguage2Link().containsKey(key)) {
            throw new SiteException("No link for [" + key + "]");
        }
        return (Link) getUuidLanguage2Link().get(key);
    }
View Full Code Here

Examples of org.apache.lenya.cms.site.SiteException

    }

    public SiteNode getNode(String path) throws SiteException {
        Assert.notNull("path", path);
        if (!getPath2Node().containsKey(path)) {
            throw new SiteException("No node for path [" + path + "]");
        }
        return (SiteNode) this.path2node.get(path);
    }
View Full Code Here

Examples of org.apache.lenya.cms.site.SiteException

            else {
                getLogger().info("Empty sitetree will be created/initialized!");
                this.document = createDocument();
            }
        } catch (Exception e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.site.SiteException

                            singletonMap(RdfResourceEnum.isChached.getUri(), (Object) Boolean.TRUE));
                    }
                    return new QueryResultListImpl<Entity>(query, results, Entity.class);
                } catch (YardException e) {
                    if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                        throw new SiteException("Unable to execute query on Cache "
                                + siteConfiguration.getCacheId(), e);
                    } else {
                        log.warn(
                            String.format(
                                "Error while performing query on Cache %s! Try to use remote site %s as fallback!",
                                siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e);
                    }
                }
            } else {
                if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                    throw new SiteException(String.format(
                        "Unable to execute query on Cache %s because it is currently not active",
                        siteConfiguration.getCacheId()));
                } else {
                    log.warn(String.format(
                        "Cache %s currently not active will query remote Site %s as fallback",
                        siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()));
                }
            }
        }
        QueryResultList<String> entityIds;
        if (entitySearcher == null) {
            throw new SiteException(String.format("EntitySearcher %s not available for remote site %s!",
                siteConfiguration.getEntitySearcherType(), siteConfiguration.getQueryUri()));
        }
        ensureOnline(siteConfiguration.getQueryUri(), entitySearcher.getClass());
        try {
            log.trace("Will use an entity-searcher [type :: {}][query-uri :: {}].", entitySearcher.getClass()
                    .toString(), EntitySearcher.QUERY_URI);
            entityIds = entitySearcher.findEntities(query);
        } catch (IOException e) {
            throw new SiteException(String.format(
                "Unable to execute query on remote site %s with entitySearcher %s!",
                siteConfiguration.getQueryUri(), siteConfiguration.getEntitySearcherType()), e);
        }
        int numResults = entityIds.size();
        List<Entity> entities = new ArrayList<Entity>(numResults);
        int errors = 0;
        SiteException lastError = null;
        for (String id : entityIds) {
            Entity entity;
            try {
                entity = getEntity(id);
                if (entity == null) {
                    log.warn("Unable to create Entity for ID that was selected by an FieldQuery (id=" + id
                            + ")");
                }
                entities.add(entity);
                // use the position in the list as resultSocre
                entity.getRepresentation().set(RdfResourceEnum.resultScore.getUri(),
                    Float.valueOf((float) numResults));
            } catch (SiteException e) {
                lastError = e;
                errors++;
                log.warn(String
                        .format(
                            "Unable to get Representation for Entity %s. -> %d Error%s for %d Entities in QueryResult (Reason:%s)",
                            id, errors, errors > 1 ? "s" : "", entityIds.size(), e.getMessage()));
            }
            // decrease numResults because it is used as resultScore for
            // entities
            numResults--;
        }
        if (lastError != null) {
            if (entities.isEmpty()) {
                throw new SiteException(
                        "Unable to get anly Representations for Entities selected by the parsed Query (Root-Cause is the last Exception trown)",
                        lastError);
            } else {
                log.warn(String.format("Unable to get %d/%d Represetnations for selected Entities.", errors,
                    entityIds.size()));
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.site.SiteException

            if (cache != null) {
                try {
                    return cache.find(query);
                } catch (YardException e) {
                    if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                        throw new SiteException("Unable to execute query on Cache "
                                + siteConfiguration.getCacheId(), e);
                    } else {
                        log.warn(
                            String.format(
                                "Error while performing query on Cache %s! Try to use remote site %s as fallback!",
                                siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e);
                    }
                }
            } else {
                if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                    throw new SiteException(String.format(
                        "Unable to execute query because Cache %s is currently not active",
                        siteConfiguration.getCacheId()));
                } else {
                    log.warn(String.format(
                        "Cache %s currently not active will query remote Site %s as fallback",
                        siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()));
                }
            }
        }
        if (entitySearcher == null) {
            throw new SiteException(String.format("EntitySearcher %s not available for remote site %s!",
                siteConfiguration.getEntitySearcherType(), siteConfiguration.getQueryUri()));
        }
        ensureOnline(siteConfiguration.getQueryUri(), entitySearcher.getClass());
        try {
            return entitySearcher.find(query);
        } catch (IOException e) {
            throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(),
                    e);
        }
    }
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.site.SiteException

            if (cache != null) {
                try {
                    return cache.findReferences(query);
                } catch (YardException e) {
                    if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                        throw new SiteException("Unable to execute query on Cache "
                                + siteConfiguration.getCacheId(), e);
                    } else {
                        log.warn(
                            String.format(
                                "Error while performing query on Cache %s! Try to use remote site %s as fallback!",
                                siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e);
                    }
                }
            } else {
                if (siteConfiguration.getEntitySearcherType() == null || isOfflineMode()) {
                    throw new SiteException(String.format(
                        "Unable to execute query on Cache %s because it is currently not active",
                        siteConfiguration.getCacheId()));
                } else {
                    log.warn(String.format(
                        "Cache %s currently not active will query remote Site %s as fallback",
                        siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()));
                }
            }
        }
        if (entitySearcher == null) {
            throw new SiteException(String.format("EntitySearcher %s not available for remote site %s!",
                siteConfiguration.getEntitySearcherType(), siteConfiguration.getQueryUri()));
        }
        ensureOnline(siteConfiguration.getQueryUri(), entitySearcher.getClass());
        try {
            return entitySearcher.findEntities(query);
        } catch (IOException e) {
            throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(),
                    e);
        }
    }
View Full Code Here

Examples of org.apache.stanbol.entityhub.servicesapi.site.SiteException

    }

    @Override
    public InputStream getContent(String id, String contentType) throws SiteException {
        if (siteConfiguration.getEntityDereferencerType() == null) {
            throw new SiteException(
                    String.format(
                        "Unable to get Content for Entity %s because No dereferencer configured for ReferencedSite %s",
                        id, getId()));
        }
        if (dereferencer == null) {
            throw new SiteException(String.format("Dereferencer %s for remote site %s is not available",
                siteConfiguration.getEntityDereferencerType(), siteConfiguration.getAccessUri()));
        }
        ensureOnline(siteConfiguration.getAccessUri(), dereferencer.getClass());
        try {
            return dereferencer.dereference(id, contentType);
        } catch (IOException e) {
            throw new SiteException(
                    String.format(
                        "Unable to load content for Entity %s and mediaType %s from remote site %s by using dereferencer %s",
                        id, contentType, siteConfiguration.getAccessUri(),
                        siteConfiguration.getEntityDereferencerType()), e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.