From 999f5e9565f119253a6f23e98aa0732aa1cc69ad Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 30 Apr 2007 13:10:57 +0000
Subject: [PATCH] Refactor some code:
---
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java | 41 +++
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 31 +-
/dev/null | 391 ------------------------------
opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java | 18
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java | 43 +-
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 8
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java | 2
opends/src/quicksetup/org/opends/quicksetup/Installation.java | 27 +-
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java | 4
opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java | 23
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 109 ++++---
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java | 40 --
12 files changed, 185 insertions(+), 552 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index 281e5c4..5a79706 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -342,10 +342,10 @@
* configuration is stored in config/upgrade/config.ldif.[svn rev].
*
* @return Configuration object representing the base configuration.
- * @throws QuickSetupException if there was a problem determining the
+ * @throws ApplicationException if there was a problem determining the
* svn rev number.
*/
- public Configuration getBaseConfiguration() throws QuickSetupException {
+ public Configuration getBaseConfiguration() throws ApplicationException {
if (baseConfiguration == null) {
baseConfiguration = new Configuration(getBaseConfigurationFile());
}
@@ -390,10 +390,10 @@
* customizations.
*
* @return File object with no
- * @throws QuickSetupException if there was a problem determining the
+ * @throws ApplicationException if there was a problem determining the
* svn revision number
*/
- public File getBaseSchemaFile() throws QuickSetupException {
+ public File getBaseSchemaFile() throws ApplicationException {
return new File(getConfigurationUpgradeDirectory(),
"schema.ldif." + getSvnRev().toString());
}
@@ -404,10 +404,10 @@
* customizations.
*
* @return File object with no
- * @throws QuickSetupException if there was a problem determining the
+ * @throws ApplicationException if there was a problem determining the
* svn revision number
*/
- public File getBaseConfigurationFile() throws QuickSetupException {
+ public File getBaseConfigurationFile() throws ApplicationException {
return new File(getConfigurationUpgradeDirectory(),
BASE_CONFIG_FILE_PREFIX + getSvnRev().toString());
}
@@ -417,10 +417,10 @@
* configuration file config/upgrade/config.ldif.[svn rev #].
*
* @return Integer representing the svn number
- * @throws QuickSetupException if for some reason the number could not
+ * @throws ApplicationException if for some reason the number could not
* be determined
*/
- public Integer getSvnRev() throws QuickSetupException {
+ public Integer getSvnRev() throws ApplicationException {
Integer rev = null;
File configUpgradeDir = getConfigurationUpgradeDirectory();
if (configUpgradeDir.exists()) {
@@ -448,8 +448,9 @@
}
if (rev == null) {
// TODO: i18n
- throw new QuickSetupException(QuickSetupException.Type.FILE_SYSTEM_ERROR,
- "Could not determine SVN rev", null);
+ throw new ApplicationException(
+ ApplicationException.Type.FILE_SYSTEM_ERROR,
+ "Could not determine SVN rev", null);
}
return rev;
}
@@ -457,9 +458,9 @@
/**
* Gets the build ID which is the 14 digit number code like 20070420110336.
* @return String representing the build ID
- * @throws QuickSetupException if something goes wrong
+ * @throws ApplicationException if something goes wrong
*/
- public String getBuildId() throws QuickSetupException {
+ public String getBuildId() throws ApplicationException {
if (buildId == null) {
List<String> args = new ArrayList<String>();
args.add(Utils.getPath(getServerStartCommandFile()));
@@ -479,7 +480,7 @@
}
}
} catch (IOException e) {
- throw new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ throw new ApplicationException(ApplicationException.Type.START_ERROR,
"Error attempting to determine build ID", e);
} finally {
if (is != null) {
diff --git a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupException.java b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupException.java
deleted file mode 100644
index 49dc8fa..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupException.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup;
-
-/**
- * This exception is used to encapsulate all the error that we might have
- * during the installation.
- */
-public class QuickSetupException extends Exception
-{
- private static final long serialVersionUID = -3527273444231560341L;
-
- private Type type;
-
- /**
- * This enum contains the different type of QuickSetupException that we can
- * have.
- *
- */
- public enum Type
- {
- /**
- * Error related to file system error: IOException writing files, permission
- * errors, etc.
- */
- FILE_SYSTEM_ERROR,
- /**
- * Error downloading jar files from web start server. This is specific
- * to the web start installation.
- */
- DOWNLOAD_ERROR,
- /**
- * Error during the configuration of the Directory Server.
- */
- CONFIGURATION_ERROR,
- /**
- * Error during the import of data (base entry, from LDIF file or
- * automatically generated data).
- */
- IMPORT_ERROR,
- /**
- * Error starting the Open DS server.
- */
- START_ERROR,
- /**
- * Error enabling the Windows service.
- */
- WINDOWS_SERVICE_ERROR,
- /**
- * A bug (for instance when we throw an IllegalStateException).
- */
- BUG
- };
-
- /**
- * The constructor of the QuickSetupException.
- * @param type the type of error we have.
- * @param localizedMsg a localized string describing the problem.
- * @param rootCause the root cause of this exception.
- */
- public QuickSetupException(Type type,
- String localizedMsg,
- Throwable rootCause)
- {
- super(localizedMsg, rootCause);
- this.type = type;
- }
-
- /**
- * Returns the Type of this exception.
- * @return the Type of this exception.
- */
- public Type getType()
- {
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString()
- {
- return getMessage();
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 744e594..120e9d5 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -576,9 +576,9 @@
* the base dn and the number of entries to be generated.
*
* @return the file object pointing to the create template file.
- * @throws QuickSetupException if an error occurs.
+ * @throws ApplicationException if an error occurs.
*/
- protected File createTemplateFile() throws QuickSetupException {
+ protected File createTemplateFile() throws ApplicationException {
try
{
return SetupUtils.createTemplateFile(
@@ -588,17 +588,17 @@
catch (IOException ioe)
{
String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe);
- throw new QuickSetupException(QuickSetupException.Type.FILE_SYSTEM_ERROR,
- failedMsg, ioe);
+ throw new ApplicationException(
+ ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe);
}
}
/**
* This methods configures the server based on the contents of the UserData
* object provided in the constructor.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void configureServer() throws QuickSetupException {
+ protected void configureServer() throws ApplicationException {
notifyListeners(getFormattedWithPoints(getMsg("progress-configuring")));
ArrayList<String> argList = new ArrayList<String>();
@@ -692,14 +692,14 @@
if (result != 0)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("error-configuring"), null);
}
} catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-configuring", null, t), t);
}
@@ -805,8 +805,8 @@
}
catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-configuring-certificate", null, t), t);
}
}
@@ -814,9 +814,9 @@
/**
* This methods creates the base entry for the suffix based on the contents of
* the UserData object provided in the constructor.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void createBaseEntry() throws QuickSetupException {
+ protected void createBaseEntry() throws ApplicationException {
String[] arg =
{ getUserData().getNewSuffixOptions().getBaseDn() };
notifyListeners(getFormattedWithPoints(
@@ -850,14 +850,14 @@
if (result != 0)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("error-creating-base-entry"), null);
}
} catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-creating-base-entry", null, t), t);
}
@@ -867,9 +867,9 @@
/**
* This methods imports the contents of an LDIF file based on the contents of
* the UserData object provided in the constructor.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void importLDIF() throws QuickSetupException {
+ protected void importLDIF() throws ApplicationException {
String[] arg =
{ getUserData().getNewSuffixOptions().getLDIFPath() };
notifyListeners(getFormattedProgress(getMsg("progress-importing-ldif", arg))
@@ -896,14 +896,14 @@
if (result != 0)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("error-importing-ldif"), null);
}
} catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-importing-ldif", null, t), t);
}
}
@@ -911,9 +911,9 @@
/**
* This methods imports automatically generated data based on the contents
* of the UserData object provided in the constructor.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void importAutomaticallyGenerated() throws QuickSetupException {
+ protected void importAutomaticallyGenerated() throws ApplicationException {
File templatePath = createTemplateFile();
int nEntries = getUserData().getNewSuffixOptions().getNumberEntries();
String[] arg =
@@ -946,23 +946,23 @@
if (result != 0)
{
String[] msgArgs = { Utils.stringArrayToString(args, " ") };
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("error-import-automatically-generated", msgArgs), null);
}
} catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-import-automatically-generated", null, t), t);
}
}
/**
* This methods enables this server as a Windows service.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void enableWindowsService() throws QuickSetupException {
+ protected void enableWindowsService() throws ApplicationException {
notifyListeners(getFormattedProgress(
getMsg("progress-enabling-windows-service")));
InstallerHelper helper = new InstallerHelper();
@@ -1086,9 +1086,9 @@
/**
* This methods updates the data on the server based on the contents of the
* UserData object provided in the constructor.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void createData() throws QuickSetupException
+ protected void createData() throws ApplicationException
{
if (createNotReplicatedSuffix())
{
@@ -1117,8 +1117,15 @@
/* TODO: replicate them. */
Set<SuffixDescriptor> suffixesToReplicate =
getUserData().getSuffixesToReplicateOptions().getAvailableSuffixes();
+ boolean startedServer = false;
+ if (suffixesToReplicate.size() > 0)
+ {
+ startServerWithoutConnectionHandlers();
+ startedServer = true;
+ }
for (SuffixDescriptor suffix: suffixesToReplicate)
{
+ // TODO: localize
notifyListeners(getFormattedWithPoints("Creating Suffix"));
ArrayList<String> argList = new ArrayList<String>();
@@ -1140,30 +1147,34 @@
if (result != 0)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("error-configuring"), null);
}
} catch (Throwable t)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-configuring", null, t), t);
}
notifyListeners(getFormattedDone());
- // TO REMOVE
+ // TODO: localize
notifyListeners(
getFormattedProgress("One day we will replicate the suffixes!"));
}
+ if (startedServer)
+ {
+ getServerController().stopServerInProcess();
+ }
}
}
/**
* This methods updates the ADS contents (and creates the according suffixes).
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- protected void updateADS() throws QuickSetupException
+ protected void updateADS() throws ApplicationException
{
if (true) return;
/* First check if the remote server contains an ADS: if it is the case the
@@ -1251,22 +1262,22 @@
catch (NoPermissionException x)
{
String[] arg = {getHostDisplay(auth)};
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("cannot-connect-to-remote-permissions", arg), x);
}
catch (NamingException ne)
{
String[] arg = {getHostDisplay(auth)};
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("cannot-connect-to-remote-generic", arg), ne);
}
catch (ADSContextException ace)
{
String[] args = {getHostDisplay(auth), ace.toString()};
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("remote-ads-exception", args), ace);
}
finally
@@ -1295,8 +1306,8 @@
}
catch (ADSContextException ace)
{
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getMsg("local-ads-exception"), ace);
}
notifyListeners(getFormattedDone());
diff --git a/opends/src/quicksetup/org/opends/quicksetup/InstallerHelper.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
similarity index 81%
rename from opends/src/quicksetup/org/opends/quicksetup/InstallerHelper.java
rename to opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index 92d6948..15ab091 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/InstallerHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -25,11 +25,12 @@
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
-package org.opends.quicksetup;
+package org.opends.quicksetup.installer;
import java.io.File;
import java.io.IOException;
+import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.i18n.ResourceProvider;
import org.opends.quicksetup.webstart.JnlpProperties;
import org.opends.quicksetup.util.Utils;
@@ -53,10 +54,10 @@
* Invokes the method ConfigureDS.configMain with the provided parameters.
* @param args the arguments to be passed to ConfigureDS.configMain.
* @return the return code of the ConfigureDS.configMain method.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
* @see org.opends.server.tools.ConfigureDS#configMain(String[]).
*/
- public int invokeConfigureServer(String[] args) throws QuickSetupException {
+ public int invokeConfigureServer(String[] args) throws ApplicationException {
return org.opends.server.tools.ConfigureDS.configMain(args);
}
@@ -64,10 +65,10 @@
* Invokes the method ImportLDIF.mainImportLDIF with the provided parameters.
* @param args the arguments to be passed to ImportLDIF.mainImportLDIF.
* @return the return code of the ImportLDIF.mainImportLDIF method.
- * @throws org.opends.quicksetup.QuickSetupException if something goes wrong.
+ * @throws org.opends.quicksetup.ApplicationException if something goes wrong.
* @see org.opends.server.tools.ImportLDIF#mainImportLDIF(String[]).
*/
- public int invokeImportLDIF(String[] args) throws QuickSetupException {
+ public int invokeImportLDIF(String[] args) throws ApplicationException {
return org.opends.server.tools.ImportLDIF.mainImportLDIF(args);
}
@@ -83,9 +84,9 @@
/**
* This methods enables this server as a Windows service.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
- public void enableWindowsService() throws QuickSetupException {
+ public void enableWindowsService() throws ApplicationException {
int code = org.opends.server.tools.ConfigureWindowsService.enableService(
System.out, System.err);
@@ -100,8 +101,8 @@
org.opends.server.tools.ConfigureWindowsService.SERVICE_ALREADY_ENABLED:
break;
default:
- throw new QuickSetupException(
- QuickSetupException.Type.WINDOWS_SERVICE_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.WINDOWS_SERVICE_ERROR,
errorMessage, null);
}
}
@@ -122,10 +123,10 @@
* baseDn.
* @param baseDn the dn of the entry that will be created in the LDIF file.
* @return the File object pointing to the created temporary file.
- * @throws QuickSetupException if something goes wrong.
+ * @throws ApplicationException if something goes wrong.
*/
public File createBaseEntryTempFile(String baseDn)
- throws QuickSetupException {
+ throws ApplicationException {
File ldifFile;
try
{
@@ -134,8 +135,8 @@
} catch (IOException ioe)
{
String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe);
- throw new QuickSetupException(QuickSetupException.Type.FILE_SYSTEM_ERROR,
- failedMsg, ioe);
+ throw new ApplicationException(
+ ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe);
}
try
@@ -156,20 +157,20 @@
writer.writeEntry(entry);
writer.close();
} catch (org.opends.server.types.DirectoryException de) {
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-importing-ldif", null, de), de);
} catch (org.opends.server.util.LDIFException le) {
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-importing-ldif", null, le), le);
} catch (IOException ioe) {
- throw new QuickSetupException(
- QuickSetupException.Type.CONFIGURATION_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.CONFIGURATION_ERROR,
getThrowableMsg("error-importing-ldif", null, ioe), ioe);
} catch (Throwable t) {
- throw new QuickSetupException(
- QuickSetupException.Type.BUG, getThrowableMsg(
+ throw new ApplicationException(
+ ApplicationException.Type.BUG, getThrowableMsg(
"bug-msg", t), t);
}
return ldifFile;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 9a5da9a..bcee79c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -31,7 +31,7 @@
import java.util.ArrayList;
import java.util.HashMap;
-import org.opends.quicksetup.QuickSetupException;
+import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.ProgressStep;
import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.installer.InstallProgressStep;
@@ -105,7 +105,7 @@
setStatus(InstallProgressStep.FINISHED_SUCCESSFULLY);
notifyListeners(null);
- } catch (QuickSetupException ex)
+ } catch (ApplicationException ex)
{
setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
String html = getFormattedError(ex, true);
@@ -114,8 +114,8 @@
catch (Throwable t)
{
setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
- QuickSetupException ex = new QuickSetupException(
- QuickSetupException.Type.BUG, getThrowableMsg("bug-msg", t), t);
+ ApplicationException ex = new ApplicationException(
+ ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t);
String msg = getFormattedError(ex, true);
notifyListeners(msg);
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
deleted file mode 100644
index bb9cf9a..0000000
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE
- * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at
- * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
- * add the following below this CDDL HEADER, with the fields enclosed
- * by brackets "[]" replaced with your own identifying information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
- */
-
-package org.opends.quicksetup.installer.webstart;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.opends.quicksetup.QuickSetupException;
-import org.opends.quicksetup.ProgressStep;
-import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.webstart.JnlpProperties;
-import org.opends.quicksetup.installer.Installer;
-import org.opends.quicksetup.installer.InstallProgressStep;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.util.ZipExtractor;
-import org.opends.quicksetup.util.ServerController;
-
-/**
- * This is an implementation of the Installer class that is used to install
- * the Directory Server using Web Start.
- *
- * It just takes a UserData object and based on that installs OpenDS.
- *
- *
- * This object has as parameter a WebStartDownloader object that is downloading
- * some jar files. Until the WebStartDownloader has not finished downloading
- * the jar files will be on the ProgressStep.DOWNLOADING step because
- * we require all the jar files to be downloaded in order to install and
- * configure the Directory Server.
- *
- * Based on the Java properties set through the QuickSetup.jnlp file this
- * class will retrieve the zip file containing the install, unzip it and extract
- * it in the path specified by the user and that is contained in the
- * UserData object.
- *
- *
- * When there is an update during the installation it will notify the
- * ProgressUpdateListener objects that have been added to it. The notification
- * will send a ProgressUpdateEvent.
- *
- * This class is supposed to be fully independent of the graphical layout.
- *
- */
-public class WebStartInstaller extends Installer implements JnlpProperties {
- private HashMap<InstallProgressStep, Integer> hmRatio =
- new HashMap<InstallProgressStep, Integer>();
-
- private HashMap<InstallProgressStep, String> hmSummary =
- new HashMap<InstallProgressStep, String>();
-
- /**
- * WebStartInstaller constructor.
- */
- public WebStartInstaller()
- {
- initLoader();
- setStatus(InstallProgressStep.NOT_STARTED);
- }
-
- /**
- * Actually performs the install in this thread. The thread is blocked.
- *
- */
- public void run()
- {
- initMaps();
- PrintStream origErr = System.err;
- PrintStream origOut = System.out;
- try
- {
- PrintStream err = new ErrorPrintStream();
- PrintStream out = new OutputPrintStream();
- System.setErr(err);
- System.setOut(out);
-
- setStatus(InstallProgressStep.DOWNLOADING);
-
- InputStream in =
- getZipInputStream(getRatio(InstallProgressStep.EXTRACTING));
- notifyListeners(getTaskSeparator());
-
- setStatus(InstallProgressStep.EXTRACTING);
- createParentDirectoryIfRequired();
- extractZipFiles(in, getRatio(InstallProgressStep.EXTRACTING),
- getRatio(InstallProgressStep.CONFIGURING_SERVER));
- notifyListeners(getTaskSeparator());
-
- setInstallation(new Installation(getUserData().getServerLocation()));
-
- setStatus(InstallProgressStep.CONFIGURING_SERVER);
- configureServer();
-
- createData();
-
- updateADS();
-
- writeJavaHome();
-
- if (Utils.isWindows())
- {
- notifyListeners(getTaskSeparator());
- setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
- enableWindowsService();
- }
-
- if (getUserData().getStartServer())
- {
- notifyListeners(getTaskSeparator());
- setStatus(InstallProgressStep.STARTING_SERVER);
- new ServerController(this).startServer();
- }
-
- setStatus(InstallProgressStep.FINISHED_SUCCESSFULLY);
- notifyListeners(null);
-
- } catch (QuickSetupException ex)
- {
- setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
- String html = getFormattedError(ex, true);
- notifyListeners(html);
- }
- catch (Throwable t)
- {
- setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
- QuickSetupException ex = new QuickSetupException(
- QuickSetupException.Type.BUG, getThrowableMsg("bug-msg", t), t);
- String msg = getFormattedError(ex, true);
- notifyListeners(msg);
- }
- System.setErr(origErr);
- System.setOut(origOut);
- }
-
- /**
- * {@inheritDoc}
- */
- public Integer getRatio(ProgressStep status)
- {
- return hmRatio.get(status);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getSummary(ProgressStep status)
- {
- String summary = null;
- if (InstallProgressStep.DOWNLOADING.equals(status)) {
- summary = loader.getSummary();
- } else {
- summary = hmSummary.get(status);
- }
- return summary;
- }
-
- /**
- * Initialize the different map used in this class.
- *
- */
- private void initMaps()
- {
- initSummaryMap(hmSummary);
-
- /*
- * hmTime contains the relative time that takes for each task to be
- * accomplished. For instance if downloading takes twice the time of
- * extracting, the value for downloading will be the double of the value for
- * extracting.
- */
- HashMap<InstallProgressStep, Integer> hmTime =
- new HashMap<InstallProgressStep, Integer>();
- hmTime.put(InstallProgressStep.DOWNLOADING, 15);
- hmTime.put(InstallProgressStep.EXTRACTING, 15);
- hmTime.put(InstallProgressStep.CONFIGURING_SERVER, 5);
- hmTime.put(InstallProgressStep.CREATING_BASE_ENTRY, 10);
- hmTime.put(InstallProgressStep.IMPORTING_LDIF, 20);
- hmTime.put(InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED,
- 20);
- hmTime.put(InstallProgressStep.ENABLING_WINDOWS_SERVICE, 5);
- hmTime.put(InstallProgressStep.STARTING_SERVER, 10);
-
- int totalTime = 0;
- ArrayList<InstallProgressStep> steps =
- new ArrayList<InstallProgressStep>();
- totalTime += hmTime.get(InstallProgressStep.DOWNLOADING);
- steps.add(InstallProgressStep.DOWNLOADING);
- totalTime += hmTime.get(InstallProgressStep.EXTRACTING);
- steps.add(InstallProgressStep.EXTRACTING);
- totalTime += hmTime.get(InstallProgressStep.CONFIGURING_SERVER);
- steps.add(InstallProgressStep.CONFIGURING_SERVER);
-
- switch (getUserData().getNewSuffixOptions().getType())
- {
- case CREATE_BASE_ENTRY:
- steps.add(InstallProgressStep.CREATING_BASE_ENTRY);
- totalTime += hmTime.get(InstallProgressStep.CREATING_BASE_ENTRY);
- break;
- case IMPORT_FROM_LDIF_FILE:
- steps.add(InstallProgressStep.IMPORTING_LDIF);
- totalTime += hmTime.get(InstallProgressStep.IMPORTING_LDIF);
- break;
- case IMPORT_AUTOMATICALLY_GENERATED_DATA:
- steps.add(InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED);
- totalTime +=hmTime.get(
- InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED);
- break;
- }
- if (Utils.isWindows())
- {
- totalTime += hmTime.get(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
- steps.add(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
- }
- if (getUserData().getStartServer())
- {
- totalTime += hmTime.get(InstallProgressStep.STARTING_SERVER);
- steps.add(InstallProgressStep.STARTING_SERVER);
- }
-
- int cumulatedTime = 0;
- for (InstallProgressStep s : steps)
- {
- Integer statusTime = hmTime.get(s);
- hmRatio.put(s, (100 * cumulatedTime) / totalTime);
- if (statusTime != null)
- {
- cumulatedTime += statusTime;
- }
- }
-
- hmRatio.put(InstallProgressStep.FINISHED_SUCCESSFULLY, 100);
- hmRatio.put(InstallProgressStep.FINISHED_WITH_ERROR, 100);
- }
-
- private InputStream getZipInputStream(Integer maxRatio)
- throws QuickSetupException {
- notifyListeners(getFormattedWithPoints(getMsg("progress-downloading")));
- InputStream in = null;
-
- waitForLoader(maxRatio);
-
- String zipName = getZipFileName();
- in =
- Installer.class.getClassLoader().getResourceAsStream(zipName);
-
- if (in == null)
- {
- throw new QuickSetupException(QuickSetupException.Type.DOWNLOAD_ERROR,
- getMsg("error-zipinputstreamnull", new String[] {zipName}), null);
- }
-
-
- notifyListeners(getFormattedDone());
- return in;
- }
-
- /**
- * Creates the parent Directory for the server location if it does not exist.
- * @throws QuickSetupException if something goes wrong.
- */
- private void createParentDirectoryIfRequired() throws QuickSetupException
- {
- String serverLocation = getUserData().getServerLocation();
- if (!Utils.parentDirectoryExists(serverLocation))
- {
- File f = new File(serverLocation);
- String parent = f.getParent();
- try
- {
- if (!Utils.createDirectory(parent))
- {
- throw new QuickSetupException(
- QuickSetupException.Type.FILE_SYSTEM_ERROR,
- getMsg("error-could-not-create-parent-dir",
- new String[] {parent}), null);
- }
- }
- catch (IOException ioe)
- {
- throw new QuickSetupException(
- QuickSetupException.Type.FILE_SYSTEM_ERROR,
- getMsg("error-could-not-create-parent-dir", new String[] {parent}),
- ioe);
- }
- }
- }
-
- /**
- * This method extracts the zip file.
- * @param is the inputstream with the contents of the zip file.
- * @param minRatio the value of the ratio in the install that corresponds to
- * the moment where we start extracting the zip files. Used to update
- * properly the install progress ratio.
- * @param maxRatio the value of the ratio in the installation that corresponds
- * to the moment where we finished extracting the last zip file. Used to
- * update properly the install progress ratio.
- * @throws QuickSetupException if an error occurs.
- */
- private void extractZipFiles(InputStream is, int minRatio, int maxRatio)
- throws QuickSetupException {
- ZipExtractor extractor =
- new ZipExtractor(is, minRatio, maxRatio,
- Utils.getNumberZipEntries(),
- getZipFileName(),
- this);
- extractor.extract(getUserData().getServerLocation());
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getOpenDSClassPath()
- {
- StringBuilder buf = new StringBuilder();
- String[] jars = getOpenDSJarPaths();
- for (int i = 0; i < jars.length; i++)
- {
- if (i != 0)
- {
- buf.append(System.getProperty("path.separator"));
- }
- buf.append(jars[i]);
- }
- return buf.toString();
- }
-
- /**
- * Returns the jar file paths in the installation. This is used to launch
- * command lines that require a classpath.
- * @return the jar file paths in the installation.
- */
- private String[] getOpenDSJarPaths()
- {
- String[] jarPaths =
- new String[Installation.OPEN_DS_JAR_RELATIVE_PATHS.length];
- File parentDir = new File(getUserData().getServerLocation());
- for (int i = 0; i < jarPaths.length; i++)
- {
- File f = new File(parentDir, Installation.OPEN_DS_JAR_RELATIVE_PATHS[i]);
- jarPaths[i] = f.getAbsolutePath();
- }
- return jarPaths;
-
- }
-
- /**
- * Returns the name of the zip file name that contains all the installation.
- * @return the name of the zip file name that contains all the installation.
- */
- private String getZipFileName()
- {
- // Passed as a java option in the JNLP file
- return System.getProperty(ZIP_FILE_NAME);
- }
-
- /**
- * {@inheritDoc}
- */
- protected String getInstallationPath()
- {
- return getUserData().getServerLocation();
- }
-}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index 48c8fe5..52842d1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -28,12 +28,15 @@
package org.opends.quicksetup.ui;
import org.opends.quicksetup.*;
+import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.webstart.WebStartDownloader;
import javax.swing.*;
import java.awt.event.WindowEvent;
+import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Set;
+import java.util.logging.Level;
import java.util.logging.Logger;
/**
@@ -390,10 +393,10 @@
* process, then maxRatio will be 25. When the download is complete this
* method will send a notification to the ProgressUpdateListeners with a ratio
* of 25 %.
- * @throws org.opends.quicksetup.QuickSetupException if something goes wrong
+ * @throws org.opends.quicksetup.ApplicationException if something goes wrong
*
*/
- protected void waitForLoader(Integer maxRatio) throws QuickSetupException {
+ protected void waitForLoader(Integer maxRatio) throws ApplicationException {
int lastPercentage = -1;
WebStartDownloader.Status lastStatus =
WebStartDownloader.Status.DOWNLOADING;
@@ -455,4 +458,38 @@
public int getExtraDialogHeight() {
return 0;
}
+
+ /**
+ * Starts the server to be able to update its configuration but not allowing
+ * it to listen to external connections.
+ * @throws ApplicationException if the server could not be started.
+ */
+ protected void startServerWithoutConnectionHandlers()
+ throws ApplicationException {
+ try {
+ ServerController control = new ServerController(this);
+ if (getInstallation().getStatus().isServerRunning()) {
+ control.stopServer();
+ }
+ control.startServerInProcess(true);
+ } catch (IOException e) {
+ String msg = "Failed to determine server state: " +
+ e.getLocalizedMessage();
+ LOG.log(Level.INFO, msg, e);
+ throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
+ msg, e);
+ } catch (org.opends.server.types.InitializationException e) {
+ String msg = "Failed to start server due to initialization error:" +
+ e.getLocalizedMessage();
+ LOG.log(Level.INFO, msg, e);
+ throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
+ msg, e);
+ } catch (org.opends.server.config.ConfigException e) {
+ String msg = "Failed to start server due to configuration error: " +
+ e.getLocalizedMessage();
+ LOG.log(Level.INFO, msg, e);
+ throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
+ msg, e);
+ }
+ }
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
index a0a53a5..4d6626c 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -124,7 +124,7 @@
}
private void expandZipFile(File buildFile)
- throws ApplicationException, IOException, QuickSetupException {
+ throws ApplicationException, IOException {
ZipExtractor extractor = new ZipExtractor(buildFile,
1, 10, // TODO figure out these values
Utils.getNumberZipEntries(), this);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 4c7956f..b321017 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -439,7 +439,7 @@
public void run() {
try {
installation.getBuildId();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.INFO, "error", e);
}
}
@@ -557,7 +557,7 @@
if (Utils.isWebStart()) {
try {
waitForLoader(15); // TODO: ratio
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.SEVERE, "Error downloading WebStart jars", e);
throw e;
}
@@ -868,7 +868,7 @@
private void verifyUpgrade() throws ApplicationException {
try {
new ServerController(this).startServer();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.INFO, "Error starting server: " +
e.getLocalizedMessage(), e);
}
@@ -916,34 +916,6 @@
}
}
- private void startServerWithoutConnectionHandlers()
- throws ApplicationException {
- try {
- ServerController control = new ServerController(this);
- if (getInstallation().getStatus().isServerRunning()) {
- control.stopServer();
- }
- control.startServerInProcess(true);
- } catch (IOException e) {
- String msg = "Failed to determine server state: " +
- e.getLocalizedMessage();
- LOG.log(Level.INFO, msg, e);
- throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
- msg, e);
- } catch (org.opends.server.types.InitializationException e) {
- String msg = "Failed to start server due to initialization error:" +
- e.getLocalizedMessage();
- LOG.log(Level.INFO, msg, e);
- throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
- msg, e);
- } catch (org.opends.server.config.ConfigException e) {
- String msg = "Failed to start server due to configuration error: " +
- e.getLocalizedMessage();
- LOG.log(Level.INFO, msg, e);
- throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
- msg, e);
- }
- }
/**
* Applies configuration or schema customizations.
@@ -1286,7 +1258,7 @@
try {
currentVersion = getInstallation().getSvnRev();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.INFO, "error", e);
throw ApplicationException.createFileSystemException(
"Could not determine current version number: " +
@@ -1375,7 +1347,7 @@
String newVersion = null;
try {
newVersion = getInstallation().getBuildId();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
newVersion = getMsg("upgrade-build-id-unknown");
}
String[] args = {
@@ -1429,7 +1401,7 @@
if (this.currentVersion == null) {
try {
currentVersion = getInstallation().getSvnRev();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.INFO, "error trying to determine current version", e);
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
index bdb8aa9..e26e2ff 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/UpgraderReviewPanel.java
@@ -33,7 +33,7 @@
import org.opends.quicksetup.upgrader.Upgrader;
import org.opends.quicksetup.upgrader.UpgradeUserData;
import org.opends.quicksetup.upgrader.Build;
-import org.opends.quicksetup.QuickSetupException;
+import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.UserData;
import javax.swing.*;
@@ -186,7 +186,7 @@
String oldVersion;
try {
oldVersion = getApplication().getInstallation().getBuildId();
- } catch (QuickSetupException e) {
+ } catch (ApplicationException e) {
LOG.log(Level.INFO, "error", e);
oldVersion = getMsg("upgrade-build-id-unknown");
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 6c9e85d..0982969 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -28,6 +28,7 @@
package org.opends.quicksetup.util;
import org.opends.quicksetup.*;
+import org.opends.quicksetup.installer.InstallerHelper;
import javax.naming.NamingException;
import java.util.ArrayList;
@@ -223,9 +224,9 @@
/**
* This methods starts the server.
- * @throws org.opends.quicksetup.QuickSetupException if something goes wrong.
+ * @throws org.opends.quicksetup.ApplicationException if something goes wrong.
*/
- public void startServer() throws QuickSetupException {
+ public void startServer() throws ApplicationException {
startServer(true);
}
@@ -233,9 +234,9 @@
* This methods starts the server.
* @param verify boolean indicating whether this method will attempt to
* connect to the server after starting to verify that it is listening.
- * @throws org.opends.quicksetup.QuickSetupException if something goes wrong.
+ * @throws org.opends.quicksetup.ApplicationException if something goes wrong.
*/
- private void startServer(boolean verify) throws QuickSetupException {
+ private void startServer(boolean verify) throws ApplicationException {
application.notifyListeners(
application.getFormattedProgress(
application.getMsg("progress-starting")) +
@@ -284,7 +285,7 @@
}
}
// Check if something wrong occurred reading the starting of the server
- QuickSetupException ex = errReader.getException();
+ ApplicationException ex = errReader.getException();
if (ex == null)
{
ex = outputReader.getException();
@@ -349,13 +350,15 @@
if (Utils.isWindows())
{
- throw new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.START_ERROR,
application.getMsg("error-starting-server-in-windows", arg),
null);
}
else
{
- throw new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.START_ERROR,
application.getMsg("error-starting-server-in-unix", arg), null);
}
}
@@ -363,7 +366,7 @@
} catch (IOException ioe)
{
- throw new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ throw new ApplicationException(ApplicationException.Type.START_ERROR,
application.getThrowableMsg("error-starting-server", ioe), ioe);
}
}
@@ -476,7 +479,7 @@
*/
private class StartReader
{
- private QuickSetupException ex;
+ private ApplicationException ex;
private boolean isFinished;
@@ -533,14 +536,14 @@
{
String errorMsg = application.getThrowableMsg(errorTag, ioe);
ex =
- new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ new ApplicationException(ApplicationException.Type.START_ERROR,
errorMsg, ioe);
} catch (Throwable t)
{
String errorMsg = application.getThrowableMsg(errorTag, t);
ex =
- new QuickSetupException(QuickSetupException.Type.START_ERROR,
+ new ApplicationException(ApplicationException.Type.START_ERROR,
errorMsg, t);
}
isFinished = true;
@@ -550,12 +553,12 @@
}
/**
- * Returns the QuickSetupException that occurred reading the Start error and
- * output or <CODE>null</CODE> if no exception occurred.
+ * Returns the ApplicationException that occurred reading the Start error
+ * and output or <CODE>null</CODE> if no exception occurred.
* @return the exception that occurred reading or <CODE>null</CODE> if
* no exception occurred.
*/
- public QuickSetupException getException()
+ public ApplicationException getException()
{
return ex;
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
index 5ae8327..662e23e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
@@ -27,7 +27,7 @@
package org.opends.quicksetup.util;
-import org.opends.quicksetup.QuickSetupException;
+import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Application;
import org.opends.quicksetup.i18n.ResourceProvider;
@@ -102,18 +102,18 @@
/**
* Performs the zip extraction.
* @param destination File where the zip file will be extracted
- * @throws QuickSetupException if something goes wrong
+ * @throws ApplicationException if something goes wrong
*/
- public void extract(File destination) throws QuickSetupException {
+ public void extract(File destination) throws ApplicationException {
extract(Utils.getPath(destination));
}
/**
* Performs the zip extraction.
* @param destination File where the zip file will be extracted
- * @throws QuickSetupException if something goes wrong
+ * @throws ApplicationException if something goes wrong
*/
- public void extract(String destination) throws QuickSetupException {
+ public void extract(String destination) throws ApplicationException {
ZipInputStream zipIn = new ZipInputStream(is);
int nEntries = 1;
@@ -156,8 +156,8 @@
Utils.getThrowableMsg(ResourceProvider.getInstance(),
"error-copying", arg, ioe);
- throw new QuickSetupException(
- QuickSetupException.Type.FILE_SYSTEM_ERROR,
+ throw new ApplicationException(
+ ApplicationException.Type.FILE_SYSTEM_ERROR,
errorMsg, ioe);
}
}
@@ -199,8 +199,8 @@
String errorMsg =
Utils.getThrowableMsg(ResourceProvider.getInstance(),
"error-zip-stream", arg, ioe);
- throw new QuickSetupException(QuickSetupException.Type.FILE_SYSTEM_ERROR,
- errorMsg, ioe);
+ throw new ApplicationException(
+ ApplicationException.Type.FILE_SYSTEM_ERROR, errorMsg, ioe);
}
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 80eb824..a8c0cf0 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -37,7 +37,7 @@
import javax.jnlp.UnavailableServiceException;
import org.opends.quicksetup.i18n.ResourceProvider;
-import org.opends.quicksetup.QuickSetupException;
+import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.util.Utils;
/**
@@ -52,7 +52,7 @@
*/
public class WebStartDownloader implements DownloadServiceListener,
JnlpProperties {
- private QuickSetupException ex;
+ private ApplicationException ex;
private boolean isFinished;
@@ -121,12 +121,12 @@
{
// This is a bug
ex =
- new QuickSetupException(QuickSetupException.Type.BUG,
+ new ApplicationException(ApplicationException.Type.BUG,
getExceptionMsg(
"bug-msg", mfe), mfe);
} catch (IOException ioe)
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
String[] jars = getJarUrls();
for (int i = 0; i < jars.length; i++)
{
@@ -139,13 +139,13 @@
String[] arg =
{ buf.toString() };
ex =
- new QuickSetupException(QuickSetupException.Type.DOWNLOAD_ERROR,
+ new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR,
getExceptionMsg("downloading-error", arg, ioe), ioe);
} catch (Throwable t)
{
// This is a bug
ex =
- new QuickSetupException(QuickSetupException.Type.BUG,
+ new ApplicationException(ApplicationException.Type.BUG,
getExceptionMsg(
"bug-msg", t), t);
}
@@ -334,12 +334,12 @@
}
/**
- * Returns the QuickSetupException that has occurred during the download or
+ * Returns the ApplicationException that has occurred during the download or
* <CODE>null</CODE> if no exception occurred.
- * @return the QuickSetupException that has occurred during the download or
+ * @return the ApplicationException that has occurred during the download or
* <CODE>null</CODE> if no exception occurred.
*/
- public QuickSetupException getException()
+ public ApplicationException getException()
{
return ex;
}
@@ -350,9 +350,8 @@
public void downloadFailed(URL url, String version)
{
ex =
- new QuickSetupException(QuickSetupException.Type.DOWNLOAD_ERROR, getMsg(
- "downloading-error", new String[]
- { url.toString() }), null);
+ new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR,
+ getMsg("downloading-error", new String[] { url.toString() }), null);
}
/**
--
Gitblit v1.10.0