From 7066ee5065f5b90b61c1720d0f2859e1661e1397 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 02 Aug 2006 06:30:27 +0000
Subject: [PATCH] Add methods to various operations in order to get the target entry (or, in the case of modify and modify DN operations, both the before and after entries). The entries will not be available for use in pre-parse plugins, and in some cases they may not be available for conflict resolution synchronization processing.

---
 opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperation.java   |   22 +++++++
 opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperation.java |   46 ++++++++++++++
 opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperation.java   |   22 +++++++
 opendj-sdk/opends/src/server/org/opends/server/core/AddOperation.java      |   24 +++++++
 opendj-sdk/opends/src/server/org/opends/server/core/CompareOperation.java  |   22 +++++++
 5 files changed, 130 insertions(+), 6 deletions(-)

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 c3ff384..c5d8808 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
@@ -116,6 +116,9 @@
   // The processed DN of the entry to add.
   private DN entryDN;
 
+  // The entry being added to the server.
+  private Entry entry;
+
   // The set of attributes (including the objectclass attribute) in a raw,
   // unprocessed form as provided in the request.  One or more of these
   // attributes may be invalid.
@@ -178,6 +181,7 @@
 
     responseControls      = new ArrayList<Control>();
     cancelRequest         = null;
+    entry                 = null;
     entryDN               = null;
     userAttributes        = null;
     operationalAttributes = null;
@@ -226,6 +230,8 @@
     this.userAttributes        = userAttributes;
     this.operationalAttributes = operationalAttributes;
 
+    entry = null;
+
     rawEntryDN = new ASN1OctetString(entryDN.toString());
 
     rawAttributes = new ArrayList<LDAPAttribute>();
@@ -445,6 +451,23 @@
 
 
   /**
+   * Retrieves the entry to be added to the server.  Note that this will not be
+   * available to pre-parse plugins or during the conflict resolution portion of
+   * the synchronization processing.
+   *
+   * @return  The entry to be added to the server, or <CODE>null</CODE> if it is
+   *          not yet available.
+   */
+  public Entry getEntryToAdd()
+  {
+    assert debugEnter(CLASS_NAME, "getEntryToAdd");
+
+    return entry;
+  }
+
+
+
+  /**
    * Retrieves the time that processing started for this operation.
    *
    * @return  The time that processing started for this operation.
@@ -667,7 +690,6 @@
     // Start the processing timer.
     processingStartTime = System.currentTimeMillis();
     setResultCode(ResultCode.UNDEFINED);
-    Entry entry = null;
 
 
     // Check for and handle a request to cancel this operation.
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 13c71f5..cd15438 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
@@ -95,6 +95,9 @@
   // The DN of the entry for the compare operation.
   private DN entryDN;
 
+  // The entry to be compared.
+  private Entry entry;
+
   // The set of response controls for this compare operation.
   private List<Control> responseControls;
 
@@ -148,6 +151,7 @@
     this.assertionValue   = assertionValue;
 
     responseControls = new ArrayList<Control>();
+    entry            = null;
     entryDN          = null;
     attributeType    = null;
     cancelRequest    = null;
@@ -195,6 +199,7 @@
     rawEntryDN       = new ASN1OctetString(entryDN.toString());
     rawAttributeType = attributeType.getNameOrOID();
     cancelRequest    = null;
+    entry            = null;
   }
 
 
@@ -344,6 +349,22 @@
 
 
   /**
+   * Retrieves the entry to target with the compare operation.  It will not be
+   * available to pre-parse plugins.
+   *
+   * @return  The entry to target with the compare operation, or
+   *          <CODE>null</CODE> if the entry is not yet available.
+   */
+  public Entry getEntryToCompare()
+  {
+    assert debugEnter(CLASS_NAME, "getEntryToCompare");
+
+    return entry;
+  }
+
+
+
+  /**
    * Retrieves the time that processing started for this operation.
    *
    * @return  The time that processing started for this operation.
@@ -697,7 +718,6 @@
       try
       {
         // Get the entry.  If it does not exist, then fail.
-        Entry entry = null;
         try
         {
           entry = DirectoryServer.getEntry(entryDN);
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 4787692..f052974 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
@@ -94,6 +94,9 @@
   // The DN of the entry for the delete operation.
   private DN entryDN;
 
+  // The entry to be deleted.
+  private Entry entry;
+
   // The set of response controls for this delete operation.
   private List<Control> responseControls;
 
@@ -134,6 +137,7 @@
 
     this.rawEntryDN = rawEntryDN;
 
+    entry            = null;
     entryDN          = null;
     responseControls = new ArrayList<Control>();
     cancelRequest    = null;
@@ -171,6 +175,7 @@
     responseControls = new ArrayList<Control>();
     cancelRequest    = null;
     changeNumber     = -1;
+    entry            = null;
   }
 
 
@@ -244,6 +249,22 @@
 
 
   /**
+   * Retrieves the entry to be deleted.  This will not be available to pre-parse
+   * plugins.
+   *
+   * @return  The entry to be deleted, or <CODE>null</CODE> if the entry is not
+   *          yet available.
+   */
+  public Entry getEntryToDelete()
+  {
+    assert debugEnter(CLASS_NAME, "getEntryToDelete");
+
+    return entry;
+  }
+
+
+
+  /**
    * Retrieves the time that processing started for this operation.
    *
    * @return  The time that processing started for this operation.
@@ -463,7 +484,6 @@
     assert debugEnter(CLASS_NAME, "run");
 
     setResultCode(ResultCode.UNDEFINED);
-    Entry entry = null;
 
 
     // Get the plugin config manager that will be used for invoking plugins.
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 7307842..2a91f81 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
@@ -117,6 +117,12 @@
   // The new parent for the entry.
   private DN newSuperior;
 
+  // The current entry, before it is renamed.
+  private Entry currentEntry;
+
+  // The new entry, as it will appear after it has been renamed.
+  private Entry newEntry;
+
   // The set of response controls for this modify DN operation.
   private List<Control> responseControls;
 
@@ -188,6 +194,8 @@
     cancelRequest    = null;
     modifications    = null;
     changeNumber     = -1;
+    currentEntry     = null;
+    newEntry         = null;
   }
 
 
@@ -249,6 +257,8 @@
     cancelRequest    = null;
     modifications    = null;
     changeNumber     = -1;
+    currentEntry     = null;
+    newEntry         = null;
   }
 
 
@@ -523,6 +533,40 @@
 
 
   /**
+   * Retrieves the current entry, before it is renamed.  This will not be
+   * available to pre-parse plugins or during the conflict resolution portion of
+   * the synchronization processing.
+   *
+   * @return  The current entry, or <CODE>null</CODE> if it is not yet
+   *           available.
+   */
+  public Entry getOriginalEntry()
+  {
+    assert debugEnter(CLASS_NAME, "getOriginalEntry");
+
+    return currentEntry;
+  }
+
+
+
+  /**
+   * Retrieves the new entry, as it will appear after it is renamed.  This will
+   * not be  available to pre-parse plugins or during the conflict resolution
+   * portion of the synchronization processing.
+   *
+   * @return  The updated entry, or <CODE>null</CODE> if it is not yet
+   *           available.
+   */
+  public Entry getUpdatedEntry()
+  {
+    assert debugEnter(CLASS_NAME, "getUpdatedEntry");
+
+    return newEntry;
+  }
+
+
+
+  /**
    * Retrieves the time that processing started for this operation.
    *
    * @return  The time that processing started for this operation.
@@ -755,8 +799,6 @@
     assert debugEnter(CLASS_NAME, "run");
 
     setResultCode(ResultCode.UNDEFINED);
-    Entry currentEntry = null;
-    Entry newEntry     = null;
 
 
     // Get the plugin config manager that will be used for invoking plugins.
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 75d9b59..f48d289 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
@@ -106,6 +106,9 @@
   // The DN of the entry for the modify operation.
   private DN entryDN;
 
+  // The current entry, before any changes are applied.
+  private Entry currentEntry;
+
   // The modified entry that will be stored in the backend.
   private Entry modifiedEntry;
 
@@ -168,6 +171,7 @@
 
     entryDN          = null;
     modifications    = null;
+    currentEntry     = null;
     modifiedEntry    = null;
     responseControls = new ArrayList<Control>();
     cancelRequest    = null;
@@ -218,6 +222,7 @@
                                     new LDAPAttribute(m.getAttribute())));
     }
 
+    currentEntry     = null;
     modifiedEntry    = null;
     responseControls = new ArrayList<Control>();
     cancelRequest    = null;
@@ -368,6 +373,22 @@
 
 
   /**
+   * Retrieves the current entry before any modifications are applied.  This
+   * will not be available to pre-parse plugins.
+   *
+   * @return  The current entry, or <CODE>null</CODE> if it is not yet
+   *          available.
+   */
+  public Entry getCurrentEntry()
+  {
+    assert debugEnter(CLASS_NAME, "getCurrentEntry");
+
+    return currentEntry;
+  }
+
+
+
+  /**
    * Retrieves the modified entry that is to be written to the backend.  This
    * will be available to pre-operation plugins, and if such a plugin does make
    * a change to this entry, then it is also necessary to add that change to
@@ -605,7 +626,6 @@
     assert debugEnter(CLASS_NAME, "run");
 
     setResultCode(ResultCode.UNDEFINED);
-    Entry currentEntry = null;
 
 
     // Get the plugin config manager that will be used for invoking plugins.

--
Gitblit v1.10.0