/** * @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 } }; /**
@Override public IndexMetadata createSolrIndex(String indexName, String resourceName, Properties properties) throws IOException { if(indexName == null || indexName.isEmpty()){ throw new IllegalArgumentException("The parsed index name MUST NOT be NULL nor empty!"); } if(!ConfigUtils.isValidSolrIndexFileName(resourceName)){ log.debug("add SolrIndexFileExtension to parsed indexArchive {}",resourceName); resourceName = ConfigUtils.appandSolrIndexFileExtension(resourceName, null); } if(isManagedIndex(indexName)){ throw new IllegalArgumentException("An index with the parsed name '"+ indexName+"' already exists on this managed Solr server '"+serverName+"'!"); } IndexMetadata metadata = new IndexMetadata(); if(properties != null){ metadata.putAll(properties); } metadata.setServerName(serverName); metadata.setIndexName(indexName); metadata.setIndexArchives(Collections.singletonList(resourceName)); metadata.setState(ManagedIndexState.UNINITIALISED); //TODO: we need to deal with the synchronised property! // now add the index to the list of uninitialised managedCores.store(metadata); //now start tracking this archive file indexArchiveTracker.addTracking(metadata); dataFileTracker.add(indexArchiveTracker, resourceName, IndexMetadata.toStringMap(metadata)); return metadata; }
@Override public IndexMetadata createSolrIndex(String indexName, String resourceName, Properties properties) throws IOException { if(indexName == null || indexName.isEmpty()){ throw new IllegalArgumentException("The parsed index name MUST NOT be NULL nor empty!"); } if(!ConfigUtils.isValidSolrIndexFileName(resourceName)){ log.debug("add SolrIndexFileExtension to parsed indexArchive {}",resourceName); resourceName = ConfigUtils.appandSolrIndexFileExtension(resourceName, null); } if(isManagedIndex(indexName)){ throw new IllegalArgumentException("An index with the parsed name '"+ indexName+"' already exists on this managed Solr server '"+serverName+"'!"); } IndexMetadata metadata = new IndexMetadata(); if(properties != null){ metadata.putAll(properties); } metadata.setServerName(serverName); metadata.setIndexName(indexName); metadata.setIndexArchives(Collections.singletonList(resourceName)); metadata.setState(ManagedIndexState.UNINITIALISED); //TODO: we need to deal with the synchronised property! // now add the index to the list of uninitialised managedCores.store(metadata); //now start tracking this archive file indexArchiveTracker.addTracking(metadata); dataFileTracker.add(indexArchiveTracker, resourceName, IndexMetadata.toStringMap(metadata)); return metadata; }
IndexMetadata.toStringMap(metadata));
IndexMetadata.toStringMap(metadata));