| | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.logging.Logger; |
| | | import java.util.logging.Level; |
| | | |
| | | import org.opends.quicksetup.Launcher; |
| | | import org.opends.quicksetup.CliApplication; |
| | |
| | | static private final Logger LOG = |
| | | Logger.getLogger(InstallLauncher.class.getName()); |
| | | |
| | | |
| | | /** |
| | | * The main method which is called by the setup command lines. |
| | | * |
| | |
| | | new InstallLauncher(args).launch(); |
| | | } |
| | | |
| | | private ArgumentParser argParser; |
| | | |
| | | /** |
| | | * Creates a launcher. |
| | | * |
| | |
| | | */ |
| | | public InstallLauncher(String[] args) { |
| | | super(args); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void guiLaunchFailed(String logFileName) { |
| | | if (logFileName != null) |
| | | { |
| | | System.err.println(getMsg("setup-launcher-gui-launched-failed-details", |
| | | logFileName)); |
| | | } |
| | | else |
| | | { |
| | | System.err.println(getMsg("setup-launcher-gui-launched-failed")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void willLaunchGui() { |
| | | System.out.println(getMsg("setup-launcher-launching-gui")); |
| | | System.setProperty("org.opends.quicksetup.Application.class", |
| | | "org.opends.quicksetup.installer.offline.OfflineInstaller"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getFrameTitle() { |
| | | return getI18n().getMsg("frame-install-title"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void printUsage(boolean toStdErr) { |
| | | String scriptName; |
| | | if (Utils.isWindows()) { |
| | | scriptName = Installation.WINDOWS_SETUP_FILE_NAME; |
| | |
| | | scriptName = Installation.UNIX_SETUP_FILE_NAME; |
| | | } |
| | | System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName); |
| | | ArgumentParser argParser = new ArgumentParser(getClass().getName(), |
| | | |
| | | argParser = new ArgumentParser(getClass().getName(), |
| | | getI18n().getMsg("setup-launcher-usage-description"), |
| | | false); |
| | | BooleanArgument addBaseEntry; |
| | |
| | | MSGID_INSTALLDS_DESCRIPTION_HELP); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | String msg = argParser.getUsage(); |
| | | printUsage(msg, toStdErr); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void guiLaunchFailed(String logFileName) { |
| | | if (logFileName != null) |
| | | { |
| | | System.err.println(getMsg("setup-launcher-gui-launched-failed-details", |
| | | logFileName)); |
| | | } |
| | | else |
| | | { |
| | | System.err.println(getMsg("setup-launcher-gui-launched-failed")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ArgumentParser getArgumentParser() { |
| | | return this.argParser; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void willLaunchGui() { |
| | | System.out.println(getMsg("setup-launcher-launching-gui")); |
| | | System.setProperty("org.opends.quicksetup.Application.class", |
| | | "org.opends.quicksetup.installer.offline.OfflineInstaller"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getFrameTitle() { |
| | | return getI18n().getMsg("frame-install-title"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected CliApplication createCliApplication() { |
| | | // Setup currently has no implemented CliApplication |
| | | // but rather relies on InstallDS from the server |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected int launchCli(String[] args, CliApplication cliApp) { |
| | | protected int launchCli(CliApplication cliApp) { |
| | | System.setProperty("org.opends.quicksetup.cli", "true"); |
| | | |
| | | if (Utils.isWindows()) { |
| | |
| | | } |
| | | ArrayList<String> newArgList = new ArrayList<String>(); |
| | | if (args != null) { |
| | | for (int i = 0; i < args.length; i++) { |
| | | if (!args[i].equalsIgnoreCase("--cli") && |
| | | !args[i].equalsIgnoreCase("-c")) { |
| | | newArgList.add(args[i]); |
| | | for (String arg : args) { |
| | | if (!arg.equalsIgnoreCase("--cli") && |
| | | !arg.equalsIgnoreCase("-c")) { |
| | | newArgList.add(arg); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | String[] newArgs = new String[newArgList.size()]; |
| | | newArgList.toArray(newArgs); |
| | | |
| | | LOG.log(Level.INFO, "Launching 'installMain' with args " + |
| | | Utils.listToString(newArgList, " ")); |
| | | return org.opends.server.tools.InstallDS.installMain(newArgs); |
| | | } |
| | | } |