| | |
| | | * 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.InitializationException; |
| | | 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 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 IntegerFirstComponentEqualityMatchingRule |
| | | extends EqualityMatchingRule |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.schema.IntegerFirstComponentEqualityMatchingRule"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | public void initializeMatchingRule(ConfigEntry configEntry) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeMatchingRule", |
| | | String.valueOf(configEntry)); |
| | | |
| | | // No initialization is required. |
| | | } |
| | |
| | | */ |
| | | public String getName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getName"); |
| | | |
| | | return EMR_INTEGER_FIRST_COMPONENT_NAME; |
| | | } |
| | |
| | | */ |
| | | public String getOID() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getOID"); |
| | | |
| | | return EMR_INTEGER_FIRST_COMPONENT_OID; |
| | | } |
| | |
| | | */ |
| | | public String getDescription() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDescription"); |
| | | |
| | | // There is no standard description for this matching rule. |
| | | return null; |
| | |
| | | */ |
| | | public String getSyntaxOID() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSyntaxOID"); |
| | | |
| | | return SYNTAX_INTEGER_OID; |
| | | } |
| | |
| | | public ByteString normalizeValue(ByteString value) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "normalizeValue", String.valueOf(value)); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | toLowerCase(value.value(), buffer, true); |
| | |
| | | */ |
| | | public boolean areEqual(ByteString value1, ByteString value2) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "areEqual", String.valueOf(value1), |
| | | String.valueOf(value2)); |
| | | |
| | | |
| | | try |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "areEqual", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public int generateHashCode(AttributeValue attributeValue) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "generateHashCode", |
| | | String.valueOf(attributeValue)); |
| | | |
| | | // In this case, we'll always return the same value because the matching |
| | | // isn't based on the entire value. |
| | |
| | | private static int extractIntValue(String valueString) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "extractIntValue", |
| | | String.valueOf(valueString)); |
| | | |
| | | |
| | | int valueLength = valueString.length(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "extractIntValue", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_EMR_INTFIRSTCOMP_NO_INITIAL_PARENTHESIS; |
| | | String message = getMessage(msgID, String.valueOf(valueString)); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "extractIntValue", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT; |
| | | String message = getMessage(msgID, String.valueOf(valueString)); |