| | |
| | | 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; |
| | |
| | | |
| | | 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() |
| | | { |
| | | } |
| | |
| | | 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]; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |