From fc649ad091ca53cbb9798ab193f0e36695abe825 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 09 May 2007 20:41:56 +0000
Subject: [PATCH] Update the DSML gateway so that it properly treats the request ID as an optional element rather than required.  Also, update the DSML search processing code to be a little more forgiving when it comes to the search scope and deref policy strings.

---
 opends/src/dsml/org/opends/dsml/protocol/DSMLServlet.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/opends/src/dsml/org/opends/dsml/protocol/DSMLServlet.java b/opends/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
index f59e435..2e1144f 100644
--- a/opends/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
+++ b/opends/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
@@ -65,6 +65,7 @@
   private static final String PORT = "ldap.port";
   private static final String HOST = "ldap.host";
   private static final long serialVersionUID = -3748022009593442973L;
+  private static final AtomicInteger nextMessageID = new AtomicInteger(1);
 
   private Unmarshaller unmarshaller;
   private Marshaller marshaller;
@@ -303,7 +304,7 @@
       }
     } finally {
       if (connection != null) {
-        connection.close(new AtomicInteger(1));
+        connection.close(nextMessageID);
       }
     }
   }
@@ -347,5 +348,25 @@
     reply.writeTo(os);
     os.flush();
   }
+
+
+
+  /**
+   * Retrieves a message ID that may be used for the next LDAP message sent to
+   * the Directory Server.
+   *
+   * @return  A message ID that may be used for the next LDAP message sent to
+   *          the Directory Server.
+   */
+  public static int nextMessageID()
+  {
+    int nextID = nextMessageID.getAndIncrement();
+    if (nextID == Integer.MAX_VALUE)
+    {
+      nextMessageID.set(1);
+    }
+
+    return nextID;
+  }
 }
 

--
Gitblit v1.10.0