mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
07.12.2015 58c567c94469de3ea9c729f251e9c9da3babf614
AttributeIndex.java:
Progressively getting rid of getExtensibleIndexes(), replaced by getNameToIndexes() wherever possible.
2 files modified
63 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java 51 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Suffix.java 12 ●●●● patch | view | raw | blame | history
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;
    }
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Suffix.java
@@ -27,7 +27,6 @@
package org.opends.server.backends.pluggable;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.util.ServerConstants.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@@ -263,15 +262,10 @@
    entryContainer.getID2Subtree().setTrusted(txn, trusted);
    for (AttributeIndex attributeIndex : entryContainer.getAttributeIndexes())
    {
      setTrusted(txn, attributeIndex.getDefaultNameToIndexes().values(), trusted);
      Map<String, Collection<MatchingRuleIndex>> exIndexes = attributeIndex.getExtensibleIndexes();
      if(!exIndexes.isEmpty())
      {
        setTrusted(txn, exIndexes.get(EXTENSIBLE_INDEXER_ID_SUBSTRING), trusted);
        setTrusted(txn, exIndexes.get(EXTENSIBLE_INDEXER_ID_SHARED), trusted);
      }
      setTrusted(txn, attributeIndex.getNameToIndexes().values(), trusted);
    }
    for(VLVIndex vlvIdx : entryContainer.getVLVIndexes()) {
    for (VLVIndex vlvIdx : entryContainer.getVLVIndexes())
    {
      vlvIdx.setTrusted(txn, trusted);
    }
  }