opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
@@ -137,7 +137,6 @@ * ConfigureDS) this initialization is done. */ DirectoryServer.bootstrapClient(); // Bootstrap definition classes. try { ConfigurationFramework configFramework = ConfigurationFramework.getInstance(); opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
@@ -24,6 +24,7 @@ import java.util.Properties; import java.util.TreeMap; import java.util.TreeSet; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.opendj.config.ACIPropertyDefinition; import org.forgerock.opendj.config.AbsoluteInheritedDefaultBehaviorProvider; @@ -58,7 +59,7 @@ import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.server.config.meta.RootCfgDefn; import org.opends.server.util.EmbeddedUtils; import org.opends.server.core.DirectoryServer; import org.opends.server.util.DynamicConstants; /** @@ -169,8 +170,7 @@ // Enable the client-side class loader to explicitly load classes // which are not directly reachable from the root configuration EmbeddedUtils.initializeForClientUse(); // Bootstrap definition classes. DirectoryServer.bootstrapClient(); try { ConfigurationFramework.getInstance().initialize(); } catch (ConfigException e) { @@ -178,10 +178,6 @@ e.printStackTrace(); System.exit(1); } // Switch off class name validation in client. // ClassPropertyDefinition.setAllowClassValidation(false); // Switch off attribute type name validation in client. // AttributeTypePropertyDefinition.setCheckSchema(false); // Build a sorted list of top managed objects TopCfgDefn topCfg = TopCfgDefn.getInstance(); opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -1263,7 +1263,6 @@ logger.debug(INFO_DIRECTORY_BOOTSTRAPPING); // Perform all the bootstrapping that is shared with the client-side processing. bootstrapClient(); // Initialize the variables that will be used for connection tracking. opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -548,8 +548,6 @@ } } // Initialize the Directory Server configuration handler using the // information that was provided. final DirectoryServer directoryServer = DirectoryServer.getInstance(); DirectoryServer.bootstrapClient(); opendj-server-legacy/src/main/java/org/opends/server/tools/CreateRCScript.java
@@ -36,7 +36,6 @@ import org.opends.server.loggers.JDKLogging; import org.opends.server.types.FilePermission; import org.opends.server.types.NullOutputStream; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.SetupUtils; import com.forgerock.opendj.cli.ArgumentException; @@ -162,7 +161,7 @@ return 0; } EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); File serverRoot = DirectoryServer.getEnvironmentConfig().getServerRoot(); if (serverRoot == null) { opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPCompare.java
@@ -20,7 +20,6 @@ import static com.forgerock.opendj.cli.CliMessages.INFO_DESCRIPTION_BINDPASSWORDFILE; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; import static org.opends.server.util.cli.LDAPConnectionArgumentParser.*; @@ -41,6 +40,7 @@ import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DecodeException; import org.opends.server.controls.LDAPAssertionRequestControl; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.protocols.ldap.CompareRequestProtocolOp; import org.opends.server.protocols.ldap.CompareResponseProtocolOp; @@ -51,8 +51,6 @@ import org.opends.server.types.LDAPException; import org.opends.server.types.NullOutputStream; import org.opends.server.util.Base64; import org.opends.server.util.EmbeddedUtils; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; @@ -830,8 +828,7 @@ { if (initializeServer) { // Bootstrap and initialize directory data structures. EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); } // Connect to the specified host with the supplied userDN and password. opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPDelete.java
@@ -20,7 +20,6 @@ import static com.forgerock.opendj.cli.CliMessages.INFO_DESCRIPTION_BINDPASSWORDFILE; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; import static org.opends.server.util.cli.LDAPConnectionArgumentParser.*; @@ -41,6 +40,7 @@ import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DecodeException; import org.opends.server.controls.SubtreeDeleteControl; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.protocols.ldap.DeleteRequestProtocolOp; import org.opends.server.protocols.ldap.DeleteResponseProtocolOp; @@ -49,8 +49,6 @@ import org.opends.server.types.Control; import org.opends.server.types.LDAPException; import org.opends.server.types.NullOutputStream; import org.opends.server.util.EmbeddedUtils; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; @@ -651,8 +649,7 @@ { if (initializeServer) { // Bootstrap and initialize directory data structures. EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); } // Connect to the specified host with the supplied userDN and password. opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPModify.java
@@ -21,7 +21,6 @@ import static com.forgerock.opendj.cli.CliMessages.INFO_DESCRIPTION_BINDPASSWORDFILE; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; import static org.opends.server.util.ServerConstants.*; @@ -43,6 +42,7 @@ import org.forgerock.opendj.ldap.DecodeException; import org.forgerock.opendj.ldap.ResultCode; import org.opends.server.controls.*; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.plugins.ChangeNumberControlPlugin; import org.opends.server.protocols.ldap.AddRequestProtocolOp; @@ -63,7 +63,6 @@ import org.opends.server.types.*; import org.opends.server.util.AddChangeRecordEntry; import org.opends.server.util.ChangeRecordEntry; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.LDIFException; import org.opends.server.util.LDIFReader; import org.opends.server.util.ModifyChangeRecordEntry; @@ -1001,8 +1000,7 @@ { if (initializeServer) { // Bootstrap and initialize directory data structures. EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); } // Connect to the specified host with the supplied userDN and password. opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
@@ -21,7 +21,6 @@ import static org.opends.server.protocols.ldap.LDAPResultCode.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; @@ -40,6 +39,7 @@ import org.opends.server.controls.PasswordPolicyErrorType; import org.opends.server.controls.PasswordPolicyResponseControl; import org.opends.server.controls.PasswordPolicyWarningType; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp; @@ -50,8 +50,6 @@ import org.opends.server.types.Control; import org.forgerock.opendj.ldap.DN; import org.opends.server.types.NullOutputStream; import org.opends.server.util.EmbeddedUtils; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; @@ -412,10 +410,9 @@ } } // Perform a basic Directory Server bootstrap if appropriate. if (initializeServer) { EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); } // Establish a connection to the Directory Server. opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPSearch.java
@@ -19,7 +19,6 @@ import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.protocols.ldap.LDAPConstants.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; @@ -41,12 +40,11 @@ import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.DecodeException; import org.opends.server.controls.*; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.protocols.ldap.*; import org.opends.server.types.*; import org.opends.server.util.Base64; import org.opends.server.util.EmbeddedUtils; import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; @@ -1478,8 +1476,7 @@ { if (initializeServer) { // Bootstrap and initialize directory data structures. EmbeddedUtils.initializeForClientUse(); DirectoryServer.bootstrapClient(); } // Connect to the specified host with the supplied userDN and password. opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFDiff.java
@@ -268,7 +268,6 @@ boolean checkSchema = configFile.isPresent() && doCheckSchema.isPresent(); if (! serverInitialized) { // Bootstrap the Directory Server configuration for use as a client. DirectoryServer directoryServer = DirectoryServer.getInstance(); DirectoryServer.bootstrapClient(); opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFModify.java
@@ -492,7 +492,6 @@ if (! serverInitialized) { // Bootstrap the Directory Server configuration for use as a client. DirectoryServer directoryServer = DirectoryServer.getInstance(); DirectoryServer.bootstrapClient(); opendj-server-legacy/src/main/java/org/opends/server/tools/ManageAccount.java
@@ -23,7 +23,6 @@ import static com.forgerock.opendj.cli.CliMessages.INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.cli.CommonArguments.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.extensions.PasswordPolicyStateExtendedOperation.*; import static org.opends.server.protocols.ldap.LDAPResultCode.*; @@ -46,6 +45,7 @@ import org.forgerock.opendj.io.ASN1Writer; import org.forgerock.opendj.ldap.ByteStringBuilder; import org.opends.server.config.AdministrationConnector; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.loggers.JDKLogging; import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp; @@ -53,7 +53,6 @@ import org.opends.server.protocols.ldap.LDAPMessage; import org.opends.server.protocols.ldap.LDAPResultCode; import org.opends.server.types.NullOutputStream; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.cli.LDAPConnectionArgumentParser; import com.forgerock.opendj.cli.Argument; @@ -1233,7 +1232,8 @@ // Bootstrap and initialize directory data structures. if (initServer) { EmbeddedUtils.initializeForClientUse(); DirectoryServer.getInstance(); DirectoryServer.bootstrapClient(); } // Create the LDAP connection options object, which will be used to // customize the way that we connect to the server and specify a set of opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/LocalPurgeHistorical.java
@@ -16,22 +16,20 @@ */ package org.opends.server.tools.dsreplication; import static org.opends.server.util.embedded.ConfigParameters.Builder.configParams; import static org.opends.messages.AdminToolMessages.*; import java.io.File; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ResultCode; import org.opends.quicksetup.util.ProgressMessageFormatter; import org.opends.server.replication.plugin.LDAPReplicationDomain; import org.opends.server.types.DirectoryEnvironmentConfig; import org.opends.server.types.DirectoryException; import org.opends.server.types.OpenDsException; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.TimeThread; import org.opends.server.util.cli.PointAdder; import org.opends.server.util.embedded.EmbeddedDirectoryServer; import com.forgerock.opendj.cli.ConsoleApplication; @@ -90,12 +88,12 @@ try { // Create a configuration for the server. DirectoryEnvironmentConfig environmentConfig = new DirectoryEnvironmentConfig(); environmentConfig.setConfigFile(new File(configFile)); environmentConfig.setDisableConnectionHandlers(true); EmbeddedUtils.startServer(environmentConfig); EmbeddedDirectoryServer server = EmbeddedDirectoryServer.defineServerForStartStopOperations( configParams() .configurationFile(configFile) .disableConnectionHandlers(true) .build()); server.start(); } catch (OpenDsException ode) { opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -237,8 +237,6 @@ if (initializeServer) { // Initialize the Directory Server configuration handler using the // information that was provided. DirectoryServer directoryServer = DirectoryServer.getInstance(); DirectoryServer.bootstrapClient(); opendj-server-legacy/src/main/java/org/opends/server/util/EmbeddedUtils.java
@@ -33,7 +33,10 @@ * This class provides a number of utility methods for using OpenDS in an * embedded manner (i.e., running within the same JVM as another application and * controlled by that application). * * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated @org.opends.server.types.PublicAPI( stability=org.opends.server.types.StabilityLevel.UNCOMMITTED, mayInstantiate=false, @@ -46,7 +49,9 @@ * * @return {@code true} if the server is currently running, or {@code false} * if not. * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated public static boolean isRunning() { return DirectoryServer.isRunning(); @@ -62,7 +67,9 @@ * @throws InitializationException If the Directory Server is already * running, or if an error occurs during * server initialization or startup. * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated public static void startServer(DirectoryEnvironmentConfig config) throws InitializationException { @@ -90,7 +97,9 @@ * * @param className The name of the class that initiated the shutdown. * @param reason A message explaining the reason for the shutdown. * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated public static void stopServer(String className, LocalizableMessage reason) { DirectoryServer.shutDown(className, reason); @@ -107,7 +116,9 @@ * @param reason A message explaining the reason for the retart. * @param config The environment configuration to use for the new server * instance. * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated public static void restartServer(String className, LocalizableMessage reason, DirectoryEnvironmentConfig config) { @@ -122,7 +133,9 @@ * going to be used without the server running (e.g., to facilitate use in an * LDAP client API, for DN processing, etc.). This will have no effect if the * server has already been initialized for client use. * @deprecated Use {@code EmbeddedDirectoryServer} class instead */ @Deprecated public static void initializeForClientUse() { DirectoryServer.getInstance(); opendj-server-legacy/src/main/java/org/opends/server/util/embedded/ConfigParameters.java
@@ -23,6 +23,7 @@ private String serverRootDirectory; private String serverInstanceDirectory; private String configurationFile; private boolean disableConnectionHandlers; private ConfigParameters() { @@ -37,7 +38,7 @@ String getServerInstanceDirectory() { // provides the expected default value if not set return serverInstanceDirectory != null ? serverInstanceDirectory : serverRootDirectory; return serverInstanceDirectory; } String getConfigurationFile() @@ -45,6 +46,11 @@ return configurationFile; } boolean isDisableConnectionHandlers() { return disableConnectionHandlers; } /** * Builder for this class. */ @@ -123,5 +129,18 @@ params.configurationFile = file; return this; } /** * Sets the indicator allowing to disable the connection handlers. * * @param disable * {@code true} to disable the connection handlers * @return this builder */ public Builder disableConnectionHandlers(boolean disable) { params.disableConnectionHandlers = disable; return this; } } } opendj-server-legacy/src/main/java/org/opends/server/util/embedded/EmbeddedDirectoryServer.java
@@ -44,7 +44,6 @@ import org.opends.server.types.DirectoryEnvironmentConfig; import org.opends.server.types.DirectoryException; import org.opends.server.types.InitializationException; import org.opends.server.util.ServerConstants; import org.opends.server.util.StaticUtils; /** @@ -94,11 +93,11 @@ new LDAPConnectionFactory(connectionParams.getHostname(), connectionParams.getLdapPort()) : null; System.setProperty("org.opends.quicksetup.Root", configParams.getServerRootDirectory()); System.setProperty(ServerConstants.PROPERTY_SERVER_ROOT, configParams.getServerRootDirectory()); System.setProperty(ServerConstants.PROPERTY_INSTANCE_ROOT, configParams.getServerInstanceDirectory()); //System.setProperty("org.opends.quicksetup.Root", configParams.getServerRootDirectory()); //System.setProperty(ServerConstants.PROPERTY_SERVER_ROOT, configParams.getServerRootDirectory()); //System.setProperty(ServerConstants.PROPERTY_INSTANCE_ROOT, configParams.getServerInstanceDirectory()); // from LicenseFile.java - provided by AM OpenDJUpgrader.java System.setProperty("INSTALL_ROOT", configParams.getServerInstanceDirectory()); //System.setProperty("INSTALL_ROOT", configParams.getServerInstanceDirectory()); } /** @@ -156,6 +155,21 @@ } /** * Defines an embedded directory server for start/stop operation. * <p> * To be able to perform any operation on the server, use the alternative {@code defineServer()} * method. * * @param configParams * The basic configuration parameters for the server. * @return the directory server */ public static EmbeddedDirectoryServer defineServerForStartStopOperations(ConfigParameters configParams) { return new EmbeddedDirectoryServer(configParams, null, System.out, System.err); } /** * Displays the replication status on the output stream defined for this server. * <p> * Displays a list with the basic replication configuration of all base DNs of @@ -403,7 +417,7 @@ * @param reason * A message explaining the reason for the restart. */ public void restartServer(String className, LocalizableMessage reason) public void restart(String className, LocalizableMessage reason) { DirectoryServer.restart(className, reason, DirectoryServer.getEnvironmentConfig()); } @@ -425,13 +439,7 @@ try { DirectoryEnvironmentConfig env = new DirectoryEnvironmentConfig(); env.setServerRoot(new File(configParams.getServerRootDirectory())); env.setInstanceRoot(new File(configParams.getServerInstanceDirectory())); env.setForceDaemonThreads(true); env.setConfigFile(new File(configParams.getConfigurationFile())); DirectoryServer directoryServer = DirectoryServer.reinitialize(env); DirectoryServer directoryServer = DirectoryServer.reinitialize(createEnvironmentConfig()); directoryServer.startServer(); } catch (InitializationException | ConfigException e) @@ -441,6 +449,26 @@ } } private DirectoryEnvironmentConfig createEnvironmentConfig() throws InitializationException { // If server root directory or instance directory are not defined, // the DirectoryEnvironmentConfig class has several ways to find the values, // including using system properties. DirectoryEnvironmentConfig env = new DirectoryEnvironmentConfig(); if (configParams.getServerRootDirectory() != null) { env.setServerRoot(new File(configParams.getServerRootDirectory())); } if (configParams.getServerInstanceDirectory() != null) { env.setInstanceRoot(new File(configParams.getServerInstanceDirectory())); } env.setForceDaemonThreads(true); env.setDisableConnectionHandlers(configParams.isDisableConnectionHandlers()); env.setConfigFile(new File(configParams.getConfigurationFile())); return env; } /** * Stops this server. * opendj-server-legacy/src/test/java/org/opends/server/TestCaseUtils.java
@@ -104,7 +104,6 @@ import org.opends.server.types.LDIFImportConfig; import org.forgerock.opendj.ldap.schema.Schema; import org.opends.server.util.BuildVersion; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.LDIFReader; import org.opends.server.util.embedded.EmbeddedDirectoryServer; import org.testng.Assert; @@ -589,9 +588,11 @@ clearLoggersContents(); EmbeddedUtils.stopServer(null, null); server.stop(TestCaseUtils.class.getSimpleName(), LocalizableMessage.raw("restart server for tests")); restoreServerConfigLdif(); EmbeddedUtils.startServer(DirectoryServer.getEnvironmentConfig()); server.start(); clearJEBackends(); initializeTestBackend(true); @@ -610,6 +611,16 @@ } } /** * Returns the embedded server used for tests. * * @return the embedded server. */ public static EmbeddedDirectoryServer getServer() { return server; } private static List<Long> restartTimesMs = new ArrayList<>(); public static List<Long> getRestartTimesMs() { return Collections.unmodifiableList(restartTimesMs); opendj-server-legacy/src/test/java/org/opends/server/crypto/CryptoManagerTestCase.java
@@ -46,7 +46,6 @@ import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.types.Modification; import org.opends.server.util.EmbeddedUtils; import org.opends.server.util.StaticUtils; import org.opends.server.util.TimeThread; import org.testng.annotations.AfterClass; @@ -334,10 +333,8 @@ final byte[] cipherText2 = cm.encrypt("RC4", 104, secretMessage.getBytes()); EmbeddedUtils.restartServer( this.getClass().getName(), LocalizableMessage.raw("CryptoManager: testing persistent secret keys."), DirectoryServer.getEnvironmentConfig()); TestCaseUtils.getServer().restart(this.getClass().getName(), LocalizableMessage.raw("CryptoManager: testing persistent secret keys.")); byte[] plainText = cm.decrypt(cipherText); assertEquals(new String(plainText), secretMessage); opendj-server-legacy/src/test/java/org/opends/server/util/EmbeddedUtilsTestCase.java
File was deleted