| | |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.DirectoryStringAttributeSyntaxCfg; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.opends.server.api.AttributeValueDecoder; |
| | | import org.opends.server.api.EqualityMatchingRule; |
| | | import org.opends.server.api.OrderingMatchingRule; |
| | | import org.opends.server.api.SubstringMatchingRule; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | import org.opends.server.types.*; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | |
| | | |
| | |
| | | private SubstringMatchingRule defaultSubstringMatchingRule; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A {@link String} attribute value decoder for this syntax. |
| | | */ |
| | | public static final AttributeValueDecoder<String> DECODER = |
| | | new AttributeValueDecoder<String>() |
| | | { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String decode(AttributeValue value) throws DirectoryException |
| | | { |
| | | // Make sure that the value is valid. |
| | | value.getNormalizedValue(); |
| | | return value.getValue().toString(); |
| | | } |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void initializeSyntax(DirectoryStringAttributeSyntaxCfg configuration) |
| | | throws ConfigException |
| | | { |
| | |
| | | /** |
| | | * Performs any finalization that may be necessary for this attribute syntax. |
| | | */ |
| | | @Override |
| | | public void finalizeSyntax() |
| | | { |
| | | currentConfig.removeDirectoryStringChangeListener(this); |
| | |
| | | * |
| | | * @return The common name for this attribute syntax. |
| | | */ |
| | | @Override |
| | | public String getName() |
| | | { |
| | | return SYNTAX_DIRECTORY_STRING_NAME; |
| | |
| | | * |
| | | * @return The OID for this attribute syntax. |
| | | */ |
| | | @Override |
| | | public String getOID() |
| | | { |
| | | return SYNTAX_DIRECTORY_STRING_OID; |
| | |
| | | * |
| | | * @return A description for this attribute syntax. |
| | | */ |
| | | @Override |
| | | public String getDescription() |
| | | { |
| | | return SYNTAX_DIRECTORY_STRING_DESCRIPTION; |
| | |
| | | * attributes with this syntax, or <CODE>null</CODE> if equality |
| | | * matches will not be allowed for this type by default. |
| | | */ |
| | | @Override |
| | | public EqualityMatchingRule getEqualityMatchingRule() |
| | | { |
| | | return defaultEqualityMatchingRule; |
| | |
| | | * attributes with this syntax, or <CODE>null</CODE> if ordering |
| | | * matches will not be allowed for this type by default. |
| | | */ |
| | | @Override |
| | | public OrderingMatchingRule getOrderingMatchingRule() |
| | | { |
| | | return defaultOrderingMatchingRule; |
| | |
| | | * attributes with this syntax, or <CODE>null</CODE> if substring |
| | | * matches will not be allowed for this type by default. |
| | | */ |
| | | @Override |
| | | public SubstringMatchingRule getSubstringMatchingRule() |
| | | { |
| | | return defaultSubstringMatchingRule; |
| | |
| | | * attributes with this syntax, or <CODE>null</CODE> if approximate |
| | | * matches will not be allowed for this type by default. |
| | | */ |
| | | @Override |
| | | public ApproximateMatchingRule getApproximateMatchingRule() |
| | | { |
| | | return defaultApproximateMatchingRule; |
| | |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use with |
| | | * this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(ByteSequence value, |
| | | LocalizableMessageBuilder invalidReason) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | DirectoryStringAttributeSyntaxCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | DirectoryStringAttributeSyntaxCfg configuration) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isBEREncodingRequired() |
| | | { |
| | | return false; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public boolean isHumanReadable() |
| | | { |
| | | return true; |