From a09e50d8d41c0f50c486742f4cc2343083c635e3 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 25 Jun 2010 09:25:49 +0000
Subject: [PATCH] Fixes issues #4552 #4557, making sure plugins and internal services are properly handling subtree move or delete. The changes particularly resolve problems raised by the community with the referential integrity and the isMemberOf plug-ins. Unit-tests have been updated to cover those cases
---
opends/src/server/org/opends/server/api/plugin/PluginResult.java | 194 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 193 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/api/plugin/PluginResult.java b/opends/src/server/org/opends/server/api/plugin/PluginResult.java
index 8f16525..4a51e1e 100644
--- a/opends/src/server/org/opends/server/api/plugin/PluginResult.java
+++ b/opends/src/server/org/opends/server/api/plugin/PluginResult.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.api.plugin;
@@ -1035,6 +1035,198 @@
}
/**
+ * Defines a subordinate delete plugin result for core server
+ * operation processing consisting of either continue, skip
+ * further plugins, or stop operation processing with a result
+ * code, matched DN, referral URLs, and error message.
+ */
+ public static final class SubordinateDelete
+ {
+ // Whether to continue operation processing.
+ private final boolean continueProcessing;
+
+ // Whether to invoke the rest of the plugins.
+ private final boolean continuePluginProcessing;
+
+ // An message explaining why processing should stop.
+ private final Message errorMessage;
+
+ // The matched DN for this result.
+ private final DN matchedDN;
+
+ // The set of referral URLs for this result.
+ private final List<String> referralURLs;
+
+ // The result code for this result.
+ private final ResultCode resultCode;
+
+ private static SubordinateDelete DEFAULT_RESULT =
+ new SubordinateDelete(true, true, null, null, null, null);
+
+ /**
+ * Construct a new subordinate delete plugin result.
+ *
+ * @param continueProcessing Whether to continue startup.
+ * @param continuePluginProcessing Whether to invoke the rest
+ * of the plugins.
+ * @param errorMessage An message explaining why processing
+ * should stop.
+ * @param resultCode The result code for this result.
+ * @param matchedDN The matched DN for this result.
+ * @param referralURLs The set of referral URLs for this result.
+ * stop.
+ */
+ private SubordinateDelete(boolean continueProcessing,
+ boolean continuePluginProcessing,
+ Message errorMessage,
+ ResultCode resultCode, DN matchedDN,
+ List<String> referralURLs)
+ {
+ this.continueProcessing = continueProcessing;
+ this.errorMessage = errorMessage;
+ this.continuePluginProcessing = continuePluginProcessing;
+ this.resultCode = resultCode;
+ this.matchedDN = matchedDN;
+ this.referralURLs = referralURLs;
+ }
+
+ /**
+ * Defines a continue processing subordinate delete plugin
+ * result.
+ *
+ * @return a continue processing subordinate delete plugin
+ * result.
+ */
+ public static SubordinateDelete continueOperationProcessing()
+ {
+ return DEFAULT_RESULT;
+ }
+
+ /**
+ * Defines a skip further plugin processing subordinate delete
+ * plugin result.
+ *
+ * @return a skip further plugin processing subordinate delete
+ * plugin result.
+ */
+ public static SubordinateDelete skipFurtherPluginProcesssing()
+ {
+ return new SubordinateDelete(true, false, null, null, null,
+ null);
+ }
+
+ /**
+ * Defines a new stop processing subordinate delete plugin
+ * result.
+ *
+ * @param resultCode The result code for this result.
+ * @param errorMessage An message explaining why processing
+ * should stop.
+ * @param matchedDN The matched DN for this result.
+ * @param referralURLs The set of referral URLs for this result.
+ *
+ * @return a new stop processing subordinate delete plugin
+ * result.
+ */
+ public static SubordinateDelete stopProcessing(
+ ResultCode resultCode, Message errorMessage, DN matchedDN,
+ List<String> referralURLs)
+ {
+ return new SubordinateDelete(false, false, errorMessage,
+ resultCode, matchedDN, referralURLs);
+ }
+
+ /**
+ * Contrust a new stop processing subordinate delete plugin
+ * result.
+ *
+ * @param resultCode The result code for this result.
+ * @param errorMessage An message explaining why processing
+ * should stop.
+ *
+ * @return a new stop processing subordinate delete plugin
+ * result.
+ */
+ public static SubordinateDelete stopProcessing(
+ ResultCode resultCode, Message errorMessage)
+ {
+ return new SubordinateDelete(false, false, errorMessage,
+ resultCode, null, null);
+ }
+
+ /**
+ * Whether to continue operation processing.
+ *
+ * @return <code>true</code> if processing should continue
+ * or <code>false</code> otherwise.
+ */
+ public boolean continueProcessing()
+ {
+ return continueProcessing;
+ }
+
+ /**
+ * Whether to invoke the rest of the plugins.
+ *
+ * @return <code>true</code> if the rest of the plugins should
+ * be invoked for <code>false</code> to skip the rest of the
+ * plugins.
+ */
+ public boolean continuePluginProcessing()
+ {
+ return continuePluginProcessing;
+ }
+
+ /**
+ * Retrieves the error message if <code>continueProcessing</code>
+ * returned <code>false</code>.
+ *
+ * @return An error message explaining why processing should
+ * stop or <code>null</code> if none is provided.
+ */
+ public Message getErrorMessage()
+ {
+ return errorMessage;
+ }
+
+ /**
+ * Retrieves the result code for the operation
+ * if <code>continueProcessing</code> returned <code>false</code>.
+ *
+ * @return the result code for the operation or <code>null</code>
+ * if none is provided.
+ */
+ public ResultCode getResultCode()
+ {
+ return resultCode;
+ }
+
+ /**
+ * Retrieves the matched DN for the operation
+ * if <code>continueProcessing</code> returned <code>false</code>.
+ *
+ * @return the matched DN for the operation or <code>null</code>
+ * if none is provided.
+ */
+ public DN getMatchedDN()
+ {
+ return matchedDN;
+ }
+
+ /**
+ * Retrieves the referral URLs for the operation
+ * if <code>continueProcessing</code> returned <code>false</code>.
+ *
+ * @return the refferal URLs for the operation or
+ * <code>null</code> if none is provided.
+ */
+ public List<String> getReferralURLs()
+ {
+ return referralURLs;
+ }
+ }
+
+ /**
* Defines an intermediate response plugin result for core server
* operation processing consisting of either continue, skip further
* plugins, or stop operation processing with a result code,
--
Gitblit v1.10.0