Examples of IndexReference


Examples of org.apache.stanbol.commons.solr.IndexReference

        this.managedSolrServer = managedSolrServer;
    }

    protected void unbindManagedSolrServer(ManagedSolrServer managedSolrServer) {
        if (this.managedSolrServer == managedSolrServer || solrCoreId != null) {
            IndexReference indexReference = IndexReference.parse(solrCoreId);
            if (!indexReference.checkServer(managedSolrServer.getServerName())) {
                return;
            }
            String indexName = indexReference.getIndex();
            IndexMetadata indexMetadata = managedSolrServer.getIndexMetadata(indexName);
            if (indexMetadata != null && indexMetadata.isActive()) {
                managedSolrServer.deactivateIndex(indexName);
            }
            this.managedSolrServer = null;
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

     */
    private void deactivateSolrServer(){
        SolrYardConfig config = (SolrYardConfig) this.getConfig();
        String indexLocation = config.getSolrServerLocation();
        if(!(indexLocation.startsWith("http") && indexLocation.indexOf("://") > 0)){
            IndexReference indexReference = IndexReference.parse(indexLocation);
            ManagedSolrServer managedSolrServer = this.managedSolrServer;
            if(indexReference.isName() && managedSolrServer != null
                    && (indexReference.getServer() == null ||
                            indexReference.getServer().equals(managedSolrServer.getServerName()))){
                managedSolrServer.deactivateIndex(indexReference.getIndex());
            } //else no managed index or index not managed on #managedSolrServer
        }//an remote server
    }
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

                    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) {
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

     * @param config
     * @param indexReference
     * @throws YardException
     */
    private IndexReference checkManagedSolrIndex(ManagedSolrServer managedSolrServer, SolrYardConfig config) throws YardException {
        IndexReference indexReference = IndexReference.parse(config.getSolrServerLocation());
        if(indexReference.isName()){
            if(managedSolrServer == null){
                log.warn("Unable to init SolrIndex '{}' because ManagedSolrServer service is not available",
                    config.getSolrServerLocation());
                return null; //indicate that the server is not yet active
            } else if(indexReference.getServer() == null ||
                        indexReference.getServer().equals(managedSolrServer.getServerName())){
                //check if the referenced Index is Managed
                IndexMetadata indexMetadata = managedSolrServer.getIndexMetadata(indexReference.getIndex());
                if(indexMetadata == null){
                    // not managed -> try to create
                    IndexReference createdIndexRef = createSolrIndex(managedSolrServer,config, indexReference.getIndex());
                    if(context == null){
                        //in that case we need to replace the parse SolrServerLocation
                        //with the name of the created solr index
                        config.setSolrServerLocation(createdIndexRef.getIndex());
                    }
                    //return the created IndexReference
                    return createdIndexRef;
                } else if(!indexMetadata.isActive()){ //already managed, but not active
                    //try to activate
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

     */
    private void deactivateSolrServer(){
        SolrYardConfig config = (SolrYardConfig) this.getConfig();
        String indexLocation = config.getSolrServerLocation();
        if(!(indexLocation.startsWith("http") && indexLocation.indexOf("://") > 0)){
            IndexReference indexReference = IndexReference.parse(indexLocation);
            ManagedSolrServer managedSolrServer = this.managedSolrServer;
            if(indexReference.isName() && managedSolrServer != null
                    && (indexReference.getServer() == null ||
                            indexReference.getServer().equals(managedSolrServer.getServerName()))){
                managedSolrServer.deactivateIndex(indexReference.getIndex());
            } //else no managed index or index not managed on #managedSolrServer
        }//an remote server
    }
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

                    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) {
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

     * @param config
     * @param indexReference
     * @throws YardException
     */
    private IndexReference checkManagedSolrIndex(ManagedSolrServer managedSolrServer, SolrYardConfig config) throws YardException {
        IndexReference indexReference = IndexReference.parse(config.getSolrServerLocation());
        if(indexReference.isName()){
            if(managedSolrServer == null){
                log.warn("Unable to init SolrIndex '{}' because ManagedSolrServer service is not available",
                    config.getSolrServerLocation());
                return null; //indicate that the server is not yet active
            } else if(indexReference.getServer() == null ||
                        indexReference.getServer().equals(managedSolrServer.getServerName())){
                //check if the referenced Index is Managed
                IndexMetadata indexMetadata = managedSolrServer.getIndexMetadata(indexReference.getIndex());
                if(indexMetadata == null){
                    // not managed -> try to create
                    IndexReference createdIndexRef = createSolrIndex(managedSolrServer,config, indexReference.getIndex());
                    if(context == null){
                        //in that case we need to replace the parse SolrServerLocation
                        //with the name of the created solr index
                        config.setSolrServerLocation(createdIndexRef.getIndex());
                    }
                    //return the created IndexReference
                    return createdIndexRef;
                } else if(!indexMetadata.isActive()){ //already managed, but not active
                    //try to activate
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

                throw new ConfigurationException(solrCoreProperty,
                        solrCoreProperty + " should be a SolrServer instance for using"
                                + " the engine without any OSGi context. Got: " + solrCoreId);
            }
            try {
                IndexReference indexReference = IndexReference.parse(solrCoreId);
                indexReference = checkInitSolrIndex(indexReference);
                // track the solr core OSGi updates
                indexTracker = new RegisteredSolrServerTracker(context.getBundleContext(), indexReference);
                indexTracker.open();
            } catch (Exception e) {
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

        this.managedSolrServer = managedSolrServer;
    }

    protected void unbindManagedSolrServer(ManagedSolrServer managedSolrServer) {
        if (this.managedSolrServer == managedSolrServer || solrCoreId != null) {
            IndexReference indexReference = IndexReference.parse(solrCoreId);
            if (!indexReference.checkServer(managedSolrServer.getServerName())) {
                return;
            }
            String indexName = indexReference.getIndex();
            IndexMetadata indexMetadata = managedSolrServer.getIndexMetadata(indexName);
            if (indexMetadata != null && indexMetadata.isActive()) {
                managedSolrServer.deactivateIndex(indexName);
            }
            this.managedSolrServer = null;
View Full Code Here

Examples of org.apache.stanbol.commons.solr.IndexReference

     * Getter for the {@link IndexReference} based on the {@link #getServerName()} and
     * {@link #getIndexName()} values
     * @return the {@link IndexReference} to the index described by this metadata
     */
    public IndexReference getIndexReference(){
        return new IndexReference(getServerName(), getIndexName());
    }
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.