0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
0N/A * Common Development and Distribution License, Version 1.0 only
0N/A * (the "License"). You may not use this file except in compliance
0N/A * with the License.
0N/A *
0N/A * You can obtain a copy of the license at
0N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0N/A * See the License for the specific language governing permissions
0N/A * and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
0N/A * file and include the License file at
0N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0N/A * add the following below this CDDL HEADER, with the fields enclosed
873N/A * by brackets "[]" replaced with your own identifying information:
0N/A * Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A *
0N/A *
3231N/A * Copyright 2006-2008 Sun Microsystems, Inc.
5866N/A * Portions Copyright 2012 ForgeRock AS
0N/A */
0N/Apackage org.opends.server.schema;
0N/A
0N/A
0N/A
1617N/Aimport org.opends.server.admin.std.server.AttributeSyntaxCfg;
0N/Aimport org.opends.server.api.ApproximateMatchingRule;
0N/Aimport org.opends.server.api.AttributeSyntax;
0N/Aimport org.opends.server.api.EqualityMatchingRule;
0N/Aimport org.opends.server.api.OrderingMatchingRule;
0N/Aimport org.opends.server.api.SubstringMatchingRule;
0N/Aimport org.opends.server.config.ConfigException;
0N/Aimport org.opends.server.core.DirectoryServer;
4134N/Aimport org.opends.server.types.ByteSequence;
2086N/A
0N/A
1280N/Aimport static org.opends.server.loggers.ErrorLogger.*;
2086N/Aimport static org.opends.messages.SchemaMessages.*;
2086N/Aimport org.opends.messages.MessageBuilder;
0N/Aimport static org.opends.server.schema.SchemaConstants.*;
0N/A
0N/A
0N/A/**
0N/A * This class implements the protocol information attribute syntax, which is
0N/A * being deprecated. As such, this implementation behaves exactly like the
0N/A * directory string syntax.
0N/A */
0N/Apublic class ProtocolInformationSyntax
1617N/A extends AttributeSyntax<AttributeSyntaxCfg>
0N/A{
0N/A // The default approximate matching rule for this syntax.
0N/A private ApproximateMatchingRule defaultApproximateMatchingRule;
0N/A
0N/A // The default equality matching rule for this syntax.
0N/A private EqualityMatchingRule defaultEqualityMatchingRule;
0N/A
0N/A // The default ordering matching rule for this syntax.
0N/A private OrderingMatchingRule defaultOrderingMatchingRule;
0N/A
0N/A // The default substring matching rule for this syntax.
0N/A private SubstringMatchingRule defaultSubstringMatchingRule;
0N/A
0N/A
0N/A
0N/A /**
0N/A * Creates a new instance of this syntax. Note that the only thing that
0N/A * should be done here is to invoke the default constructor for the
0N/A * superclass. All initialization should be performed in the
0N/A * <CODE>initializeSyntax</CODE> method.
0N/A */
0N/A public ProtocolInformationSyntax()
0N/A {
0N/A super();
0N/A }
0N/A
0N/A
0N/A
0N/A /**
1617N/A * {@inheritDoc}
0N/A */
1617N/A public void initializeSyntax(AttributeSyntaxCfg configuration)
0N/A throws ConfigException
0N/A {
0N/A defaultApproximateMatchingRule =
0N/A DirectoryServer.getApproximateMatchingRule(AMR_DOUBLE_METAPHONE_OID);
0N/A if (defaultApproximateMatchingRule == null)
0N/A {
2086N/A logError(ERR_ATTR_SYNTAX_UNKNOWN_APPROXIMATE_MATCHING_RULE.get(
2086N/A AMR_DOUBLE_METAPHONE_OID, SYNTAX_PROTOCOL_INFORMATION_NAME));
0N/A }
0N/A
0N/A defaultEqualityMatchingRule =
0N/A DirectoryServer.getEqualityMatchingRule(EMR_CASE_IGNORE_OID);
0N/A if (defaultEqualityMatchingRule == null)
0N/A {
2086N/A logError(ERR_ATTR_SYNTAX_UNKNOWN_EQUALITY_MATCHING_RULE.get(
2086N/A EMR_CASE_IGNORE_OID, SYNTAX_PROTOCOL_INFORMATION_NAME));
0N/A }
0N/A
0N/A defaultOrderingMatchingRule =
0N/A DirectoryServer.getOrderingMatchingRule(OMR_CASE_IGNORE_OID);
0N/A if (defaultOrderingMatchingRule == null)
0N/A {
2086N/A logError(ERR_ATTR_SYNTAX_UNKNOWN_ORDERING_MATCHING_RULE.get(
2086N/A OMR_CASE_IGNORE_OID, SYNTAX_PROTOCOL_INFORMATION_NAME));
0N/A }
0N/A
0N/A defaultSubstringMatchingRule =
0N/A DirectoryServer.getSubstringMatchingRule(SMR_CASE_IGNORE_OID);
0N/A if (defaultSubstringMatchingRule == null)
0N/A {
2086N/A logError(ERR_ATTR_SYNTAX_UNKNOWN_SUBSTRING_MATCHING_RULE.get(
2086N/A SMR_CASE_IGNORE_OID, SYNTAX_PROTOCOL_INFORMATION_NAME));
0N/A }
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the common name for this attribute syntax.
0N/A *
0N/A * @return The common name for this attribute syntax.
0N/A */
0N/A public String getSyntaxName()
0N/A {
0N/A return SYNTAX_PROTOCOL_INFORMATION_NAME;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the OID for this attribute syntax.
0N/A *
0N/A * @return The OID for this attribute syntax.
0N/A */
0N/A public String getOID()
0N/A {
0N/A return SYNTAX_PROTOCOL_INFORMATION_OID;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves a description for this attribute syntax.
0N/A *
0N/A * @return A description for this attribute syntax.
0N/A */
0N/A public String getDescription()
0N/A {
0N/A return SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the default equality matching rule that will be used for
0N/A * attributes with this syntax.
0N/A *
0N/A * @return The default equality matching rule that will be used for
0N/A * attributes with this syntax, or <CODE>null</CODE> if equality
0N/A * matches will not be allowed for this type by default.
0N/A */
0N/A public EqualityMatchingRule getEqualityMatchingRule()
0N/A {
0N/A return defaultEqualityMatchingRule;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the default ordering matching rule that will be used for
0N/A * attributes with this syntax.
0N/A *
0N/A * @return The default ordering matching rule that will be used for
0N/A * attributes with this syntax, or <CODE>null</CODE> if ordering
0N/A * matches will not be allowed for this type by default.
0N/A */
0N/A public OrderingMatchingRule getOrderingMatchingRule()
0N/A {
0N/A return defaultOrderingMatchingRule;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the default substring matching rule that will be used for
0N/A * attributes with this syntax.
0N/A *
0N/A * @return The default substring matching rule that will be used for
0N/A * attributes with this syntax, or <CODE>null</CODE> if substring
0N/A * matches will not be allowed for this type by default.
0N/A */
0N/A public SubstringMatchingRule getSubstringMatchingRule()
0N/A {
0N/A return defaultSubstringMatchingRule;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Retrieves the default approximate matching rule that will be used for
0N/A * attributes with this syntax.
0N/A *
0N/A * @return The default approximate matching rule that will be used for
0N/A * attributes with this syntax, or <CODE>null</CODE> if approximate
0N/A * matches will not be allowed for this type by default.
0N/A */
0N/A public ApproximateMatchingRule getApproximateMatchingRule()
0N/A {
0N/A return defaultApproximateMatchingRule;
0N/A }
0N/A
0N/A
0N/A
0N/A /**
0N/A * Indicates whether the provided value is acceptable for use in an attribute
0N/A * with this syntax. If it is not, then the reason may be appended to the
0N/A * provided buffer.
0N/A *
0N/A * @param value The value for which to make the determination.
0N/A * @param invalidReason The buffer to which the invalid reason should be
0N/A * appended.
0N/A *
0N/A * @return <CODE>true</CODE> if the provided value is acceptable for use with
0N/A * this syntax, or <CODE>false</CODE> if not.
0N/A */
4134N/A public boolean valueIsAcceptable(ByteSequence value,
2086N/A MessageBuilder invalidReason)
0N/A {
0N/A // We will accept any value for this syntax.
0N/A return true;
0N/A }
3853N/A
3853N/A
3853N/A
3853N/A /**
3853N/A * {@inheritDoc}
3853N/A */
3853N/A public boolean isBinary()
3853N/A {
3853N/A return false;
3853N/A }
5866N/A
5866N/A
5866N/A
5866N/A /**
5866N/A * {@inheritDoc}
5866N/A */
5866N/A public boolean isHumanReadable()
5866N/A {
5866N/A return true;
5866N/A }
0N/A}
0N/A