| | |
| | | import org.opends.quicksetup.event.ButtonEvent; |
| | | import org.opends.quicksetup.event.ProgressUpdateEvent; |
| | | import org.opends.quicksetup.*; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.util.ProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.HtmlProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.BackgroundTask; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import static org.opends.quicksetup.util.Utils.*; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.messages.Message; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | import javax.swing.*; |
| | | |
| | |
| | | |
| | | private QuickSetupDialog dialog; |
| | | |
| | | private StringBuffer progressDetails = new StringBuffer(); |
| | | private MessageBuilder progressDetails = new MessageBuilder(); |
| | | |
| | | private ProgressDescriptor lastDescriptor; |
| | | |
| | |
| | | } |
| | | catch (Throwable t) { |
| | | throw new UserDataException(cStep, |
| | | getThrowableMsg("bug-msg", t)); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t)); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | UserDataException ude = (UserDataException) throwable; |
| | | if (ude instanceof UserDataConfirmationException) |
| | | { |
| | | if (displayConfirmation(ude.getLocalizedMessage(), |
| | | getMsg("confirmation-title"))) |
| | | if (displayConfirmation(ude.getMessageObject(), |
| | | INFO_CONFIRMATION_TITLE.get())) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | displayError(ude.getLocalizedMessage(), getMsg("error-title")); |
| | | displayError(ude.getMessageObject(), INFO_ERROR_TITLE.get()); |
| | | } |
| | | } else { |
| | | setCurrentStep(application.getNextWizardStep(cStep)); |
| | |
| | | if (isWebStart()) { |
| | | rootDirectory = application.getUserData().getServerLocation(); |
| | | } else { |
| | | rootDirectory = Utils.getInstallPathFromClasspath(); |
| | | rootDirectory = getInstallPathFromClasspath(); |
| | | } |
| | | Installation installation = new Installation(rootDirectory); |
| | | String cmd = Utils.getPath(installation.getStatusPanelCommandFile()); |
| | | String cmd = getPath(installation.getStatusPanelCommandFile()); |
| | | ProcessBuilder pb = new ProcessBuilder(cmd); |
| | | Map<String, String> env = pb.environment(); |
| | | env.put("JAVA_HOME", System.getProperty("java.home")); |
| | |
| | | |
| | | if (returnValue != 0) |
| | | { |
| | | throw new Error(getMsg("could-not-launch-status-panel-msg")); |
| | | throw new Error( |
| | | INFO_COULD_NOT_LAUNCH_STATUS_PANEL_MSG.get().toString()); |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // This looks like a bug |
| | | t.printStackTrace(); |
| | | throw new Error(getMsg("could-not-launch-status-panel-msg")); |
| | | throw new Error( |
| | | INFO_COULD_NOT_LAUNCH_STATUS_PANEL_MSG.get().toString()); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | |
| | | if (throwable != null) |
| | | { |
| | | displayError(throwable.getMessage(), getMsg("error-title")); |
| | | displayError(Message.raw(throwable.getMessage()), |
| | | INFO_ERROR_TITLE.get()); |
| | | } |
| | | } |
| | | }; |
| | |
| | | } |
| | | |
| | | /** |
| | | * The following three methods are just commodity methods to get localized |
| | | * messages. |
| | | * @param key String key |
| | | * @return String message |
| | | */ |
| | | private String getMsg(String key) |
| | | { |
| | | return getI18n().getMsg(key); |
| | | } |
| | | |
| | | /** |
| | | * The following three methods are just commodity methods to get localized |
| | | * messages. |
| | | * @param key String key |
| | | * @param t Throwable throwable |
| | | * @return String message |
| | | */ |
| | | private String getThrowableMsg(String key, Throwable t) |
| | | { |
| | | return Utils.getThrowableMsg(getI18n(), key, null, t); |
| | | } |
| | | |
| | | private ResourceProvider getI18n() |
| | | { |
| | | return ResourceProvider.getInstance(); |
| | | } |
| | | |
| | | /** |
| | | * Get the current step. |
| | | * |
| | | * @return the currently displayed Step of the wizard. |
| | |
| | | * @param title |
| | | * the title for the dialog. |
| | | */ |
| | | public void displayError(String msg, String title) |
| | | public void displayError(Message msg, Message title) |
| | | { |
| | | if (Utils.isCli()) { |
| | | if (isCli()) { |
| | | System.err.println(msg); |
| | | } else { |
| | | getDialog().displayError(msg, title); |
| | |
| | | * @return <CODE>true</CODE> if the user confirms the message, or |
| | | * <CODE>false</CODE> if not. |
| | | */ |
| | | public boolean displayConfirmation(String msg, String title) |
| | | public boolean displayConfirmation(Message msg, Message title) |
| | | { |
| | | return getDialog().displayConfirmation(msg, title); |
| | | } |
| | |
| | | * |
| | | * @param ce |
| | | * the certificate exception that occurred. |
| | | * @param title |
| | | * the title of the dialog. |
| | | * @return <CODE>true</CODE> if the user confirms the message, or |
| | | * <CODE>false</CODE> if not. |
| | | */ |
| | |
| | | ProgressUpdateEvent ev) |
| | | { |
| | | ProgressStep status = ev.getProgressStep(); |
| | | String newProgressLabel = ev.getCurrentPhaseSummary(); |
| | | String additionalDetails = ev.getNewLogs(); |
| | | Message newProgressLabel = ev.getCurrentPhaseSummary(); |
| | | Message additionalDetails = ev.getNewLogs(); |
| | | Integer ratio = ev.getProgressRatio(); |
| | | |
| | | if (additionalDetails != null) |
| | |
| | | } |
| | | |
| | | return new ProgressDescriptor(status, ratio, newProgressLabel, |
| | | progressDetails.toString()); |
| | | progressDetails.toMessage()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private boolean isWebStart() |
| | | { |
| | | return Utils.isWebStart(); |
| | | return isWebStart(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | catch (Throwable t) { |
| | | throw new UserDataException(cStep, |
| | | getThrowableMsg("bug-msg", t)); |
| | | getThrowableMsg(INFO_BUG_MSG.get(), t)); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | UserDataException ude = (UserDataException) throwable; |
| | | if (ude instanceof UserDataConfirmationException) |
| | | { |
| | | if (displayConfirmation(ude.getLocalizedMessage(), |
| | | getMsg("confirmation-title"))) |
| | | if (displayConfirmation(ude.getMessageObject(), |
| | | INFO_CONFIRMATION_TITLE.get())) |
| | | { |
| | | setCurrentStep(application.getNextWizardStep(cStep)); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | displayError(ude.getLocalizedMessage(), getMsg("error-title")); |
| | | displayError(ude.getMessageObject(), INFO_ERROR_TITLE.get()); |
| | | } |
| | | } |
| | | } else { |