/** * validates the values of the IndexProperties * @throws IOException */ private void validate(boolean store) throws IOException { if(isSynchronized() && getIndexArchives().isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Synchronized=true and no Index-Archives are defined!"); } ManagedIndexState state = getState(); if(state == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexMetadata without the required key '"+STATE+ "' set to one of the values '"+ Arrays.toString(ManagedIndexState.values())+"'!"); } if(isActive()){ if(getDirectory() == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Active=true and no Directory is defined!"); } } String name = getIndexName(); if(name == null || name.isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where the required key '"+ INDEX_NAME+"' is not defined or empty!"); } }
/** * validates the values of the IndexProperties * @throws IOException */ private void validate(boolean store) throws IOException { if(isSynchronized() && getIndexArchives().isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Synchronized=true and no Index-Archives are defined!"); } ManagedIndexState state = getState(); if(state == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexMetadata without the required key '"+STATE+ "' set to one of the values '"+ Arrays.toString(ManagedIndexState.values())+"'!"); } if(isActive()){ if(getDirectory() == null){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where Active=true and no Directory is defined!"); } } String name = getIndexName(); if(name == null || name.isEmpty()){ throw new IOException("Unable to "+(store?"store":"read")+ " IndexPropertis where the required key '"+ INDEX_NAME+"' is not defined or empty!"); } }
SolrServerAdapter server = this.server; File coreDir = null; if(metadata.isActive()){ coreDir = deactivateCore(metadata.getIndexName(), server);
SolrServerAdapter server = this.server; File coreDir = null; if(metadata.isActive()){ coreDir = deactivateCore(metadata.getIndexName(), server);
/** * @param indexName */ public void addTracking(IndexMetadata metadata) { if(metadata != null){ //may be removed in the meantime if(!(metadata.isActive() || metadata.isInactive()) || metadata.isSynchronized()){ String archive = metadata.getArchive(); boolean found = false; //only track higher priority files as the current for(String indexArchive : metadata.getIndexArchives()){ if(!found){ if(indexArchive.equals(archive)){ found = true; } tracker.add(this, indexArchive, IndexMetadata.toStringMap(metadata)); } // else higher priority archive present -> no tracking } } //else (active || inactive) and not syncronized -> no tracking } }; /**
/** * @param indexName */ public void addTracking(IndexMetadata metadata) { if(metadata != null){ //may be removed in the meantime if(!(metadata.isActive() || metadata.isInactive()) || metadata.isSynchronized()){ String archive = metadata.getArchive(); boolean found = false; //only track higher priority files as the current for(String indexArchive : metadata.getIndexArchives()){ if(!found){ if(indexArchive.equals(archive)){ found = true; } tracker.add(this, indexArchive, IndexMetadata.toStringMap(metadata)); } // else higher priority archive present -> no tracking } } //else (active || inactive) and not syncronized -> no tracking } }; /**
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; } } }
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; } } }