Package org.apache.stanbol.entityhub.servicesapi.yard

Examples of org.apache.stanbol.entityhub.servicesapi.yard.YardException


                } else if(!indexMetadata.isActive()){ //already managed, but not active
                    //try to activate
                    try {
                        IndexMetadata activatedMetadata = managedSolrServer.activateIndex(indexReference.getIndex());
                        if(activatedMetadata == null){
                            throw new YardException(String.format(
                                "Unable to actiate SolrIndex '%s' for SolrYard '%s" +
                                "on MnagedSolrServer '%s'!",indexReference,
                                getConfig().getName(),managedSolrServer.getServerName()));
                        } else {
                            return activatedMetadata.getIndexReference();
                        }
                    } catch (IOException e) {
                        throw new YardException("Unable to actiate SolrIndex for SolrYard "+getConfig().getName(),e);
                    } catch (SAXException e) {
                        throw new YardException("Unable to actiate SolrIndex for SolrYard "+getConfig().getName(),e);
                    } catch (RuntimeException e){
                        throw new YardException("Unable to actiate SolrIndex for SolrYard "+getConfig().getName(),e);
                    }
                } else{ //already active ... noting todo
                    return indexReference;
                }
            } else { //indexReference.getServer() != managedSolrServer.getServerName
View Full Code Here


        log.info(" ... initialise new SolrDirectory Index with name {} by using Index Configuration {}",
            solrIndexLocation,configName);
        try {
            IndexMetadata metadata = managedServer.createSolrIndex(solrIndexLocation,configName,null);
            if (metadata == null) {
                throw new YardException("SolrIndex "+ config.getSolrServerLocation() +
                        " is not available" + (config.isDefaultInitialisation() ?
                                " and could not be initialised!" :
                                    ". The necessary Index is not yet installed."));
            } else {
                log.info(" ... created IndexDirectory {} for SolrIndex {} by using config {}",
                    new Object[]{metadata.getDirectory(),solrIndexLocation,configName});
            }
            return metadata.getIndexReference();
        } catch (IOException e) {
            throw new YardException("SolrIndex "+ config.getSolrServerLocation() +
                    " could not be initialised!",e);
        }
    }
View Full Code Here

    public final void optimize() throws YardException{
        SolrServer server = getServer();
        try {
            server.optimize();
        } catch (SolrServerException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        } catch (IOException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        }
    }
View Full Code Here

        try {
            StreamQueryRequest request = new StreamQueryRequest(query);
            response = request.process(getServer());
        } catch (SolrServerException e) {
            if ("unknown handler: /mlt".equals(e.getCause().getMessage())) {
                throw new YardException("Solr is missing '<requestHandler name=\"/mlt\""
                                        + " class=\"solr.MoreLikeThisHandler\" startup=\"lazy\" />'"
                                        + " in 'solrconfig.xml'", e);
            }
            throw new YardException("Error while performing Query on SolrServer: " + query.getQuery(), e);
        }
        long queryTime = System.currentTimeMillis();
        // return a queryResultList
        QueryResultListImpl<Representation> resultList = new QueryResultListImpl<Representation>(fieldQuery,
        // by adapting SolrDocuments to Representations
View Full Code Here

        SolrQuery query = getSolrQueryFactory().parseFieldQuery(fieldQuery, SELECT.ID);
        QueryResponse respone;
        try {
            respone = getServer().query(query, METHOD.POST);
        } catch (SolrServerException e) {
            throw new YardException("Error while performing query on the SolrServer", e);
        }
        final FieldMapper fieldMapper = getFieldMapper();
        // return a queryResultList
        return new QueryResultListImpl<String>(fieldQuery,
        // by adapting SolrDocuments to Representations
View Full Code Here

        SolrDocument doc;
        long start = System.currentTimeMillis();
        try {
            doc = getSolrDocument(server,fieldMapper,id);
        } catch (SolrServerException e) {
            throw new YardException("Error while getting SolrDocument for id" + id, e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
        long retrieve = System.currentTimeMillis();
        Representation rep;
        if (doc != null) {
            // create an Representation for the Doc! retrieve
View Full Code Here

        final SolrServer server = getServer();
        final FieldMapper fieldMapper = getFieldMapper();
        try {
            return getSolrDocument(server,fieldMapper,id, Arrays.asList(fieldMapper.getDocumentIdField())) != null;
        } catch (SolrServerException e) {
            throw new YardException("Error while performing getDocumentByID request for id " + id, e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
    }
View Full Code Here

        SolrServer server = getServer();
        try {
            server.deleteById(id);
            server.commit();
        } catch (SolrServerException e) {
            throw new YardException("Error while deleting document " + id + " from the Solr server", e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
        // NOTE: We do not need to update all Documents that refer this ID, because
        // only the representation of the Entity is deleted and not the
        // Entity itself. So even that we do no longer have an representation
        // the entity still exists and might be referenced by others!
View Full Code Here

        SolrServer server = getServer();
        try {
            server.deleteById(toRemove);
            server.commit();
        } catch (SolrServerException e) {
            throw new YardException("Error while deleting documents from the Solr server", e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
        // NOTE: We do not need to update all Documents that refer this ID, because
        // only the representation of the Entity is deleted and not the
        // Entity itself. So even that we do no longer have an representation
        // the entity still exists and might be referenced by others!
View Full Code Here

            long stored = System.currentTimeMillis();
            log.debug("  ... done [create={}ms|store={}ms|sum={}ms]", new Object[] {(create - start),
                                                                                    (stored - create),
                                                                                    (stored - start)});
        } catch (SolrServerException e) {
            throw new YardException(String.format("Exception while adding Document to Solr",
                representation.getId()), e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
        return representation;
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.yard.YardException

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.