From 1fbc9df5d0c44ae72c76dacc3c945d4f0d641ee6 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 22 Dec 2009 05:55:54 +0000
Subject: [PATCH] Initial implementation of fail over connection factory
---
sdk/src/org/opends/sdk/ldap/LDAPConnectionOptions.java | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/sdk/src/org/opends/sdk/ldap/LDAPConnectionOptions.java b/sdk/src/org/opends/sdk/ldap/LDAPConnectionOptions.java
index 1267b96..323a27d 100644
--- a/sdk/src/org/opends/sdk/ldap/LDAPConnectionOptions.java
+++ b/sdk/src/org/opends/sdk/ldap/LDAPConnectionOptions.java
@@ -32,6 +32,9 @@
import javax.net.ssl.SSLContext;
import org.opends.sdk.schema.Schema;
+import org.opends.sdk.requests.SearchRequest;
+import org.opends.sdk.requests.Requests;
+import org.opends.sdk.SearchScope;
import com.sun.opends.sdk.util.Validator;
@@ -42,12 +45,18 @@
*/
public final class LDAPConnectionOptions
{
+ private static final SearchRequest DEFAULT_PING = Requests
+ .newSearchRequest("", SearchScope.BASE_OBJECT, "(objectClass=*)",
+ "1.1");
+
private Schema schema = Schema.getDefaultSchema();
private SSLContext sslContext = null;
private boolean useStartTLS = false;
+ private SearchRequest pingRequest = DEFAULT_PING;
+
/**
@@ -197,7 +206,29 @@
return this;
}
+ /**
+ * Retrieves the search request used to verify the validity of a
+ * LDAP connection. By default, the root DSE is retrieved without any
+ * attributes.
+ *
+ * @return The search request.
+ */
+ public SearchRequest getPingRequest()
+ {
+ return pingRequest;
+ }
+ /**
+ * Sets the search request used to verify the validity of a
+ * LDAP connection.
+ *
+ * @param pingRequest The search request that can be used to verify the
+ * validity of a LDAP connection.
+ */
+ public void setPingRequest(SearchRequest pingRequest)
+ {
+ this.pingRequest = pingRequest;
+ }
// Assigns the provided options to this set of options.
LDAPConnectionOptions assign(LDAPConnectionOptions options)
--
Gitblit v1.10.0