}
// Refresh the index definitions ...
RepositoryIndexes indexes = readIndexDefinitions();
// And notify the affected providers ...
StringFactory strings = context.getValueFactories().getStringFactory();
ScanningTasks feedback = new ScanningTasks();
for (Map.Entry<Name, IndexChangeInfo> entry : changesByProviderName.get().entrySet()) {
String providerName = strings.create(entry.getKey());
IndexProvider provider = providers.get(providerName);
if (provider == null) continue;
IndexChanges changes = new IndexChanges();
IndexChangeInfo info = entry.getValue();
if (info.removedAll) {
// Get all of the definitions for this provider ...
for (IndexDefinition defn : indexes.getIndexDefinitions().values()) {
if (defn.getProviderName().equals(providerName)) changes.remove(defn.getName());
}
}
// Others might have been added or changed after the existing ones were removed ...
for (Name name : info.removedIndexes) {
changes.remove(strings.create(name));
}
for (Name name : info.changedIndexes) {
IndexDefinition defn = indexes.getIndexDefinitions().get(strings.create(name));
if (defn != null) changes.change(defn);
}
// Notify the provider ...
try {
provider.notify(changes, repository.changeBus(), repository.nodeTypeManager(), repository.repositoryCache()