From 58c567c94469de3ea9c729f251e9c9da3babf614 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 07 Apr 2015 16:12:01 +0000
Subject: [PATCH] AttributeIndex.java: Progressively getting rid of getExtensibleIndexes(), replaced by getNameToIndexes() wherever possible.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java | 51 ++++++++++++---------------------------------------
1 files changed, 12 insertions(+), 39 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
index a4f5796..6c8e043 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -657,21 +657,7 @@
{
for (AttributeIndex attributeIndex : suffix.getAttrIndexMap().values())
{
- putInIdContainerMap(attributeIndex.getDefaultNameToIndexes().values());
- Map<String, Collection<MatchingRuleIndex>> extensibleMap = attributeIndex.getExtensibleIndexes();
- if (!extensibleMap.isEmpty())
- {
- putInIdContainerMap(extensibleMap.get(EXTENSIBLE_INDEXER_ID_SUBSTRING));
- putInIdContainerMap(extensibleMap.get(EXTENSIBLE_INDEXER_ID_SHARED));
- }
- }
- }
-
- private void putInIdContainerMap(Collection<MatchingRuleIndex> indexes)
- {
- if (indexes != null)
- {
- for (Index index : indexes)
+ for (Index index : attributeIndex.getNameToIndexes().values())
{
putInIdContainerMap(index);
}
@@ -1676,20 +1662,11 @@
{
final IndexingOptions options = attrIndex.getIndexingOptions();
- for (Map.Entry<String, MatchingRuleIndex> mapEntry : attrIndex.getDefaultNameToIndexes().entrySet())
+ for (Map.Entry<String, MatchingRuleIndex> mapEntry : attrIndex.getNameToIndexes().entrySet())
{
ImportIndexType indexType = toImportIndexType(mapEntry.getKey());
processAttribute(mapEntry.getValue(), indexType, entry, attrType, entryID, options);
}
-
- Map<String, Collection<MatchingRuleIndex>> extensibleMap = attrIndex.getExtensibleIndexes();
- if (!extensibleMap.isEmpty())
- {
- Collection<MatchingRuleIndex> subIndexes = extensibleMap.get(EXTENSIBLE_INDEXER_ID_SUBSTRING);
- processAttributes(subIndexes, ImportIndexType.EX_SUBSTRING, entry, attrType, entryID, options);
- Collection<MatchingRuleIndex> sharedIndexes = extensibleMap.get(EXTENSIBLE_INDEXER_ID_SHARED);
- processAttributes(sharedIndexes, ImportIndexType.EX_SHARED, entry, attrType, entryID, options);
- }
}
void processVLVIndexes(Suffix suffix, Entry entry, EntryID entryID) throws DirectoryException
@@ -1703,18 +1680,6 @@
buffer.flush(txn);
}
- private void processAttributes(Collection<MatchingRuleIndex> indexes, ImportIndexType indexType, Entry entry,
- AttributeType attributeType, EntryID entryID, IndexingOptions options) throws InterruptedException
- {
- if (indexes != null)
- {
- for (MatchingRuleIndex index : indexes)
- {
- processAttribute(index, indexType, entry, attributeType, entryID, options);
- }
- }
- }
-
private void processAttribute(MatchingRuleIndex index, ImportIndexType indexType, Entry entry,
AttributeType attributeType, EntryID entryID, IndexingOptions options) throws InterruptedException
{
@@ -3134,7 +3099,8 @@
private void fillIndexMap(WriteableTransaction txn, AttributeType attrType, MatchingRuleIndex index,
ImportIndexType importIndexType, boolean onlyDegraded)
{
- if (index != null && (!onlyDegraded || !index.isTrusted())
+ if (index != null
+ && (!onlyDegraded || !index.isTrusted())
&& (!rebuildConfig.isClearDegradedState() || index.getRecordCount(txn) == 0))
{
putInIdContainerMap(index);
@@ -3807,7 +3773,14 @@
{
return ImportIndexType.APPROXIMATE;
}
- throw new IllegalArgumentException("Unsupported indexID: " + indexID);
+ else if (indexID.endsWith(EXTENSIBLE_INDEXER_ID_SUBSTRING))
+ {
+ return ImportIndexType.EX_SUBSTRING;
+ }
+ else
+ {
+ return ImportIndexType.EX_SHARED;
+ }
}
/**
--
Gitblit v1.10.0