opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CurrentInstallStatus.java
@@ -296,16 +296,6 @@ } /** * Provides the config file path (path to config.ldif file). * * @return the config file path. */ private String getConfigFilePath() { return Utils.getConfigFileFromClasspath(); } /** * Provides the LDAP port as is specified in the config.ldif file. * * @return the LDAP port specified in the config.ldif file. @@ -411,7 +401,9 @@ StringBuffer buf = new StringBuffer(); try { FileReader reader = new FileReader(getConfigFilePath()); Installation installation = getInstallationFromClassPath(); FileReader reader = new FileReader(installation.getCurrentConfigurationFile()); BufferedReader in = new BufferedReader(reader); String line; // We do not care about encoding: we are just interested in the ports @@ -481,4 +473,8 @@ index1 + attrName.length()); } } private Installation getInstallationFromClassPath() { return new Installation(Utils.getInstallPathFromClasspath()); } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -569,4 +569,15 @@ return new File(getRootDirectory(), "uninstall.bat"); } public File getStatusPanelCommandFile() { File statusPanelCommandFile; if (Utils.isWindows()) { statusPanelCommandFile = new File(getBinariesDirectory(), WINDOWS_STATUSPANEL_FILE_NAME); } else { statusPanelCommandFile = new File(getBinariesDirectory(), UNIX_STATUSPANEL_FILE_NAME); } return statusPanelCommandFile; } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetup.java
@@ -361,19 +361,14 @@ public Object processBackgroundTask() throws UserDataException { try { String cmd = Utils.isWindows()?Utils.getWindowsStatusPanelFileName(): Utils.getUnixStatusPanelFileName(); String serverPath; if (Utils.isWebStart()) { serverPath = application.getUserData().getServerLocation(); String rootDirectory; if (isWebStart()) { rootDirectory = application.getUserData().getServerLocation(); } else { rootDirectory = Utils.getInstallPathFromClasspath(); } else { serverPath = Utils.getInstallPathFromClasspath(); } cmd = Utils.getPath(serverPath, Utils.getBinariesRelativePath()+ File.separator+cmd); Installation installation = new Installation(rootDirectory); String cmd = Utils.getPath(installation.getStatusPanelCommandFile()); ProcessBuilder pb = new ProcessBuilder(cmd); Map<String, String> env = pb.environment(); env.put("JAVA_HOME", System.getProperty("java.home")); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -30,6 +30,7 @@ import org.opends.quicksetup.Launcher; import org.opends.quicksetup.CliApplication; import org.opends.quicksetup.Installation; import org.opends.quicksetup.util.Utils; /** @@ -114,9 +115,9 @@ public void printUsage() { String arg; if (Utils.isWindows()) { arg = Utils.getWindowsSetupFileName(); arg = Installation.WINDOWS_SETUP_FILE_NAME; } else { arg = Utils.getUnixSetupFileName(); arg = Installation.UNIX_SETUP_FILE_NAME; } /* * This is required because the usage message contains '{' characters that @@ -154,10 +155,10 @@ if (Utils.isWindows()) { System.setProperty("org.opends.server.scriptName", Utils.getWindowsSetupFileName()); Installation.WINDOWS_SETUP_FILE_NAME); } else { System.setProperty("org.opends.server.scriptName", Utils.getUnixSetupFileName()); Installation.UNIX_SETUP_FILE_NAME); } ArrayList<String> newArgList = new ArrayList<String>(); if (args != null) { @@ -170,7 +171,9 @@ newArgList.add("--configClass"); newArgList.add("org.opends.server.extensions.ConfigFileHandler"); newArgList.add("--configFile"); newArgList.add(Utils.getConfigFileFromClasspath()); Installation installation = new Installation(Utils.getInstallPathFromClasspath()); newArgList.add(Utils.getPath(installation.getCurrentConfigurationFile())); String[] newArgs = new String[newArgList.size()]; newArgList.toArray(newArgs); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -659,17 +659,8 @@ hmSummary.put(InstallProgressStep.ENABLING_WINDOWS_SERVICE, getFormattedSummary(getMsg("summary-enabling-windows-service"))); String cmd; if (Utils.isWindows()) { cmd = Utils.getBinariesRelativePath()+File.separator+ Utils.getWindowsStatusPanelFileName(); } else { cmd = Utils.getBinariesRelativePath()+File.separator+ Utils.getUnixStatusPanelFileName(); } Installation installation = getInstallation(); String cmd = Utils.getPath(installation.getStatusPanelCommandFile()); cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT); String[] args = {formatter.getFormattedText(getInstallationPath()), cmd}; hmSummary.put(InstallProgressStep.FINISHED_SUCCESSFULLY, opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -35,6 +35,7 @@ import org.opends.quicksetup.QuickSetupException; import org.opends.quicksetup.ProgressStep; import org.opends.quicksetup.Installation; import org.opends.quicksetup.webstart.JnlpProperties; import org.opends.quicksetup.installer.Installer; import org.opends.quicksetup.installer.InstallProgressStep; @@ -403,14 +404,16 @@ */ private String[] getOpenDSJarPaths() { String[] jarPaths = new String[Utils.getOpenDSJarPaths().length]; String[] jarPaths = new String[Installation.OPEN_DS_JAR_RELATIVE_PATHS.length]; File parentDir = new File(getUserData().getServerLocation()); for (int i = 0; i < jarPaths.length; i++) { File f = new File(parentDir, Utils.getOpenDSJarPaths()[i]); File f = new File(parentDir, Installation.OPEN_DS_JAR_RELATIVE_PATHS[i]); jarPaths[i] = f.getAbsolutePath(); } return jarPaths; } /** opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/InstallWelcomePanel.java
@@ -30,6 +30,7 @@ import java.awt.Component; import org.opends.quicksetup.util.Utils; import org.opends.quicksetup.Installation; /** * This panel is used to show a welcome message. @@ -71,8 +72,8 @@ { msgKey = "welcome-panel-webstart-instructions"; args = new String[3]; String cmd = Utils.isWindows()?Utils.getWindowsSetupFileName(): Utils.getUnixSetupFileName(); String cmd = Utils.isWindows()? Installation.WINDOWS_SETUP_FILE_NAME: Installation.UNIX_SETUP_FILE_NAME; args[0] = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT); args[1] = org.opends.server.util.DynamicConstants.COMPACT_VERSION_STRING; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
@@ -29,6 +29,7 @@ import org.opends.quicksetup.CliApplication; import org.opends.quicksetup.Launcher; import org.opends.quicksetup.Installation; import org.opends.quicksetup.util.Utils; /** @@ -95,9 +96,9 @@ protected void printUsage() { String arg; if (Utils.isWindows()) { arg = Utils.getWindowsUninstallFileName(); arg = Installation.WINDOWS_UNINSTALL_FILE_NAME; } else { arg = Utils.getUnixUninstallFileName(); arg = Installation.UNIX_UNINSTALL_FILE_NAME; } String msg = getMsg("uninstall-launcher-usage"); /* opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
@@ -29,6 +29,7 @@ import org.opends.quicksetup.Launcher; import org.opends.quicksetup.CliApplication; import org.opends.quicksetup.Installation; import org.opends.quicksetup.util.Utils; /** @@ -61,9 +62,9 @@ protected void printUsage() { String arg; if (Utils.isWindows()) { arg = Utils.getWindowsUpgradeFileName(); arg = Installation.WINDOWS_UPGRADE_FILE_NAME; } else { arg = Utils.getUnixUpgradeFileName(); arg = Installation.UNIX_UPGRADE_FILE_NAME; } String msg = getMsg("upgrade-launcher-usage"); /* opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -51,6 +51,7 @@ import javax.swing.JOptionPane; import org.opends.quicksetup.CurrentInstallStatus; import org.opends.quicksetup.Installation; import org.opends.quicksetup.webstart.JnlpProperties; import org.opends.quicksetup.i18n.ResourceProvider; import org.opends.server.util.SetupUtils; @@ -66,126 +67,6 @@ private static final int MAX_LINE_WIDTH = 80; private static final String[] OPEN_DS_JAR_RELATIVE_PATHS = { "lib/quicksetup.jar", "lib/OpenDS.jar", "lib/je.jar" }; /** * The relative path where all the Windows binaries (batch files) are. */ private static final String WINDOWS_BINARIES_PATH_RELATIVE = "bat"; /** * The relative path where all the UNIX binaries (scripts) are. */ private static final String UNIX_BINARIES_PATH_RELATIVE = "bin"; /** * The relative path where all the libraries (jar files) are. */ private static final String LIBRARIES_PATH_RELATIVE = "lib"; /** * The relative path where the database files are. */ private static final String DATABASES_PATH_RELATIVE = "db"; /** * The relative path where the log files are. */ private static final String LOGS_PATH_RELATIVE = "logs"; /** * The relative path where the LDIF files are. */ private static final String LDIFS_PATH_RELATIVE = "ldif"; /** * The relative path where the backup files are. */ private static final String BACKUPS_PATH_RELATIVE = "bak"; /** * The relative path where the config files are. */ private static final String CONFIG_PATH_RELATIVE = "config"; /** * The relative path to the Configuration LDIF file. */ private static final String CONFIG_FILE_PATH_RELATIVE = "config/config.ldif"; /** * The UNIX setup script file name. */ private static final String UNIX_SETUP_FILE_NAME = "setup"; /** * The Windows setup batch file name. */ private static final String WINDOWS_SETUP_FILE_NAME = "setup.bat"; /** * The UNIX uninstall script file name. */ private static final String UNIX_UNINSTALL_FILE_NAME = "uninstall"; /** * The Windows uninstall batch file name. */ private static final String WINDOWS_UNINSTALL_FILE_NAME = "uninstall.bat"; /** * The UNIX uninstall script file name. */ private static final String UNIX_UPGRADE_FILE_NAME = "upgrade"; /** * The Windows uninstall batch file name. */ private static final String WINDOWS_UPGRADE_FILE_NAME = "upgrade.bat"; /** * The UNIX start script file name. */ private static final String UNIX_START_FILE_NAME = "start-ds"; /** * The Windows start batch file name. */ private static final String WINDOWS_START_FILE_NAME = "start-ds.bat"; /** * The UNIX stop script file name. */ private static final String UNIX_STOP_FILE_NAME = "stop-ds"; /** * The Windows stop batch file name. */ private static final String WINDOWS_STOP_FILE_NAME = "stop-ds.bat"; /** * The UNIX status panel script file name. */ private static final String UNIX_STATUSPANEL_FILE_NAME = "status-panel"; /** * The Windows status panel batch file name. */ private static final String WINDOWS_STATUSPANEL_FILE_NAME = "status-panel.bat"; /** * The UNIX status command line script file name. */ private static final String UNIX_STATUSCLI_FILE_NAME = "status"; /** * The Windows status command line batch file name. */ private static final String WINDOWS_STATUSCLI_FILE_NAME = "status.bat"; private Utils() { } @@ -973,11 +854,11 @@ String path = null; for (int i = 0; i < classPaths.length && (path == null); i++) { for (int j = 0; j < OPEN_DS_JAR_RELATIVE_PATHS.length && for (int j = 0; j < Installation.OPEN_DS_JAR_RELATIVE_PATHS.length && (path == null); j++) { String normPath = classPaths[i].replace(File.separatorChar, '/'); if (normPath.endsWith(OPEN_DS_JAR_RELATIVE_PATHS[j])) if (normPath.endsWith(Installation.OPEN_DS_JAR_RELATIVE_PATHS[j])) { path = classPaths[i]; } @@ -1003,265 +884,6 @@ } /** * Returns the path to the configuration file of the directory server. Note * that this method assumes that this code is being run locally. * @return the path of the configuration file of the directory server. */ public static String getConfigFileFromClasspath() { return getPath(getInstallPathFromClasspath(), CONFIG_FILE_PATH_RELATIVE); } /** * Returns the list of jar files that might be used to execute the code of * the installation and uninstallation. * @return the list of jar files that might be used to execute the code of * the installation and uninstallation. */ public static String[] getOpenDSJarPaths() { return OPEN_DS_JAR_RELATIVE_PATHS; } /** * Returns the relative path of the directory containing the Windows binaries * of the Open DS installation. The path is relative to the installation * path. * @return the relative path of the directory containing the Windows binaries * of the Open DS installation. */ public static String getWindowsBinariesRelativePath() { return WINDOWS_BINARIES_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the binaries/scripts * of the Open DS installation. The path is relative to the installation * path. * @return the relative path of the directory containing the binaries/scripts * of the Open DS installation. */ public static String getBinariesRelativePath() { String binPath; if (isWindows()) { binPath = getWindowsBinariesRelativePath(); } else { binPath = getUNIXBinariesRelativePath(); } return binPath; } /** * Returns the relative path of the directory containing the UNIX binaries of * the Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the UNIX binaries of * the Open DS installation. */ public static String getUNIXBinariesRelativePath() { return UNIX_BINARIES_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the libraries of the * Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the libraries of the * Open DS installation. */ public static String getLibrariesRelativePath() { return LIBRARIES_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the databases of the * Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the databases of the * Open DS installation. */ public static String getDatabasesRelativePath() { return DATABASES_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the logs of the * Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the logs of the * Open DS installation. */ public static String getLogsRelativePath() { return LOGS_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the LDIF files of the * Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the LDIF files of the * Open DS installation. */ public static String getLDIFsRelativePath() { return LDIFS_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the backup files of * the Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the backup files of * the Open DS installation. */ public static String getBackupsRelativePath() { return BACKUPS_PATH_RELATIVE; } /** * Returns the relative path of the directory containing the config files of * the Open DS installation. The path is relative to the installation path. * @return the relative path of the directory containing the config files of * the Open DS installation. */ public static String getConfigRelativePath() { return CONFIG_PATH_RELATIVE; } /** * Returns the name of the UNIX setup script file name. * @return the name of the UNIX setup script file name. */ public static String getUnixSetupFileName() { return UNIX_SETUP_FILE_NAME; } /** * Returns the name of the Windows setup batch file name. * @return the name of the Windows setup batch file name. */ public static String getWindowsSetupFileName() { return WINDOWS_SETUP_FILE_NAME; } /** * Returns the name of the UNIX uninstall script file name. * @return the name of the UNIX uninstall script file name. */ public static String getUnixUninstallFileName() { return UNIX_UNINSTALL_FILE_NAME; } /** * Returns the name of the Windows uninstall batch file name. * @return the name of the Windows uninstall batch file name. */ public static String getWindowsUninstallFileName() { return WINDOWS_UNINSTALL_FILE_NAME; } /** * Returns the name of the UNIX upgrade script file name. * @return the name of the UNIX upgrade script file name. */ public static String getUnixUpgradeFileName() { return UNIX_UPGRADE_FILE_NAME; } /** * Returns the name of the Windows upgrade batch file name. * @return the name of the Windows upgrade batch file name. */ public static String getWindowsUpgradeFileName() { return WINDOWS_UPGRADE_FILE_NAME; } /** * Returns the name of the UNIX start script file name. * @return the name of the UNIX start script file name. */ public static String getUnixStartFileName() { return UNIX_START_FILE_NAME; } /** * Returns the name of the Windows start batch file name. * @return the name of the Windows start batch file name. */ public static String getWindowsStartFileName() { return WINDOWS_START_FILE_NAME; } /** * Returns the name of the UNIX stop script file name. * @return the name of the UNIX stop script file name. */ public static String getUnixStopFileName() { return UNIX_STOP_FILE_NAME; } /** * Returns the name of the Windows stop batch file name. * @return the name of the Windows stop batch file name. */ public static String getWindowsStopFileName() { return WINDOWS_STOP_FILE_NAME; } /** * Returns the name of the UNIX status panel script file name. * @return the name of the UNIX status panel script file name. */ public static String getUnixStatusPanelFileName() { return UNIX_STATUSPANEL_FILE_NAME; } /** * Returns the name of the Windows status panel batch file name. * @return the name of the Windows status panel batch file name. */ public static String getWindowsStatusPanelFileName() { return WINDOWS_STATUSPANEL_FILE_NAME; } /** * Returns the name of the UNIX status command line script file name. * @return the name of the UNIX status command line script file name. */ public static String getUnixStatusCliFileName() { return UNIX_STATUSCLI_FILE_NAME; } /** * Returns the name of the Windows status command line batch file name. * @return the name of the Windows status command line batch file name. */ public static String getWindowsStatusCliFileName() { return WINDOWS_STATUSCLI_FILE_NAME; } /** * Displays a confirmation message dialog. * * @param parent opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
@@ -29,6 +29,7 @@ import org.opends.quicksetup.QuickSetupException; import org.opends.quicksetup.Application; import org.opends.quicksetup.Installation; import org.opends.quicksetup.i18n.ResourceProvider; import java.io.InputStream; @@ -266,9 +267,9 @@ File file = new File(path); if (file.getParent().endsWith( File.separator + Utils.getWindowsBinariesRelativePath()) || File.separator + Installation.WINDOWS_BINARIES_PATH_RELATIVE) || file.getParent().endsWith( File.separator + Utils.getUNIXBinariesRelativePath())) File.separator + Installation.UNIX_BINARIES_PATH_RELATIVE)) { if (path.endsWith(".bat")) { @@ -282,9 +283,9 @@ else if (path.endsWith(".sh")) { perm = "755"; } else if (path.endsWith(Utils.getUnixSetupFileName()) || path.endsWith(Utils.getUnixUninstallFileName()) || path.endsWith(Utils.getUnixUpgradeFileName())) } else if (path.endsWith(Installation.UNIX_SETUP_FILE_NAME) || path.endsWith(Installation.UNIX_UNINSTALL_FILE_NAME) || path.endsWith(Installation.UNIX_UPGRADE_FILE_NAME)) { perm = "755"; } else opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromFile.java
@@ -43,6 +43,7 @@ import org.opends.server.types.ObjectClass; import org.opends.statuspanel.i18n.ResourceProvider; import org.opends.quicksetup.util.Utils; import org.opends.quicksetup.Installation; /** * This class is used to retrieve configuration information directly from the @@ -88,8 +89,10 @@ errorMessage = null; try { Installation installation = new Installation(Utils.getInstallPathFromClasspath()); LDIFImportConfig c = new LDIFImportConfig( Utils.getConfigFileFromClasspath()); Utils.getPath(installation.getCurrentConfigurationFile())); LDIFReader reader = new LDIFReader(c); for (Entry entry = reader.readEntry(false); entry != null; entry = reader.readEntry(false)) opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
@@ -38,6 +38,7 @@ import javax.swing.table.TableModel; import org.opends.quicksetup.CurrentInstallStatus; import org.opends.quicksetup.Installation; import org.opends.quicksetup.util.Utils; import org.opends.server.core.DirectoryServer; @@ -337,10 +338,10 @@ String arg; if (Utils.isWindows()) { arg = Utils.getWindowsStatusCliFileName(); arg = Installation.WINDOWS_STATUSCLI_FILE_NAME; } else { arg = Utils.getUnixStatusCliFileName(); arg = Installation.UNIX_STATUSCLI_FILE_NAME; } /* * This is required because the usage message contains '{' characters that opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelController.java
@@ -40,6 +40,7 @@ import org.opends.server.core.DirectoryServer; import org.opends.quicksetup.CurrentInstallStatus; import org.opends.quicksetup.Installation; import org.opends.quicksetup.ui.UIFactory; import org.opends.quicksetup.util.BackgroundTask; import org.opends.quicksetup.util.HtmlProgressMessageFormatter; @@ -531,14 +532,9 @@ getFormattedProgress(getMsg("progress-starting")) + getLineBreak()); ArrayList<String> argList = new ArrayList<String>(); if (Utils.isWindows()) { argList.add(Utils.getPath(getBinariesPath(), "start-ds.bat")); } else { argList.add(Utils.getPath(getBinariesPath(), "start-ds")); } Installation installation = new Installation(Utils.getInstallPathFromClasspath()); argList.add(Utils.getPath(installation.getServerStartCommandFile())); String[] args = new String[argList.size()]; argList.toArray(args); @@ -655,16 +651,9 @@ getFormattedProgress(getMsg("progress-stopping")) + getLineBreak()); ArrayList<String> argList = new ArrayList<String>(); if (Utils.isWindows()) { argList.add(Utils.getPath(getBinariesPath(), Utils.getWindowsStopFileName())); } else { argList.add(Utils.getPath(getBinariesPath(), Utils.getUnixStopFileName())); } Installation installation = new Installation(Utils.getInstallPathFromClasspath()); argList.add(Utils.getPath(installation.getServerStopCommandFile())); String[] args = new String[argList.size()]; argList.toArray(args); ProcessBuilder pb = new ProcessBuilder(args); @@ -894,7 +883,7 @@ * have something of type: * key=value * * @see ResourceProvider.getMsg(String key) * @see ResourceProvider#getMsg(String) * @param key the key in the properties file. * @return the value associated to the key in the properties file. * properties file. @@ -914,7 +903,7 @@ * mykey=value with argument {0}. * * This method will return "value with argument value1". * @see ResourceProvider.getMsg(String key, String[] args) * @see ResourceProvider#getMsg(String, String[]) * @param key the key in the properties file. * @param args the arguments to be passed to generate the resulting value. * @return the value associated to the key in the properties file. @@ -934,16 +923,6 @@ } /** * Returns the path to the binaries. * @return the path to the binaries. */ private String getBinariesPath() { return Utils.getPath(Utils.getInstallPathFromClasspath(), Utils.getBinariesRelativePath()); } /** * Returns the formatted representation of the text that is the summary of the * installation process (the one that goes in the UI next to the progress * bar). opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
@@ -30,6 +30,7 @@ import java.io.PrintStream; import org.opends.quicksetup.util.Utils; import org.opends.quicksetup.Installation; import org.opends.statuspanel.i18n.ResourceProvider; /** @@ -120,10 +121,10 @@ String arg; if (Utils.isWindows()) { arg = Utils.getWindowsStatusPanelFileName(); arg = Installation.WINDOWS_STATUSPANEL_FILE_NAME; } else { arg = Utils.getUnixStatusPanelFileName(); arg = Installation.UNIX_STATUSPANEL_FILE_NAME; } /* * This is required because the usage message contains '{' characters that