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

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


            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if(e instanceof SolrServerException){
                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);
            } else if(e instanceof IOException){
                throw new YardException("Unable to access SolrServer",e);
            } else {
                throw RuntimeException.class.cast(e);
            }
        }
        if(query.getRequestHandler() == SolrQueryFactory.MLT_QUERY_TYPE){
View Full Code Here


                }
            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if(e instanceof SolrServerException){
                throw new YardException("Error while performing query on the SolrServer (query: "
                        + query.getQuery()+")!", e);
            } else if(e instanceof IOException){
                throw new YardException("Unable to access SolrServer",e);
            } else {
                throw RuntimeException.class.cast(e);
            }
        }
        // return a queryResultList
View Full Code Here

        SolrDocument doc;
        long start = System.currentTimeMillis();
        try {
            doc = getSolrDocument(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

            throw new IllegalArgumentException("The parsed Representation id MUST NOT be empty!");
        }
        try {
            return getSolrDocument(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

                }
            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if(e instanceof SolrServerException){
                throw new YardException("Error while deleting document " + id + " from the Solr server", e);
            } else if(e instanceof IOException){
                throw new YardException("Unable to access SolrServer",e);
            } else {
                throw RuntimeException.class.cast(e);
            }
        }
        // NOTE: We do not need to update all Documents that refer this ID, because
View Full Code Here

                }
            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if(e instanceof SolrServerException){
                throw new YardException("Error while deleting documents from the Solr server", e);
            } else if(e instanceof IOException){
                throw new YardException("Unable to access SolrServer",e);
            } else {
                throw RuntimeException.class.cast(e);
            }
        }
        // NOTE: We do not need to update all Documents that refer this ID, because
View Full Code Here

                }
            });
        } catch (PrivilegedActionException pae) {
            Exception e = pae.getException();
            if(e instanceof SolrServerException){
                throw new YardException("Error while deleting documents from the Solr server", e);
            } else if(e instanceof IOException){
                throw new YardException("Unable to access SolrServer",e);
            } else if(e instanceof YardException){
                throw (YardException)e;
            } else {
                throw RuntimeException.class.cast(e);
            }
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 (PrivilegedActionException pae){
            if(pae.getException() instanceof SolrServerException){
                throw new YardException(String.format("Exception while adding Document to Solr",
                    representation.getId()), pae.getException());
            } else if( pae.getException() instanceof IOException){
                throw new YardException("Unable to access SolrServer", pae.getException());
            } else {
                throw RuntimeException.class.cast(pae.getException());
            }
        }
        return representation;
View Full Code Here

            log.debug(String.format(
                "Processed store request for %d documents in %dms (created %dms| stored%dms)", inputDocs.size(),
                ready - start, created - start, ready - created));
        } catch (PrivilegedActionException pae){
            if(pae.getException() instanceof SolrServerException){
                throw new YardException("Exception while adding Documents to the Solr Server!", pae.getException());
            } else if( pae.getException() instanceof IOException){
                throw new YardException("Unable to access SolrServer", pae.getException());
            } else {
                throw RuntimeException.class.cast(pae.getException());
            }
        }
        return added;
View Full Code Here

        }
        int numDocs = ids.size(); // for debuging
        try {
            ids = checkRepresentations(ids); // returns the ids found in the solrIndex
        } catch (SolrServerException e) {
            throw new YardException("Error while searching for alredy present documents "
                + "before executing the actual update for the parsed Representations", e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
        long checked = System.currentTimeMillis();
        List<SolrInputDocument> inputDocs = new ArrayList<SolrInputDocument>(ids.size());
        List<Representation> updated = new ArrayList<Representation>();
        for (Representation representation : representations) {
            if (representation != null && ids.contains(representation.getId())) { // null parsed or not
                                                                                  // already present
                inputDocs.add(createSolrInputDocument(representation));
                updated.add(representation);
            }
        }
        long created = System.currentTimeMillis();
        if (!inputDocs.isEmpty()) {
            try {
                final UpdateRequest update = new UpdateRequest();
                if (!immediateCommit) {
                    update.setCommitWithin(commitWithin);
                }
                update.add(inputDocs);
                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                    public UpdateResponse run() throws IOException, SolrServerException {
                        update.process(server);
                        if (immediateCommit) {
                            server.commit();
                        }
                        return null;
                    }
                });
            } catch (PrivilegedActionException pae){
                if(pae.getException() instanceof SolrServerException){
                    throw new YardException("Error while adding updated Documents to the SolrServer",
                        pae.getException());
                } else if( pae.getException() instanceof IOException){
                    throw new YardException("Unable to access SolrServer", pae.getException());
                } else {
                    throw RuntimeException.class.cast(pae.getException());
                }
            }
        }
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.