This commit:
- Brings the quicksetup code to "internationalized with possible i18n bugs" to address issue 1629. In other words I moved messages formerly coded as string literals (with the exception of log messages and non-ApplicationException exception messages) presented to the user into resource bundles.
- Fixes small miscellaneous issues that Idea complains about (e.g. unnecessary casts, variable initialization).
- Moves some commonly defined string literal and constants to a single Constants file.
- Trimmed a little dead code.
1 files renamed
30 files modified
| | |
| | | if (errors.size() > 0) |
| | | { |
| | | String msg = Utils.getStringFromCollection(errors, |
| | | QuickSetupCli.LINE_SEPARATOR+QuickSetupCli.LINE_SEPARATOR); |
| | | Constants.LINE_SEPARATOR+Constants.LINE_SEPARATOR); |
| | | throw new UserDataException(null, msg); |
| | | } |
| | | } |
| | |
| | | * @param args String[] args |
| | | * @return String message |
| | | */ |
| | | protected static String getMsg(String key, String[] args) |
| | | protected static String getMsg(String key, String... args) |
| | | { |
| | | return org.opends.server.util.StaticUtils.wrapText( |
| | | getI18n().getMsg(key, args), Utils.getCommandLineMaxLineWidth()); |
| | |
| | | int index1 = getContents().indexOf(attrWithPoints, index); |
| | | if (index1 != -1) { |
| | | int index2 = |
| | | getContents().indexOf( |
| | | System.getProperty("line.separator"), index1); |
| | | getContents().indexOf(Constants.LINE_SEPARATOR, index1); |
| | | if (index2 != -1) { |
| | | String sPort = |
| | | getContents().substring(attrWithPoints.length() + |
| | |
| | | String line; |
| | | // We do not care about encoding: we are just interested in the ports |
| | | while ((line = in.readLine()) != null) { |
| | | buf.append(line).append(System.getProperty("line.separator")); |
| | | buf.append(line).append(Constants.LINE_SEPARATOR); |
| | | } |
| | | reader.close(); |
| | | contents = buf.toString().toLowerCase(); |
| | |
| | | attrName += ":"; |
| | | int index1 = getContents().indexOf(attrName); |
| | | while (index1 != -1) { |
| | | int index2 = getContents().indexOf( |
| | | System.getProperty("line.separator"), index1); |
| | | int index2 = getContents().indexOf(Constants.LINE_SEPARATOR, index1); |
| | | String value; |
| | | if (index2 > (index1 + attrName.length())) { |
| | | value = getContents().substring(attrName.length() + index1, |
| File was renamed from opends/src/quicksetup/org/opends/quicksetup/DefaultDataOptions.java |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.quicksetup; |
| | | |
| | | /** |
| | | * This class is just used to specify which are the default values that will be |
| | | * proposed to the user in the Data Options panel of the Installation wizard. |
| | | * |
| | | * Defines common constants. |
| | | */ |
| | | class DefaultDataOptions extends DataOptions |
| | | { |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | public DefaultDataOptions() |
| | | { |
| | | super(Type.CREATE_BASE_ENTRY, "dc=example,dc=com"); |
| | | } |
| | | public class Constants { |
| | | |
| | | /** |
| | | * Get the number of entries that will be automatically generated. |
| | | * |
| | | * @return the number of entries that will be automatically generated. |
| | | */ |
| | | public int getNumberEntries() |
| | | { |
| | | return 2000; |
| | | } |
| | | /** Platform appropriate line separator. */ |
| | | static public final String LINE_SEPARATOR = |
| | | System.getProperty("line.separator"); |
| | | |
| | | /** HTML line break tag. */ |
| | | public static final String HTML_LINE_BREAK = "<br>"; |
| | | |
| | | /** HTML bold open tag. */ |
| | | public static final String HTML_BOLD_OPEN = "<b>"; |
| | | |
| | | /** HTML bold close tag. */ |
| | | public static final String HTML_BOLD_CLOSE = "</b>"; |
| | | |
| | | /** Default dynamic name of directory manager. */ |
| | | public static final String DIRECTORY_MANAGER_DN = "cn=Directory Manager"; |
| | | |
| | | } |
| | |
| | | if (index1 != -1) |
| | | { |
| | | int index2 = |
| | | getConfigFileContents().indexOf( |
| | | System.getProperty("line.separator"), index1); |
| | | getConfigFileContents().indexOf(Constants.LINE_SEPARATOR, index1); |
| | | if (index2 != -1) |
| | | { |
| | | String sPort = |
| | |
| | | // We do not care about encoding: we are just interested in the ports |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | buf.append(line + System.getProperty("line.separator")); |
| | | buf.append(line).append(Constants.LINE_SEPARATOR); |
| | | } |
| | | reader.close(); |
| | | } catch (IOException ioe) |
| | |
| | | while (index1 != -1) |
| | | { |
| | | int index2 = getConfigFileContents().indexOf( |
| | | System.getProperty("line.separator"), index1); |
| | | Constants.LINE_SEPARATOR, index1); |
| | | String value; |
| | | if (index2 > (index1 + attrName.length())) |
| | | { |
| | |
| | | import java.util.concurrent.ExecutionException; |
| | | |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | |
| | | /** |
| | | * This class represents the physical state of an OpenDS installation. |
| | |
| | | * an actual OpenDS installation. |
| | | * @param rootDirectory File directory candidate |
| | | * @throws IllegalArgumentException if root directory does not appear to |
| | | * be an OpenDS installation root. |
| | | * be an OpenDS installation root. The thrown exception contains |
| | | * a localized message indicating the reason why |
| | | * <code>rootDirectory</code> is not a valid OpenDS install root. |
| | | */ |
| | | static public void validateRootDirectory(File rootDirectory) |
| | | throws IllegalArgumentException { |
| | | // TODO: i18n |
| | | String failureReason = null; |
| | | if (rootDirectory == null) { |
| | | failureReason = "root directory is null"; |
| | | failureReason = getMsg("error-install-root-dir-null"); |
| | | } else if (!rootDirectory.exists()) { |
| | | failureReason = "is not a directory"; |
| | | failureReason = getMsg("error-install-root-dir-no-exist", |
| | | Utils.getPath(rootDirectory)); |
| | | } else if (!rootDirectory.isDirectory()) { |
| | | failureReason = "does not exist"; |
| | | failureReason = getMsg("error-install-root-dir-not-dir", |
| | | Utils.getPath(rootDirectory)); |
| | | } else { |
| | | String[] children = rootDirectory.list(); |
| | | if (children != null) { |
| | |
| | | }; |
| | | for (String dir : dirsToCheck) { |
| | | if (!childrenSet.contains(dir)) { |
| | | failureReason = "does not contain directory '" + dir + "'"; |
| | | failureReason = getMsg("error-install-root-dir-no-dir", |
| | | Utils.getPath(rootDirectory), dir); |
| | | } |
| | | } |
| | | } else { |
| | | failureReason = "is empty or you lack permissions " + |
| | | "to access this directory"; |
| | | failureReason = getMsg("error-install-root-dir-empty", |
| | | Utils.getPath(rootDirectory)); |
| | | } |
| | | } |
| | | if (failureReason != null) { |
| | | throw new IllegalArgumentException("Install root '" + |
| | | (rootDirectory != null ? Utils.getPath(rootDirectory) : "null") + |
| | | "' is not an OpenDS installation root: " + |
| | | " " + failureReason); |
| | | throw new IllegalArgumentException(failureReason); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | if (rev == null) { |
| | | // TODO: i18n |
| | | throw new ApplicationException( |
| | | ApplicationException.Type.FILE_SYSTEM_ERROR, |
| | | "Could not determine SVN rev", null); |
| | | getMsg("error-determining-svn-rev"), null); |
| | | } |
| | | return rev; |
| | | } |
| | |
| | | backupDirectory.delete(); |
| | | } |
| | | if (!backupDirectory.mkdirs()) { |
| | | // TODO: i18n |
| | | throw new IOException("failed to create history backup directory"); |
| | | } |
| | | return backupDirectory; |
| | |
| | | public BuildInformation getBuildInformation(boolean useCachedVersion) |
| | | throws ApplicationException |
| | | { |
| | | if (buildInformation == null || useCachedVersion == false) { |
| | | if (buildInformation == null || !useCachedVersion) { |
| | | FutureTask<BuildInformation> ft = new FutureTask<BuildInformation>( |
| | | new Callable<BuildInformation>() { |
| | | public BuildInformation call() throws ApplicationException { |
| | |
| | | public String toString() { |
| | | return Utils.getPath(rootDirectory); |
| | | } |
| | | |
| | | static private String getMsg(String key) { |
| | | return ResourceProvider.getInstance().getMsg(key); |
| | | } |
| | | |
| | | static private String getMsg(String key, String... args) { |
| | | return ResourceProvider.getInstance().getMsg(key, args); |
| | | } |
| | | |
| | | } |
| | |
| | | while (t != null) |
| | | { |
| | | StackTraceElement[] stack = t.getStackTrace(); |
| | | for (int i = 0; i < stack.length; i++) |
| | | { |
| | | buf.append(stack[i].toString()+"\n"); |
| | | for (StackTraceElement aStack : stack) { |
| | | buf.append(aStack.toString()).append("\n"); |
| | | } |
| | | |
| | | t = t.getCause(); |
| | |
| | | private void printVersion() |
| | | { |
| | | System.out.print(PRINTABLE_VERSION_STRING); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | static public int UNKNOWN = 100; |
| | | |
| | | /** Platform dependent filesystem separator. */ |
| | | public static String LINE_SEPARATOR = System.getProperty("line.separator"); |
| | | |
| | | /** Arguments passed in the command line. */ |
| | | protected String[] args; |
| | | |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // do nothing; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | catch (UserDataException uude) |
| | | { |
| | | System.err.println(LINE_SEPARATOR+uude.getLocalizedMessage()+ |
| | | LINE_SEPARATOR); |
| | | System.err.println(Constants.LINE_SEPARATOR+uude.getLocalizedMessage()+ |
| | | Constants.LINE_SEPARATOR); |
| | | returnValue = USER_DATA_ERROR; |
| | | } |
| | | return returnValue; |
| | |
| | | } |
| | | |
| | | static private String getInitialLogRecord() { |
| | | // Note; currently the logs are not internationalized. |
| | | StringBuffer sb = new StringBuffer() |
| | | .append("QuickSetup application launched " + |
| | | DateFormat.getDateTimeInstance(DateFormat.LONG, |
| | |
| | | |
| | | /** |
| | | * Sets the key store password. |
| | | * @param keystorePassword the new key store password. |
| | | * @param keyStorePassword the new key store password. |
| | | */ |
| | | private void setKeyStorePassword(String keyStorePassword) |
| | | { |
| | |
| | | }); |
| | | } catch (Exception ex) |
| | | { |
| | | // do nothing; |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | } catch (Exception ex) |
| | | { |
| | | // do nothing; |
| | | } |
| | | } |
| | | |
| | |
| | | Thread.sleep(sleepTime); |
| | | } catch (Exception ex) |
| | | { |
| | | // do nothing; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @return boolean where true means the configuration has been modified |
| | | */ |
| | | public boolean configurationHasBeenModified() { |
| | | // TODO: a better way might be to diff config.ldif with configuration |
| | | // base in config/upgrade/config.ldif.<svn rev> |
| | | boolean mod = false; |
| | | try { |
| | | mod = installation.getCurrentConfiguration().hasBeenModified(); |
| | |
| | | setServerPort(defaultPort); |
| | | } |
| | | |
| | | setDirectoryManagerDn("cn=Directory Manager"); |
| | | setDirectoryManagerDn(Constants.DIRECTORY_MANAGER_DN); |
| | | |
| | | setNewSuffixOptions(defaultNewSuffixOptions); |
| | | AuthenticationData data = new AuthenticationData(); |
| | | data.setDn("cn=Directory Manager"); |
| | | data.setDn(Constants.DIRECTORY_MANAGER_DN); |
| | | data.setPort(389); |
| | | DataReplicationOptions repl = new DataReplicationOptions( |
| | | DataReplicationOptions.Type.STANDALONE, data); |
| | |
| | | continue-button-label=Continue |
| | | continue-button-install-tooltip=Continue with Setup |
| | | ok-button-label=OK |
| | | retry-button-label=Retry |
| | | |
| | | # |
| | | # Confirmation dialogs |
| | |
| | | confirm-uninstall-server-running-title=Server is Running |
| | | confirm-cancel-title=Confirmation Required |
| | | confirm-cancel-prompt=Cancel the running operation? |
| | | |
| | | network-error-title=Network Error |
| | | |
| | | # |
| | | # Error dialog title |
| | |
| | | open-ldif-file-dialog-title=Choose an LDIF File |
| | | open-zip-file-dialog-title=Choose an OpenDS Installation Package (.zip) |
| | | open-generic-file-dialog-title=Choose a File |
| | | show-details-button-label=Show Details |
| | | hide-details-button-label=Hide Details |
| | | details-label=Details: |
| | | |
| | | # |
| | | # Progress Summary Labels |
| | |
| | | error-server-status=Error determining the server's status. |
| | | error-server-health-check-failure=Server health check failed. |
| | | error-upgraded-server-starts-with-errors=The upgraded server starts with errors: {0} |
| | | error-restoring-file=The following could not be restored after the failed \ |
| | | upgrade attempt. You should restore this file/directory manually: {0} to {1} |
| | | |
| | | # General errors |
| | | error-failed-moving-file=Failed to move file {0} to {1}. |
| | |
| | | error-apply-ldif-modify=Error processing modification operation of {0}: {1} |
| | | error-apply-ldif-add=Error processing add operation of {0}: {1} |
| | | error-apply-ldif-delete=Error processing delete operation of {0}: {1} |
| | | error-invalid-port-value=Invalid port value {0}. A port number must be an integer \ |
| | | between 1 and 65535. |
| | | error-initializing-log=Error initializing log. |
| | | error-invalid-server-location=Invalid Directory Selected: {0}\n\ |
| | | Either the selected directory is not a valid OpenDS root installation\n\ |
| | | directory or you do not have access permissions for this directory. |
| | | error-option-required=Option {0} is required. |
| | | error-parsing-options=Error parsing options. |
| | | error-install-root-dir-null=The root directory is null. |
| | | error-install-root-dir-not-dir=File {0} is not an OpenDS installation root. |
| | | error-install-root-dir-no-exist=Directory {0} does not exist. |
| | | error-install-root-dir-no-dir=Directory {0} does not contain directory {1}. |
| | | error-install-root-dir-empty=Directory {0} is either empty or you lack permissions\ |
| | | to access its contents. |
| | | |
| | | |
| | | # |
| | | # Install Status: messages displayed in the offline quick setup |
| | |
| | | upgrade-build-id-label=Build Version: |
| | | upgrade-build-id-tooltip=The ID of the build version installed in the above location |
| | | upgrade-build-id-unknown=Unknown |
| | | error-invalid-server-location=Invalid Directory Selected: {0}\n\ |
| | | Either the selected directory is not a valid OpenDS root installation\n\ |
| | | directory or you do not have access permissions for this directory. |
| | | |
| | | # |
| | | # Upgrader Choose Version Panel |
| | |
| | | is down or experiencing difficulty.</li></ul><br>You can still continue with \ |
| | | upgrade but will need to download a build separately and then point to it in \ |
| | | the wizard. |
| | | upgrade-choose-version-unable-to-access-build-info=Unable to access remote build information. |
| | | upgrade-choose-version-loading-build-info=Loading remote build information... |
| | | upgrade-choose-version-reading-build-info=Reading remote build information... |
| | | |
| | | upgrade-review-panel-title=Review |
| | | upgrade-review-panel-instructions=Review your settings and click Finish if they \ |
| | |
| | | build-manager-downloading-build=Downloading Build... |
| | | build-manager-downloading-build-done=Finished Downloading Build |
| | | |
| | | # Build extractor |
| | | build-extractor-error=Failed to extract build: {0} |
| | | build-extractor-error-file-no-exist=File {0} does not exist. |
| | | |
| | | # Web Proxy dialog strings |
| | | web-proxy-dlg-title=Web Proxy Configuration |
| | | web-proxy-dlg-user-label=User: |
| | | web-proxy-dlg-password-label=Password: |
| | | web-proxy-dlg-host-label=Host: |
| | | web-proxy-dlg-port-label=Port: |
| | | web-proxy-dlg-auth-label=Authentication: |
| | | web-proxy-dlg-auth-req-label=Required by proxy |
| | | |
| | | # Upgrade log |
| | | upgrade-log-field-op=Operation: |
| | | upgrade-log-field-time=Time: |
| | | upgrade-log-field-from=From: |
| | | upgrade-log-field-to=To: |
| | | upgrade-log-field-status=Status: |
| | | upgrade-log-field-note=Note: |
| | | upgrade-log-status-started=Started |
| | | upgrade-log-status-success=Success |
| | | upgrade-log-status-failure=Failure |
| | | |
| | | general-loading=Loading... |
| | | general-see-for-details=See {0} for a detailed log of this operation. |
| | | general-build-id=Build ID |
| | | general-unset=Unset |
| | | general-none=None |
| | | general-unspecified=Unspecified |
| | |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | import org.opends.quicksetup.UserInteraction; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | import javax.swing.*; |
| | |
| | | // characters per line functionality of the extends options |
| | | // pane does not affect message that are components so we |
| | | // have to format this ourselves. |
| | | StringBuilder sb = new StringBuilder("<b>"); |
| | | StringBuilder sb = new StringBuilder(Constants.HTML_BOLD_OPEN); |
| | | sb.append(Utils.breakHtmlString(summary, MAX_CHARS_PER_LINE)); |
| | | sb.append("</b><br>"); |
| | | sb.append(Constants.HTML_BOLD_CLOSE); |
| | | sb.append(Constants.HTML_LINE_BREAK); |
| | | sb.append(Utils.breakHtmlString(details, MAX_CHARS_PER_LINE)); |
| | | JEditorPane ep = UIFactory.makeHtmlPane( |
| | | sb.toString(), |
| | |
| | | detailsButtonsPanel.setLayout( |
| | | new BoxLayout(detailsButtonsPanel, |
| | | BoxLayout.LINE_AXIS)); |
| | | final JButton btnDetails = new JButton("Show Details"); |
| | | final String showDetailsLabel = getMsg("show-details-button-label"); |
| | | final String hideDetailsLabel = getMsg("hide-details-button-label"); |
| | | final JButton btnDetails = new JButton(showDetailsLabel); |
| | | btnDetails.addActionListener(new ActionListener() { |
| | | public void actionPerformed(ActionEvent e) { |
| | | Dimension current = dialog.getSize(); |
| | |
| | | // detailsComponent.setVisible(true); |
| | | dialog.setSize(current.width, |
| | | current.height + getExpansionHeight()); |
| | | btnDetails.setText("Hide Details"); |
| | | btnDetails.setText(hideDetailsLabel); |
| | | } else { |
| | | // detailsComponent.setVisible(false); |
| | | dialog.setSize(current.width, |
| | | current.height - getExpansionHeight()); |
| | | btnDetails.setText("Show Details"); |
| | | btnDetails.setText(showDetailsLabel); |
| | | } |
| | | detailsShowing = !detailsShowing; |
| | | } |
| | |
| | | gbc.insets = new Insets(15, 0, 0, 0); |
| | | gbc.fill = GridBagConstraints.HORIZONTAL; |
| | | detailsPanel.add(UIFactory.makeJLabel(null, |
| | | "Details:", |
| | | getMsg("details-label"), |
| | | UIFactory.TextStyle.PRIMARY_FIELD_VALID), gbc); |
| | | |
| | | gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD; |
| | |
| | | |
| | | } |
| | | |
| | | private static String getMsg(String key) { |
| | | return ResourceProvider.getInstance().getMsg(key); |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // new GuiUserInteraction(null).confirm( |
| | | // "Summary", |
| | |
| | | import org.opends.quicksetup.ProgressDescriptor; |
| | | import org.opends.quicksetup.SecurityOptions; |
| | | import org.opends.quicksetup.UserData; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.quicksetup.util.HtmlProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.ProgressMessageFormatter; |
| | | import org.opends.quicksetup.util.URLWorker; |
| | |
| | | { |
| | | if (html) |
| | | { |
| | | buf.append("<br>"); |
| | | buf.append(Constants.HTML_LINE_BREAK); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | if (html) |
| | | { |
| | | buf.append("<br>"); |
| | | buf.append(Constants.HTML_LINE_BREAK); |
| | | } |
| | | else |
| | | { |
| | |
| | | package org.opends.quicksetup.ui; |
| | | |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | |
| | | } |
| | | |
| | | private void init(String host, Integer port, String user, char[] pw) { |
| | | setTitle("Proxy Configuration"); |
| | | setTitle(getMsg("web-proxy-dlg-title")); |
| | | optionPane = createContentPane(host, port, user, pw); |
| | | optionPane.addPropertyChangeListener(this); |
| | | setContentPane(optionPane); |
| | |
| | | p.setLayout(new GridBagLayout()); |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | | |
| | | final JLabel lblUser = UIFactory.makeJLabel(null, "User:", |
| | | final JLabel lblUser = UIFactory.makeJLabel(null, |
| | | getMsg("web-proxy-dlg-user-label"), |
| | | UIFactory.TextStyle.SECONDARY_FIELD_VALID); |
| | | |
| | | final JLabel lblPassword = UIFactory.makeJLabel(null, "Password:", |
| | | final JLabel lblPassword = UIFactory.makeJLabel(null, |
| | | getMsg("web-proxy-dlg-password-label"), |
| | | UIFactory.TextStyle.SECONDARY_FIELD_VALID); |
| | | |
| | | gbc.gridx = 0; |
| | | gbc.gridy = 0; |
| | | gbc.anchor = GridBagConstraints.FIRST_LINE_START; |
| | | gbc.fill = GridBagConstraints.NONE; |
| | | p.add(new JLabel("Proxy Host:"), gbc); |
| | | p.add(new JLabel(getMsg("web-proxy-dlg-host-label")), gbc); |
| | | |
| | | gbc.gridx = 1; |
| | | gbc.gridy = 0; |
| | |
| | | gbc.gridy = 1; |
| | | gbc.weightx = 0; |
| | | gbc.fill = GridBagConstraints.NONE; |
| | | p.add(new JLabel("Proxy Port:"), gbc); |
| | | p.add(new JLabel(getMsg("web-proxy-dlg-port-label")), gbc); |
| | | |
| | | gbc.gridx = 1; |
| | | gbc.gridy = 1; |
| | |
| | | gbc.weightx = 0; |
| | | gbc.fill = GridBagConstraints.NONE; |
| | | gbc.insets.top = 7; // I don't understand why this is necesary |
| | | p.add(new JLabel("Auhentication:"), gbc); |
| | | p.add(new JLabel(getMsg("web-proxy-dlg-auth-label")), gbc); |
| | | |
| | | gbc.gridx = 1; |
| | | gbc.gridy = 2; |
| | | gbc.fill = GridBagConstraints.HORIZONTAL; |
| | | gbc.insets.top = 0; |
| | | p.add(chkRequiresAuth = |
| | | UIFactory.makeJCheckBox("Required by proxy","", |
| | | UIFactory.makeJCheckBox(getMsg("web-proxy-dlg-auth-req-label"), |
| | | "", |
| | | UIFactory.TextStyle.SECONDARY_FIELD_VALID |
| | | ), gbc); |
| | | chkRequiresAuth.addActionListener(new ActionListener() { |
| | |
| | | String errorMsg = null; |
| | | String portString = tfPort.getText(); |
| | | |
| | | //TODO better port number verification |
| | | try { |
| | | Integer.parseInt(portString); |
| | | Integer port = Integer.parseInt(portString); |
| | | if (!(port >= 1 && port <= 65535)) { |
| | | errorMsg = getMsg("invalid-port-value-range", portString); |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | errorMsg = "Illegal port value " + portString; |
| | | errorMsg = getMsg("invalid-port-value-range", portString); |
| | | } |
| | | |
| | | if (errorMsg != null) { |
| | |
| | | return (errorMsg == null); |
| | | } |
| | | |
| | | private String getMsg(String key) { |
| | | return ResourceProvider.getInstance().getMsg(key); |
| | | } |
| | | |
| | | private String getMsg(String key, String... args) { |
| | | return ResourceProvider.getInstance().getMsg(key, args); |
| | | } |
| | | |
| | | // /** |
| | | // * For testing. |
| | | // * @param args cl args |
| | |
| | | if (i == 6) |
| | | { |
| | | String[] arg = {Utils.getStringFromCollection(outsideDbs, |
| | | QuickSetupCli.LINE_SEPARATOR)}; |
| | | Constants.LINE_SEPARATOR)}; |
| | | msg = getMsg(keys[i], arg); |
| | | } |
| | | else if (i == 7) |
| | | { |
| | | String[] arg = {Utils.getStringFromCollection(outsideLogs, |
| | | QuickSetupCli.LINE_SEPARATOR)}; |
| | | Constants.LINE_SEPARATOR)}; |
| | | msg = getMsg(keys[i], arg); |
| | | } |
| | | else |
| | |
| | | !userData.getRemoveLogs()) |
| | | { |
| | | somethingSelected = false; |
| | | System.out.println(QuickSetupCli.LINE_SEPARATOR+ |
| | | System.out.println(Constants.LINE_SEPARATOR+ |
| | | getMsg("cli-uninstall-nothing-to-be-uninstalled")); |
| | | } |
| | | else |
| | |
| | | /** |
| | | * Daily build descriptor. |
| | | */ |
| | | DAILY("Daily Build"), |
| | | DAILY("Daily Build"), // DO NOT i18n |
| | | |
| | | /** |
| | | * Weekly build descriptor. |
| | | */ |
| | | WEEKLY("Weekly Build"), |
| | | WEEKLY("Weekly Build"), // DO NOT i18n |
| | | |
| | | /** |
| | | * Release build descriptor. |
| | | */ |
| | | RELEASE("Release Build"); |
| | | RELEASE("Release Build"); // DO NOT i18n |
| | | |
| | | /** |
| | | * Creates a Category from its 'key' String value. |
| | |
| | | package org.opends.quicksetup.upgrader; |
| | | |
| | | import org.opends.quicksetup.*; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.event.ProgressUpdateListener; |
| | | import org.opends.quicksetup.event.ProgressUpdateEvent; |
| | | import org.opends.quicksetup.util.Utils; |
| | |
| | | UpgradeLauncher.LOG_FILE_PREFIX + "ext-", |
| | | UpgradeLauncher.LOG_FILE_SUFFIX)); |
| | | } catch (Throwable t) { |
| | | System.err.println("Unable to initialize log"); |
| | | System.err.println( |
| | | ResourceProvider.getInstance().getMsg("error-initializing-log")); |
| | | t.printStackTrace(); |
| | | } |
| | | new BuildExtractor(args).run(); |
| | |
| | | File buildFile = getBuildFile(args); |
| | | if (buildFile != null) { |
| | | if (!buildFile.exists()) { |
| | | // TODO: i18n |
| | | throw new FileNotFoundException( |
| | | buildFile.getName() + " does not exist"); |
| | | getMsg("build-extractor-error-file-no-exist", |
| | | Utils.getPath(buildFile))); |
| | | } |
| | | expandZipFile(buildFile); |
| | | } |
| | | } catch (Throwable t) { |
| | | LOG.log(Level.INFO, "unexpected error extracting build", t); |
| | | System.err.println("Failed to extract build: " + t.getLocalizedMessage()); |
| | | String reason = t.getLocalizedMessage(); |
| | | System.err.println(getMsg("build-extractor-error", reason)); |
| | | retCode = 1; |
| | | } |
| | | LOG.log(Level.INFO, "extractor exiting code=" + retCode); |
| | |
| | | static private final Logger LOG = |
| | | Logger.getLogger(HistoricalRecord.class.getName()); |
| | | |
| | | static private String OPERATION = "operation:"; |
| | | //--------------------------------------------------// |
| | | // Since these are internationalized, logs that are // |
| | | // moved from one locale to another may not be // |
| | | // readable programmatically. // |
| | | //--------------------------------------------------// |
| | | |
| | | static private String TIME = "time:"; |
| | | static private String OPERATION = getMsg("upgrade-log-field-op"); |
| | | |
| | | static private String FROM = "from:"; |
| | | static private String TIME = getMsg("upgrade-log-field-time"); |
| | | |
| | | static private String TO = "to:"; |
| | | static private String FROM = getMsg("upgrade-log-field-from"); |
| | | |
| | | static private String STATUS = "status:"; |
| | | static private String TO = getMsg("upgrade-log-field-to"); |
| | | |
| | | static private String NOTE = "note:"; |
| | | static private String STATUS = getMsg("upgrade-log-field-status"); |
| | | |
| | | static private String NOTE = getMsg("upgrade-log-field-note"); |
| | | |
| | | static private String SEPARATOR = " "; |
| | | |
| | |
| | | */ |
| | | enum Status { |
| | | |
| | | STARTED("started"), |
| | | STARTED(getMsg("upgrade-log-status-started")), |
| | | |
| | | SUCCESS("success"), |
| | | SUCCESS(getMsg("upgrade-log-status-success")), |
| | | |
| | | FAILURE("failure"); |
| | | FAILURE(getMsg("upgrade-log-status-failure")); |
| | | |
| | | private String representation; |
| | | |
| | |
| | | |
| | | token = st.nextToken(); |
| | | String toString = token.substring(TO.length()); |
| | | to = BuildInformation.fromBuildString(fromString); |
| | | to = BuildInformation.fromBuildString(toString); |
| | | |
| | | token = st.nextToken(); |
| | | String outcomeString = token.substring(STATUS.length()); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String getMsg(String key) { |
| | | static private String getMsg(String key) { |
| | | return ResourceProvider.getInstance().getMsg(key); |
| | | } |
| | | |
| | |
| | | } |
| | | String proxyAuthString = createProxyAuthString(); |
| | | if (proxyAuthString != null) { |
| | | conn.setRequestProperty("Proxy-Authorization", "Basic " + |
| | | conn.setRequestProperty("Proxy-Authorization", "Basic " + // DO NOT i18n |
| | | proxyAuthString); |
| | | } |
| | | InputStream in; |
| | |
| | | } |
| | | String proxyAuthString = createProxyAuthString(); |
| | | if (proxyAuthString != null) { |
| | | conn.setRequestProperty("Proxy-Authorization", "Basic " + |
| | | conn.setRequestProperty("Proxy-Authorization", "Basic " + // DO NOT i18n |
| | | proxyAuthString); |
| | | } |
| | | InputStream is = null; |
| | |
| | | import org.opends.quicksetup.CliApplication; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.QuickSetupLog; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.util.Utils; |
| | | |
| | | import java.util.logging.Logger; |
| | |
| | | QuickSetupLog.initLogFileHandler( |
| | | File.createTempFile(LOG_FILE_PREFIX, LOG_FILE_SUFFIX)); |
| | | } catch (Throwable t) { |
| | | System.err.println("Unable to initialize log"); |
| | | System.err.println( |
| | | ResourceProvider.getInstance().getMsg("error-initializing-log")); |
| | | t.printStackTrace(); |
| | | } |
| | | new UpgradeLauncher(args).launch(); |
| | |
| | | import org.opends.quicksetup.BuildInformation; |
| | | import org.opends.quicksetup.CurrentInstallStatus; |
| | | import org.opends.quicksetup.UserInteraction; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.webstart.WebStartDownloader; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.quicksetup.util.ZipExtractor; |
| | |
| | | UpgradeLauncher.LOG_FILE_PREFIX, |
| | | UpgradeLauncher.LOG_FILE_SUFFIX)); |
| | | } catch (IOException e) { |
| | | System.err.println("Failed to initialize log"); |
| | | System.err.println( |
| | | ResourceProvider.getInstance().getMsg("error-initializing-log")); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // Get started on downloading the web start jars |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public String getSummary(ProgressStep step) { |
| | | String txt = null; |
| | | String txt; |
| | | if (step == UpgradeProgressStep.FINISHED) { |
| | | txt = getFinalSuccessMessage(); |
| | | } else if (step == UpgradeProgressStep.FINISHED_CANCELED) { |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canFinish(WizardStep step) { |
| | | boolean cf = UpgradeWizardStep.REVIEW.equals(step); |
| | | return cf; |
| | | return UpgradeWizardStep.REVIEW.equals(step); |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | |
| | | if (Utils.isWebStart()) { |
| | | ZipExtractor extractor = null; |
| | | ZipExtractor extractor; |
| | | try { |
| | | LOG.log(Level.INFO, "Waiting for Java Web Start jar download"); |
| | | waitForLoader(15); // TODO: ratio |
| | |
| | | |
| | | checkAbort(); |
| | | |
| | | boolean schemaCustomizationPresent = false; |
| | | boolean schemaCustomizationPresent; |
| | | try { |
| | | LOG.log(Level.INFO, "checking for schema customizations"); |
| | | setCurrentProgressStep( |
| | |
| | | |
| | | checkAbort(); |
| | | |
| | | boolean configCustimizationPresent = false; |
| | | boolean configCustimizationPresent; |
| | | try { |
| | | LOG.log(Level.INFO, "checking for config customizations"); |
| | | setCurrentProgressStep( |
| | |
| | | if (errors != null && errors.size() > 0) { |
| | | notifyListeners(formatter.getFormattedError() + |
| | | formatter.getLineBreak()); |
| | | String sep = System.getProperty("line.separator"); |
| | | String formattedDetails = |
| | | Utils.listToString(errors, sep, /*bullet=*/"\u2022 ", ""); |
| | | Utils.listToString(errors, |
| | | Constants.LINE_SEPARATOR, /*bullet=*/"\u2022 ", ""); |
| | | runWarning = new ApplicationException( |
| | | ApplicationException.Type.APPLICATION, |
| | | getMsg("error-upgraded-server-starts-with-errors", |
| | | sep + formattedDetails), null); |
| | | Constants.LINE_SEPARATOR + formattedDetails), null); |
| | | String cancel = getMsg("upgrade-verification-failure-cancel"); |
| | | UserInteraction ui = userInteraction(); |
| | | if (ui == null || cancel.equals(ui.confirm( |
| | |
| | | } catch (ApplicationException e) { |
| | | notifyListeners(formatter.getFormattedError() + |
| | | formatter.getLineBreak()); |
| | | System.err.print("Error cleaning up after upgrade: " + |
| | | e.getLocalizedMessage()); |
| | | LOG.log(Level.INFO, "Error cleaning up after upgrade.", e); |
| | | } |
| | | |
| | | // Decide final status based on presense of error |
| | |
| | | fm.move(f, root, null); |
| | | } catch (Throwable t) { |
| | | restoreError = true; |
| | | notifyListeners("The following could not be restored after the" + |
| | | "failed upgrade attempt. You should restore this " + |
| | | "file/directory manually: '" + f + "' to '" + root + "'"); |
| | | notifyListeners(getMsg("error-restoring-file", |
| | | Utils.getPath(f), |
| | | Utils.getPath(root))); |
| | | } |
| | | } |
| | | if (!restoreError) { |
| | |
| | | * an upgrade from the current version to the next version |
| | | * is possible. Upgrading may not be possible due to 'flag |
| | | * day' types of changes to the codebase. |
| | | * @throws org.opends.quicksetup.ApplicationException if upgradability |
| | | * cannot be insured. |
| | | */ |
| | | private void insureUpgradability() throws ApplicationException { |
| | | BuildInformation currentVersion; |
| | |
| | | try { |
| | | currentVersion = getInstallation().getBuildInformation(); |
| | | } catch (ApplicationException e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | LOG.log(Level.INFO, "error getting build information for " + |
| | | "current installation", e); |
| | | throw ApplicationException.createFileSystemException( |
| | | getMsg("error-determining-current-build"), e); |
| | | } |
| | |
| | | try { |
| | | newVersion = getStagedInstallation().getBuildInformation(); |
| | | } catch (Exception e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | LOG.log(Level.INFO, "error getting build information for " + |
| | | "staged installation", e); |
| | | throw ApplicationException.createFileSystemException( |
| | | getMsg("error-determining-upgrade-build"), e); } |
| | | |
| | |
| | | private String getFinalSuccessMessage() { |
| | | String txt; |
| | | String installPath = Utils.getPath(getInstallation().getRootDirectory()); |
| | | String newVersion = null; |
| | | String newVersion; |
| | | try { |
| | | BuildInformation bi = getInstallation().getBuildInformation(); |
| | | if (bi != null) { |
| | |
| | | try { |
| | | stagedVersion = getStagedInstallation().getBuildInformation(); |
| | | } catch (Exception e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | LOG.log(Level.INFO, "error getting build info for staged installation", |
| | | e); |
| | | } |
| | | } |
| | | return stagedVersion; |
| | |
| | | localInstallPackFileNameArg.getValue(); |
| | | File installPackFile = new File(localInstallPackFileName); |
| | | if (!installPackFile.exists()) { |
| | | throw new UserDataException(null, "File '" + |
| | | localInstallPackFileName + |
| | | "' does not exist"); |
| | | throw new UserDataException(null, |
| | | getMsg("build-extractor-error-file-no-exist", |
| | | localInstallPackFileName)); |
| | | } else { |
| | | uud.setInstallPackage(installPackFile); |
| | | } |
| | | } else { |
| | | // TODO i18N |
| | | // TODO: ask the user for this information if non noninteractive |
| | | throw new UserDataException(null, |
| | | "Option -f is required."); |
| | | getMsg("error-option-required", |
| | | "-" + FILE_OPTION_SHORT + "/--" + FILE_OPTION_LONG)); |
| | | } |
| | | |
| | | } catch (ArgumentException e) { |
| | | throw new UserDataException(null, "Error parsing arguments"); |
| | | throw new UserDataException(null, getMsg("error-parsing-options")); |
| | | } |
| | | return uud; |
| | | } |
| | |
| | | import java.net.*; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | |
| | | /** |
| | | * This panel represents the big error message the pops up when the |
| | |
| | | private void layoutPanel() { |
| | | setLayout(new GridBagLayout()); |
| | | |
| | | String proxyString = "None"; |
| | | String proxyString = getMsg("general-none"); |
| | | Proxy proxy = rbm.getProxy(); |
| | | if (proxy != null) { |
| | | SocketAddress addr = proxy.address(); |
| | | proxyString = addr.toString(); |
| | | } |
| | | |
| | | String baseContext = "Unspecified"; |
| | | String baseContext = getMsg("general-unspecified"); |
| | | URL url = rbm.getBaseContext(); |
| | | if (url != null) { |
| | | baseContext = url.toString(); |
| | |
| | | |
| | | String html = |
| | | getMsg("upgrade-choose-version-build-list-error", |
| | | new String[]{ |
| | | baseContext, |
| | | reason.getLocalizedMessage(), |
| | | proxyString}); |
| | | baseContext, |
| | | reason.getLocalizedMessage(), |
| | | proxyString); |
| | | |
| | | /* This helps with debugger the HTML rendering |
| | | StringBuffer content = new StringBuffer(); |
| | |
| | | add(UIFactory.makeHtmlPane(html, ek, UIFactory.INSTRUCTIONS_FONT)); |
| | | } |
| | | |
| | | /** |
| | | * Returns a localized message for a key value. In the properties file we |
| | | * have something of type: |
| | | * key=value |
| | | * <p/> |
| | | * For instance if we pass as key "mykey" and as arguments {"value1"} and |
| | | * in the properties file we have: |
| | | * mykey=value with argument {0}. |
| | | * <p/> |
| | | * This method will return "value with argument value1". |
| | | * |
| | | * @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. |
| | | * @see org.opends.quicksetup.i18n.ResourceProvider#getMsg(String,String[]) |
| | | */ |
| | | public String getMsg(String key, String[] args) { |
| | | return getI18n().getMsg(key, args); |
| | | private String getMsg(String key) { |
| | | return ResourceProvider.getInstance().getMsg(key); |
| | | } |
| | | |
| | | /** |
| | | * Returns a ResourceProvider instance. |
| | | * |
| | | * @return a ResourceProvider instance. |
| | | */ |
| | | public ResourceProvider getI18n() { |
| | | return ResourceProvider.getInstance(); |
| | | private String getMsg(String key, String... args) { |
| | | return ResourceProvider.getInstance().getMsg(key, args); |
| | | } |
| | | |
| | | /** |
| | |
| | | } else { |
| | | try { |
| | | SwingUtilities.invokeAndWait(proxySpecifier); |
| | | } catch (InterruptedException e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | } catch (InvocationTargetException e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | } catch (Throwable t) { |
| | | LOG.log(Level.INFO, "error", t); |
| | | LOG.log(Level.INFO, "error waiting for event thread", t); |
| | | } |
| | | } |
| | | } |
| | |
| | | private JLabel lblCurrentVersion = null; |
| | | private JRadioButton rbRemote = null; |
| | | private JRadioButton rbLocal = null; |
| | | private ButtonGroup grpRemoteLocal = null; |
| | | private JComboBox cboBuild = null; |
| | | private JLabel lblFile = null; |
| | | private JTextField tfFile = null; |
| | |
| | | try { |
| | | loadBuildList(); |
| | | } catch (IOException e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | LOG.log(Level.INFO, "Error loading build list", e); |
| | | } |
| | | } |
| | | }; |
| | |
| | | public Object getFieldValue(FieldName fieldName) { |
| | | Object value = null; |
| | | if (FieldName.UPGRADE_DOWNLOAD.equals(fieldName)) { |
| | | value = new Boolean(rbRemote.isSelected()); |
| | | value = rbRemote.isSelected(); |
| | | } else if (FieldName.UPGRADE_BUILD_TO_DOWNLOAD.equals(fieldName)) { |
| | | value = cboBuild.getSelectedItem(); |
| | | } else if (FieldName.UPGRADE_FILE.equals(fieldName)) { |
| | |
| | | getMsg("upgrade-choose-version-local-tooltip"), |
| | | UIFactory.TextStyle.SECONDARY_FIELD_VALID); |
| | | |
| | | grpRemoteLocal = new ButtonGroup(); |
| | | ButtonGroup grpRemoteLocal = new ButtonGroup(); |
| | | grpRemoteLocal.add(rbRemote); |
| | | grpRemoteLocal.add(rbLocal); |
| | | grpRemoteLocal.setSelected(rbRemote.getModel(), true); |
| | |
| | | try { |
| | | bld = new RemoteBuildListComboBoxModelCreator(rbm); |
| | | } catch (IOException e) { |
| | | LOG.log(Level.INFO, "error", e); |
| | | LOG.log(Level.INFO, "error creating remote build list combo " + |
| | | "box model creator", e); |
| | | } |
| | | } |
| | | return bld; |
| | |
| | | * Creates a default instance. |
| | | */ |
| | | public BuildListErrorComboBoxRenderer() { |
| | | super("Unable to access remote build information", |
| | | super(getMsg("upgrade-choose-version-unable-to-access-build-info"), |
| | | UIFactory.getImageIcon(UIFactory.IconType.WARNING), |
| | | SwingConstants.LEFT); |
| | | UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS); |
| | |
| | | * Creates a default instance. |
| | | */ |
| | | public BuildListLoadingComboBoxRenderer() { |
| | | super("Loading remote build information...", |
| | | super(getMsg("upgrade-choose-version-loading-build-info"), |
| | | UIFactory.getImageIcon(UIFactory.IconType.WAIT_TINY), |
| | | SwingConstants.LEFT); |
| | | UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS); |
| | |
| | | cbm = new DefaultComboBoxModel(buildList.toArray()); |
| | | } else { |
| | | try { |
| | | String[] options = { "Retry", "Close" }; |
| | | String[] options = { |
| | | getMsg("retry-button-label"), |
| | | getMsg("close-button-label") |
| | | }; |
| | | int i = JOptionPane.showOptionDialog(getMainWindow(), |
| | | new BuildListDownloadErrorPanel(rbm, |
| | | throwable), |
| | | "Network Error", |
| | | getMsg("network-error-title"), |
| | | JOptionPane.YES_NO_OPTION, |
| | | JOptionPane.ERROR_MESSAGE, |
| | | null, |
| | |
| | | private InputStream getInputStream() throws IOException { |
| | | if (this.in == null) { |
| | | this.in = rbm.getDailyBuildsInputStream(getMainWindow(), |
| | | "Reading build information"); |
| | | getMsg("upgrade-choose-version-reading-build-info")); |
| | | } |
| | | return this.in; |
| | | } |
| | |
| | | * Create a new copy operation. |
| | | * @param objectFile to copy |
| | | * @param destDir to copy to |
| | | * @param overwrite if true copy should overwrite any existing file |
| | | */ |
| | | public CopyOperation(File objectFile, File destDir, boolean overwrite) { |
| | | super(objectFile); |
| | |
| | | /** |
| | | * Creates a delete operation. |
| | | * @param objectFile to delete |
| | | * @param newParent Filr where <code>objectFile</code> will be copied. |
| | | */ |
| | | public MoveOperation(File objectFile, File newParent) { |
| | | super(objectFile); |
| | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | import org.opends.quicksetup.Constants; |
| | | |
| | | /** |
| | | * This is an implementation of the ProgressMessageFormatter class that |
| | |
| | | */ |
| | | public class HtmlProgressMessageFormatter implements ProgressMessageFormatter |
| | | { |
| | | static private final Logger LOG = |
| | | Logger.getLogger(HtmlProgressMessageFormatter.class.getName()); |
| | | |
| | | private String doneHtml; |
| | | private String errorHtml; |
| | | |
| | | /** |
| | | * The line break in HTML. |
| | | */ |
| | | private static String LINE_BREAK = "<br>"; |
| | | |
| | | /** |
| | | * The constant used to separate parameters in an URL. |
| | | */ |
| | | private String PARAM_SEPARATOR = "&&&&"; |
| | |
| | | UIFactory.getIconHtml(UIFactory.IconType.INFORMATION_LARGE) + SPACE |
| | | + SPACE + UIFactory.applyFontToHtml(text, UIFactory.PROGRESS_FONT); |
| | | |
| | | String result = UIFactory.applySuccessfulBackgroundToHtml(html); |
| | | return result; |
| | | return UIFactory.applySuccessfulBackgroundToHtml(html); |
| | | } |
| | | |
| | | /** |
| | |
| | | Throwable root = ex.getCause(); |
| | | while (root != null) |
| | | { |
| | | stackBuf.append(getHtml(getMsg("exception-root-cause")) + LINE_BREAK); |
| | | stackBuf.append(getHtml(getMsg("exception-root-cause"))) |
| | | .append(Constants.HTML_LINE_BREAK); |
| | | stackBuf.append(getHtmlStack(root)); |
| | | root = root.getCause(); |
| | | } |
| | |
| | | if (msg != null) |
| | | { |
| | | buf.append(UIFactory.applyFontToHtml(getHtml(ex.getMessage()), |
| | | UIFactory.PROGRESS_ERROR_FONT) |
| | | + LINE_BREAK); |
| | | UIFactory.PROGRESS_ERROR_FONT)).append(Constants.HTML_LINE_BREAK); |
| | | } else |
| | | { |
| | | buf.append(ex.toString() + LINE_BREAK); |
| | | buf.append(ex.toString()).append(Constants.HTML_LINE_BREAK); |
| | | } |
| | | buf.append(getErrorWithStackHtml(openDiv, hideText, showText, stackText, |
| | | closeDiv, false)); |
| | |
| | | */ |
| | | public String getLineBreak() |
| | | { |
| | | return LINE_BREAK; |
| | | return Constants.HTML_LINE_BREAK; |
| | | } |
| | | |
| | | /** |
| | |
| | | int index = lastText.indexOf(urlText); |
| | | if (index == -1) |
| | | { |
| | | System.out.println("lastText: " + lastText); |
| | | System.out.println("does not contain: " + urlText); |
| | | LOG.log(Level.FINE, "lastText: " + lastText + |
| | | "does not contain: " + urlText); |
| | | } else |
| | | { |
| | | lastText = |
| | |
| | | { |
| | | if (i != 0) |
| | | { |
| | | buffer.append("<br>"); |
| | | buffer.append(Constants.HTML_LINE_BREAK); |
| | | } |
| | | buffer.append(escape(lines[i])); |
| | | } |
| | |
| | | { |
| | | StringBuilder buf = new StringBuilder(); |
| | | StackTraceElement[] stack = ex.getStackTrace(); |
| | | for (int i = 0; i < stack.length; i++) |
| | | { |
| | | buf.append(SPACE + SPACE + SPACE + SPACE + SPACE + SPACE + SPACE + |
| | | SPACE + SPACE + SPACE + getHtml(stack[i].toString()) + LINE_BREAK); |
| | | for (StackTraceElement aStack : stack) { |
| | | buf.append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(SPACE) |
| | | .append(getHtml(aStack.toString())) |
| | | .append(Constants.HTML_LINE_BREAK); |
| | | } |
| | | return buf.toString(); |
| | | } |
| | |
| | | try |
| | | { |
| | | String text = hide ? hideText : showText; |
| | | buf.append(openDiv + "<a href=\"http://").append( |
| | | URLEncoder.encode(params, "UTF-8") + "\">" + text + "</a>"); |
| | | buf.append(openDiv).append("<a href=\"http://") |
| | | .append(URLEncoder.encode(params, "UTF-8")) |
| | | .append("\">").append(text).append("</a>"); |
| | | if (hide) |
| | | { |
| | | buf.append(LINE_BREAK + stackText); |
| | | buf.append(Constants.HTML_LINE_BREAK).append(stackText); |
| | | } |
| | | buf.append(closeDiv); |
| | | |
| | |
| | | String showText, String stackText, String closeDiv, boolean hide) |
| | | { |
| | | StringBuilder buf = new StringBuilder(); |
| | | buf.append(openDiv + PARAM_SEPARATOR); |
| | | buf.append(hideText + PARAM_SEPARATOR); |
| | | buf.append(showText + PARAM_SEPARATOR); |
| | | buf.append(stackText + PARAM_SEPARATOR); |
| | | buf.append(closeDiv + PARAM_SEPARATOR); |
| | | buf.append(openDiv).append(PARAM_SEPARATOR); |
| | | buf.append(hideText).append(PARAM_SEPARATOR); |
| | | buf.append(showText).append(PARAM_SEPARATOR); |
| | | buf.append(stackText).append(PARAM_SEPARATOR); |
| | | buf.append(closeDiv).append(PARAM_SEPARATOR); |
| | | buf.append(hide); |
| | | return buf.toString(); |
| | | } |
| | |
| | | String showText = params[i++]; |
| | | String stackText = params[i++]; |
| | | String closeDiv = params[i++]; |
| | | boolean isHide = new Boolean(params[i]); |
| | | boolean isHide = Boolean.valueOf(params[i]); |
| | | |
| | | if (isHide) |
| | | { |
| | |
| | | // Attempting to use DirectoryServer with a configuration file |
| | | // for a different version of the server can cause problems for |
| | | // the server at startup. |
| | | BuildInformation installBi = null; |
| | | BuildInformation currentBi = null; |
| | | BuildInformation installBi; |
| | | BuildInformation currentBi; |
| | | try { |
| | | installBi = installation.getBuildInformation(); |
| | | currentBi = BuildInformation.getCurrent(); |
| | |
| | | } |
| | | } |
| | | |
| | | static private void unregisterListenersForOutput() { |
| | | DebugLogger.removeDebugLogPublisher(DN.NULL_DN); |
| | | ErrorLogger.removeErrorLogPublisher(DN.NULL_DN); |
| | | AccessLogger.removeAccessLogPublisher(DN.NULL_DN); |
| | | } |
| | | |
| | | static private String getMsg(String key, String... args) { |
| | | return ResourceProvider.getInstance().getMsg(key, args); |
| | | } |
| | |
| | | package org.opends.quicksetup.util; |
| | | |
| | | import org.opends.quicksetup.i18n.ResourceProvider; |
| | | import org.opends.quicksetup.Constants; |
| | | |
| | | /** |
| | | * This is an implementation of the ProgressMessageFormatter class that |
| | |
| | | private String errorText; |
| | | |
| | | /** |
| | | * The line break in plain text. |
| | | */ |
| | | private static String LINE_BREAK = System.getProperty("line.separator"); |
| | | |
| | | /** |
| | | * The space in plain text. |
| | | */ |
| | | private static String SPACE = " "; |
| | |
| | | String result; |
| | | if (applyMargin) |
| | | { |
| | | result = LINE_BREAK+text; |
| | | result = Constants.LINE_SEPARATOR+text; |
| | | } else |
| | | { |
| | | result = text; |
| | |
| | | String result; |
| | | if (applyMargin) |
| | | { |
| | | result = LINE_BREAK+text; |
| | | result = Constants.LINE_SEPARATOR+text; |
| | | } else |
| | | { |
| | | result = text; |
| | |
| | | String result; |
| | | if (applyMargin) |
| | | { |
| | | result = LINE_BREAK+msg; |
| | | result = Constants.LINE_SEPARATOR+msg; |
| | | } else |
| | | { |
| | | result = msg; |
| | |
| | | */ |
| | | public String getLineBreak() |
| | | { |
| | | return LINE_BREAK; |
| | | return Constants.LINE_SEPARATOR; |
| | | } |
| | | |
| | | /** |
| | |
| | | p = d.indexOf(' ', maxll); |
| | | if (p > 0 && p < len) { |
| | | return d.substring(0, p) + |
| | | "<br>" + |
| | | Constants.HTML_LINE_BREAK + |
| | | breakHtmlString(d.substring(p + 1), maxll); |
| | | } else { |
| | | return d; |