| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import static org.opends.server.loggers.Debug.debugEnter; |
| | | import static org.opends.server.loggers.Debug.debugException; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.Error.logError; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.SchemaMessages.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | | |
| | |
| | | */ |
| | | public final class RFC3672SubtreeSpecificationSyntax extends |
| | | AttributeSyntax { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | RFC3672SubtreeSpecificationSyntax.class.getName(); |
| | | |
| | | // The default equality matching rule for this syntax. |
| | | private EqualityMatchingRule defaultEqualityMatchingRule; |
| | |
| | | */ |
| | | public void initializeSyntax(ConfigEntry configEntry) |
| | | throws ConfigException { |
| | | assert debugEnter(CLASS_NAME, "initializeSyntax", String |
| | | .valueOf(configEntry)); |
| | | |
| | | defaultEqualityMatchingRule = DirectoryServer |
| | | .getEqualityMatchingRule(EMR_OCTET_STRING_OID); |
| | |
| | | * @return The common name for this attribute syntax. |
| | | */ |
| | | public String getSyntaxName() { |
| | | assert debugEnter(CLASS_NAME, "getSyntaxName"); |
| | | |
| | | return SYNTAX_RFC3672_SUBTREE_SPECIFICATION_NAME; |
| | | } |
| | |
| | | * @return The OID for this attribute syntax. |
| | | */ |
| | | public String getOID() { |
| | | assert debugEnter(CLASS_NAME, "getOID"); |
| | | |
| | | return SYNTAX_RFC3672_SUBTREE_SPECIFICATION_OID; |
| | | } |
| | |
| | | * @return A description for this attribute syntax. |
| | | */ |
| | | public String getDescription() { |
| | | assert debugEnter(CLASS_NAME, "getDescription"); |
| | | |
| | | return SYNTAX_RFC3672_SUBTREE_SPECIFICATION_DESCRIPTION; |
| | | } |
| | |
| | | * default. |
| | | */ |
| | | public EqualityMatchingRule getEqualityMatchingRule() { |
| | | assert debugEnter(CLASS_NAME, "getEqualityMatchingRule"); |
| | | |
| | | return defaultEqualityMatchingRule; |
| | | } |
| | |
| | | * default. |
| | | */ |
| | | public OrderingMatchingRule getOrderingMatchingRule() { |
| | | assert debugEnter(CLASS_NAME, "getOrderingMatchingRule"); |
| | | |
| | | return defaultOrderingMatchingRule; |
| | | } |
| | |
| | | * default. |
| | | */ |
| | | public SubstringMatchingRule getSubstringMatchingRule() { |
| | | assert debugEnter(CLASS_NAME, "getSubstringMatchingRule"); |
| | | |
| | | return defaultSubstringMatchingRule; |
| | | } |
| | |
| | | * default. |
| | | */ |
| | | public ApproximateMatchingRule getApproximateMatchingRule() { |
| | | assert debugEnter(CLASS_NAME, "getApproximateMatchingRule"); |
| | | |
| | | // There is no approximate matching rule by default. |
| | | return null; |
| | |
| | | */ |
| | | public boolean valueIsAcceptable(ByteString value, |
| | | StringBuilder invalidReason) { |
| | | assert debugEnter(CLASS_NAME, "valueIsAcceptable", String |
| | | .valueOf(value), "java.lang.StringBuilder"); |
| | | |
| | | // Use the subtree specification code to make this determination. |
| | | try { |
| | |
| | | |
| | | return true; |
| | | } catch (DirectoryException e) { |
| | | assert debugException(CLASS_NAME, "valueIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | invalidReason.append(e.getErrorMessage()); |
| | | return false; |