From b979e5a32f5317c7385c10653963f3daa37cabba Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 20 Feb 2014 11:34:28 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support
---
opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java | 53 +++++++++++++
opendj3-server-dev/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java | 21 -----
opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java | 14 ---
opendj3-server-dev/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java | 20 ----
opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java | 16 ---
opendj3-server-dev/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java | 20 ----
opendj3-server-dev/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java | 20 ----
opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java | 20 ----
opendj3-server-dev/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java | 36 ++++-----
opendj3-server-dev/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java | 20 ----
10 files changed, 78 insertions(+), 162 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
index 0f68034..e467f50 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
@@ -33,8 +33,7 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
+import org.opends.server.schema.AbstractOrderingMatchingRule;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.util.StaticUtils.*;
@@ -43,8 +42,7 @@
* Used to establish an order between historical information and index them.
*/
public class HistoricalCsnOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
/**
* The serial version identifier required to satisfy the compiler because this
@@ -98,16 +96,6 @@
}
/**
- * Get the description of this Class.
- * @return the Class description in String form, currently not used.
- */
- @Override
- public String getDescription()
- {
- return null;
- }
-
- /**
* Get the Syntax OID for this class.
* @return the syntax OID in String form
*/
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
new file mode 100644
index 0000000..5e4bd99
--- /dev/null
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2014 ForgeRock AS
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AbstractMatchingRule;
+import org.opends.server.api.OrderingMatchingRule;
+
+/**
+ * This class defines the set of methods and structures that must be implemented
+ * by a Directory Server module that implements a matching rule used for
+ * ordering matching.
+ */
+public abstract class AbstractOrderingMatchingRule
+ extends AbstractMatchingRule
+ implements OrderingMatchingRule
+{
+
+ /**
+ * Retrieves the description for this matching rule.
+ *
+ * @return The description for this matching rule, or <CODE>null</CODE> if
+ * there is none.
+ */
+ @Override
+ public String getDescription()
+ {
+ // There is no standard description for this matching rule.
+ return null;
+ }
+
+}
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
index 3b18ebe..172b793 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
@@ -34,8 +34,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
@@ -49,8 +47,7 @@
* and referenced in RFC 4519.
*/
public class CaseExactOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
/**
* The serial version identifier required to satisfy the compiler because this
@@ -96,21 +93,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
index c29b696..6329938 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
@@ -34,8 +34,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
@@ -49,8 +47,7 @@
* and referenced in RFC 2252.
*/
public class CaseIgnoreOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
/**
* The serial version identifier required to satisfy the compiler because this
@@ -96,21 +93,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
index 999161c..2da20e2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
@@ -35,8 +35,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.DirectoryException;
@@ -49,8 +47,7 @@
* X.520 and referenced in RFC 2252.
*/
public class GeneralizedTimeOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -100,21 +97,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
index 135cce2..af2a370 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
@@ -36,8 +36,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.core.DirectoryServer;
import static org.opends.messages.SchemaMessages.*;
@@ -49,9 +47,7 @@
* This class defines the integerOrderingMatch matching rule defined in X.520
* and referenced in RFC 4519.
*/
-public class IntegerOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+public class IntegerOrderingMatchingRule extends AbstractOrderingMatchingRule
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -100,21 +96,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
index a2c4da1..e7bae7b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
@@ -1507,8 +1507,7 @@
* Implementation of an Enum Ordering matching rule.
*/
private final class EnumOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
//The enumeration syntax instance.
private EnumSyntax syntax;
@@ -1588,17 +1587,6 @@
* {@inheritDoc}
*/
@Override
- public String getDescription()
- {
- return null;
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public String getSyntaxOID()
{
return SYNTAX_DIRECTORY_STRING_OID;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
index 0539f26..f2ad65a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
@@ -34,8 +34,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.StaticUtils;
@@ -49,8 +47,7 @@
* in X.520 and referenced in RFC 2252.
*/
public class NumericStringOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -99,21 +96,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
index 3134234..f47ebf2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
@@ -34,8 +34,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.util.StaticUtils;
import static org.opends.server.schema.SchemaConstants.*;
@@ -48,8 +46,7 @@
* octet string syntaxes.
*/
public class OctetStringOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+ extends AbstractOrderingMatchingRule
{
/**
* The serial version identifier required to satisfy the compiler because this
@@ -95,21 +92,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
index 182a325..8df4b66 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
@@ -36,8 +36,6 @@
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
-import org.opends.server.api.AbstractMatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.StaticUtils;
@@ -50,9 +48,7 @@
* This class defines the uuidOrderingMatch matching rule defined in RFC 4530.
* This will be the default ordering matching rule for the UUID syntax.
*/
-public class UUIDOrderingMatchingRule
- extends AbstractMatchingRule
- implements OrderingMatchingRule
+public class UUIDOrderingMatchingRule extends AbstractOrderingMatchingRule
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -101,21 +97,6 @@
/**
- * Retrieves the description for this matching rule.
- *
- * @return The description for this matching rule, or <CODE>null</CODE> if
- * there is none.
- */
- @Override
- public String getDescription()
- {
- // There is no standard description for this matching rule.
- return null;
- }
-
-
-
- /**
* Retrieves the OID of the syntax with which this matching rule is
* associated.
*
@@ -233,6 +214,21 @@
}
}
+ private ByteString reject(ByteSequence value, LocalizableMessage message)
+ throws DecodeException
+ {
+ switch (DirectoryServer.getSyntaxEnforcementPolicy())
+ {
+ case REJECT:
+ throw DecodeException.error(message);
+ case WARN:
+ logger.error(message);
+ return value.toByteString();
+ default:
+ return value.toByteString();
+ }
+ }
+
/**
--
Gitblit v1.10.0