@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; }
@Override public IndexMetadata updateIndex(String indexName, String resourceName, Properties properties) throws IOException { //NOTE: this does not deactivate the current index version, but only updates //the metadata and re-registers the DataFileTracking IndexMetadata oldMetadata = managedCores.getIndexMetadata(indexName); IndexMetadata metadata = new IndexMetadata(); if(properties != null){ metadata.putAll(properties); } metadata.setServerName(serverName); metadata.setIndexName(indexName); metadata.setIndexArchives(Collections.singletonList(resourceName)); if(oldMetadata != null){ //we need to metadata.setState(oldMetadata.getState()); //same as for the old version metadata.setDirectory(oldMetadata.getDirectory()); } else { 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); indexArchiveTracker.updateTracking(oldMetadata,metadata); return metadata; } @Override
@Override public IndexMetadata updateIndex(String indexName, String resourceName, Properties properties) throws IOException { //NOTE: this does not deactivate the current index version, but only updates //the metadata and re-registers the DataFileTracking IndexMetadata oldMetadata = managedCores.getIndexMetadata(indexName); IndexMetadata metadata = new IndexMetadata(); if(properties != null){ metadata.putAll(properties); } metadata.setServerName(serverName); metadata.setIndexName(indexName); metadata.setIndexArchives(Collections.singletonList(resourceName)); if(oldMetadata != null){ //we need to metadata.setState(oldMetadata.getState()); //same as for the old version metadata.setDirectory(oldMetadata.getDirectory()); } else { 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); indexArchiveTracker.updateTracking(oldMetadata,metadata); return metadata; } @Override