From afa089fedd62a29826d57cc34293ad5e0e6a4efd Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 26 Mar 2014 13:15:01 +0000
Subject: [PATCH] Replaced OperatingSystem class by its SDK class.
---
opendj3-server-dev/src/server/org/opends/server/util/SetupUtils.java | 121 ---------
opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java | 7
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java | 5
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java | 5
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java | 5
opendj3-server-dev/src/server/org/opends/server/tools/StopWindowsService.java | 4
opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java | 1
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java | 4
opendj3-server-dev/src/server/org/opends/server/types/FilePermission.java | 2
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java | 4
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java | 3
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java | 7
opendj3-server-dev/src/server/org/opends/server/tools/StartWindowsService.java | 4
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java | 3
opendj3-server-dev/src/server/org/opends/server/tools/CreateRCScript.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 6
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/Utilities.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java | 60 ----
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java | 15
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java | 31 --
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java | 8
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java | 6
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java | 1
opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 3
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java | 8
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/FileManager.java | 3
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java | 1
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java | 3
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java | 3
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java | 5
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java | 25 --
opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java | 5
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ExtensionFileFilter.java | 4
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java | 9
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java | 9
opendj3-server-dev/src/server/org/opends/server/tools/InstallDSArgumentParser.java | 5
opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesTool.java | 3
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java | 3
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/Task.java | 3
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java | 3
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java | 3
opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java | 4
/dev/null | 232 -------------------
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 5
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java | 3
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java | 3
49 files changed, 143 insertions(+), 529 deletions(-)
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
index 9f7911d..fa4b1dc 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -27,6 +27,8 @@
package org.opends.guitools.controlpanel.datamodel;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+
import java.io.File;
import java.net.InetAddress;
import java.util.Collection;
@@ -478,7 +480,7 @@
desc.setInstallPath(installPath);
desc.setInstancePath(Utils.getInstancePathFromInstallPath(installPath));
boolean windowsServiceEnabled = false;
- if (Utilities.isWindows())
+ if (isWindows())
{
int result = ConfigureWindowsService.serviceState(null, null);
windowsServiceEnabled =
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
index d4266ce..8e64368 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
@@ -46,7 +46,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.OpenDsException;
-import org.opends.server.types.OperatingSystem;
+import com.forgerock.opendj.util.OperatingSystem;
import org.opends.server.types.Schema;
import static org.opends.server.types.CommonSchemaElements.*;
@@ -230,7 +230,7 @@
{
sameInstallAndInstance = instance.equals(install);
if (!sameInstallAndInstance &&
- (isLocal() || (isWindows() == Utilities.isWindows())))
+ (isLocal() || (OperatingSystem.isWindows())))
{
File f1 = new File(instance);
File f2 = new File(install);
@@ -458,7 +458,7 @@
}
}
- if (equals && Utilities.isWindows())
+ if (equals && OperatingSystem.isWindows())
{
equals =
desc.isWindowsServiceEnabled() == isWindowsServiceEnabled();
@@ -654,7 +654,7 @@
boolean isWindows;
if (isLocal())
{
- isWindows = Utilities.isWindows();
+ isWindows = OperatingSystem.isWindows();
}
else
{
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/Task.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/Task.java
index 87dbb2c..5ac740d 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/Task.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/Task.java
@@ -28,6 +28,7 @@
package org.opends.guitools.controlpanel.task;
import static org.opends.messages.AdminToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.File;
import java.util.ArrayList;
@@ -721,7 +722,7 @@
protected String getCommandLinePath(String scriptBasicName)
{
String cmdLineName;
- if (Utilities.isWindows())
+ if (isWindows())
{
cmdLineName = getBinaryDir()+scriptBasicName+".bat";
}
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
index 5496d22..e2c463e 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
@@ -30,6 +30,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.ToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.awt.Component;
import java.awt.Dimension;
@@ -538,7 +539,7 @@
{
String path;
- if (desc.isLocal() || (desc.isWindows() == Utilities.isWindows()))
+ if (desc.isLocal() || (desc.isWindows() == isWindows()))
{
File f = new File(desc.getInstancePath(),
org.opends.quicksetup.Installation.BACKUPS_PATH_RELATIVE);
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
index cf255d6..30e2906 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
@@ -22,10 +22,15 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
+
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
+
import java.awt.Color;
import java.awt.Font;
@@ -120,7 +125,7 @@
* The grey color background that is used for instance as background for the
* buttons in the dialogs (in the bottom of the dialogs).
*/
- public static final Color greyBackground = Utilities.isWindows() ?
+ public static final Color greyBackground = isWindows() ?
UIManager.getColor("MenuBar.background") :
UIManager.getColor("Panel.background");
@@ -134,7 +139,7 @@
* The grid color for the table.
*/
public static final Color gridColor =
- Utilities.isMacOS() ? defaultBorderColor :
+ isMacOS() ? defaultBorderColor :
UIManager.getColor("Table.gridColor");
/**
* The color of the text in the table.
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
index a86cb8a..122496b 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -28,6 +28,7 @@
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -976,7 +977,7 @@
private File getJavaFile(File javaHome)
{
File javaFile = new File(javaHome, "bin");
- if (Utilities.isWindows())
+ if (isWindows())
{
javaFile = new File(javaFile, "java.exe");
}
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java
index 17940c3..4d7a550 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java
@@ -28,6 +28,7 @@
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -190,7 +191,7 @@
{
ArrayList<Category> categories = new ArrayList<Category>();
LocalizableMessage[][] labels;
- if (Utilities.isWindows())
+ if (isWindows())
{
labels = new LocalizableMessage[][] {
{
@@ -275,7 +276,7 @@
classes.add(ConnectionHandlerMonitoringPanel.class);
classes.add(ManageTasksPanel.class);
classes.add(JavaPropertiesPanel.class);
- if (Utilities.isWindows())
+ if (isWindows())
{
classes.add(WindowsServicePanel.class);
}
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java
index e87d5ca..b994456 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java
@@ -28,6 +28,7 @@
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -67,7 +68,7 @@
addMenus();
- if (Utilities.isMacOS())
+ if (isMacOS())
{
setMacOSQuitHandler();
}
@@ -136,7 +137,7 @@
});
menu.add(menuItem);
- if (!Utilities.isMacOS())
+ if (!isMacOS())
{
menuItem = Utilities.createMenuItem(INFO_CTRL_PANEL_EXIT_MENU.get());
menuItem.addActionListener(new ActionListener()
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java
index 6ac6cba..b750d5e 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java
@@ -22,10 +22,13 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui.components;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
+
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
@@ -42,7 +45,6 @@
import javax.swing.tree.TreePath;
import org.opends.guitools.controlpanel.ui.renderer.TreeCellRenderer;
-import org.opends.guitools.controlpanel.util.Utilities;
/**
* The tree that is used in different places in the Control Panel (schema
@@ -152,7 +154,7 @@
}
MouseEvent newEvent = getTranslatedEvent(ev);
- if (Utilities.isMacOS() && ev.isPopupTrigger() &&
+ if (isMacOS() && ev.isPopupTrigger() &&
(ev.getButton() != MouseEvent.BUTTON1))
{
MouseEvent baseEvent = ev;
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java
index a2b01f6..cb4d791 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java
@@ -35,7 +35,6 @@
import java.util.Arrays;
import org.forgerock.i18n.LocalizableMessage;
-import org.opends.quicksetup.util.Utils;
import org.opends.server.api.AttributeSyntax;
import org.opends.server.api.MatchingRule;
import org.opends.server.config.ConfigConstants;
@@ -47,6 +46,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Schema;
+import com.forgerock.opendj.util.OperatingSystem;
/**
* Class used to retrieve the schema from the schema files.
@@ -164,7 +164,7 @@
{
accept = true;
}
- else if (Utils.isWindows())
+ else if (OperatingSystem.isWindows())
{
accept = f.getName().toLowerCase().endsWith(".ldif");
}
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index d95075d..a292117 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -27,6 +27,8 @@
package org.opends.guitools.controlpanel.util;
import static org.opends.messages.AdminToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
import java.awt.Color;
import java.awt.Component;
@@ -161,18 +163,6 @@
INFO_CTRL_PANEL_NOT_IMPLEMENTED.get();
/**
- * Returns <CODE>true</CODE> if we are running Mac OS and <CODE>false</CODE>
- * otherwise.
- * @return <CODE>true</CODE> if we are running Mac OS and <CODE>false</CODE>
- * otherwise.
- */
- public static boolean isMacOS()
- {
- String os = System.getProperty("os.name").toLowerCase();
- return os.indexOf("mac") != -1;
- }
-
- /**
* Creates a combo box.
* @return a combo box.
*/
@@ -231,18 +221,6 @@
}
/**
- * Returns <CODE>true</CODE> if we are running Windows and <CODE>false</CODE>
- * otherwise.
- * @return <CODE>true</CODE> if we are running Windows and <CODE>false</CODE>
- * otherwise.
- */
- public static boolean isWindows()
- {
- String os = System.getProperty("os.name").toLowerCase();
- return os.indexOf("windows") != -1;
- }
-
- /**
* Derives a color by adding the specified offsets to the base color's
* hue, saturation, and brightness values. The resulting hue, saturation,
* and brightness values will be contrained to be between 0 and 1.
@@ -614,15 +592,14 @@
final JTable table = new JTable(tableModel);
table.setShowGrid(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- boolean isMacOS = Utilities.isMacOS();
table.setGridColor(ColorAndFontConstants.gridColor);
- if (isMacOS)
+ if (isMacOS())
{
table.getTableHeader().setBorder(
BorderFactory.createMatteBorder(1, 1, 0, 0,
ColorAndFontConstants.gridColor));
}
- if (Utilities.isWindows())
+ if (isWindows())
{
table.getTableHeader().setBorder(
BorderFactory.createMatteBorder(1, 1, 0, 1,
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
index b7904ec..c9a4056 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -29,6 +29,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.ERR_ERROR_PARSING_ARGS;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.messages.ToolMessages;
@@ -89,7 +90,7 @@
super(args);
String scriptName;
- if (Utils.isWindows()) {
+ if (isWindows()) {
scriptName = Installation.WINDOWS_UNINSTALL_FILE_NAME;
} else {
scriptName = Installation.UNIX_UNINSTALL_FILE_NAME;
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index 8385a56..714a0fd 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -72,6 +72,7 @@
import static org.opends.quicksetup.Step.*;
import static org.opends.quicksetup.util.Utils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.*;
import java.net.InetAddress;
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java
index 6c0d610..5386cf5 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -29,6 +29,7 @@
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.util.SetupUtils.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -81,7 +82,7 @@
is = process.getInputStream();
out = process.getOutputStream();
final OutputStream fOut = out;
- if (Utils.isWindows())
+ if (isWindows())
{
// In windows if there is an error we wait the user to click on
// return to continue.
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
index 759c99f..7a3f245 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
@@ -30,6 +30,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.File;
import java.io.IOException;
@@ -108,7 +109,7 @@
buf.append(Constants.LINE_SEPARATOR);
buf.append("- ").append(msg);
}
- String cmd = Utils.isWindows() ?
+ String cmd = isWindows() ?
Installation.WINDOWS_SETUP_FILE_NAME :
Installation.UNIX_SETUP_FILE_NAME;
installationMsg = INFO_INSTALLSTATUS_INSTALLED_CLI.get(cmd, buf);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java
index a43b1c2..20434a0 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -27,6 +27,9 @@
package org.opends.quicksetup;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
+
import java.io.*;
import java.util.*;
@@ -772,7 +775,7 @@
public File getBinariesDirectory()
{
File binPath;
- if (Utils.isWindows())
+ if (isWindows())
{
binPath = new File(getRootDirectory(), WINDOWS_BINARIES_PATH_RELATIVE);
}
@@ -954,7 +957,7 @@
public File getCommandFile(String command)
{
File commandFile;
- if (Utils.isWindows())
+ if (isWindows())
{
commandFile = new File(getBinariesDirectory(), command + ".bat");
}
@@ -976,7 +979,7 @@
public File getServerStartCommandFile()
{
File startCommandFile;
- if (Utils.isWindows())
+ if (isWindows())
{
startCommandFile = new File(getBinariesDirectory(),
WINDOWS_START_FILE_NAME);
@@ -999,7 +1002,7 @@
public File getServerStopCommandFile()
{
File stopCommandFile;
- if (Utils.isWindows())
+ if (isWindows())
{
stopCommandFile = new File(getBinariesDirectory(),
WINDOWS_STOP_FILE_NAME);
@@ -1071,12 +1074,12 @@
public File getControlPanelCommandFile()
{
File controlPanelCommandFile;
- if (Utils.isWindows())
+ if (isWindows())
{
controlPanelCommandFile = new File(getBinariesDirectory(),
WINDOWS_CONTROLPANEL_FILE_NAME);
}
- else if (Utils.isMacOS())
+ else if (isMacOS())
{
controlPanelCommandFile = new File(getRootDirectory() + File.separator
+ MAC_APPLICATIONS_PATH_RELATIVE, MAC_CONTROLPANEL_FILE_NAME);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index a23f900..ab0b77c 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -61,6 +61,8 @@
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
+import com.forgerock.opendj.util.OperatingSystem;
+
import static org.forgerock.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.Step.*;
@@ -2960,7 +2962,7 @@
serverProperties.put(ADSContext.ServerProperty.ID, serverID);
serverProperties.put(ADSContext.ServerProperty.HOST_OS,
- getOSString());
+ OperatingSystem.getOperatingSystem().toString());
return serverProperties;
}
@@ -3069,7 +3071,7 @@
long requiredInMb = getRequiredInstallSpace() / (1024 * 1024);
errorMsgs.add(INFO_NOT_ENOUGH_DISK_SPACE.get(serverLocation, requiredInMb));
qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
- } else if (isWindows() && (serverLocation.contains("%")))
+ } else if (OperatingSystem.isWindows() && (serverLocation.contains("%")))
{
errorMsgs.add(INFO_INVALID_CHAR_IN_PATH.get("%"));
qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index 4a4fe4a..9d6d03a 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -69,6 +69,7 @@
import org.opends.messages.ReplicationMessages;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.opends.server.tools.ConfigureDS;
import org.opends.server.tools.ConfigureWindowsService;
@@ -86,7 +87,7 @@
/**
* This is the only class that uses classes in org.opends.server (excluding the
- * case of DynamicConstants, SetupUtils, OperatingSystem and CertificateManager
+ * case of DynamicConstants, SetupUtils and CertificateManager
* which are already included in quicksetup.jar).
*
* Important note: do not include references to this class until OpenDS.jar has
@@ -126,7 +127,7 @@
File installPath = new File(application.getInstallationPath());
ArrayList<String> argList = new ArrayList<String>();
File binPath;
- if (Utils.isWindows())
+ if (isWindows())
{
binPath =
new File(installPath, Installation.WINDOWS_BINARIES_PATH_RELATIVE);
@@ -136,7 +137,7 @@
new File(installPath, Installation.UNIX_BINARIES_PATH_RELATIVE);
}
File importPath;
- if (Utils.isWindows())
+ if (isWindows())
{
importPath = new File(binPath, Installation.WINDOWS_IMPORT_LDIF);
} else
@@ -1159,7 +1160,7 @@
{
fLib.mkdir();
}
- if (Utils.isWindows())
+ if (isWindows())
{
destinationFile = Utils.getPath(libDir,
Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
index e71d1a0..5c6da13 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
@@ -29,6 +29,7 @@
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.messages.ToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.File;
@@ -85,7 +86,7 @@
public SetupLauncher(String[] args) {
super(args);
String scriptName;
- if (Utils.isWindows()) {
+ if (isWindows()) {
scriptName = Installation.WINDOWS_SETUP_FILE_NAME;
} else {
scriptName = Installation.UNIX_SETUP_FILE_NAME;
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 5c9573f..3db8fc9 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -29,6 +29,7 @@
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.PrintStream;
@@ -119,7 +120,7 @@
checkAbort();
- if (Utils.isWindows() && getUserData().getEnableWindowsService())
+ if (isWindows() && getUserData().getEnableWindowsService())
{
if (isVerbose())
{
@@ -492,7 +493,7 @@
}
}
- if (Utils.isWindows() && getUserData().getEnableWindowsService())
+ if (isWindows() && getUserData().getEnableWindowsService())
{
totalTime += hmTime.get(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
steps.add(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
index 76a2e33..1d23785 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -32,6 +32,7 @@
import static org.forgerock.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.opends.admin.ads.ServerDescriptor;
import org.opends.quicksetup.Constants;
@@ -666,7 +667,7 @@
gbc.weightx = 1.0;
auxPanel.add(Box.createHorizontalGlue(), gbc);
bottomComponent.add(auxPanel, gbc);
- if (Utils.isWindows())
+ if (isWindows())
{
gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD;
bottomComponent.add(getEnableWindowsServiceCheckBox(), gbc);
@@ -722,7 +723,7 @@
{
public void actionPerformed(ActionEvent ev)
{
- if (Utils.isWindows())
+ if (isWindows())
{
lastUserData.setEnableWindowsService(
enableWindowsServiceCheckBox.isSelected());
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 567bcd4..1b5b5bd 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -53,6 +53,7 @@
import org.opends.server.util.SetupUtils;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
/**
* This is an implementation of the Installer class that is used to install
@@ -164,7 +165,7 @@
checkAbort();
- if (Utils.isWindows() && getUserData().getEnableWindowsService())
+ if (isWindows() && getUserData().getEnableWindowsService())
{
if (isVerbose())
{
@@ -416,7 +417,7 @@
}
}
- if (Utils.isWindows() && getUserData().getEnableWindowsService())
+ if (isWindows() && getUserData().getEnableWindowsService())
{
totalTime += hmTime.get(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
steps.add(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
index 808c21f..3edef2a 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -41,6 +41,7 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
import javax.swing.*;
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/Utilities.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
index 740d601..81d2163 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/ui/Utilities.java
@@ -27,8 +27,7 @@
package org.opends.quicksetup.ui;
import org.forgerock.i18n.LocalizableMessage;
-
-import org.opends.quicksetup.util.Utils;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
import javax.swing.*;
import javax.swing.text.JTextComponent;
@@ -87,7 +86,7 @@
static public void setFrameIcon(JFrame frame)
{
UIFactory.IconType ic;
- if (Utils.isMacOS()) {
+ if (isMacOS()) {
ic = UIFactory.IconType.MINIMIZED_MAC;
} else {
ic = UIFactory.IconType.MINIMIZED;
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ExtensionFileFilter.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ExtensionFileFilter.java
index 4edb83b..8a0c2b2 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ExtensionFileFilter.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ExtensionFileFilter.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.quicksetup.util;
@@ -29,6 +30,7 @@
import java.io.File;
import javax.swing.filechooser.FileFilter;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
/**
* This is a class used to be able to filter on certain type of files
@@ -63,7 +65,7 @@
if (f.isDirectory())
{
accept = true;
- } else if (Utils.isWindows())
+ } else if (isWindows())
{
accept =
f.getName().toLowerCase().endsWith("." + extension.toLowerCase());
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java
index a39e472..0c5e835 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -34,6 +34,7 @@
import org.opends.server.util.StaticUtils;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isUnix;
/**
* Utility class for use by applications containing methods for managing
@@ -505,7 +506,7 @@
if (destination.exists()) {
// TODO: set the file's permissions. This is made easier in
// Java 1.6 but until then use the TestUtilities methods
- if (Utils.isUnix()) {
+ if (isUnix()) {
String permissions =
Utils.getFileSystemPermissions(objectFile);
Utils.setPermissionsUnix(
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index ef7f76e..4a93141 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -29,6 +29,7 @@
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.util.Utils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -197,7 +198,7 @@
org.opends.server.protocols.ldap.
LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR;
if ((returnValue == clientSideError) || (returnValue == 0)) {
- if (Utils.isWindows()) {
+ if (isWindows()) {
/*
* Sometimes the server keeps some locks on the files.
* TODO: remove this code once stop-ds returns properly when
@@ -503,7 +504,7 @@
}
if (!connected)
{
- if (Utils.isWindows())
+ if (isWindows())
{
throw new ApplicationException(
ReturnCode.START_ERROR,
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 2f29478..94798ac 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -29,6 +29,8 @@
import static org.forgerock.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.util.DynamicConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static com.forgerock.opendj.util.OperatingSystem.isUnix;
import java.io.*;
import java.net.InetAddress;
@@ -139,7 +141,7 @@
String script;
String libPath = Utils.getPath(installPath,
Installation.LIBRARIES_PATH_RELATIVE);
- if (Utils.isWindows())
+ if (isWindows())
{
script = Utils.getScriptPath(Utils.getPath(libPath,
Installation.SCRIPT_UTIL_FILE_WINDOWS));
@@ -158,7 +160,7 @@
env.remove("OPENDJ_JAVA_BIN");
// In windows by default the scripts ask the user to click on enter when
// they fail. Set this environment variable to avoid it.
- if (Utils.isWindows())
+ if (isWindows())
{
env.put("DO_NOT_PAUSE", "true");
}
@@ -172,7 +174,7 @@
logger.info(LocalizableMessage.raw("The output: "+line));
if (line.contains("ERROR: The detected Java version"))
{
- if (Utils.isWindows())
+ if (isWindows())
{
// If we are running windows, the process get blocked waiting for
// user input. Just wait for a certain time to print the output
@@ -308,48 +310,6 @@
}
/**
- * Returns <CODE>true</CODE> if we are running under windows and
- * <CODE>false</CODE> otherwise.
- * @return <CODE>true</CODE> if we are running under windows and
- * <CODE>false</CODE> otherwise.
- */
- public static boolean isWindows()
- {
- return SetupUtils.isWindows();
- }
-
- /**
- * Returns <CODE>true</CODE> if we are running under Mac OS and
- * <CODE>false</CODE> otherwise.
- * @return <CODE>true</CODE> if we are running under Mac OS and
- * <CODE>false</CODE> otherwise.
- */
- public static boolean isMacOS()
- {
- return SetupUtils.isMacOS();
- }
-
- /**
- * Returns <CODE>true</CODE> if we are running under Unix and
- * <CODE>false</CODE> otherwise.
- * @return <CODE>true</CODE> if we are running under Unix and
- * <CODE>false</CODE> otherwise.
- */
- public static boolean isUnix()
- {
- return SetupUtils.isUnix();
- }
-
- /**
- * Returns a String representation of the OS we are running.
- * @return a String representation of the OS we are running.
- */
- public static String getOSString()
- {
- return SetupUtils.getOSString();
- }
-
- /**
* Returns <CODE>true</CODE> if the parent directory for the provided path
* exists and <CODE>false</CODE> otherwise.
* @param path the path that we are analyzing.
@@ -1472,7 +1432,7 @@
catch (Throwable t)
{
String setupFile;
- if (Utils.isWindows())
+ if (isWindows())
{
setupFile = Installation.WINDOWS_SETUP_FILE_NAME;
}
@@ -1853,7 +1813,7 @@
int initialIndex = 1;
StringBuilder sbSeparator = new StringBuilder();
sbSeparator.append(formatter.getSpace());
- if (!Utils.isWindows())
+ if (!isWindows())
{
sbSeparator.append("\\");
sbSeparator.append(formatter.getLineBreak());
@@ -1896,7 +1856,7 @@
public static String escapeCommandLineValue(String value)
{
StringBuilder b = new StringBuilder();
- if (Utils.isUnix())
+ if (isUnix())
{
for (int i=0 ; i<value.length(); i++)
{
@@ -1934,7 +1894,7 @@
{
ArrayList<String> cmdLine = new ArrayList<String>();
String setupFile;
- if (Utils.isWindows())
+ if (isWindows())
{
setupFile = Installation.WINDOWS_SETUP_FILE_NAME;
}
@@ -1996,7 +1956,7 @@
cmdLine.add("--rootUserPassword");
cmdLine.add(OBFUSCATED_VALUE);
- if (Utils.isWindows() && userData.getEnableWindowsService())
+ if (isWindows() && userData.getEnableWindowsService())
{
cmdLine.add("--enableWindowsService");
}
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
index 3247ecd..9e03d65 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/WebBrowserLauncher.java
@@ -26,6 +26,10 @@
*/
package org.opends.quicksetup.util;
+
+
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
+import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
import org.forgerock.i18n.LocalizableMessage;
import java.io.IOException;
@@ -47,14 +51,14 @@
{
try
{
- if (Utils.isMacOS())
+ if (isMacOS())
{
Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[]
{ String.class });
openURL.invoke(null, url);
- } else if (Utils.isWindows())
+ } else if (isWindows())
{
String[] cmd = {"rundll32", "url.dll,FileProtocolHandler", url};
Runtime.getRuntime().exec(cmd);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
index b6b7a14..9c0930a 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
@@ -29,6 +29,7 @@
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isUnix;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Application;
@@ -224,7 +225,7 @@
nEntries++;
}
- if (Utils.isUnix()) {
+ if (isUnix()) {
// Change the permissions for UNIX systems
for (String perm : permissions.keySet()) {
ArrayList<String> paths = permissions.get(perm);
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 8063fbe..d9128be 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -48,6 +48,7 @@
import static org.opends.quicksetup.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
/**
* This class is used to download the files that have been marked as lazy
@@ -249,7 +250,7 @@
logger.error(LocalizableMessage.raw("Could not find service: "+
Utils.JNLP_SERVICE_NAME, e));
String setupFile;
- if (Utils.isWindows())
+ if (isWindows())
{
setupFile = Installation.WINDOWS_SETUP_FILE_NAME;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
index 7c6738f..350b017 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -212,7 +212,6 @@
import org.opends.server.types.Modification;
import org.opends.server.types.NameForm;
import org.opends.server.types.ObjectClass;
-import org.opends.server.types.OperatingSystem;
import org.opends.server.types.Operation;
import org.opends.server.types.Privilege;
import org.opends.server.types.RestoreConfig;
@@ -236,6 +235,7 @@
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
+import com.forgerock.opendj.util.OperatingSystem;
/**
* This class defines the core of the Directory Server. It manages the startup
@@ -9176,7 +9176,7 @@
public static boolean isRunningAsWindowsService()
{
boolean isRunningAsWindowsService;
- if (SetupUtils.isWindows())
+ if (OperatingSystem.isWindows())
{
isRunningAsWindowsService = ConfigureWindowsService.serviceState(null,
null) == ConfigureWindowsService.SERVICE_STATE_ENABLED;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java b/opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java
index 94456e7..885cd20 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -42,6 +42,7 @@
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
+import static com.forgerock.opendj.util.OperatingSystem.hasUAC;
/**
* This class is used to configure the Windows service for this instance on
@@ -410,7 +411,7 @@
String[] cmd;
- if (SetupUtils.hasUAC())
+ if (hasUAC())
{
cmd = new String[] {
getLauncherBinaryFullPath(),
@@ -521,7 +522,7 @@
LocalizableMessage msg;
String serverRoot = getServerRoot();
String[] cmd;
- if (SetupUtils.hasUAC())
+ if (hasUAC())
{
cmd = new String[] {
getLauncherBinaryFullPath(),
@@ -601,7 +602,7 @@
int returnValue;
LocalizableMessage msg;
String[] cmd;
- if (SetupUtils.hasUAC())
+ if (hasUAC())
{
cmd = new String[] {
getLauncherBinaryFullPath(),
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/CreateRCScript.java b/opendj3-server-dev/src/server/org/opends/server/tools/CreateRCScript.java
index 1f4e50e..af30aae 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/CreateRCScript.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/CreateRCScript.java
@@ -38,7 +38,6 @@
import org.opends.server.loggers.JDKLogging;
import org.opends.server.types.FilePermission;
import org.opends.server.types.NullOutputStream;
-import org.opends.server.types.OperatingSystem;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.SetupUtils;
@@ -47,6 +46,7 @@
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.StringArgument;
+import com.forgerock.opendj.util.OperatingSystem;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -104,8 +104,7 @@
EmbeddedUtils.initializeForClientUse();
- OperatingSystem operatingSystem = DirectoryServer.getOperatingSystem();
- if (! OperatingSystem.isUNIXBased(operatingSystem))
+ if (! OperatingSystem.isUnixBased())
{
err.println(ERR_CREATERC_ONLY_RUNS_ON_UNIX.get());
return 1;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
index 9b2c091..45a00be 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
@@ -34,6 +34,7 @@
import static com.forgerock.opendj.cli.Utils.CONFIRMATION_MAX_TRIES;
import static com.forgerock.opendj.cli.Utils.canWrite;
import static org.forgerock.util.Utils.joinAsString;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.BufferedReader;
import java.io.File;
@@ -575,7 +576,7 @@
// Use this instead a call to Installation to avoid to launch a new JVM
// just to retrieve a path.
String root = Utils.getInstallPathFromClasspath();
- if (SetupUtils.isWindows())
+ if (isWindows())
{
String binDir = Utils.getPath(root,
Installation.WINDOWS_BINARIES_PATH_RELATIVE);
@@ -1809,7 +1810,7 @@
{
boolean enableService = false;
// If we are in Windows ask if the server must run as a windows service.
- if (SetupUtils.isWindows())
+ if (isWindows())
{
if (argParser.enableWindowsServiceArg.isPresent())
{
@@ -2481,7 +2482,7 @@
println(INFO_INSTALLDS_DO_NOT_START_SERVER.get());
}
- if (Utils.isWindows())
+ if (isWindows())
{
if (uData.getEnableWindowsService())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDSArgumentParser.java b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDSArgumentParser.java
index b32bdf0..383d789 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDSArgumentParser.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDSArgumentParser.java
@@ -28,6 +28,7 @@
import static org.opends.messages.ToolMessages.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.util.Collection;
import java.util.HashSet;
@@ -127,7 +128,7 @@
addArgument(cliArg);
String defaultProgName;
- if (SetupUtils.isWindows())
+ if (isWindows())
{
defaultProgName = Installation.WINDOWS_SETUP_FILE_NAME;
}
@@ -278,7 +279,7 @@
"enableWindowsService",
INFO_INSTALLDS_DESCRIPTION_ENABLE_WINDOWS_SERVICE.get());
enableWindowsServiceArg.setPropertyName("enableWindowsService");
- if (SetupUtils.isWindows())
+ if (isWindows())
{
addArgument(enableWindowsServiceArg);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesTool.java b/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesTool.java
index 432c1c4..105628c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesTool.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesTool.java
@@ -43,6 +43,7 @@
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
/**
* This class is used to update the scripts that are used to launch the command
@@ -306,7 +307,7 @@
try
{
String value;
- if (Utils.isWindows())
+ if (isWindows())
{
value = getWindowsContents(overwriteEnvJavaHome, overwriteEnvJavaArgs,
defaultJavaHome, defaultJavaArgs, properties);
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java b/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
index 910b575..eab5546 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/JavaPropertiesToolArgumentParser.java
@@ -28,6 +28,7 @@
import static org.opends.messages.ToolMessages.*;
import static com.forgerock.opendj.cli.Utils.canWrite;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import java.io.File;
import java.util.LinkedHashSet;
@@ -164,7 +165,7 @@
if (root != null)
{
String libDir = Utils.getPath(root, Installation.LIBRARIES_PATH_RELATIVE);
- if (Utils.isWindows())
+ if (isWindows())
{
value = Utils.getPath(libDir,
Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
@@ -179,7 +180,7 @@
{
// This can happen when we are not launched using the command-line (for
// instance from the WebInstaller).
- if (Utils.isWindows())
+ if (isWindows())
{
value = Utils.getPath(Installation.LIBRARIES_PATH_RELATIVE,
Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS);
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/StartWindowsService.java b/opendj3-server-dev/src/server/org/opends/server/tools/StartWindowsService.java
index 245fc57..d1d636b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/StartWindowsService.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/StartWindowsService.java
@@ -33,10 +33,10 @@
import org.opends.server.loggers.JDKLogging;
import org.opends.server.types.NullOutputStream;
-import org.opends.server.util.SetupUtils;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.StaticUtils.*;
+import static com.forgerock.opendj.util.OperatingSystem.hasUAC;
/**
* This class is used to start the Windows service associated with this
@@ -99,7 +99,7 @@
else
{
String[] cmd;
- if (SetupUtils.hasUAC())
+ if (hasUAC())
{
cmd= new String[] {
ConfigureWindowsService.getLauncherBinaryFullPath(),
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/StopWindowsService.java b/opendj3-server-dev/src/server/org/opends/server/tools/StopWindowsService.java
index 65b058a..51a9257 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/StopWindowsService.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/StopWindowsService.java
@@ -33,10 +33,10 @@
import org.opends.server.loggers.JDKLogging;
import org.opends.server.types.NullOutputStream;
-import org.opends.server.util.SetupUtils;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.StaticUtils.*;
+import static com.forgerock.opendj.util.OperatingSystem.hasUAC;
/**
@@ -98,7 +98,7 @@
else
{
String[] cmd;
- if (SetupUtils.hasUAC())
+ if (hasUAC())
{
cmd= new String[] {
ConfigureWindowsService.getLauncherBinaryFullPath(),
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index 11da65d..d939b57 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -63,6 +63,7 @@
import static org.opends.quicksetup.util.Utils.getMessageFromCollection;
import static org.opends.quicksetup.util.Utils.getServerClock;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import org.opends.server.admin.*;
import org.opends.server.admin.client.ManagementContext;
@@ -11448,7 +11449,7 @@
private String getCommandLinePath(String scriptBasicName)
{
String cmdLineName;
- if (Utilities.isWindows())
+ if (isWindows())
{
cmdLineName = getBinaryDir()+scriptBasicName+".bat";
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/FileManager.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/FileManager.java
index 9f20051..f7df43d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/FileManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/FileManager.java
@@ -30,6 +30,7 @@
import static org.opends.messages.ToolMessages.*;
+import static com.forgerock.opendj.util.OperatingSystem.isUnix;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.types.DirectoryException;
@@ -387,7 +388,7 @@
{
// TODO: set the file's permissions. This is made easier in
// Java 1.6 but until then use the TestUtilities methods
- if (UpgradeUtils.isUnix())
+ if (isUnix())
{
final FilePermission permissions =
getFileSystemPermissions(objectFile);
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java
index c6a0160..86f7ec5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeUtils.java
@@ -48,7 +48,6 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SchemaConfigManager;
import org.opends.server.util.ChangeOperationType;
-import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
import static org.opends.messages.ConfigMessages.INFO_CONFIG_FILE_HEADER;
@@ -261,30 +260,6 @@
}
/**
- * Returns <CODE>true</CODE> if we are running under windows and
- * <CODE>false</CODE> otherwise.
- *
- * @return <CODE>true</CODE> if we are running under windows and
- * <CODE>false</CODE> otherwise.
- */
- static boolean isWindows()
- {
- return SetupUtils.isWindows();
- }
-
- /**
- * Returns <CODE>true</CODE> if we are running under Unix and
- * <CODE>false</CODE> otherwise.
- *
- * @return <CODE>true</CODE> if we are running under Unix and
- * <CODE>false</CODE> otherwise.
- */
- static boolean isUnix()
- {
- return SetupUtils.isUnix();
- }
-
- /**
* Determines whether one file is the parent of another.
*
* @param ancestor
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java b/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
index c0549a2..9051b6c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
@@ -45,6 +45,7 @@
import org.opends.server.config.ConfigEntry;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
+import com.forgerock.opendj.util.OperatingSystem;
/**
* This interface defines a set of methods that may be used by
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/FilePermission.java b/opendj3-server-dev/src/server/org/opends/server/types/FilePermission.java
index d1c11e9..4916685 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/FilePermission.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/FilePermission.java
@@ -36,6 +36,8 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.core.DirectoryServer;
+import com.forgerock.opendj.util.OperatingSystem;
+
import static org.opends.messages.UtilityMessages.*;
/**
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/OperatingSystem.java b/opendj3-server-dev/src/server/org/opends/server/types/OperatingSystem.java
deleted file mode 100644
index 7958ef5..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/types/OperatingSystem.java
+++ /dev/null
@@ -1,232 +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 legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * 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 legal-notices/CDDLv1_0.txt.
- * 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
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.types;
-
-
-/**
- * This class defines an enumeration that may be used to identify
- * the operating system on which the JVM is running.
- *
- * NOTE: to share code this class is used in SetupUtils and should
- * not contain any dependency with other classes (not even with
- * classes in this package).
- * If this class is modified to depend on other classes it will break
- * the quicksetup. If this must be done, the references to this
- * class in SetupUtils must be removed.
- */
-@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.VOLATILE,
- mayInstantiate=false,
- mayExtend=false,
- mayInvoke=true)
-public enum OperatingSystem
-{
- /**
- * The value indicating the AIX operating system.
- */
- AIX("AIX"),
-
-
-
- /**
- * The value indicating the FreeBSD operating system.
- */
- FREEBSD("FreeBSD"),
-
-
-
- /**
- * The value indicating the HP-UX operating system.
- */
- HPUX("HP-UX"),
-
-
-
- /**
- * The value indicating the Linux operating system.
- */
- LINUX("Linux"),
-
-
-
- /**
- * The value indicating the Mac OS X operating system.
- */
- MACOS("Mac OS X"),
-
-
-
- /**
- * The value indicating the Solaris operating system.
- */
- SOLARIS("Solaris"),
-
-
-
- /**
- * The value indicating the Windows operating system.
- */
- WINDOWS("Windows"),
-
-
-
- /**
- * The value indicating the z/OS operating system.
- */
- ZOS("z/OS"),
-
-
-
- /**
- * The value indicating an unknown operating system.
- */
- UNKNOWN("Unknown");
-
-
-
- // The human-readable name for this operating system.
- private String osName;
-
-
-
- /**
- * Creates a new operating system value with the provided name.
- *
- * @param osName The human-readable name for the operating system.
- */
- private OperatingSystem(String osName)
- {
- this.osName = osName;
- }
-
-
-
- /**
- * Retrieves the human-readable name of this operating system.
- *
- * @return The human-readable name for this operating system.
- */
- public String toString()
- {
- return osName;
- }
-
-
-
- /**
- * Retrieves the operating system for the provided name. The name
- * provided should come from the <CODE>os.name</CODE> system
- * property.
- *
- * @param osName The name for which to retrieve the corresponding
- * operating system.
- *
- * @return The operating system for the provided name.
- */
- public static OperatingSystem forName(String osName)
- {
- if (osName == null)
- {
- return UNKNOWN;
- }
-
-
- String lowerName = osName.toLowerCase();
-
- if ((lowerName.indexOf("solaris") >= 0) ||
- (lowerName.indexOf("sunos") >= 0))
- {
- return SOLARIS;
- }
- else if (lowerName.indexOf("linux") >= 0)
- {
- return LINUX;
- }
- else if ((lowerName.indexOf("hp-ux") >= 0) ||
- (lowerName.indexOf("hp ux") >= 0) ||
- (lowerName.indexOf("hpux") >= 0))
- {
- return HPUX;
- }
- else if (lowerName.indexOf("aix") >= 0)
- {
- return AIX;
- }
- else if (lowerName.indexOf("windows") >= 0)
- {
- return WINDOWS;
- }
- else if ((lowerName.indexOf("freebsd") >= 0) ||
- (lowerName.indexOf("free bsd") >= 0))
- {
- return FREEBSD;
- }
- else if ((lowerName.indexOf("macos") >= 0) ||
- (lowerName.indexOf("mac os") >= 0))
- {
- return MACOS;
- }
- else if (lowerName.indexOf("z/os") >= 0)
- {
- return ZOS;
- }
- else
- {
- return UNKNOWN;
- }
- }
-
-
-
- /**
- * Indicates whether the provided operating system is UNIX-based.
- * UNIX-based operating systems include Solaris, Linux, HP-UX, AIX,
- * FreeBSD, and Mac OS X.
- *
- * @param os The operating system for which to make the
- * determination.
- *
- * @return <CODE>true</CODE> if the provided operating system is
- * UNIX-based, or <CODE>false</CODE> if not.
- */
- public static boolean isUNIXBased(OperatingSystem os)
- {
- switch (os)
- {
- case SOLARIS:
- case LINUX:
- case HPUX:
- case AIX:
- case FREEBSD:
- case MACOS:
- return true;
- default:
- return false;
- }
- }
-}
-
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/SetupUtils.java b/opendj3-server-dev/src/server/org/opends/server/util/SetupUtils.java
index 45549d9..6d04e50 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/SetupUtils.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/SetupUtils.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.util;
@@ -39,7 +39,7 @@
import java.util.Random;
import java.util.Set;
-import org.opends.server.types.OperatingSystem;
+import com.forgerock.opendj.util.OperatingSystem;
/**
* This class provides a number of utility methods that may be used during the
@@ -248,117 +248,6 @@
}
/**
- * Returns {@code true} if we are running under Mac OS and
- * {@code false} otherwise.
- * @return {@code true} if we are running under Mac OS and
- * {@code false} otherwise.
- */
- public static boolean isMacOS()
- {
- return OperatingSystem.MACOS == getOperatingSystem();
- }
-
- /**
- * Returns {@code true} if we are running under Unix and
- * {@code false} otherwise.
- * @return {@code true} if we are running under Unix and
- * {@code false} otherwise.
- */
- public static boolean isUnix()
- {
- return OperatingSystem.isUNIXBased(getOperatingSystem());
- }
-
- /**
- * Indicates whether the underlying operating system is a Windows variant.
- *
- * @return {@code true} if the underlying operating system is a Windows
- * variant, or {@code false} if not.
- */
- public static boolean isWindows()
- {
- return OperatingSystem.WINDOWS == getOperatingSystem();
- }
-
- /**
- * Indicates whether the underlying operating system is Windows Vista.
- *
- * @return {@code true} if the underlying operating system is Windows
- * Vista, or {@code false} if not.
- */
- public static boolean isVista()
- {
- String os = System.getProperty("os.name");
- if (os != null)
- {
- return isWindows() && (os.toLowerCase().indexOf("vista") != -1);
- }
- return false;
- }
-
- /**
- * Indicates whether the underlying operating system is Windows 2008.
- *
- * @return {@code true} if the underlying operating system is Windows
- * 2008, or {@code false} if not.
- */
- public static boolean isWindows2008()
- {
- String os = System.getProperty("os.name");
- if (os != null)
- {
- return isWindows() && (os.toLowerCase().indexOf("server 2008") != -1);
- }
- return false;
- }
-
- /**
- * Indicates whether the underlying operating system is Windows 7.
- *
- * @return {@code true} if the underlying operating system is Windows 7, or
- * {@code false} if not.
- */
- public static boolean isWindows7()
- {
- String os = System.getProperty("os.name");
- if (os != null)
- {
- return os.toLowerCase().indexOf("windows 7") != -1;
- }
- return false;
- }
-
- /**
- * Indicates whether the underlying operating system has UAC (User Access
- * Control).
- *
- * @return {@code true} if the underlying operating system has UAC (User
- * Access Control), or {@code false} if not.
- */
- public static boolean hasUAC()
- {
- return isVista() || isWindows2008() || isWindows7();
- }
-
- /**
- * Returns a String representation of the OS we are running.
- * @return a String representation of the OS we are running.
- */
- public static String getOSString()
- {
- return getOperatingSystem().toString();
- }
-
- /**
- * Commodity method to help identifying the OS we are running on.
- * @return the OperatingSystem we are running on.
- */
- public static OperatingSystem getOperatingSystem()
- {
- return OperatingSystem.forName(System.getProperty("os.name"));
- }
-
- /**
* Returns {@code true} if the provided port is free and we can use it,
* {@code false} otherwise.
* @param hostname the host name we are analyzing. Use <CODE>null</CODE>
@@ -383,7 +272,7 @@
socketAddress = new InetSocketAddress(port);
}
serverSocket = new ServerSocket();
- if (!isWindows())
+ if (!OperatingSystem.isWindows())
{
serverSocket.setReuseAddress(true);
}
@@ -458,7 +347,7 @@
*/
public static boolean isPriviledgedPort(int port)
{
- return (port <= 1024) && !isWindows();
+ return (port <= 1024) && !OperatingSystem.isWindows();
}
/**
@@ -491,7 +380,7 @@
public static String getScriptPath(String script)
{
String s = script;
- if (isWindows())
+ if (OperatingSystem.isWindows())
{
if (s != null)
{
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
index 7adefac..eb0b9af 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/quicksetup/TestUtilities.java
@@ -37,7 +37,7 @@
import org.opends.quicksetup.util.ZipExtractor;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.ByteStringBuilder;
-import org.opends.server.types.OperatingSystem;
+import com.forgerock.opendj.util.OperatingSystem;
@SuppressWarnings("javadoc")
public class TestUtilities {
@@ -81,8 +81,7 @@
List<String> args = new ArrayList<String>();
File root = getQuickSetupTestServerRootDir();
- if (OperatingSystem.isUNIXBased(
- OperatingSystem.forName(System.getProperty("os.name")))) {
+ if (OperatingSystem.isUnixBased()) {
args.add(new File(root, "setup").getPath());
} else {
args.add(new File(root, "setup.bat").getPath());
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 4513e13..6be03bf 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -74,6 +74,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.testng.Assert.*;
+import com.forgerock.opendj.util.OperatingSystem;
/**
* This class defines some utility functions which can be used by test cases.
@@ -407,9 +408,7 @@
}
// Make the shell scripts in the bin directory executable, if possible.
- OperatingSystem os = DirectoryServer.getOperatingSystem();
- if ((os != null) && OperatingSystem.isUNIXBased(os) &&
- FilePermission.canSetPermissions())
+ if (OperatingSystem.isUnixBased() && FilePermission.canSetPermissions())
{
try
{
--
Gitblit v1.10.0