opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/UserData.java
@@ -28,7 +28,6 @@ package org.opends.quicksetup; import org.opends.quicksetup.util.Utils; import org.opends.server.util.SetupUtils; /** * Represents user specified input data to an application. @@ -303,7 +302,7 @@ for (int i=0;i<65000 && (defaultJMXPort == -1);i+=1000) { int port = i + SetupUtils.getDefaultJMXPort(); int port = i + org.opends.server.util.SetupUtils.getDefaultJMXPort(); boolean isForbidden = false; if (forbiddenPorts != null) { opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/event/BrowseActionListener.java
@@ -74,6 +74,10 @@ */ OPEN_LDIF_FILE, /** * The Browser is used to retrieve a .zip file. */ OPEN_ZIP_FILE, /** * The Browser is used to retrieve a generic file. */ GENERIC_FILE @@ -121,6 +125,18 @@ fc.setFileFilter(ldifFiles); break; case OPEN_ZIP_FILE: fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setDialogType(JFileChooser.OPEN_DIALOG); fc.setDialogTitle(i18n.getMsg("open-zip-file-dialog-title")); ExtensionFileFilter zipFiles = new ExtensionFileFilter("zip", i18n.getMsg("zip-files-description")); fc.addChoosableFileFilter(zipFiles); fc.setFileFilter(zipFiles); break; case GENERIC_FILE: fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setDialogType(JFileChooser.OPEN_DIALOG); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/images/wait_tiny.png
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -330,6 +330,13 @@ /** * {@inheritDoc} */ public int getExtraDialogHeight() { return UIFactory.EXTRA_DIALOG_HEIGHT; } /** * {@inheritDoc} */ public void previousClicked(WizardStep cStep, QuickSetup qs) { // do nothing; } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -77,15 +77,12 @@ private HashMap<InstallProgressStep, String> hmSummary = new HashMap<InstallProgressStep, String>(); private WebStartDownloader loader; /** * WebStartInstaller constructor. */ public WebStartInstaller() { loader = new WebStartDownloader(); loader.start(false); initLoader(); status = InstallProgressStep.NOT_STARTED; } @@ -191,7 +188,13 @@ */ public String getSummary(ProgressStep status) { return hmSummary.get(status); String summary = null; if (InstallProgressStep.DOWNLOADING.equals(status)) { summary = loader.getSummary(); } else { summary = hmSummary.get(status); } return summary; } /** @@ -295,73 +298,6 @@ } /** * Waits for the loader to be finished. Every time we have an update in the * percentage that is downloaded we notify the listeners of this. * * @param maxRatio is the integer value that tells us which is the max ratio * that corresponds to the download. It is used to calculate how the global * installation ratio changes when the download ratio increases. For instance * if we suppose that the download takes 25 % of the total installation * process, then maxRatio will be 25. When the download is complete this * method will send a notification to the ProgressUpdateListeners with a ratio * of 25 %. * @throws QuickSetupException if something goes wrong * */ private void waitForLoader(Integer maxRatio) throws QuickSetupException { int lastPercentage = -1; WebStartDownloader.Status lastStatus = WebStartDownloader.Status.DOWNLOADING; while (!loader.isFinished() && (loader.getException() == null)) { // Pool until is over int perc = loader.getDownloadPercentage(); WebStartDownloader.Status downloadStatus = loader.getStatus(); if ((perc != lastPercentage) || (downloadStatus != lastStatus)) { lastPercentage = perc; int ratio = (perc * maxRatio) / 100; String summary; switch (downloadStatus) { case VALIDATING: String[] argsValidating = { String.valueOf(perc), String.valueOf(loader.getCurrentValidatingPercentage())}; summary = getMsg("validating-ratio", argsValidating); break; case UPGRADING: String[] argsUpgrading = { String.valueOf(perc), String.valueOf(loader.getCurrentUpgradingPercentage())}; summary = getMsg("upgrading-ratio", argsUpgrading); break; default: String[] arg = { String.valueOf(perc) }; summary = getMsg("downloading-ratio", arg); } hmSummary.put(InstallProgressStep.DOWNLOADING, summary); notifyListeners(ratio, summary, null); try { Thread.sleep(300); } catch (Exception ex) { } } } if (loader.getException() != null) { throw loader.getException(); } } /** * Creates the parent Directory for the server location if it does not exist. * @throws QuickSetupException if something goes wrong. */ opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -358,6 +358,7 @@ subsection-left-icon-description=Decoration icon. subsection-right-icon-description=Decoration icon. help-small-icon-description=Help icon. help-wait-description=Busy, please wait. # # Icon tooltips. @@ -391,6 +392,7 @@ subsection-right-icon=images/divider-right.png opends-small-icon=images/opends_logo_small.png help-small-icon=images/help_small.gif wait-tiny=images/wait_tiny.png # # Welcome Panel specific labels @@ -634,8 +636,10 @@ browse-button-label=Browse... browse-button-tooltip=Click to display a file system browser ldif-files-description=LDAP Data Interchange Format (*.ldif) zip-files-description=OpenDS Installation Package (.zip) open-server-location-dialog-title=Choose Installation Path 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 # @@ -716,6 +720,7 @@ progress-extracting=Extracting {0} progress-configuring=Configuring Directory Server progress-updating-certificates=Configuring Certificates downloading=Downloading... downloading-ratio=Downloading: {0}% Completed. validating-ratio=Downloading: {0}% Completed - Validating file: {1} % Completed. upgrading-ratio=Downloading: {0}% Completed - Upgrading file: {1} % Completed. @@ -886,3 +891,5 @@ upgrade-review-panel-start-server=Start Server when the Upgrade has Completed upgrade-review-panel-start-server-tooltip=Check this check box if you want to \ start the server once the upgrade has completed general-loading=Loading... opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/CurrentStepPanel.java
@@ -27,16 +27,16 @@ package org.opends.quicksetup.ui; import java.awt.CardLayout; import java.awt.Dimension; import java.awt.*; import java.util.HashMap; import java.util.Set; import org.opends.quicksetup.event.ButtonActionListener; import org.opends.quicksetup.installer.Installer; import org.opends.quicksetup.*; import javax.swing.*; /** * This is the class that contains the panel on the right-top part of the * QuickSetupDialog). It uses a CardLayout that contains all @@ -54,6 +54,8 @@ { private static final long serialVersionUID = 5474803491510999334L; private static final String LOADING_PANEL = "loading"; private HashMap<WizardStep, QuickSetupStepPanel> hmPanels = new HashMap<WizardStep, QuickSetupStepPanel>(); @@ -140,12 +142,17 @@ add(getPanel(s), s.toString()); } // Add a special panel to display while panels are // initializing themselves JPanel loadingPanel = UIFactory.makeJPanel(); loadingPanel.setLayout(new GridBagLayout()); loadingPanel.add(UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, getMsg("general-loading"), UIFactory.TextStyle.PRIMARY_FIELD_VALID), new GridBagConstraints()); add(loadingPanel, LOADING_PANEL); // For aesthetical reasons we add a little bit of height // TODO: remove this hack if (getApplication() instanceof Installer) { minHeight += UIFactory.EXTRA_DIALOG_HEIGHT; } minHeight += getApplication().getExtraDialogHeight(); setPreferredSize(new Dimension(minWidth, minHeight)); setMinimumSize(new Dimension(minWidth, minHeight)); @@ -183,12 +190,25 @@ * @param userData the UserData object that must be used to populate * the panels. */ public void setDisplayedStep(WizardStep step, UserData userData) public void setDisplayedStep(final WizardStep step, final UserData userData) { CardLayout cl = (CardLayout) (getLayout()); getPanel(step).beginDisplay(userData); cl.show(this, step.toString()); getPanel(step).endDisplay(); final CardLayout cl = (CardLayout) (getLayout()); // Show the 'loading...' panel and invoke begin // display in another thread in case the panel // taske a while to initialize. cl.show(this, LOADING_PANEL); new Thread(new Runnable() { public void run() { getPanel(step).beginDisplay(userData); SwingUtilities.invokeLater(new Runnable() { public void run() { cl.show(CurrentStepPanel.this, step.toString()); getPanel(step).endDisplay(); } }); } },"panel begin display thread").start(); } /** opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -28,6 +28,7 @@ package org.opends.quicksetup.ui; import org.opends.quicksetup.*; import org.opends.quicksetup.webstart.WebStartDownloader; import javax.swing.*; import java.awt.event.WindowEvent; @@ -47,6 +48,9 @@ /** The currently displayed wizard step. */ private WizardStep displayedStep; /** Downloads .jar files for webstart application. */ protected WebStartDownloader loader; /** * Constructs an instance of an application. Subclasses * of this application must have a default constructor. @@ -319,4 +323,89 @@ return "finish-button-label"; } /** * Begins downloading webstart jars in another thread * for WebStart applications only. */ protected void initLoader() { loader = new WebStartDownloader(); loader.start(false); } /** * Waits for the loader to be finished. Every time we have an update in the * percentage that is downloaded we notify the listeners of this. * * @param maxRatio is the integer value that tells us which is the max ratio * that corresponds to the download. It is used to calculate how the global * installation ratio changes when the download ratio increases. For instance * if we suppose that the download takes 25 % of the total installation * process, then maxRatio will be 25. When the download is complete this * method will send a notification to the ProgressUpdateListeners with a ratio * of 25 %. * @throws org.opends.quicksetup.QuickSetupException if something goes wrong * */ protected void waitForLoader(Integer maxRatio) throws QuickSetupException { int lastPercentage = -1; WebStartDownloader.Status lastStatus = WebStartDownloader.Status.DOWNLOADING; while (!loader.isFinished() && (loader.getException() == null)) { // Pool until is over int perc = loader.getDownloadPercentage(); WebStartDownloader.Status downloadStatus = loader.getStatus(); if ((perc != lastPercentage) || (downloadStatus != lastStatus)) { lastPercentage = perc; int ratio = (perc * maxRatio) / 100; String summary; switch (downloadStatus) { case VALIDATING: String[] argsValidating = { String.valueOf(perc), String.valueOf(loader.getCurrentValidatingPercentage())}; summary = getMsg("validating-ratio", argsValidating); break; case UPGRADING: String[] argsUpgrading = { String.valueOf(perc), String.valueOf(loader.getCurrentUpgradingPercentage())}; summary = getMsg("upgrading-ratio", argsUpgrading); break; default: String[] arg = { String.valueOf(perc) }; summary = getMsg("downloading-ratio", arg); } loader.setSummary(summary); notifyListeners(ratio, summary, null); try { Thread.sleep(300); } catch (Exception ex) { } } } if (loader.getException() != null) { throw loader.getException(); } } /** * Gets the amount of addition pixels added to the height * of the tallest panel in order to size the wizard for * asthetic reasons. * @return int height to add */ public int getExtraDialogHeight() { return 0; } } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -43,6 +43,7 @@ import javax.swing.text.html.HTMLEditorKit; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.BevelBorder; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; @@ -393,6 +394,12 @@ Font.decode("Arial-ITALIC-12"); /** * Specifies the font for the secondary invalid field. */ public static final Font SECONDARY_STATUS_FONT = Font.decode("Arial-ITALIC-12"); /** * Specifies the font for read only text. */ public static final Font READ_ONLY_FONT = Font.decode("Arial-PLAIN-12"); @@ -496,6 +503,7 @@ static { UIManager.put("OptionPane.background",Color.WHITE); UIManager.put("Panel.background",Color.WHITE); UIManager.put("ComboBox.background", Color.WHITE); } /** @@ -564,6 +572,17 @@ * Question icon. */ HELP_SMALL, /** * Hourglass to display when the user must wait. */ WAIT, /** * 8 x 8 Hourglass to display when the user must wait. */ WAIT_TINY, /** * No icon. */ @@ -606,6 +625,12 @@ * Secondary field invalid text style for the current step panel. */ SECONDARY_FIELD_INVALID, /** * Status messages that appear near components. */ SECONDARY_STATUS, /** * Textfield text style for the current step panel. */ @@ -676,8 +701,7 @@ */ static public JComboBox makeJComboBox() { JComboBox cbo = new JComboBox(); cbo.setOpaque(true); cbo.setBackground(Color.WHITE); cbo.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); return cbo; } @@ -944,6 +968,11 @@ l.setForeground(FIELD_INVALID_COLOR); break; case SECONDARY_STATUS: l.setFont(UIFactory.SECONDARY_STATUS_FONT); l.setForeground(FIELD_VALID_COLOR); break; case READ_ONLY: l.setFont(UIFactory.READ_ONLY_FONT); l.setForeground(READ_ONLY_COLOR); @@ -1430,6 +1459,10 @@ key = "error-large-icon"; break; case WAIT_TINY: key = "wait-tiny"; break; default: throw new IllegalArgumentException("Unknown iconName: " + iconType); } @@ -1506,6 +1539,10 @@ description = getMsg("help-small-icon-description"); break; case WAIT_TINY: description = getMsg("help-wait-description"); break; case NO_ICON: description = null; break; @@ -1589,6 +1626,11 @@ case HELP_SMALL: tooltip = null; break; case WAIT_TINY: tooltip = null; break; case NO_ICON: tooltip = null; break; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -29,7 +29,6 @@ import org.opends.quicksetup.Application; import org.opends.quicksetup.util.Utils; import org.opends.server.util.DynamicConstants; import javax.swing.*; import java.net.URL; @@ -40,6 +39,7 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; import java.util.logging.Logger; import java.util.logging.Level; import java.io.*; import java.awt.*; @@ -97,28 +97,17 @@ } /** * Gets a list of builds found in the remote repository. * @return List of Build objects representing remote builds * @throws IOException if there was a problem contacting the build * repository */ public List<Build> listBuilds() throws IOException { return listBuilds(null, null); } /** * Gets the list of builds from the build repository using a * progress monitor to keep the user informed about the status * of downloading the build page. * @param c Component to act as parent of the progress monitor * @param o message to display in the progress monitor * @param in InputStream of build information * @return list of Build objects * @throws IOException if something goes wrong loading the list * from the build repository */ public List<Build> listBuilds(Component c, Object o) throws IOException { public List<Build> listBuilds(InputStream in) throws IOException { List<Build> buildList = new ArrayList<Build>(); String dailyBuildsPage = downloadDailyBuildsPage(c, o); String dailyBuildsPage = downloadDailyBuildsPage(in); Pattern p = Pattern.compile("\\d{14}"); Matcher m = p.matcher(dailyBuildsPage); Set<String> buildIds = new HashSet<String>(); @@ -139,10 +128,10 @@ // way of getting this information. StringBuilder latestContextSb = new StringBuilder() .append("daily-builds/latest/OpenDS/build/package/OpenDS-") .append(DynamicConstants.MAJOR_VERSION) .append(org.opends.server.util.DynamicConstants.MAJOR_VERSION) .append(".") .append(DynamicConstants.MINOR_VERSION) .append(DynamicConstants.VERSION_QUALIFIER) .append(org.opends.server.util.DynamicConstants.MINOR_VERSION) .append(org.opends.server.util.DynamicConstants.VERSION_QUALIFIER) .append(".zip"); Build latest = new Build(new URL(url, latestContextSb.toString()), "Latest"); @@ -151,8 +140,16 @@ return buildList; } private String downloadDailyBuildsPage(Component c, Object o) throws IOException /** * Gets an input stream to download. * @param c Component parent * @param o Object message to display in the ProgressMonitor * @return InputStream for the build list * @throws IOException if something goes wrong */ public InputStream getDailyBuildsInputStream(final Component c, final Object o) throws IOException { URL dailyBuildsUrl = new URL(url, "daily-builds"); URLConnection conn; @@ -171,16 +168,32 @@ ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(c, o, conn.getInputStream()); ProgressMonitor pm = pmis.getProgressMonitor(); pm.setMillisToDecideToPopup(0); pm.setMaximum(conn.getContentLength()); // pm.setMillisToDecideToPopup(0); // pm.setMillisToPopup(0); in = pmis; } else { in = conn.getInputStream(); } return in; } private String downloadDailyBuildsPage(InputStream in) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder builder = new StringBuilder(); String line; while (null != (line = reader.readLine())) { builder.append(line); // FOR TESTING try { Thread.sleep(50); } catch (InterruptedException e) { LOG.log(Level.INFO, "error", e); } } return builder.toString(); } @@ -230,6 +243,9 @@ while ((i = is.read(buf)) != -1) { fos.write(buf, 0, i); bytesRead += i; if (app != null) { app.notifyListeners("."); } } } finally { if (is != null) { opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -36,14 +36,6 @@ import org.opends.quicksetup.util.ServerController; import org.opends.quicksetup.util.ZipExtractor; import org.opends.quicksetup.ui.*; import org.opends.server.tools.BackUpDB; import org.opends.server.tools.LDIFDiff; import org.opends.server.util.*; import org.opends.server.types.*; import org.opends.server.protocols.internal.InternalClientConnection; import org.opends.server.config.ConfigException; import org.opends.server.core.ModifyOperation; import org.opends.server.core.DirectoryServer; import java.awt.event.WindowEvent; import java.util.*; @@ -213,6 +205,15 @@ private RemoteBuildManager remoteBuildManager = null; /** * Creates a default instance. */ public Upgrader() { if (Utils.isWebStart()) { initLoader(); } } /** * {@inheritDoc} */ public String getFrameTitle() { @@ -258,6 +259,13 @@ /** * {@inheritDoc} */ public int getExtraDialogHeight() { return UIFactory.EXTRA_DIALOG_HEIGHT; } /** * {@inheritDoc} */ protected String getInstallationPath() { // The upgrader runs from the bits extracted by BuildExtractor // in the staging directory. So 'stagePath' below will point @@ -302,19 +310,20 @@ public String getSummary(ProgressStep step) { String txt = null; if (step == UpgradeProgressStep.FINISHED) { String installPath = Utils.getPath(getInstallation().getRootDirectory()); String newVersion = null; try { newVersion = getInstallation().getBuildId(); } catch (QuickSetupException e) { newVersion = getMsg("upgrade-build-id-unknown"); } String[] args = { formatter.getFormattedText(installPath), newVersion }; txt = getFormattedSuccess( getMsg("summary-upgrade-finished-successfully", args)); // String installPath = Utils.getPath(getInstallation().getRootDirectory()); // String newVersion = null; // try { // newVersion = getInstallation().getBuildId(); // } catch (QuickSetupException e) { // newVersion = getMsg("upgrade-build-id-unknown"); // } // String[] args = { // formatter.getFormattedText(installPath), // newVersion }; // txt = getFormattedSuccess( // getMsg("summary-upgrade-finished-successfully", // args)); txt = "Upgrade completed successfully"; // TODO BETTER MESSAGE } else if (step == UpgradeProgressStep.FINISHED_WITH_ERRORS) { txt = getFormattedError( getMsg("summary-upgrade-finished-with-errors")); @@ -433,8 +442,22 @@ Installation.validateRootDirectory(serverLocation); // If we get here the value is acceptable Installation installation = new Installation(serverLocation); final Installation installation = new Installation(serverLocation); setInstallation(installation); // The build ID is needed on the review panel and it is // fairly time consuming to get. So prime this cached // value in a separate thread. new Thread(new Runnable() { public void run() { try { installation.getBuildId(); } catch (QuickSetupException e) { LOG.log(Level.INFO, "error", e); } } }).start(); uud.setServerLocation(serverLocationString); } catch (IllegalArgumentException iae) { @@ -457,6 +480,13 @@ (Build)qs.getFieldValue(FieldName.UPGRADE_BUILD_TO_DOWNLOAD); } else { buildFile = (File)qs.getFieldValue(FieldName.UPGRADE_FILE); if (buildFile == null) { errorMsgs.add("You must specify a path to an OpenDS build file"); } else if (!buildFile.exists()) { errorMsgs.add("File " + Utils.getPath(buildFile) + " does not exist."); qs.displayFieldInvalid(FieldName.UPGRADE_FILE, true); } } uud.setBuildToDownload(buildToDownload); uud.setInstallPackage(buildFile); @@ -537,6 +567,15 @@ try { if (Utils.isWebStart()) { try { waitForLoader(15); // TODO: ratio } catch (QuickSetupException e) { LOG.log(Level.SEVERE, "Error downloading WebStart jars", e); throw e; } } File buildZip; Build buildToDownload = getUpgradeUserData().getInstallPackageToDownload(); @@ -552,6 +591,7 @@ } } getRemoteBuildManager().download(buildToDownload, buildZip); notifyListeners(formatter.getFormattedDone()); } catch (ApplicationException e) { LOG.log(Level.INFO, "Error downloading build file", e); throw e; @@ -817,7 +857,7 @@ LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (LDIFException e) { } catch (org.opends.server.util.LDIFException e) { String msg = "LDIF error applying configuration customization: " + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); @@ -838,7 +878,7 @@ LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (LDIFException e) { } catch (org.opends.server.util.LDIFException e) { String msg = "LDIF error applying schema customization: " + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); @@ -861,13 +901,13 @@ LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (InitializationException e) { } catch (org.opends.server.types.InitializationException e) { String msg = "Failed to start server due to initialization error:" + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR, msg, e); } catch (ConfigException e) { } catch (org.opends.server.config.ConfigException e) { String msg = "Failed to start server due to configuration error: " + e.getLocalizedMessage(); LOG.log(Level.INFO, msg, e); @@ -877,31 +917,41 @@ } private void applyCustomizationLdifFile(File ldifFile) throws IOException, LDIFException, ApplicationException { throws IOException, org.opends.server.util.LDIFException, ApplicationException { try { startServerWithoutConnectionHandlers(); InternalClientConnection cc = InternalClientConnection.getRootConnection(); LDIFImportConfig importCfg = new LDIFImportConfig(Utils.getPath(ldifFile)); LDIFReader ldifReader = new LDIFReader(importCfg); ChangeRecordEntry cre; org.opends.server.protocols.internal.InternalClientConnection cc = org.opends.server.protocols.internal. InternalClientConnection.getRootConnection(); org.opends.server.types.LDIFImportConfig importCfg = new org.opends.server.types.LDIFImportConfig( Utils.getPath(ldifFile)); org.opends.server.util.LDIFReader ldifReader = new org.opends.server.util.LDIFReader(importCfg); org.opends.server.util.ChangeRecordEntry cre; while (null != (cre = ldifReader.readChangeRecord(false))) { if (cre instanceof ModifyChangeRecordEntry) { ModifyChangeRecordEntry mcre = (ModifyChangeRecordEntry) cre; ByteString dnByteString = ByteStringFactory.create(mcre.getDN().toString()); ModifyOperation op = if (cre instanceof org.opends.server.util.ModifyChangeRecordEntry) { org.opends.server.util.ModifyChangeRecordEntry mcre = (org.opends.server.util.ModifyChangeRecordEntry) cre; org.opends.server.types.ByteString dnByteString = org.opends.server.types.ByteStringFactory.create( mcre.getDN().toString()); org.opends.server.core.ModifyOperation op = cc.processModify(dnByteString, mcre.getModifications()); ResultCode rc = op.getResultCode(); if (rc.equals(ResultCode.OBJECTCLASS_VIOLATION)) { org.opends.server.types.ResultCode rc = op.getResultCode(); if (rc.equals( org.opends.server.types.ResultCode. OBJECTCLASS_VIOLATION)) { // try again without schema checking DirectoryServer.setCheckSchema(false); org.opends.server.core.DirectoryServer.setCheckSchema(false); op = cc.processModify(dnByteString, mcre.getModifications()); rc = op.getResultCode(); } if (rc.equals(ResultCode.SUCCESS)) { if (DirectoryServer.checkSchema()) { if (rc.equals(org.opends.server.types.ResultCode. SUCCESS)) { if (org.opends.server.core.DirectoryServer.checkSchema()) { notifyListeners( getMsg("upgrade-mod", modListToString(op.getModifications())) @@ -911,9 +961,11 @@ getMsg("upgrade-mod-no-schema", modListToString(op.getModifications())) + formatter.getLineBreak()); DirectoryServer.setCheckSchema(true); org.opends.server.core.DirectoryServer.setCheckSchema(true); } } else if (rc.equals(ResultCode.ATTRIBUTE_OR_VALUE_EXISTS)) { } else if (rc.equals( org.opends.server.types.ResultCode. ATTRIBUTE_OR_VALUE_EXISTS)) { // ignore this error notifyListeners( getMsg("upgrade-mod-ignore", @@ -945,7 +997,8 @@ } } private String modListToString(List<Modification> modifications) { private String modListToString( List<org.opends.server.types.Modification> modifications) { StringBuilder modsMsg = new StringBuilder(); for(int i = 0; i < modifications.size(); i++) { modsMsg.append(modifications.get(i).toString()); @@ -1054,7 +1107,8 @@ Utils.getPath(source) + " with " + Utils.getPath(target))); int ret = LDIFDiff.mainDiff(args.toArray(new String[]{}), false); int ret = org.opends.server.tools.LDIFDiff.mainDiff( args.toArray(new String[]{}), false); if (ret != 0) { StringBuffer sb = new StringBuffer() .append("'ldif-diff' tool returned error code ") @@ -1127,7 +1181,8 @@ ApplicationException.Type.FILE_SYSTEM_ERROR, "error backup up databases", e); } int ret = BackUpDB.mainBackUpDB(args.toArray(new String[0])); int ret = org.opends.server.tools.BackUpDB.mainBackUpDB( args.toArray(new String[0])); if (ret != 0) { StringBuffer sb = new StringBuffer() .append("'backup utility returned error code ") opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/ChooseVersionPanel.java
@@ -28,6 +28,7 @@ package org.opends.quicksetup.upgrader.ui; import org.opends.quicksetup.UserData; import org.opends.quicksetup.event.BrowseActionListener; import org.opends.quicksetup.ui.*; import org.opends.quicksetup.upgrader.Build; import org.opends.quicksetup.upgrader.RemoteBuildManager; @@ -36,7 +37,12 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; import java.util.logging.Logger; /** @@ -55,6 +61,7 @@ private JComboBox cboBuild = null; private JTextField tfFile = null; private boolean loadBuildListAttempted = false; private RemoteBuildListComboBoxModelCreator bld = null; /** * Creates an instance. @@ -63,6 +70,7 @@ */ public ChooseVersionPanel(GuiApplication application) { super(application); createBuildLoader(); } /** @@ -71,7 +79,32 @@ public void beginDisplay(UserData data) { super.beginDisplay(data); if (!loadBuildListAttempted) { loadBuildList(); // Begin display is called outside the UI // thread. loadBuildList must be called // inside the UI thread in order to properly // set up the ProgressListenerInputStream // displayed while downloading the build list. // The enclosing thread and sleep statement is // there to allow the card layout to switch to // this panel before setting up the downloading. int delay = 100; ActionListener loadPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { rbLocal.setSelected(true); rbRemote.setEnabled(false); cboBuild.setEnabled(false); cboBuild.setRenderer(new BuildListLoadingComboBoxRenderer()); try { loadBuildList(); } catch (IOException e) { LOG.log(Level.INFO, "error", e); } } }; Timer t = new Timer(delay, loadPerformer); t.setRepeats(false); t.start(); } } @@ -85,7 +118,10 @@ } else if (FieldName.UPGRADE_BUILD_TO_DOWNLOAD.equals(fieldName)) { value = cboBuild.getSelectedItem(); } else if (FieldName.UPGRADE_FILE.equals(fieldName)) { value = new File(tfFile.getText()); String s = tfFile.getText(); if (s != null && s.length() > 0) { value = new File(tfFile.getText()); } } return value; } @@ -120,13 +156,21 @@ tfFile = new JTextField(); tfFile.setColumns(20); JButton butBrowse = UIFactory.makeJButton(getMsg("browse-button-label"), getMsg("browse-button-tooltip")); BrowseActionListener l = new BrowseActionListener(tfFile, BrowseActionListener.BrowseType.LOCATION_DIRECTORY, getMainWindow()); butBrowse.addActionListener(l); JPanel pnlBrowse = Utilities.createBrowseButtonPanel( UIFactory.makeJLabel(null, getMsg("upgrade-choose-version-local-path"), UIFactory.TextStyle.SECONDARY_FIELD_VALID), tfFile, UIFactory.makeJButton(getMsg("browse-button-label"), getMsg("browse-button-tooltip"))); butBrowse); p.setLayout(new GridBagLayout()); // p.setBorder(BorderFactory.createLineBorder(Color.RED)); @@ -201,9 +245,20 @@ return getMsg("upgrade-choose-version-panel-instructions"); } private void loadBuildList() { RemoteBuildListComboBoxModelCreator bld = new RemoteBuildListComboBoxModelCreator(); private RemoteBuildListComboBoxModelCreator createBuildLoader() { if (bld == null) { RemoteBuildManager rbm = ((Upgrader) getApplication()).getRemoteBuildManager(); try { bld = new RemoteBuildListComboBoxModelCreator(rbm); } catch (IOException e) { LOG.log(Level.INFO, "error", e); } } return bld; } private void loadBuildList() throws IOException { bld.startBackgroundTask(); } @@ -226,10 +281,49 @@ * Creates a default instance. */ public BuildListErrorComboBoxRenderer() { super("Error accessing build information", UIFactory.getImageIcon(UIFactory.IconType.ERROR), super("Unable to access remote build information", UIFactory.getImageIcon(UIFactory.IconType.WARNING), SwingConstants.LEFT); UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_FIELD_INVALID); UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS); setOpaque(true); setBackground(Color.WHITE); } /** * {@inheritDoc} */ public Component getListCellRendererComponent(JList jList, Object object, int i, boolean b, boolean b1) { return this; } } /** * Renders the combo box when there has been an error downloading * the build information. */ private class BuildListLoadingComboBoxRenderer extends JLabel implements ListCellRenderer { /** * The serial version identifier required to satisfy the compiler because * this * class extends a class that implements the * {@code java.io.Serializable} interface. This value was generated using * the {@code serialver} command-line utility included with the Java SDK. */ private static final long serialVersionUID = -7075573664472711599L; /** * Creates a default instance. */ public BuildListLoadingComboBoxRenderer() { super("Loading remote build information...", UIFactory.getImageIcon(UIFactory.IconType.WAIT_TINY), SwingConstants.LEFT); UIFactory.setTextStyle(this, UIFactory.TextStyle.SECONDARY_STATUS); setOpaque(true); setBackground(Color.WHITE); } @@ -256,13 +350,21 @@ extends BackgroundTask<java.util.List<Build>> { private RemoteBuildManager rbm = null; private InputStream in = null; public RemoteBuildListComboBoxModelCreator(RemoteBuildManager rbm) throws IOException { this.rbm = rbm; this.in = rbm.getDailyBuildsInputStream(getMainWindow(), "Reading build information"); } /** * {@inheritDoc} */ public java.util.List<Build> processBackgroundTask() throws Exception { rbm = ((Upgrader)getApplication()).getRemoteBuildManager(); return rbm.listBuilds(getMainWindow(), "Loading build information"); return rbm.listBuilds(in); } /** opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -28,10 +28,6 @@ package org.opends.quicksetup.util; import org.opends.quicksetup.*; import org.opends.server.protocols.ldap.LDAPResultCode; import org.opends.server.core.DirectoryServer; import org.opends.server.types.InitializationException; import org.opends.server.config.ConfigException; import javax.naming.NamingException; import java.util.ArrayList; @@ -116,7 +112,9 @@ int returnValue = process.waitFor(); int clientSideError = LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR; int clientSideError = org.opends.server.protocols.ldap. LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR; if ((returnValue == clientSideError) || (returnValue == 0)) { if (Utils.isWindows()) { /* @@ -193,16 +191,20 @@ * externally as if the server is online without connection handlers * listening. * * @throws ConfigException If there is a problem with the Directory Server * configuration that prevents a critical component * from being instantiated. * @throws org.opends.server.config.ConfigException * If there is a problem with the Directory Server * configuration that prevents a critical component * from being instantiated. * * @throws InitializationException If some other problem occurs while * attempting to initialize and start the * Directory Server. * @throws org.opends.server.types.InitializationException * If some other problem occurs while * attempting to initialize and start the * Directory Server. */ public void startServerInProcess(boolean disableConnectionHandlers) throws InitializationException, ConfigException { throws org.opends.server.types.InitializationException, org.opends.server.config.ConfigException { System.setProperty( "org.opends.server.DisableConnectionHandlers", disableConnectionHandlers ? "true" : null); @@ -213,7 +215,8 @@ * Stops a server that had been running 'in process'. */ public void stopServerInProcess() { DirectoryServer.shutDown(ServerController.class.getName(), org.opends.server.core.DirectoryServer.shutDown( ServerController.class.getName(), "quicksetup requests shutdown"); } @@ -367,19 +370,24 @@ /** * Starts the OpenDS server in this process. * * @throws ConfigException If there is a problem with the Directory Server * configuration that prevents a critical component * from being instantiated. * @throws org.opends.server.config.ConfigException * If there is a problem with the Directory Server * configuration that prevents a critical component * from being instantiated. * * @throws InitializationException If some other problem occurs while * attempting to initialize and start the * Directory Server. * @throws org.opends.server.types.InitializationException * If some other problem occurs while * attempting to initialize and start the * Directory Server. */ public void startServerInProcess() throws InitializationException, ConfigException throws org.opends.server.types.InitializationException, org.opends.server.config.ConfigException { // Bootstrap and start the Directory Server. DirectoryServer directoryServer = DirectoryServer.getInstance(); org.opends.server.core.DirectoryServer directoryServer = org.opends.server.core.DirectoryServer.getInstance(); directoryServer.bootstrapServer(); String configClass = "org.opends.server.extensions.ConfigFileHandler"; opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
File was renamed from opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartDownloader.java @@ -25,7 +25,7 @@ * Portions Copyright 2006-2007 Sun Microsystems, Inc. */ package org.opends.quicksetup.installer.webstart; package org.opends.quicksetup.webstart; import java.io.IOException; import java.net.MalformedURLException; @@ -69,6 +69,8 @@ private Status status = Status.DOWNLOADING; private String summary = null; /** * This enumeration contains the different Status on which * the dowloading process of the jars can be. @@ -91,6 +93,13 @@ } /** * Creates a default instance. */ public WebStartDownloader() { this.summary = getMsg("downloading"); } /** * Starts the downloading of the jar files. If forceDownload is set to * <CODE>true</CODE> the files will be re-downloaded even if they already * are on cache. @@ -147,6 +156,22 @@ } /** * Gets a summary message of the downloader's current progress. * @return String for showing the user progress */ public String getSummary() { return this.summary; } /** * Sets a summary message of the downloader's current progress. * @param summary String for showing the user progress */ public void setSummary(String summary) { this.summary = summary; } /** * Returns <CODE>true</CODE> if the install is finished and * <CODE>false</CODE> otherwise. * @return <CODE>true</CODE> if the install is finished and @@ -421,4 +446,10 @@ { return ResourceProvider.getInstance().getMsg(key, args); } private String getMsg(String key) { return ResourceProvider.getInstance().getMsg(key); } }