/** * Getter for the name of the index within the current * {@link IndexMetadata#getArchive() archive} set to load the index data * from. If no archive is set (e.g. if the {@link ArchiveInputStream} was * directly parsed, than the {@link IndexMetadata#getIndexName() index name} * directly is used as default. * @param metadata the {@link IndexMetadata} * @return the name of the index within the indexArchive used to load the * data from. In other words the relative path to the index data within the * index archive. */ public static String getArchiveCoreName(final IndexMetadata metadata) { String name = metadata.getIndexName(); String archiveCoreName = metadata.getArchive(); if(archiveCoreName == null){ archiveCoreName = name; } else { //the name of the core in the archive MUST BE the same as //the name of the archive excluding .solrindex.{archive-format} int split = archiveCoreName.indexOf('.'); if(split>0){ archiveCoreName = archiveCoreName.substring(0,split); } } return archiveCoreName; } // /**
/** * Getter for the name of the index within the current * {@link IndexMetadata#getArchive() archive} set to load the index data * from. If no archive is set (e.g. if the {@link ArchiveInputStream} was * directly parsed, than the {@link IndexMetadata#getIndexName() index name} * directly is used as default. * @param metadata the {@link IndexMetadata} * @return the name of the index within the indexArchive used to load the * data from. In other words the relative path to the index data within the * index archive. */ public static String getArchiveCoreName(final IndexMetadata metadata) { String name = metadata.getIndexName(); String archiveCoreName = metadata.getArchive(); if(archiveCoreName == null){ archiveCoreName = name; } else { //the name of the core in the archive MUST BE the same as //the name of the archive excluding .solrindex.{archive-format} int split = archiveCoreName.indexOf('.'); if(split>0){ archiveCoreName = archiveCoreName.substring(0,split); } } return archiveCoreName; } // /**
desiredState.name(), metadata.getArchive()}); switch (desiredState) { case ACTIVE:
desiredState.name(), metadata.getArchive()}); switch (desiredState) { case ACTIVE:
/** * @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 } }; /**
if(metadata != null){ //the core might be deleted in the meantime List<String> archives = metadata.getIndexArchives(); String currentArchive = metadata.getArchive(); if(currentArchive == null || archives.indexOf(resourceName) < archives.indexOf(currentArchive)){
if(metadata != null){ //the core might be deleted in the meantime List<String> archives = metadata.getIndexArchives(); String currentArchive = metadata.getArchive(); if(currentArchive == null || archives.indexOf(resourceName) < archives.indexOf(currentArchive)){
IndexMetadata metadata = managedCores.getIndexMetadata(indexName); if(metadata != null){ //may be removed in the meantime String currentArchive = metadata.getArchive(); boolean inSync = metadata.isSynchronized(); if(resource.equals(currentArchive)){ //current archive may be null
IndexMetadata metadata = managedCores.getIndexMetadata(indexName); if(metadata != null){ //may be removed in the meantime String currentArchive = metadata.getArchive(); boolean inSync = metadata.isSynchronized(); if(resource.equals(currentArchive)){ //current archive may be null