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

sin
30.06.2009 b0bd40fa373c990e1f1d8619b45ffb1425e5b85d
Issue# 3793: Can not create extensible indexes using the dsconfig
1 files deleted
7 files modified
308 ■■■■ changed files
opends/src/admin/defn/org/opends/server/admin/std/LocalDBIndexConfiguration.xml 14 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/ExtensibleMatchingRuleTypePropertyDefinition.java 185 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/PropertyDefinitionUsageBuilder.java 11 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/PropertyDefinitionVisitor.java 16 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/PropertyValueVisitor.java 20 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java 50 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java 10 ●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/LocalDBIndexConfiguration.xml
@@ -212,9 +212,17 @@
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:extensible-matching-rule-type/>
    </adm:syntax>
 <adm:syntax>
     <adm:string>
       <adm:pattern>
          <adm:regex>([a-z][a-z](-[A-Z][A-Z]){0,2}(.(([a-z]{2,3})|\\d))?)|(^\\d.((\\d)+.)+\\d$)</adm:regex>
          <adm:usage>LOCALE | OID</adm:usage>
          <adm:synopsis>
            A Locale or an OID.
          </adm:synopsis>
        </adm:pattern>
       </adm:string>
   </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:name>ds-cfg-index-extensible-matching-rule</ldap:name>
opends/src/messages/messages/jeb.properties
@@ -356,3 +356,5 @@
  %d entries
MILD_WARN_BACKUPDB_INCREMENTAL_NOT_FOUND_DOING_NORMAL_191=Could not find any \
 backup in '%s'.  A full backup will be executed
SEVERE_ERR_CONFIG_INDEX_TYPE_NEEDS_VALID_MATCHING_RULE_192=The attribute '%s' \
cannot have extensible index type for invalid matching rule name '%s'
opends/src/server/org/opends/server/admin/ExtensibleMatchingRuleTypePropertyDefinition.java
File was deleted
opends/src/server/org/opends/server/admin/PropertyDefinitionUsageBuilder.java
@@ -338,17 +338,6 @@
     * {@inheritDoc}
     */
    @Override
     public Message visitExtensibleMatchingRuleType(
            ExtensibleMatchingRuleTypePropertyDefinition d, Void p) {
        return Message.raw("LOCALE | OID");
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public <T> Message visitUnknown(PropertyDefinition<T> d, Void p)
        throws UnknownPropertyDefinitionException {
      return Message.raw("?");
opends/src/server/org/opends/server/admin/PropertyDefinitionVisitor.java
@@ -268,22 +268,6 @@
 /**
   * Visit an extensible matching rule property definition.
   *
   * @param pd
   *          The string property definition to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  public R visitExtensibleMatchingRuleType(
          ExtensibleMatchingRuleTypePropertyDefinition pd, P p) {
    return visitUnknown(pd, p);
  }
  /**
   * Visit an unknown type of property definition. Implementations of
opends/src/server/org/opends/server/admin/PropertyValueVisitor.java
@@ -35,7 +35,6 @@
import org.opends.server.types.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.authorization.dseecompat.Aci;
import org.opends.server.api.ExtensibleMatchingRule;
/**
@@ -309,25 +308,6 @@
  /**
   * Visit an extensible matching rule type.
   *
   * @param pd
   *          The extensible matching rule type property definition.
   * @param v
   *          The property value to visit.
   * @param p
   *          A visitor specified parameter.
   * @return Returns a visitor specified result.
   */
  public R visitExtensibleMatchingRuleType(
          ExtensibleMatchingRuleTypePropertyDefinition pd,
          ExtensibleMatchingRule v, P p) {
    return visitUnknown(pd, v, p);
  }
  /**
   * Visit an unknown type of property value. Implementations of this
   * method can provide default behavior for unknown types of
   * property.
opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -47,6 +47,8 @@
import org.opends.server.config.ConfigException;
import static org.opends.messages.JebMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.util.StaticUtils.toLowerCase;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.StaticUtils;
@@ -250,7 +252,7 @@
    if (indexConfig.getIndexType().contains(
        LocalDBIndexCfgDefn.IndexType.EXTENSIBLE))
    {
      Set<ExtensibleMatchingRule> extensibleRules =
      Set<String> extensibleRules =
              indexConfig.getIndexExtensibleMatchingRule();
      if(extensibleRules == null || extensibleRules.size() == 0)
      {
@@ -264,8 +266,19 @@
      //indexer and index. A Collation substring matching rule is treated
      // differently as it uses a separate indexer and index.
      IndexConfig config = new JEIndexConfig(indexConfig.getSubstringLength());
      for(ExtensibleMatchingRule rule:extensibleRules)
      for(String ruleName:extensibleRules)
      {
        ExtensibleMatchingRule rule =
                DirectoryServer.getExtensibleMatchingRule(
                                                    toLowerCase(ruleName));
        if(rule == null)
        {
          Message message =
                  ERR_CONFIG_INDEX_TYPE_NEEDS_VALID_MATCHING_RULE.get(
                  String.valueOf(attrType),ruleName);
          logError(message);
          continue;
        }
        Map<String,Index> indexMap = new HashMap<String,Index>();
        for(ExtensibleIndexer indexer : rule.getIndexers(config))
        {
@@ -1485,6 +1498,7 @@
   * Get a string representation of this object.
   * @return return A string representation of this object.
   */
  @Override
  public String toString()
  {
    return getName();
@@ -1545,7 +1559,7 @@
    }
    if (cfg.getIndexType().contains(LocalDBIndexCfgDefn.IndexType.EXTENSIBLE))
    {
      Set<ExtensibleMatchingRule> newRules =
      Set<String> newRules =
              cfg.getIndexExtensibleMatchingRule();
      if (newRules == null || newRules.size() == 0)
      {
@@ -1895,15 +1909,29 @@
      if (cfg.getIndexType().contains(
              LocalDBIndexCfgDefn.IndexType.EXTENSIBLE))
      {
        Set<ExtensibleMatchingRule> extensibleRules =
        Set<String> extensibleRules =
            cfg.getIndexExtensibleMatchingRule();
        Set<ExtensibleMatchingRule> validRules =
                                      new HashSet<ExtensibleMatchingRule>();
        if(extensibleIndexes == null)
        {
          extensibleIndexes = new ExtensibleMatchingRuleIndex();
        }
        IndexConfig config = new JEIndexConfig(cfg.getSubstringLength());
        for(ExtensibleMatchingRule rule:extensibleRules)
        for(String ruleName:extensibleRules)
        {
          ExtensibleMatchingRule rule =
                  DirectoryServer.getExtensibleMatchingRule(
                                            toLowerCase(ruleName));
           if(rule == null)
          {
            Message message =
                    ERR_CONFIG_INDEX_TYPE_NEEDS_VALID_MATCHING_RULE.get(
                    String.valueOf(attrType),ruleName);
            logError(message);
            continue;
          }
          validRules.add(rule);
          Map<String,Index> indexMap = new HashMap<String,Index>();
          for(ExtensibleIndexer indexer: rule.getIndexers(config))
          {
@@ -1929,6 +1957,14 @@
                                        env,
                                        entryContainer);
              extensibleIndexes.addIndex(extensibleIndex,indexID);
              extensibleIndex.open();
              if(!extensibleIndex.isTrusted())
              {
                adminActionRequired = true;
                messages.add(NOTE_JEB_INDEX_ADD_REQUIRES_REBUILD.get(
                    extensibleIndex.getName()));
              }
            }
            else
            {
@@ -1946,7 +1982,7 @@
              {
                Indexer extensibleIndexer =
                      new JEExtensibleIndexer(attrType,
                                                 rule,
                                                  rule,
                                                 indexer);
                extensibleIndex.setIndexer(extensibleIndexer);
              }
@@ -1963,7 +1999,7 @@
                new HashSet<ExtensibleMatchingRule>();
        for(ExtensibleMatchingRule r:extensibleIndexes.getRules())
        {
          if(!extensibleRules.contains(r))
          if(!validRules.contains(r))
          {
            deletedRules.add(r);
          }
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -1142,10 +1142,16 @@
          hasSubIndex = true;
          break;
        }
        Set<ExtensibleMatchingRule> matchingRules =
        Set<String> matchingRules =
                              indexCfg.getIndexExtensibleMatchingRule();
        for(ExtensibleMatchingRule rule: matchingRules)
        for(String ruleName: matchingRules)
        {
          ExtensibleMatchingRule rule =
                  DirectoryServer.getExtensibleMatchingRule(ruleName);
          if(rule == null)
          {
            continue;
          }
          for(ExtensibleIndexer indexer: rule.getIndexers(null))
          {
            String indexID = indexer.getExtensibleIndexID();