From 3b230cd5af114fd8800f2aa56b7dc06db6cb0db6 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 02 Feb 2016 16:00:11 +0000
Subject: [PATCH] Simplified widespread use of OperatingSystem.isWindows() and duplication by using methods dedicated to a task
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SetupLauncher.java | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SetupLauncher.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SetupLauncher.java
index fef5ae4..c5cea98 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SetupLauncher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/SetupLauncher.java
@@ -22,30 +22,30 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS
+ * Portions Copyright 2014-2016 ForgeRock AS
*/
package org.opends.quicksetup.installer;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.messages.ToolMessages.*;
-import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static org.opends.server.util.ServerConstants.*;
import java.io.File;
-import org.opends.quicksetup.Constants;
-import org.opends.quicksetup.ReturnCode;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.quicksetup.CliApplication;
+import org.opends.quicksetup.Constants;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.QuickSetupLog;
+import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.installer.offline.OfflineInstaller;
import org.opends.quicksetup.util.IncompatibleVersionException;
import org.opends.quicksetup.util.Utils;
-import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.tools.InstallDS;
import org.opends.server.tools.InstallDSArgumentParser;
import org.opends.server.util.DynamicConstants;
-import org.opends.server.util.ServerConstants;
+
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
@@ -84,22 +84,14 @@
*/
public SetupLauncher(String[] args) {
super(args);
- String scriptName;
- if (isWindows()) {
- scriptName = Installation.WINDOWS_SETUP_FILE_NAME;
- } else {
- scriptName = Installation.UNIX_SETUP_FILE_NAME;
- }
- if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null)
+ if (System.getProperty(PROPERTY_SCRIPT_NAME) == null)
{
- System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName);
+ System.setProperty(PROPERTY_SCRIPT_NAME, Installation.getSetupFileName());
}
initializeParser();
}
- /**
- * Initialize the contents of the argument parser.
- */
+ /** Initialize the contents of the argument parser. */
protected void initializeParser()
{
argParser = new InstallDSArgumentParser(InstallDS.class.getName());
@@ -114,7 +106,7 @@
}
}
- /** {@inheritDoc} */
+ @Override
public void launch() {
try
{
@@ -169,12 +161,12 @@
}
}
- /** {@inheritDoc} */
+ @Override
public ArgumentParser getArgumentParser() {
return this.argParser;
}
- /** {@inheritDoc} */
+ @Override
protected void guiLaunchFailed(String logFileName) {
if (logFileName != null)
{
@@ -187,26 +179,26 @@
}
}
- /** {@inheritDoc} */
+ @Override
protected void willLaunchGui() {
System.out.println(INFO_SETUP_LAUNCHER_LAUNCHING_GUI.get());
System.setProperty("org.opends.quicksetup.Application.class",
OfflineInstaller.class.getName());
}
- /** {@inheritDoc} */
+ @Override
protected LocalizableMessage getFrameTitle() {
return Utils.getCustomizedObject("INFO_FRAME_INSTALL_TITLE",
INFO_FRAME_INSTALL_TITLE.get(DynamicConstants.PRODUCT_NAME),
LocalizableMessage.class);
}
- /** {@inheritDoc} */
+ @Override
protected CliApplication createCliApplication() {
return null;
}
- /** {@inheritDoc} */
+ @Override
protected boolean isCli() {
return argParser.isCli();
}
--
Gitblit v1.10.0