| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | import org.opends.server.types.ErrorLogSeverity; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | 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.*; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.SchemaMessages.*; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | |
| | | public class LDAPSyntaxDescriptionSyntax |
| | | extends AttributeSyntax |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.schema.LDAPSyntaxDescriptionSyntax"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | public void initializeSyntax(ConfigEntry configEntry) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeSyntax", |
| | | String.valueOf(configEntry)); |
| | | |
| | | defaultEqualityMatchingRule = |
| | | DirectoryServer.getEqualityMatchingRule(EMR_CASE_IGNORE_OID); |
| | |
| | | */ |
| | | public String getSyntaxName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSyntaxName"); |
| | | |
| | | return SYNTAX_LDAP_SYNTAX_NAME; |
| | | } |
| | |
| | | */ |
| | | public String getOID() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getOID"); |
| | | |
| | | return SYNTAX_LDAP_SYNTAX_OID; |
| | | } |
| | |
| | | */ |
| | | public String getDescription() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDescription"); |
| | | |
| | | return SYNTAX_LDAP_SYNTAX_DESCRIPTION; |
| | | } |
| | |
| | | */ |
| | | public EqualityMatchingRule getEqualityMatchingRule() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getEqualityMatchingRule"); |
| | | |
| | | return defaultEqualityMatchingRule; |
| | | } |
| | |
| | | */ |
| | | public OrderingMatchingRule getOrderingMatchingRule() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getOrderingMatchingRule"); |
| | | |
| | | return defaultOrderingMatchingRule; |
| | | } |
| | |
| | | */ |
| | | public SubstringMatchingRule getSubstringMatchingRule() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSubstringMatchingRule"); |
| | | |
| | | return defaultSubstringMatchingRule; |
| | | } |
| | |
| | | */ |
| | | 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"); |
| | | |
| | | |
| | | // Get string representations of the provided value using the provided form |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "valueIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ATTR_SYNTAX_ATTRSYNTAX_CANNOT_READ_DESC_TOKEN; |
| | | invalidReason.append(getMessage(msgID, valueStr, pos, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "valueIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_ATTR_SYNTAX_ATTRSYNTAX_CANNOT_READ_DESC_VALUE; |
| | | invalidReason.append(getMessage(msgID, valueStr, pos, |
| | |
| | | try { |
| | | pos=parseExtension(valueStr, pos); |
| | | } catch (Exception e) { |
| | | assert debugException(CLASS_NAME, "valueIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | int msgID = MSGID_ATTR_SYNTAX_ATTRSYNTAX_INVALID_EXTENSION; |
| | | invalidReason.append(getMessage(msgID, |
| | | stackTraceToSingleLineString(e))); |
| | |
| | | int startPos) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "readTokenName", String.valueOf(valueStr), |
| | | "java.lang.StringBuilder", String.valueOf(startPos)); |
| | | |
| | | |
| | | // Skip over any spaces at the beginning of the value. |
| | |
| | | StringBuilder valueBuffer, int startPos) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "readQuotedString", String.valueOf(valueStr), |
| | | "java.lang.StringBuilder", String.valueOf(startPos)); |
| | | |
| | | |
| | | // Skip over any spaces at the beginning of the value. |