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

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


        // we need to change the exceptions, because this will be called outside
        // of an OSGI environment!
        try {
            activate(config);
        } catch (IOException e) {
            new YardException("Unable to access SolrServer" + config.getSolrServerLocation());
        } catch (SolrServerException e) {
            new YardException("Unable to initialize SolrServer" + config.getSolrServerLocation());
        } catch (ConfigurationException e) {
            new IllegalArgumentException("Unable to initialise SolrYard with the provided configuration", e);
        }
    }
View Full Code Here


            try {
                _fieldMapper = null;
            }finally{
                writeLock.unlock();
            }
            throw new YardException(String.format("The SolrIndex '%s' for SolrYard '%s' is currently not active!",
                ((SolrYardConfig)getConfig()).getSolrServerLocation(),getName()));
           
        }
    }
View Full Code Here

            //init remote server
            try {
                _server = new HttpSolrServer(indexLocation);
                _server.ping(); //test if remove service is available
            } catch (RuntimeException e) {
                throw new YardException("Unable to connect to remote SolrServer '"+
                    config.getSolrServerLocation() +"' because of "+e.getMessage(),e);
            } catch (SolrServerException e) {
                throw new YardException("Unable to initialise to remote SolrServer '"+
                    config.getSolrServerLocation() +"' because of "+e.getMessage(),e);
            } catch (IOException e) {
                throw new YardException("Unable to connect to remote SolrServer '"+
                    config.getSolrServerLocation() +"' because of "+e.getMessage(),e);
            }
        } else { //locally managed Server
            //(1) check if available (also tries to create if not available and
            //    create is allowed based on the configuration)
            IndexReference indexReference = checkManagedSolrIndex(managedSolrServer,config);
            if(indexReference != null){
                if(context == null){ // outside OSGI
                    try {
                        _server = StandaloneEmbeddedSolrServerProvider.getInstance().getSolrServer(indexReference);
                    } catch (RuntimeException e) {
                        throw new YardException("Unable to initialise configured SolrServer'"+
                            config.getSolrServerLocation() +"'!",e);
                    }
                } else { //within OSGI dynamically track the service
                    try {
                        _registeredServerTracker = new RegisteredSolrServerTracker(
                            context.getBundleContext(), indexReference, null);
                        log.info(" ... start tracking for SolrCore based on {}",indexReference);
                        _registeredServerTracker.open(); //start tracking
                    } catch (InvalidSyntaxException e) {
                        throw new YardException("Unable to track configured SolrServer'"+
                            config.getSolrServerLocation() +"'!",e);
                    } catch (RuntimeException e) {
                        throw new YardException("Unable to initialise configured SolrServer'"+
                            config.getSolrServerLocation() +"'!",e);
                    }
                }
            }
        }
View Full Code Here

                } 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

            });
        } 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.getQueryType() == 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);
            }
        }
        final FieldMapper fieldMapper = getFieldMapper();
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

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.