From c9d828643471890c2812f7d959a98ea8cb135fb8 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Mon, 02 Apr 2007 15:07:10 +0000
Subject: [PATCH] further refactorings to delegate application logic to Application classes in addition to basic upgrade tool implementation classes and scripts
---
opends/src/quicksetup/org/opends/quicksetup/UserData.java | 65 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/UserData.java b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
index d47efa2..18cb4d2 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/UserData.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -27,6 +27,9 @@
package org.opends.quicksetup;
+import org.opends.quicksetup.util.Utils;
+import org.opends.server.util.SetupUtils;
+
/**
* Represents user specified input data to an application.
*/
@@ -42,6 +45,25 @@
private boolean stopServer;
/**
+ * Creates a user data object with default values.
+ */
+ public UserData() {
+ DataOptions defaultDataOptions = new DefaultDataOptions();
+
+ setServerLocation(Utils.getDefaultServerLocation());
+ // See what we can propose as port
+ int defaultPort = getDefaultPort();
+ if (defaultPort != -1)
+ {
+ setServerPort(defaultPort);
+ }
+
+ setDirectoryManagerDn("cn=Directory Manager");
+
+ setDataOptions(defaultDataOptions);
+ }
+
+ /**
* Sets the location of the server (installation path).
* @param serverLocation the new server location (installation path).
*/
@@ -193,4 +215,47 @@
{
return stopServer;
}
+
+ /**
+ * Provides the port that will be proposed to the user in the second page of
+ * the installation wizard. It will check whether we can use 389 and if not it
+ * will return -1.
+ *
+ * @return the port 389 if it is available and we can use and -1 if not.
+ */
+ static public int getDefaultPort()
+ {
+ int defaultPort = -1;
+
+ for (int i=0;i<10000 && (defaultPort == -1);i+=1000)
+ {
+ int port = i + 389;
+ if (Utils.canUseAsPort(port))
+ {
+ defaultPort = port;
+ }
+ }
+ return defaultPort;
+ }
+
+ /**
+ * Provides the port that will be used by default for JMX.
+ *
+ * @return the port X689 if it is available and we can use and -1 if not.
+ */
+ static public int getDefaultJMXPort()
+ {
+ int defaultJMXPort = -1;
+
+ for (int i=0;i<65000 && (defaultJMXPort == -1);i+=1000)
+ {
+ int port = i + SetupUtils.getDefaultJMXPort();
+ if (Utils.canUseAsPort(port))
+ {
+ defaultJMXPort = port;
+ }
+ }
+ return defaultJMXPort;
+ }
+
}
--
Gitblit v1.10.0