From 0181e868e5eb1e3896ed4b371947bed2ccb9aa50 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 12 Oct 2006 15:08:00 +0000
Subject: [PATCH] Update the server code to eliminate the need for a 5-second delay when attempting to terminate a client connection from within an operation plugin. The issue arose when the attempt to terminate the connection tried to cancel the operation that initiated the disconnect, which made it necessary to wait for a 5-second timeout before continuing.
---
opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java | 6
opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseOperation.java | 179 ------
opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java | 17
opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java | 17
opendj-sdk/opends/src/server/org/opends/server/core/Operation.java | 23
opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationOperation.java | 178 ------
opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java | 4
opendj-sdk/opends/src/server/org/opends/server/types/operation/InProgressOperation.java | 191 -------
opendj-sdk/opends/src/server/org/opends/server/types/operation/PluginOperation.java | 260 ++++++++++
opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseOperation.java | 191 -------
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java | 134 +---
opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java | 16
opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java | 20
opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationOperation.java | 191 -------
20 files changed, 524 insertions(+), 1,023 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java b/opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java
index 7fec595..c813a3e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java
@@ -404,7 +404,11 @@
* Closes the connection to the client, optionally sending it a
* message indicating the reason for the closure. Note that the
* ability to send a notice of disconnection may not be available
- * for all protocols or under all circumstances.
+ * for all protocols or under all circumstances. Also note that
+ * when attempting to disconnect a client connection as a part of
+ * operation processing (e.g., within a plugin or other extension),
+ * the <CODE>disconnectClient</CODE> method within that operation
+ * should be called rather than invoking this method directly.
*
* @param disconnectReason The disconnect reason that provides the
* generic cause for the disconnect.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
index 068fb60..0471a6f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/AbandonOperation.java
@@ -35,6 +35,7 @@
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
import org.opends.server.types.operation.PostOperationAbandonOperation;
@@ -178,6 +179,22 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Since abandon operations can't be cancelled, we don't need to do anything
+ // but forward the request on to the client connection.
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
assert debugEnter(CLASS_NAME, "getRequestLogElements");
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
index 249dfe9..fd3807b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java
@@ -67,6 +67,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
@@ -661,6 +662,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
index d8ca5b7..d964244 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/BindOperation.java
@@ -57,6 +57,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
@@ -805,6 +806,22 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Since bind operations can't be cancelled, we don't need to do anything
+ // but forward the request on to the client connection.
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
index a7827ed..287b24f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java
@@ -52,6 +52,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.LockManager;
@@ -418,6 +419,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
index 22147df..8c93089 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java
@@ -54,6 +54,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
@@ -350,6 +351,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
index b641e8e..458ceb9 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ExtendedOperation.java
@@ -41,6 +41,7 @@
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -327,6 +328,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
index 37c105b..caf5af8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java
@@ -60,6 +60,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
@@ -634,6 +635,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
index 9622453..1956a1b 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java
@@ -72,6 +72,7 @@
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ErrorLogCategory;
@@ -558,6 +559,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final OperationType getOperationType()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/Operation.java b/opendj-sdk/opends/src/server/org/opends/server/core/Operation.java
index 443c48d..fc49f53 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/Operation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/Operation.java
@@ -38,6 +38,7 @@
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
import org.opends.server.types.Control;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.OperationType;
@@ -196,6 +197,28 @@
/**
+ * Terminates the client connection being used to process this operation. The
+ * plugin must return a result indicating that the client connection has been
+ * teriminated.
+ *
+ * @param disconnectReason The disconnect reason that provides the generic
+ * cause for the disconnect.
+ * @param sendNotification Indicates whether to try to provide notification
+ * to the client that the connection will be closed.
+ * @param message The message to send to the client. It may be
+ * <CODE>null</CODE> if no notification is to be
+ * sent.
+ * @param messageID The unique identifier associated with the message
+ * to send to the client. It may be -1 if no
+ * notification is to be sent.
+ */
+ public abstract void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification,
+ String message, int messageID);
+
+
+
+ /**
* Retrieves a set of standard elements that should be logged in all requests
* and responses for all types of operations. Each element in the array will
* itself be a two-element array in which the first element is the name of the
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
index 37c59cc..16620e2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/SearchOperation.java
@@ -61,6 +61,7 @@
import org.opends.server.types.Control;
import org.opends.server.types.DereferencePolicy;
import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.OperationType;
@@ -1414,6 +1415,25 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Before calling clientConnection.disconnect, we need to mark this
+ // operation as cancelled so that the attempt to cancel it later won't cause
+ // an unnecessary delay.
+ setCancelResult(CancelResult.CANCELED);
+
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java b/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
index 60c8693..593995f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/UnbindOperation.java
@@ -112,6 +112,22 @@
* {@inheritDoc}
*/
@Override()
+ public final void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification, String message,
+ int messageID)
+ {
+ // Since unbind operations can't be cancelled, we don't need to do anything
+ // but forward the request on to the client connection.
+ clientConnection.disconnect(disconnectReason, sendNotification, message,
+ messageID);
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override()
public final String[][] getRequestLogElements()
{
// Note that no debugging will be done in this method because it is a likely
diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
index 6969fe4..e59bc4f 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/TraditionalWorkerThread.java
@@ -211,8 +211,8 @@
String.valueOf(operation),
stackTraceToSingleLineString(e));
- operation.getClientConnection().disconnect(
- DisconnectReason.SERVER_ERROR, true, message, msgID);
+ operation.disconnectClient(DisconnectReason.SERVER_ERROR, true,
+ message, msgID);
}
catch (Exception e2)
{
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/InProgressOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/InProgressOperation.java
index 2f703c7..468c45d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/InProgressOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/InProgressOperation.java
@@ -29,14 +29,10 @@
import java.util.List;
-import java.util.Map;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.CancelRequest;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
-import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -50,79 +46,9 @@
* is not intended to be implemented by any custom classes.
*/
public interface InProgressOperation
+ extends PluginOperation
{
/**
- * Retrieves the operation type for this operation.
- *
- * @return The operation type for this operation.
- */
- public OperationType getOperationType();
-
-
-
- /**
- * Retrieves the client connection with which this operation is
- * associated.
- *
- * @return The client connection with which this operation is
- * associated.
- */
- public ClientConnection getClientConnection();
-
-
-
- /**
- * Retrieves the unique identifier that is assigned to the client
- * connection that submitted this operation.
- *
- * @return The unique identifier that is assigned to the client
- * connection that submitted this operation.
- */
- public long getConnectionID();
-
-
-
- /**
- * Retrieves the operation ID for this operation.
- *
- * @return The operation ID for this operation.
- */
- public long getOperationID();
-
-
-
- /**
- * Retrieves the message ID assigned to this operation.
- *
- * @return The message ID assigned to this operation.
- */
- public int getMessageID();
-
-
-
- /**
- * Retrieves the set of controls included in the request from the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls included in the request from the
- * client.
- */
- public List<Control> getRequestControls();
-
-
-
- /**
- * Retrieves the set of controls to include in the response to the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls to include in the response to the
- * client.
- */
- public List<Control> getResponseControls();
-
-
-
- /**
* Adds the provided control to the set of controls to include in
* the response to the client.
*
@@ -287,28 +213,6 @@
/**
- * Indicates whether this is an internal operation rather than one
- * that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is an internal operation, or
- * <CODE>false</CODE> if it is not.
- */
- public boolean isInternalOperation();
-
-
-
- /**
- * Indicates whether this is a synchronization operation rather than
- * one that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is a data synchronization
- * operation, or <CODE>false</CODE> if it is not.
- */
- public boolean isSynchronizationOperation();
-
-
-
- /**
* Retrieves the authorization DN for this operation. In many
* cases, it will be the same as the DN of the authenticated user
* for the underlying connection, or the null DN if no
@@ -320,98 +224,5 @@
* @return The authorization DN for this operation.
*/
public DN getAuthorizationDN();
-
-
-
- /**
- * Retrieves the set of attachments defined for this operation, as a
- * mapping between the attachment name and the associated object.
- *
- * @return The set of attachments defined for this operation.
- */
- public Map<String,Object> getAttachments();
-
-
-
- /**
- * Retrieves the attachment with the specified name.
- *
- * @param name The name for the attachment to retrieve. It will
- * be treated in a case-sensitive manner.
- *
- * @return The requested attachment object, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object getAttachment(String name);
-
-
-
- /**
- * Removes the attachment with the specified name.
- *
- * @param name The name for the attachment to remove. It will be
- * treated in a case-sensitive manner.
- *
- * @return The attachment that was removed, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object removeAttachment(String name);
-
-
-
- /**
- * Sets the value of the specified attachment. If an attachment
- * already exists with the same name, it will be replaced.
- * Otherwise, a new attachment will be added.
- *
- * @param name The name to use for the attachment.
- * @param value The value to use for the attachment.
- *
- * @return The former value held by the attachment with the given
- * name, or <CODE>null</CODE> if there was previously no
- * such attachment.
- */
- public Object setAttachment(String name, Object value);
-
-
-
- /**
- * Retrieves the time that processing started for this operation.
- *
- * @return The time that processing started for this operation.
- */
- public long getProcessingStartTime();
-
-
-
- /**
- * Retrieves the cancel request that has been issued for this
- * operation, if there is one.
- *
- * @return The cancel request that has been issued for this
- * operation, or <CODE>null</CODE> if there has not been
- * any request to cancel.
- */
- public CancelRequest getCancelRequest();
-
-
-
- /**
- * Retrieves a string representation of this operation.
- *
- * @return A string representation of this operation.
- */
- public String toString();
-
-
-
- /**
- * Appends a string representation of this operation to the provided
- * buffer.
- *
- * @param buffer The buffer into which a string representation of
- * this operation should be appended.
- */
- public void toString(StringBuilder buffer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PluginOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PluginOperation.java
new file mode 100644
index 0000000..13d1f13
--- /dev/null
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PluginOperation.java
@@ -0,0 +1,260 @@
+/*
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * 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
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.types.operation;
+
+
+
+import java.util.List;
+import java.util.Map;
+
+import org.opends.server.api.ClientConnection;
+import org.opends.server.types.CancelRequest;
+import org.opends.server.types.Control;
+import org.opends.server.types.DisconnectReason;
+import org.opends.server.types.OperationType;
+
+
+
+/**
+ * This class defines a set of methods that are available for use by
+ * all types of plugins involved in operation processing (pre-parse,
+ * pre-operation, post-operation, post-response, search result entry,
+ * search result reference, and intermediate response). Note that
+ * this interface is intended only to define an API for use by plugins
+ * and is not intended to be implemented by any custom classes.
+ */
+public interface PluginOperation
+{
+ /**
+ * Retrieves the operation type for this operation.
+ *
+ * @return The operation type for this operation.
+ */
+ public OperationType getOperationType();
+
+
+
+ /**
+ * Retrieves the client connection with which this operation is
+ * associated.
+ *
+ * @return The client connection with which this operation is
+ * associated.
+ */
+ public ClientConnection getClientConnection();
+
+
+
+ /**
+ * Terminates the client connection being used to process this
+ * operation. The plugin must return a result indicating that the
+ * client connection has been teriminated.
+ *
+ * @param disconnectReason The disconnect reason that provides the
+ * generic cause for the disconnect.
+ * @param sendNotification Indicates whether to try to provide
+ * notification to the client that the
+ * connection will be closed.
+ * @param message The message to send to the client. It
+ * may be <CODE>null</CODE> if no
+ * notification is to be sent.
+ * @param messageID The unique identifier associated with
+ * the message to send to the client. It
+ * may be -1 if no notification is to be
+ * sent.
+ */
+ public void disconnectClient(DisconnectReason disconnectReason,
+ boolean sendNotification,
+ String message, int messageID);
+
+
+
+ /**
+ * Retrieves the unique identifier that is assigned to the client
+ * connection that submitted this operation.
+ *
+ * @return The unique identifier that is assigned to the client
+ * connection that submitted this operation.
+ */
+ public long getConnectionID();
+
+
+
+ /**
+ * Retrieves the operation ID for this operation.
+ *
+ * @return The operation ID for this operation.
+ */
+ public long getOperationID();
+
+
+
+ /**
+ * Retrieves the message ID assigned to this operation.
+ *
+ * @return The message ID assigned to this operation.
+ */
+ public int getMessageID();
+
+
+
+ /**
+ * Retrieves the set of controls included in the request from the
+ * client. The contents of this list must not be altered.
+ *
+ * @return The set of controls included in the request from the
+ * client.
+ */
+ public List<Control> getRequestControls();
+
+
+
+ /**
+ * Retrieves the set of controls to include in the response to the
+ * client. The contents of this list must not be altered.
+ *
+ * @return The set of controls to include in the response to the
+ * client.
+ */
+ public List<Control> getResponseControls();
+
+
+
+ /**
+ * Indicates whether this is an internal operation rather than one
+ * that was requested by an external client.
+ *
+ * @return <CODE>true</CODE> if this is an internal operation, or
+ * <CODE>false</CODE> if it is not.
+ */
+ public boolean isInternalOperation();
+
+
+
+ /**
+ * Indicates whether this is a synchronization operation rather than
+ * one that was requested by an external client.
+ *
+ * @return <CODE>true</CODE> if this is a data synchronization
+ * operation, or <CODE>false</CODE> if it is not.
+ */
+ public boolean isSynchronizationOperation();
+
+
+
+ /**
+ * Retrieves the set of attachments defined for this operation, as a
+ * mapping between the attachment name and the associated object.
+ *
+ * @return The set of attachments defined for this operation.
+ */
+ public Map<String,Object> getAttachments();
+
+
+
+ /**
+ * Retrieves the attachment with the specified name.
+ *
+ * @param name The name for the attachment to retrieve. It will
+ * be treated in a case-sensitive manner.
+ *
+ * @return The requested attachment object, or <CODE>null</CODE> if
+ * it does not exist.
+ */
+ public Object getAttachment(String name);
+
+
+
+ /**
+ * Removes the attachment with the specified name.
+ *
+ * @param name The name for the attachment to remove. It will be
+ * treated in a case-sensitive manner.
+ *
+ * @return The attachment that was removed, or <CODE>null</CODE> if
+ * it does not exist.
+ */
+ public Object removeAttachment(String name);
+
+
+
+ /**
+ * Sets the value of the specified attachment. If an attachment
+ * already exists with the same name, it will be replaced.
+ * Otherwise, a new attachment will be added.
+ *
+ * @param name The name to use for the attachment.
+ * @param value The value to use for the attachment.
+ *
+ * @return The former value held by the attachment with the given
+ * name, or <CODE>null</CODE> if there was previously no
+ * such attachment.
+ */
+ public Object setAttachment(String name, Object value);
+
+
+
+ /**
+ * Retrieves the time that processing started for this operation.
+ *
+ * @return The time that processing started for this operation.
+ */
+ public long getProcessingStartTime();
+
+
+
+ /**
+ * Retrieves the cancel request that has been issued for this
+ * operation, if there is one.
+ *
+ * @return The cancel request that has been issued for this
+ * operation, or <CODE>null</CODE> if there has not been
+ * any request to cancel.
+ */
+ public CancelRequest getCancelRequest();
+
+
+
+ /**
+ * Retrieves a string representation of this operation.
+ *
+ * @return A string representation of this operation.
+ */
+ public String toString();
+
+
+
+ /**
+ * Appends a string representation of this operation to the provided
+ * buffer.
+ *
+ * @param buffer The buffer into which a string representation of
+ * this operation should be appended.
+ */
+ public void toString(StringBuilder buffer);
+}
+
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationOperation.java
index 07b937b..66ba2cd 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostOperationOperation.java
@@ -29,13 +29,10 @@
import java.util.List;
-import java.util.Map;
-import org.opends.server.api.ClientConnection;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
-import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -47,79 +44,9 @@
* is not intended to be implemented by any custom classes.
*/
public interface PostOperationOperation
+ extends PluginOperation
{
/**
- * Retrieves the operation type for this operation.
- *
- * @return The operation type for this operation.
- */
- public OperationType getOperationType();
-
-
-
- /**
- * Retrieves the client connection with which this operation is
- * associated.
- *
- * @return The client connection with which this operation is
- * associated.
- */
- public ClientConnection getClientConnection();
-
-
-
- /**
- * Retrieves the unique identifier that is assigned to the client
- * connection that submitted this operation.
- *
- * @return The unique identifier that is assigned to the client
- * connection that submitted this operation.
- */
- public long getConnectionID();
-
-
-
- /**
- * Retrieves the operation ID for this operation.
- *
- * @return The operation ID for this operation.
- */
- public long getOperationID();
-
-
-
- /**
- * Retrieves the message ID assigned to this operation.
- *
- * @return The message ID assigned to this operation.
- */
- public int getMessageID();
-
-
-
- /**
- * Retrieves the set of controls included in the request from the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls included in the request from the
- * client.
- */
- public List<Control> getRequestControls();
-
-
-
- /**
- * Retrieves the set of controls to include in the response to the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls to include in the response to the
- * client.
- */
- public List<Control> getResponseControls();
-
-
-
- /**
* Adds the provided control to the set of controls to include in
* the response to the client.
*
@@ -284,28 +211,6 @@
/**
- * Indicates whether this is an internal operation rather than one
- * that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is an internal operation, or
- * <CODE>false</CODE> if it is not.
- */
- public boolean isInternalOperation();
-
-
-
- /**
- * Indicates whether this is a synchronization operation rather than
- * one that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is a data synchronization
- * operation, or <CODE>false</CODE> if it is not.
- */
- public boolean isSynchronizationOperation();
-
-
-
- /**
* Retrieves the authorization DN for this operation. In many
* cases, it will be the same as the DN of the authenticated user
* for the underlying connection, or the null DN if no
@@ -317,86 +222,5 @@
* @return The authorization DN for this operation.
*/
public DN getAuthorizationDN();
-
-
-
- /**
- * Retrieves the set of attachments defined for this operation, as a
- * mapping between the attachment name and the associated object.
- *
- * @return The set of attachments defined for this operation.
- */
- public Map<String,Object> getAttachments();
-
-
-
- /**
- * Retrieves the attachment with the specified name.
- *
- * @param name The name for the attachment to retrieve. It will
- * be treated in a case-sensitive manner.
- *
- * @return The requested attachment object, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object getAttachment(String name);
-
-
-
- /**
- * Removes the attachment with the specified name.
- *
- * @param name The name for the attachment to remove. It will be
- * treated in a case-sensitive manner.
- *
- * @return The attachment that was removed, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object removeAttachment(String name);
-
-
-
- /**
- * Sets the value of the specified attachment. If an attachment
- * already exists with the same name, it will be replaced.
- * Otherwise, a new attachment will be added.
- *
- * @param name The name to use for the attachment.
- * @param value The value to use for the attachment.
- *
- * @return The former value held by the attachment with the given
- * name, or <CODE>null</CODE> if there was previously no
- * such attachment.
- */
- public Object setAttachment(String name, Object value);
-
-
-
- /**
- * Retrieves the time that processing started for this operation.
- *
- * @return The time that processing started for this operation.
- */
- public long getProcessingStartTime();
-
-
-
- /**
- * Retrieves a string representation of this operation.
- *
- * @return A string representation of this operation.
- */
- public String toString();
-
-
-
- /**
- * Appends a string representation of this operation to the provided
- * buffer.
- *
- * @param buffer The buffer into which a string representation of
- * this operation should be appended.
- */
- public void toString(StringBuilder buffer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseOperation.java
index 4209815..c1b795c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PostResponseOperation.java
@@ -29,12 +29,8 @@
import java.util.List;
-import java.util.Map;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.Control;
import org.opends.server.types.DN;
-import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -46,79 +42,9 @@
* is not intended to be implemented by any custom classes.
*/
public interface PostResponseOperation
+ extends PluginOperation
{
/**
- * Retrieves the operation type for this operation.
- *
- * @return The operation type for this operation.
- */
- public OperationType getOperationType();
-
-
-
- /**
- * Retrieves the client connection with which this operation is
- * associated.
- *
- * @return The client connection with which this operation is
- * associated.
- */
- public ClientConnection getClientConnection();
-
-
-
- /**
- * Retrieves the unique identifier that is assigned to the client
- * connection that submitted this operation.
- *
- * @return The unique identifier that is assigned to the client
- * connection that submitted this operation.
- */
- public long getConnectionID();
-
-
-
- /**
- * Retrieves the operation ID for this operation.
- *
- * @return The operation ID for this operation.
- */
- public long getOperationID();
-
-
-
- /**
- * Retrieves the message ID assigned to this operation.
- *
- * @return The message ID assigned to this operation.
- */
- public int getMessageID();
-
-
-
- /**
- * Retrieves the set of controls included in the request from the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls included in the request from the
- * client.
- */
- public List<Control> getRequestControls();
-
-
-
- /**
- * Retrieves the set of controls to include in the response to the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls to include in the response to the
- * client.
- */
- public List<Control> getResponseControls();
-
-
-
- /**
* Retrieves the result code for this operation.
*
* @return The result code associated for this operation, or
@@ -175,28 +101,6 @@
/**
- * Indicates whether this is an internal operation rather than one
- * that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is an internal operation, or
- * <CODE>false</CODE> if it is not.
- */
- public boolean isInternalOperation();
-
-
-
- /**
- * Indicates whether this is a synchronization operation rather than
- * one that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is a data synchronization
- * operation, or <CODE>false</CODE> if it is not.
- */
- public boolean isSynchronizationOperation();
-
-
-
- /**
* Retrieves the authorization DN for this operation. In many
* cases, it will be the same as the DN of the authenticated user
* for the underlying connection, or the null DN if no
@@ -212,67 +116,6 @@
/**
- * Retrieves the set of attachments defined for this operation, as a
- * mapping between the attachment name and the associated object.
- *
- * @return The set of attachments defined for this operation.
- */
- public Map<String,Object> getAttachments();
-
-
-
- /**
- * Retrieves the attachment with the specified name.
- *
- * @param name The name for the attachment to retrieve. It will
- * be treated in a case-sensitive manner.
- *
- * @return The requested attachment object, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object getAttachment(String name);
-
-
-
- /**
- * Removes the attachment with the specified name.
- *
- * @param name The name for the attachment to remove. It will be
- * treated in a case-sensitive manner.
- *
- * @return The attachment that was removed, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object removeAttachment(String name);
-
-
-
- /**
- * Sets the value of the specified attachment. If an attachment
- * already exists with the same name, it will be replaced.
- * Otherwise, a new attachment will be added.
- *
- * @param name The name to use for the attachment.
- * @param value The value to use for the attachment.
- *
- * @return The former value held by the attachment with the given
- * name, or <CODE>null</CODE> if there was previously no
- * such attachment.
- */
- public Object setAttachment(String name, Object value);
-
-
-
- /**
- * Retrieves the time that processing started for this operation.
- *
- * @return The time that processing started for this operation.
- */
- public long getProcessingStartTime();
-
-
-
- /**
* Retrieves the time that processing stopped for this operation.
* This will actually hold a time immediately before the response
* was sent to the client.
@@ -291,25 +134,5 @@
* processing this operation.
*/
public long getProcessingTime();
-
-
-
- /**
- * Retrieves a string representation of this operation.
- *
- * @return A string representation of this operation.
- */
- public String toString();
-
-
-
- /**
- * Appends a string representation of this operation to the provided
- * buffer.
- *
- * @param buffer The buffer into which a string representation of
- * this operation should be appended.
- */
- public void toString(StringBuilder buffer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationOperation.java
index 90030d7..f1e8e3d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreOperationOperation.java
@@ -29,14 +29,10 @@
import java.util.List;
-import java.util.Map;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.CancelRequest;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
-import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -48,79 +44,9 @@
* is not intended to be implemented by any custom classes.
*/
public interface PreOperationOperation
+ extends PluginOperation
{
/**
- * Retrieves the operation type for this operation.
- *
- * @return The operation type for this operation.
- */
- public OperationType getOperationType();
-
-
-
- /**
- * Retrieves the client connection with which this operation is
- * associated.
- *
- * @return The client connection with which this operation is
- * associated.
- */
- public ClientConnection getClientConnection();
-
-
-
- /**
- * Retrieves the unique identifier that is assigned to the client
- * connection that submitted this operation.
- *
- * @return The unique identifier that is assigned to the client
- * connection that submitted this operation.
- */
- public long getConnectionID();
-
-
-
- /**
- * Retrieves the operation ID for this operation.
- *
- * @return The operation ID for this operation.
- */
- public long getOperationID();
-
-
-
- /**
- * Retrieves the message ID assigned to this operation.
- *
- * @return The message ID assigned to this operation.
- */
- public int getMessageID();
-
-
-
- /**
- * Retrieves the set of controls included in the request from the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls included in the request from the
- * client.
- */
- public List<Control> getRequestControls();
-
-
-
- /**
- * Retrieves the set of controls to include in the response to the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls to include in the response to the
- * client.
- */
- public List<Control> getResponseControls();
-
-
-
- /**
* Adds the provided control to the set of controls to include in
* the response to the client.
*
@@ -285,28 +211,6 @@
/**
- * Indicates whether this is an internal operation rather than one
- * that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is an internal operation, or
- * <CODE>false</CODE> if it is not.
- */
- public boolean isInternalOperation();
-
-
-
- /**
- * Indicates whether this is a synchronization operation rather than
- * one that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is a data synchronization
- * operation, or <CODE>false</CODE> if it is not.
- */
- public boolean isSynchronizationOperation();
-
-
-
- /**
* Retrieves the authorization DN for this operation. In many
* cases, it will be the same as the DN of the authenticated user
* for the underlying connection, or the null DN if no
@@ -318,98 +222,5 @@
* @return The authorization DN for this operation.
*/
public DN getAuthorizationDN();
-
-
-
- /**
- * Retrieves the set of attachments defined for this operation, as a
- * mapping between the attachment name and the associated object.
- *
- * @return The set of attachments defined for this operation.
- */
- public Map<String,Object> getAttachments();
-
-
-
- /**
- * Retrieves the attachment with the specified name.
- *
- * @param name The name for the attachment to retrieve. It will
- * be treated in a case-sensitive manner.
- *
- * @return The requested attachment object, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object getAttachment(String name);
-
-
-
- /**
- * Removes the attachment with the specified name.
- *
- * @param name The name for the attachment to remove. It will be
- * treated in a case-sensitive manner.
- *
- * @return The attachment that was removed, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object removeAttachment(String name);
-
-
-
- /**
- * Sets the value of the specified attachment. If an attachment
- * already exists with the same name, it will be replaced.
- * Otherwise, a new attachment will be added.
- *
- * @param name The name to use for the attachment.
- * @param value The value to use for the attachment.
- *
- * @return The former value held by the attachment with the given
- * name, or <CODE>null</CODE> if there was previously no
- * such attachment.
- */
- public Object setAttachment(String name, Object value);
-
-
-
- /**
- * Retrieves the time that processing started for this operation.
- *
- * @return The time that processing started for this operation.
- */
- public long getProcessingStartTime();
-
-
-
- /**
- * Retrieves the cancel request that has been issued for this
- * operation, if there is one.
- *
- * @return The cancel request that has been issued for this
- * operation, or <CODE>null</CODE> if there has not been
- * any request to cancel.
- */
- public CancelRequest getCancelRequest();
-
-
-
- /**
- * Retrieves a string representation of this operation.
- *
- * @return A string representation of this operation.
- */
- public String toString();
-
-
-
- /**
- * Appends a string representation of this operation to the provided
- * buffer.
- *
- * @param buffer The buffer into which a string representation of
- * this operation should be appended.
- */
- public void toString(StringBuilder buffer);
}
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseOperation.java b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseOperation.java
index 1ca15e3..95098bc 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/operation/PreParseOperation.java
@@ -29,14 +29,10 @@
import java.util.List;
-import java.util.Map;
-import org.opends.server.api.ClientConnection;
-import org.opends.server.types.CancelRequest;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
-import org.opends.server.types.OperationType;
import org.opends.server.types.ResultCode;
@@ -48,68 +44,9 @@
* is not intended to be implemented by any custom classes.
*/
public interface PreParseOperation
+ extends PluginOperation
{
/**
- * Retrieves the operation type for this operation.
- *
- * @return The operation type for this operation.
- */
- public OperationType getOperationType();
-
-
-
- /**
- * Retrieves the client connection with which this operation is
- * associated.
- *
- * @return The client connection with which this operation is
- * associated.
- */
- public ClientConnection getClientConnection();
-
-
-
- /**
- * Retrieves the unique identifier that is assigned to the client
- * connection that submitted this operation.
- *
- * @return The unique identifier that is assigned to the client
- * connection that submitted this operation.
- */
- public long getConnectionID();
-
-
-
- /**
- * Retrieves the operation ID for this operation.
- *
- * @return The operation ID for this operation.
- */
- public long getOperationID();
-
-
-
- /**
- * Retrieves the message ID assigned to this operation.
- *
- * @return The message ID assigned to this operation.
- */
- public int getMessageID();
-
-
-
- /**
- * Retrieves the set of controls included in the request from the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls included in the request from the
- * client.
- */
- public List<Control> getRequestControls();
-
-
-
- /**
* Adds the provided control to the set of request controls for this
* operation.
*
@@ -132,17 +69,6 @@
/**
- * Retrieves the set of controls to include in the response to the
- * client. The contents of this list must not be altered.
- *
- * @return The set of controls to include in the response to the
- * client.
- */
- public List<Control> getResponseControls();
-
-
-
- /**
* Adds the provided control to the set of controls to include in
* the response to the client.
*
@@ -303,120 +229,5 @@
* elements.
*/
public void setResponseData(DirectoryException directoryException);
-
-
-
- /**
- * Indicates whether this is an internal operation rather than one
- * that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is an internal operation, or
- * <CODE>false</CODE> if it is not.
- */
- public boolean isInternalOperation();
-
-
-
- /**
- * Indicates whether this is a synchronization operation rather than
- * one that was requested by an external client.
- *
- * @return <CODE>true</CODE> if this is a data synchronization
- * operation, or <CODE>false</CODE> if it is not.
- */
- public boolean isSynchronizationOperation();
-
-
-
- /**
- * Retrieves the set of attachments defined for this operation, as a
- * mapping between the attachment name and the associated object.
- *
- * @return The set of attachments defined for this operation.
- */
- public Map<String,Object> getAttachments();
-
-
-
- /**
- * Retrieves the attachment with the specified name.
- *
- * @param name The name for the attachment to retrieve. It will
- * be treated in a case-sensitive manner.
- *
- * @return The requested attachment object, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object getAttachment(String name);
-
-
-
- /**
- * Removes the attachment with the specified name.
- *
- * @param name The name for the attachment to remove. It will be
- * treated in a case-sensitive manner.
- *
- * @return The attachment that was removed, or <CODE>null</CODE> if
- * it does not exist.
- */
- public Object removeAttachment(String name);
-
-
-
- /**
- * Sets the value of the specified attachment. If an attachment
- * already exists with the same name, it will be replaced.
- * Otherwise, a new attachment will be added.
- *
- * @param name The name to use for the attachment.
- * @param value The value to use for the attachment.
- *
- * @return The former value held by the attachment with the given
- * name, or <CODE>null</CODE> if there was previously no
- * such attachment.
- */
- public Object setAttachment(String name, Object value);
-
-
-
- /**
- * Retrieves the time that processing started for this operation.
- *
- * @return The time that processing started for this operation.
- */
- public long getProcessingStartTime();
-
-
-
- /**
- * Retrieves the cancel request that has been issued for this
- * operation, if there is one.
- *
- * @return The cancel request that has been issued for this
- * operation, or <CODE>null</CODE> if there has not been
- * any request to cancel.
- */
- public CancelRequest getCancelRequest();
-
-
-
- /**
- * Retrieves a string representation of this operation.
- *
- * @return A string representation of this operation.
- */
- public String toString();
-
-
-
- /**
- * Appends a string representation of this operation to the provided
- * buffer.
- *
- * @param buffer The buffer into which a string representation of
- * this operation should be appended.
- */
- public void toString(StringBuilder buffer);
}
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java
index 46242ae..641de1e 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/DisconnectClientPlugin.java
@@ -158,8 +158,7 @@
public PreParsePluginResult
doPreParse(PreParseAbandonOperation abandonOperation)
{
- if (disconnectInternal(abandonOperation.getClientConnection(),
- abandonOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(abandonOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -177,8 +176,7 @@
@Override()
public PreParsePluginResult doPreParse(PreParseAddOperation addOperation)
{
- if (disconnectInternal(addOperation.getClientConnection(),
- addOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(addOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -196,8 +194,7 @@
@Override()
public PreParsePluginResult doPreParse(PreParseBindOperation bindOperation)
{
- if (disconnectInternal(bindOperation.getClientConnection(),
- bindOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(bindOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -216,8 +213,7 @@
public PreParsePluginResult
doPreParse(PreParseCompareOperation compareOperation)
{
- if (disconnectInternal(compareOperation.getClientConnection(),
- compareOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(compareOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -236,8 +232,7 @@
public PreParsePluginResult
doPreParse(PreParseDeleteOperation deleteOperation)
{
- if (disconnectInternal(deleteOperation.getClientConnection(),
- deleteOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(deleteOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -256,8 +251,7 @@
public PreParsePluginResult
doPreParse(PreParseExtendedOperation extendedOperation)
{
- if (disconnectInternal(extendedOperation.getClientConnection(),
- extendedOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(extendedOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -276,8 +270,7 @@
public PreParsePluginResult
doPreParse(PreParseModifyOperation modifyOperation)
{
- if (disconnectInternal(modifyOperation.getClientConnection(),
- modifyOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(modifyOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -296,8 +289,7 @@
public PreParsePluginResult
doPreParse(PreParseModifyDNOperation modifyDNOperation)
{
- if (disconnectInternal(modifyDNOperation.getClientConnection(),
- modifyDNOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(modifyDNOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -316,8 +308,7 @@
public PreParsePluginResult
doPreParse(PreParseSearchOperation searchOperation)
{
- if (disconnectInternal(searchOperation.getClientConnection(),
- searchOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(searchOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -336,8 +327,7 @@
public PreParsePluginResult
doPreParse(PreParseUnbindOperation unbindOperation)
{
- if (disconnectInternal(unbindOperation.getClientConnection(),
- unbindOperation.getRequestControls(), "PreParse"))
+ if (disconnectInternal(unbindOperation, "PreParse"))
{
return new PreParsePluginResult(true, false, false);
}
@@ -356,8 +346,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationAddOperation addOperation)
{
- if (disconnectInternal(addOperation.getClientConnection(),
- addOperation.getRequestControls(), "PreOperation"))
+ if (disconnectInternal(addOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -376,8 +365,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationBindOperation bindOperation)
{
- if (disconnectInternal(bindOperation.getClientConnection(),
- bindOperation.getRequestControls(), "PreOperation"))
+ if (disconnectInternal(bindOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -396,9 +384,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationCompareOperation compareOperation)
{
- if (disconnectInternal(compareOperation.getClientConnection(),
- compareOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(compareOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -417,9 +403,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationDeleteOperation deleteOperation)
{
- if (disconnectInternal(deleteOperation.getClientConnection(),
- deleteOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(deleteOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -438,9 +422,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationExtendedOperation extendedOperation)
{
- if (disconnectInternal(extendedOperation.getClientConnection(),
- extendedOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(extendedOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -459,9 +441,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationModifyOperation modifyOperation)
{
- if (disconnectInternal(modifyOperation.getClientConnection(),
- modifyOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(modifyOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -480,9 +460,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationModifyDNOperation modifyDNOperation)
{
- if (disconnectInternal(modifyDNOperation.getClientConnection(),
- modifyDNOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(modifyDNOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -501,9 +479,7 @@
public PreOperationPluginResult
doPreOperation(PreOperationSearchOperation searchOperation)
{
- if (disconnectInternal(searchOperation.getClientConnection(),
- searchOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(searchOperation, "PreOperation"))
{
return new PreOperationPluginResult(true, false, false);
}
@@ -522,9 +498,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationAbandonOperation abandonOperation)
{
- if (disconnectInternal(abandonOperation.getClientConnection(),
- abandonOperation.getRequestControls(),
- "PreOperation"))
+ if (disconnectInternal(abandonOperation, "PreOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -543,8 +517,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationAddOperation addOperation)
{
- if (disconnectInternal(addOperation.getClientConnection(),
- addOperation.getRequestControls(), "PostOperation"))
+ if (disconnectInternal(addOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -563,8 +536,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationBindOperation bindOperation)
{
- if (disconnectInternal(bindOperation.getClientConnection(),
- bindOperation.getRequestControls(), "PostOperation"))
+ if (disconnectInternal(bindOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -583,9 +555,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationCompareOperation compareOperation)
{
- if (disconnectInternal(compareOperation.getClientConnection(),
- compareOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(compareOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -604,9 +574,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationDeleteOperation deleteOperation)
{
- if (disconnectInternal(deleteOperation.getClientConnection(),
- deleteOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(deleteOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -625,9 +593,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationExtendedOperation extendedOperation)
{
- if (disconnectInternal(extendedOperation.getClientConnection(),
- extendedOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(extendedOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -646,9 +612,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationModifyOperation modifyOperation)
{
- if (disconnectInternal(modifyOperation.getClientConnection(),
- modifyOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(modifyOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -667,9 +631,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationModifyDNOperation modifyDNOperation)
{
- if (disconnectInternal(modifyDNOperation.getClientConnection(),
- modifyDNOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(modifyDNOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -688,9 +650,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationSearchOperation searchOperation)
{
- if (disconnectInternal(searchOperation.getClientConnection(),
- searchOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(searchOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -709,9 +669,7 @@
public PostOperationPluginResult
doPostOperation(PostOperationUnbindOperation unbindOperation)
{
- if (disconnectInternal(unbindOperation.getClientConnection(),
- unbindOperation.getRequestControls(),
- "PostOperation"))
+ if (disconnectInternal(unbindOperation, "PostOperation"))
{
return new PostOperationPluginResult(true, false);
}
@@ -730,8 +688,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseAddOperation addOperation)
{
- if (disconnectInternal(addOperation.getClientConnection(),
- addOperation.getRequestControls(), "PostResponse"))
+ if (disconnectInternal(addOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -750,8 +707,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseBindOperation bindOperation)
{
- if (disconnectInternal(bindOperation.getClientConnection(),
- bindOperation.getRequestControls(), "PostResponse"))
+ if (disconnectInternal(bindOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -770,9 +726,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseCompareOperation compareOperation)
{
- if (disconnectInternal(compareOperation.getClientConnection(),
- compareOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(compareOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -791,9 +745,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseDeleteOperation deleteOperation)
{
- if (disconnectInternal(deleteOperation.getClientConnection(),
- deleteOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(deleteOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -812,9 +764,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseExtendedOperation extendedOperation)
{
- if (disconnectInternal(extendedOperation.getClientConnection(),
- extendedOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(extendedOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -833,9 +783,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseModifyOperation modifyOperation)
{
- if (disconnectInternal(modifyOperation.getClientConnection(),
- modifyOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(modifyOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -854,9 +802,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseModifyDNOperation modifyDNOperation)
{
- if (disconnectInternal(modifyDNOperation.getClientConnection(),
- modifyDNOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(modifyDNOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -875,9 +821,7 @@
public PostResponsePluginResult
doPostResponse(PostResponseSearchOperation searchOperation)
{
- if (disconnectInternal(searchOperation.getClientConnection(),
- searchOperation.getRequestControls(),
- "PostResponse"))
+ if (disconnectInternal(searchOperation, "PostResponse"))
{
return new PostResponsePluginResult(true, false);
}
@@ -899,10 +843,10 @@
* @return <CODE>true</CODE> if the client connection was terminated, or
* <CODE>false</CODE> if it was not.
*/
- private boolean disconnectInternal(ClientConnection clientConnection,
- List<Control> requestControls,
+ private boolean disconnectInternal(PluginOperation operation,
String section)
{
+ List<Control> requestControls = operation.getRequestControls();
if (requestControls != null)
{
for (Control c : requestControls)
@@ -911,7 +855,7 @@
{
if (c.getValue().stringValue().equalsIgnoreCase(section))
{
- clientConnection.disconnect(DisconnectReason.CLOSED_BY_PLUGIN, true,
+ operation.disconnectClient(DisconnectReason.CLOSED_BY_PLUGIN, true,
"Closed by disconnect client plugin (section " + section + ")",
-1);
--
Gitblit v1.10.0