| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | 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 |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSyntax(AttributeSyntaxCfg configuration) |
| | | throws ConfigException |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the common name for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_LDAP_SYNTAX_NAME; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the OID for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_LDAP_SYNTAX_OID; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a description for this attribute syntax. |
| | | * |
| | |
| | | return SYNTAX_LDAP_SYNTAX_DESCRIPTION; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultEqualityMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultOrderingMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return defaultSubstringMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default approximate matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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, |
| | |
| | | this.oid = oid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | |
| | | 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) |
| | |
| | | return subSyntax.valueIsAcceptable(value, invalidReason); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return subSyntax.getEqualityMatchingRule(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return subSyntax.getOrderingMatchingRule(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return subSyntax.getSubstringMatchingRule(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default approximate matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides a regex mechanism where a new syntax and its |
| | | * corresponding matching rules can be created on-the-fly. A regex |
| | |
| | | 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, |
| | |
| | | this.oid = oid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return oid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getDescription() |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return definition; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean valueIsAcceptable(ByteSequence value, |
| | | LocalizableMessageBuilder invalidReason) |
| | |
| | | return matches; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return equalityMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return orderingMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return substringMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default approximate matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an enumeration-based mechanism where a new syntax |
| | | * and its corresponding matching rules can be created on-the-fly. An enum |
| | |
| | | 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, |
| | |
| | | this.oid = oid; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | |
| | | 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) |
| | |
| | | return isAllowed; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return equalityMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return orderingMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | | * attributes with this syntax. |
| | |
| | | return substringMatchingRule; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the default approximate matching rule that will be used for |
| | | * attributes with this syntax. |