opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -481,7 +481,10 @@ if (getInstallation().getStatus().isServerRunning()) { control.stopServer(true); } new InProcessServerController(getInstallation()).startServer(true); InProcessServerController ipsc = new InProcessServerController(getInstallation()); ipsc.disableConnectionHandlers(true); ipsc.startServer(); } catch (IOException e) { String msg = "Failed to determine server state: " + e.getLocalizedMessage(); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -47,8 +47,9 @@ import org.opends.quicksetup.util.InProcessServerController; import org.opends.quicksetup.util.ServerHealthChecker; import org.opends.quicksetup.util.FileManager; import org.opends.quicksetup.util.OperationOutput; import org.opends.quicksetup.util.ExternalTools; import org.opends.quicksetup.util.OperationOutput; import org.opends.quicksetup.ui.GuiApplication; import org.opends.quicksetup.ui.QuickSetupDialog; import org.opends.quicksetup.ui.UIFactory; @@ -59,7 +60,6 @@ import org.opends.quicksetup.upgrader.ui.UpgraderReviewPanel; import org.opends.quicksetup.upgrader.ui.WelcomePanel; import javax.swing.*; import java.awt.event.WindowEvent; import java.io.File; import java.io.FileFilter; @@ -859,17 +859,21 @@ LOG.log(Level.INFO, "starting server"); setCurrentProgressStep( UpgradeProgressStep.PREPARING_CUSTOMIZATIONS); startServerWithoutConnectionHandlers(); InProcessServerController ipsc = new InProcessServerController(getInstallation()); InProcessServerController.disableConnectionHandlers(true); ipsc.startServer(); LOG.log(Level.INFO, "start server finished"); notifyListeners(formatter.getFormattedDone() + formatter.getLineBreak()); LOG.log(Level.INFO, "start server finished"); } catch (ApplicationException e) { } catch (Exception e) { notifyListeners(formatter.getFormattedError() + formatter.getLineBreak()); LOG.log(Level.INFO, "Error starting server in process in order to apply custom" + "Error starting server in order to apply custom" + "schema and/or configuration", e); throw e; throw new ApplicationException(ApplicationException.Type.APPLICATION, "Error starting server:" + e.getLocalizedMessage(), e); } checkAbort(); @@ -919,6 +923,7 @@ // This class imports classes from the server new InProcessServerController( getInstallation()).stopServer(); InProcessServerController.disableConnectionHandlers(false); LOG.log(Level.INFO, "server stopped"); } catch (Throwable t) { LOG.log(Level.INFO, "Error stopping server", t); @@ -1342,7 +1347,11 @@ throws ApplicationException { ExternalTools et = new ExternalTools(getInstallation()); try { OperationOutput oo = et.ldifDiff(source, target, output); String[] args = new String[] { "-o", Utils.getPath(output), "-O", }; OperationOutput oo = et.ldifDiff(source, target, args); int ret = oo.getReturnCode(); if (ret != 0) { throw new ApplicationException( opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
@@ -80,12 +80,12 @@ * Backs up all the databases to a specified directory. * @param source File representing the source data * @param target File representing the target data * @param output File representing the output data * @param otherArgs File representing the output data * @return OperationOutput containing information about the operation * @throws java.io.IOException if the process could not be started * @throws InterruptedException if the process was prematurely interrupted */ public OperationOutput ldifDiff(File source, File target, File output) public OperationOutput ldifDiff(File source, File target, String... otherArgs) throws IOException, InterruptedException { String toolName = Installation.LDIF_DIFF; List<String> args = new ArrayList<String>(); @@ -94,10 +94,11 @@ args.add(Utils.getPath(source)); args.add("-t"); // target LDIF args.add(Utils.getPath(target)); args.add("-o"); // output LDIF args.add(Utils.getPath(output)); args.add("-O"); // overwrite args.add("-S"); // single-value changes if (otherArgs != null) { for (String otherArg : otherArgs) { args.add(otherArg); } } return startProcess(toolName, args); } opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
@@ -213,9 +213,8 @@ * Directory Server. */ public OperationOutput startServer(boolean disableConnectionHandlers) throws org.opends.server.types.InitializationException, org.opends.server.config.ConfigException { throws InitializationException, ConfigException { LOG.log(Level.INFO, "Starting in process server with connection handlers " + (disableConnectionHandlers ? "disabled" : "enabled")); System.setProperty( @@ -225,6 +224,23 @@ } /** * Disables the server's connection handlers upon startup. The server * when started is otherwise up and running but will not accept any * connections from external clients (i.e., does not create or initialize the * connection handlers). This could be useful, for example, in an upgrade mode * where it might be helpful to start the server but don't want it to appear * externally as if the server is online without connection handlers * listening. * @param disable boolean that when true disables connection handlers when * the server is started. */ static public void disableConnectionHandlers(boolean disable) { System.setProperty( "org.opends.server.DisableConnectionHandlers", disable ? "true" : "false"); } /** * Stops a server that had been running 'in process'. */ public void stopServer() { @@ -333,8 +349,7 @@ } /** * Applies configuration or schema customizations. * NOTE: Assumes that the server is running in process. * Applies modifications contained in an LDIF file to the server. * * @param ldifFile LDIF file to apply * @throws IOException if there is an IO Error @@ -354,7 +369,7 @@ new LDIFReader(importCfg); org.opends.server.util.ChangeRecordEntry cre; while (null != (cre = ldifReader.readChangeRecord(false))) { if (cre instanceof org.opends.server.util.ModifyChangeRecordEntry) { if (cre instanceof ModifyChangeRecordEntry) { ModifyChangeRecordEntry mcre = (ModifyChangeRecordEntry) cre; ByteString dnByteString = @@ -363,29 +378,23 @@ ModifyOperation op = cc.processModify(dnByteString, mcre.getModifications()); ResultCode rc = op.getResultCode(); if (rc.equals( ResultCode. OBJECTCLASS_VIOLATION)) { // try again without schema checking DirectoryServer.setCheckSchema(false); op = cc.processModify(dnByteString, mcre.getModifications()); rc = op.getResultCode(); } if (rc.equals(ResultCode. SUCCESS)) { LOG.log(Level.INFO, "processed server modification " + (DirectoryServer.checkSchema() ? ":" : "(schema checking off):" + modListToString(op.getModifications()))); if (!DirectoryServer.checkSchema()) { DirectoryServer.setCheckSchema(true); } modListToString(op.getModifications())); } else if (rc.equals( ResultCode. ATTRIBUTE_OR_VALUE_EXISTS)) { // ignore this error LOG.log(Level.INFO, "ignoring attribute that already exists: " + modListToString(op.getModifications())); } else if (rc.equals(ResultCode.NO_SUCH_ATTRIBUTE)) { // This canĀ·happen if for instance the old configuration was // changed so that the value of an attribute matches the default // value of the attribute in the new configuration. // Just log it and move on. LOG.log(Level.INFO, "Ignoring attribute not found: " + modListToString(op.getModifications())); } else { // report the error to the user StringBuilder error = op.getErrorMessage(); opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
@@ -78,7 +78,7 @@ if (installation.getStatus().isServerRunning()) { new ServerController(installation).stopServer(true); } OperationOutput op = control.startServer(false); OperationOutput op = control.startServer(); errors = op.getErrorMessages(UNHEALTHY_SERVER_LOG_REGEX); } catch (Exception e) { if (e instanceof ApplicationException) {