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

Jean-Noel Rouvignac
24.11.2015 8d21db36015f8560d9cd2bcee9817f2c0a07a386
opendj-server-legacy/src/main/java/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2015 ForgeRock AS
 */
package org.opends.server.schema;
@@ -66,17 +66,15 @@
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  // The default equality matching rule for this syntax.
  /** The default equality matching rule for this syntax. */
  private MatchingRule defaultEqualityMatchingRule;
  // The default ordering matching rule for this syntax.
  /** The default ordering matching rule for this syntax. */
  private MatchingRule defaultOrderingMatchingRule;
  // The default substring matching rule for this syntax.
  /** The default substring matching rule for this syntax. */
  private MatchingRule defaultSubstringMatchingRule;
  /**
   * Creates a new instance of this syntax.  Note that the only thing that
   * should be done here is to invoke the default constructor for the
@@ -88,11 +86,7 @@
    super();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void initializeSyntax(AttributeSyntaxCfg configuration)
         throws ConfigException
@@ -119,8 +113,6 @@
    }
  }
  /**
   * Retrieves the common name for this attribute syntax.
   *
@@ -132,8 +124,6 @@
    return SYNTAX_LDAP_SYNTAX_NAME;
  }
  /**
   * Retrieves the OID for this attribute syntax.
   *
@@ -145,8 +135,6 @@
    return SYNTAX_LDAP_SYNTAX_OID;
  }
  /**
   * Retrieves a description for this attribute syntax.
   *
@@ -158,8 +146,6 @@
    return SYNTAX_LDAP_SYNTAX_DESCRIPTION;
  }
  /**
   * Retrieves the default equality matching rule that will be used for
   * attributes with this syntax.
@@ -174,8 +160,6 @@
    return defaultEqualityMatchingRule;
  }
  /**
   * Retrieves the default ordering matching rule that will be used for
   * attributes with this syntax.
@@ -190,8 +174,6 @@
    return defaultOrderingMatchingRule;
  }
  /**
   * Retrieves the default substring matching rule that will be used for
   * attributes with this syntax.
@@ -206,8 +188,6 @@
    return defaultSubstringMatchingRule;
  }
  /**
   * Retrieves the default approximate matching rule that will be used for
   * attributes with this syntax.
@@ -223,8 +203,6 @@
    return null;
  }
  /**
   * Decodes the contents of the provided byte sequence as an ldap syntax
   * definition according to the rules of this syntax.  Note that the provided
@@ -568,8 +546,6 @@
                                     description,extraProperties);
  }
  /**
   * Indicates whether the provided value is acceptable for use in an attribute
   * with this syntax.  If it is not, then the reason may be appended to the
@@ -658,8 +634,6 @@
    return startPos;
  }
  /**
   * Reads the value of a string enclosed in single quotes, skipping over the
   * quotes and any leading or trailing spaces, and appending the string to the
@@ -897,28 +871,20 @@
    return startPos;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isBEREncodingRequired()
  {
    return false;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public boolean isHumanReadable()
  {
    return true;
  }
  /**
   * This class provides a substitution mechanism where one unimplemented
   * syntax can be substituted by another defined syntax. A substitution syntax
@@ -927,22 +893,20 @@
  private static class SubstitutionSyntax extends
          LDAPSyntaxDescriptionSyntax
  {
    // The syntax that will substitute the unimplemented syntax.
    /** The syntax that will substitute the unimplemented syntax. */
    private AttributeSyntax<?> subSyntax;
    // The description of this syntax.
    /** The description of this syntax. */
    private String description;
    // The definition of this syntax.
    /** The definition of this syntax. */
    private String definition;
    //The oid of this syntax.
    /** The oid of this syntax. */
    private String oid;
    //Creates a new instance of this syntax.
    /** Creates a new instance of this syntax. */
    private SubstitutionSyntax(AttributeSyntax<?> subSyntax,
            String definition,
            String description,
@@ -955,11 +919,7 @@
      this.oid = oid;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getName()
    {
@@ -967,44 +927,28 @@
      return null;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getOID()
    {
      return oid;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getDescription()
    {
      return description;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return definition;
    }
     /**
     * {@inheritDoc}
     */
     /** {@inheritDoc} */
    @Override
    public boolean valueIsAcceptable(ByteSequence value,
                                     LocalizableMessageBuilder invalidReason)
@@ -1012,8 +956,6 @@
      return  subSyntax.valueIsAcceptable(value, invalidReason);
    }
    /**
     * Retrieves the default equality matching rule that will be used for
     * attributes with this syntax.
@@ -1028,8 +970,6 @@
      return subSyntax.getEqualityMatchingRule();
    }
    /**
     * Retrieves the default ordering matching rule that will be used for
     * attributes with this syntax.
@@ -1044,8 +984,6 @@
      return subSyntax.getOrderingMatchingRule();
    }
    /**
     * Retrieves the default substring matching rule that will be used for
     * attributes with this syntax.
@@ -1060,8 +998,6 @@
      return subSyntax.getSubstringMatchingRule();
    }
    /**
     * Retrieves the default approximate matching rule that will be used for
     * attributes with this syntax.
@@ -1077,8 +1013,6 @@
    }
  }
  /**
   * This class provides a regex mechanism where a new syntax and its
   * corresponding matching rules can be created on-the-fly. A regex
@@ -1087,32 +1021,32 @@
  private static class RegexSyntax extends
          LDAPSyntaxDescriptionSyntax
  {
    // The Pattern associated with the regex.
    /** The Pattern associated with the regex. */
    private Pattern pattern;
    // The description of this syntax.
    /** The description of this syntax. */
    private String description;
    //The oid of this syntax.
    /** The oid of this syntax. */
    private String oid;
    //The definition of this syntax.
    /** The definition of this syntax. */
    private String definition;
    //The equality matching rule.
    /** The equality matching rule. */
    private MatchingRule equalityMatchingRule;
    //The substring matching rule.
    /** The substring matching rule. */
    private MatchingRule substringMatchingRule;
    //The ordering matching rule.
    /** The ordering matching rule. */
    private MatchingRule orderingMatchingRule;
    //The approximate matching rule.
    /** The approximate matching rule. */
    private MatchingRule approximateMatchingRule;
    //Creates a new instance of this syntax.
    /** Creates a new instance of this syntax. */
    private RegexSyntax(Pattern pattern,
            String definition,
            String description,
@@ -1125,11 +1059,7 @@
      this.oid = oid;
    }
     /**
     * {@inheritDoc}
     */
     /** {@inheritDoc} */
     @Override
    public String getName()
    {
@@ -1137,22 +1067,14 @@
      return null;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getOID()
    {
      return oid;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getDescription()
    {
@@ -1160,20 +1082,14 @@
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return definition;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public boolean valueIsAcceptable(ByteSequence value,
                                     LocalizableMessageBuilder invalidReason)
@@ -1189,8 +1105,6 @@
      return matches;
    }
    /**
     * Retrieves the default equality matching rule that will be used for
     * attributes with this syntax.
@@ -1211,8 +1125,6 @@
      return equalityMatchingRule;
    }
    /**
     * Retrieves the default ordering matching rule that will be used for
     * attributes with this syntax.
@@ -1232,8 +1144,6 @@
      return orderingMatchingRule;
    }
    /**
     * Retrieves the default substring matching rule that will be used for
     * attributes with this syntax.
@@ -1253,8 +1163,6 @@
      return substringMatchingRule;
    }
    /**
     * Retrieves the default approximate matching rule that will be used for
     * attributes with this syntax.
@@ -1275,8 +1183,6 @@
    }
  }
  /**
   * This class provides an enumeration-based mechanism where a new syntax
   * and its corresponding matching rules can be created on-the-fly. An enum
@@ -1285,32 +1191,32 @@
  private static class EnumSyntax extends
          LDAPSyntaxDescriptionSyntax
  {
    //Set of read-only enum entries.
    /** Set of read-only enum entries. */
    LinkedList<ByteSequence> entries;
    // The description of this syntax.
    /** The description of this syntax. */
    private String description;
    //The oid of this syntax.
    /** The oid of this syntax. */
    private String oid;
    //The equality matching rule.
    /** The equality matching rule. */
    private MatchingRule equalityMatchingRule;
    //The substring matching rule.
    /** The substring matching rule. */
    private MatchingRule substringMatchingRule;
    //The ordering matching rule.
    /** The ordering matching rule. */
    private MatchingRule orderingMatchingRule;
    //The approximate matching rule.
    /** The approximate matching rule. */
    private MatchingRule approximateMatchingRule;
    //The definition of this syntax.
    /** The definition of this syntax. */
    private String definition;
    //Creates a new instance of this syntax.
    /** Creates a new instance of this syntax. */
    private EnumSyntax(LinkedList<ByteSequence> entries,
            String definition,
            String description,
@@ -1323,11 +1229,7 @@
      this.oid = oid;
    }
     /**
     * {@inheritDoc}
     */
     /** {@inheritDoc} */
     @Override
    public String getName()
    {
@@ -1335,55 +1237,35 @@
      return null;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getOID()
    {
      return oid;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
      return definition;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
     @Override
    public String getDescription()
    {
      return description;
    }
     /**
      * {@inheritDoc}
      */
     /** {@inheritDoc} */
    @Override
    public void finalizeSyntax()
    {
      DirectoryServer.deregisterMatchingRule(orderingMatchingRule);
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public boolean valueIsAcceptable(ByteSequence value,
                                     LocalizableMessageBuilder invalidReason)
@@ -1397,8 +1279,6 @@
      return isAllowed;
    }
    /**
     * Retrieves the default equality matching rule that will be used for
     * attributes with this syntax.
@@ -1419,8 +1299,6 @@
      return equalityMatchingRule;
    }
    /**
     * Retrieves the default ordering matching rule that will be used for
     * attributes with this syntax.
@@ -1461,8 +1339,6 @@
      return orderingMatchingRule;
    }
    /**
     * Retrieves the default substring matching rule that will be used for
     * attributes with this syntax.
@@ -1482,8 +1358,6 @@
      return substringMatchingRule;
    }
    /**
     * Retrieves the default approximate matching rule that will be used for
     * attributes with this syntax.