From d2bbcac0b2a6f7772d444ce7081ee984085ae95a Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 17 Jul 2009 00:45:21 +0000
Subject: [PATCH] Update some messages to avoid using the term 'OpenDS'.  This helps to make productization easier. Change the name of the return code CANCELLED to CANCELED to be consistent with the rest of the code.. When we start the server, use the administration port to connect to the server instead of the LDAP port, since we know that there is always an administration port but not necessarily an LDAP port.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Configuration.java |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Configuration.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
index 18de8db..6287b07 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Configuration.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Copyright 2006-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.quicksetup;
@@ -96,6 +96,18 @@
   }
 
   /**
+   * Provides the administration port as is specified in the config.ldif file.
+   *
+   * @return the administration port specified in the config.ldif file.
+   * @throws IOException if there were problems reading the information from
+   * the configuration file.
+   */
+  public int getAdminConnectorPort() throws IOException
+  {
+    return getAdminConnectorPort("ds-cfg-listen-port");
+  }
+
+  /**
    * Tells whether this server is configured as a replication server or not.
    * @return <CODE>true</CODE> if the server is configured as a Replication
    * Server and <CODE>false</CODE> otherwise.
@@ -182,6 +194,33 @@
     return port;
   }
 
+  private int getAdminConnectorPort(String portAttr) throws IOException {
+    int port = -1;
+    String contents = getLowerCaseContents();
+    int index = contents.indexOf("cn=administration connector");
+
+    if (index != -1) {
+      String attrWithPoints = portAttr + ":";
+      int index1 = contents.indexOf(attrWithPoints, index);
+      if (index1 != -1) {
+        int index2 =
+                contents.indexOf(Constants.LINE_SEPARATOR, index1);
+        if (index2 != -1) {
+          String sPort =
+                  contents.substring(attrWithPoints.length() +
+                          index1,
+                          index2).trim();
+          try {
+            port = Integer.parseInt(sPort);
+          } catch (NumberFormatException nfe) {
+            // do nothing;
+          }
+        }
+      }
+    }
+    return port;
+  }
+
   /**
    * Indicates whether the config.ldif file has been modified (compared to what
    * we had in the zip file). This is used to know if we have configured the

--
Gitblit v1.10.0