| | |
| | | * 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.ResultCode; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | 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 org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.SchemaMessages.*; |
| | |
| | | extends AttributeSyntax |
| | | implements ConfigurableComponent |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.schema.TelephoneNumberSyntax"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | public void initializeSyntax(ConfigEntry configEntry) |
| | | throws ConfigException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeSyntax", |
| | | String.valueOf(configEntry)); |
| | | |
| | | defaultEqualityMatchingRule = |
| | | DirectoryServer.getEqualityMatchingRule(EMR_TELEPHONE_OID); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeSyntax", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_ATTR_SYNTAX_TELEPHONE_CANNOT_DETERMINE_STRICT_MODE; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | */ |
| | | public void finalizeSyntax() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeSyntax"); |
| | | |
| | | DirectoryServer.deregisterConfigurableComponent(this); |
| | | } |
| | |
| | | */ |
| | | public String getSyntaxName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSyntaxName"); |
| | | |
| | | return SYNTAX_TELEPHONE_NAME; |
| | | } |
| | |
| | | */ |
| | | public String getOID() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getOID"); |
| | | |
| | | return SYNTAX_TELEPHONE_OID; |
| | | } |
| | |
| | | */ |
| | | public String getDescription() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDescription"); |
| | | |
| | | return SYNTAX_TELEPHONE_DESCRIPTION; |
| | | } |
| | |
| | | */ |
| | | public EqualityMatchingRule getEqualityMatchingRule() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getEqualityMatchingRule"); |
| | | |
| | | return defaultEqualityMatchingRule; |
| | | } |
| | |
| | | */ |
| | | public OrderingMatchingRule getOrderingMatchingRule() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getOrderingMatchingRule"); |
| | | |
| | | // There is no ordering matching rule by default. |
| | | return null; |
| | |
| | | */ |
| | | 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"); |
| | | |
| | | |
| | | // No matter what, the value can't be empty or null. |
| | |
| | | */ |
| | | private boolean isSeparator(char c) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isSeparator", String.valueOf(c)); |
| | | |
| | | switch (c) |
| | | { |
| | |
| | | */ |
| | | public DN getConfigurableComponentEntryDN() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN"); |
| | | |
| | | return configEntryDN; |
| | | } |
| | |
| | | */ |
| | | public List<ConfigAttribute> getConfigurationAttributes() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurationAttributes"); |
| | | |
| | | |
| | | LinkedList<ConfigAttribute> attrList = new LinkedList<ConfigAttribute>(); |
| | |
| | | public boolean hasAcceptableConfiguration(ConfigEntry configEntry, |
| | | List<String> unacceptableReasons) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration", |
| | | String.valueOf(configEntry), "java.util.List<String>"); |
| | | |
| | | |
| | | boolean configIsAcceptable = true; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_ATTR_SYNTAX_TELEPHONE_CANNOT_DETERMINE_STRICT_MODE; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry, |
| | | boolean detailedResults) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyNewConfiguration", |
| | | String.valueOf(configEntry), |
| | | String.valueOf(detailedResults)); |
| | | |
| | | |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | msgID = MSGID_ATTR_SYNTAX_TELEPHONE_CANNOT_DETERMINE_STRICT_MODE; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |