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 = 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 { 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"; } 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); 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. 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"); } 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); } 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() 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; 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"); } 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, 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; 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; 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. 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); 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); 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); 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); 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; 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); 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()); 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); 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.*; 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; 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()); 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( 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, 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"); } 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); 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); 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; } 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; 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(), 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; 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()) { 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); } 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); 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); 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(), 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(), 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"; } 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); 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 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 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.*; /** opendj3-server-dev/src/server/org/opends/server/types/OperatingSystem.java
File was deleted 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) { 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()); 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 {