From 7efc6f92f5937fb085bb0b72b09214cd79600b8f Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Thu, 03 Apr 2014 15:21:56 +0000
Subject: [PATCH] Checkpoint for OPENDJ-1303 "opendj-cli" - Moved AuthenticatedConnectionFactory from tools to cli. -- Undo modifications on tools about abstract authenticated connection factory. (and deleted the file) -- Deleted the file from the tools. - Added functions to opendj-cli Utils. - Trivial code cleanup.
---
opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
index e2e3d4c..d93be76 100644
--- a/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
+++ b/opendj-sdk/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -51,6 +51,8 @@
import javax.net.ssl.SSLHandshakeException;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.RDN;
/**
* This class provides utility functions for all the client side tools.
@@ -510,4 +512,31 @@
private Utils() {
// Do nothing.
}
+
+ /**
+ * Returns {@code true} if the the provided string is a DN and {@code false} otherwise.
+ *
+ * @param dn
+ * the String we are analyzing.
+ * @return {@code true} if the the provided string is a DN and {@code false} otherwise.
+ */
+ public static boolean isDN(String dn) {
+ try {
+ DN.valueOf(dn);
+ } catch (Exception ex) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the DN of the global administrator for a given UID.
+ *
+ * @param uid
+ * The UID to be used to generate the DN.
+ * @return The DN of the administrator for the given UID.
+ */
+ private static String getAdministratorDN(String uid) {
+ return "cn=" + RDN.valueOf(uid) + ",cn=Administrators, cn=admin data";
+ }
}
--
Gitblit v1.10.0