Exemple #1
0
 /**
  * Sets the trusted status of all of the indexes, vlvIndexes, id2children and id2subtree indexes.
  *
  * @param trusted True if the indexes should be trusted or false otherwise.
  * @throws DatabaseException If an error occurred setting the indexes to trusted.
  */
 public void setIndexesTrusted(boolean trusted) throws DatabaseException {
   entryContainer.getID2Children().setTrusted(null, trusted);
   entryContainer.getID2Subtree().setTrusted(null, trusted);
   for (AttributeIndex attributeIndex : entryContainer.getAttributeIndexes()) {
     for (Index index : attributeIndex.getAllIndexes()) {
       setTrusted(index, trusted);
     }
   }
   for (VLVIndex vlvIdx : entryContainer.getVLVIndexes()) {
     vlvIdx.setTrusted(null, trusted);
   }
 }
  /** {@inheritDoc} */
  @Override()
  public boolean isIndexed(AttributeType attributeType, IndexType indexType) {
    try {
      EntryContainer ec = rootContainer.getEntryContainer(baseDNs[0]);
      AttributeIndex ai = ec.getAttributeIndex(attributeType);
      if (ai == null) {
        return false;
      }

      Set<LocalDBIndexCfgDefn.IndexType> indexTypes = ai.getConfiguration().getIndexType();
      switch (indexType) {
        case PRESENCE:
          return indexTypes.contains(LocalDBIndexCfgDefn.IndexType.PRESENCE);

        case EQUALITY:
          return indexTypes.contains(LocalDBIndexCfgDefn.IndexType.EQUALITY);

        case SUBSTRING:
        case SUBINITIAL:
        case SUBANY:
        case SUBFINAL:
          return indexTypes.contains(LocalDBIndexCfgDefn.IndexType.SUBSTRING);

        case GREATER_OR_EQUAL:
        case LESS_OR_EQUAL:
          return indexTypes.contains(LocalDBIndexCfgDefn.IndexType.ORDERING);

        case APPROXIMATE:
          return indexTypes.contains(LocalDBIndexCfgDefn.IndexType.APPROXIMATE);

        default:
          return false;
      }
    } catch (Exception e) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }

      return false;
    }
  }