opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteBaseDNAndBackendTask.java
@@ -57,7 +57,7 @@ import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; import org.opends.guitools.controlpanel.ui.ProgressDialog; import org.opends.guitools.controlpanel.util.Utilities; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.types.DirectoryException; import org.opends.server.types.OpenDsException; opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -116,7 +116,7 @@ import org.opends.quicksetup.Installation; import org.opends.quicksetup.ui.UIFactory; import org.opends.quicksetup.util.Utils; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.LockFileManager; import org.opends.server.schema.SchemaConstants; import org.opends.server.schema.SomeSchemaElement; opendj-server-legacy/src/main/java/org/opends/server/backends/ConfigurationBackend.java
File was renamed from opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationBackend.java @@ -13,7 +13,7 @@ * * Copyright 2014-2016 ForgeRock AS. */ package org.opends.server.core; package org.opends.server.backends; import static org.opends.messages.ConfigMessages.*; import static org.opends.server.config.ConfigConstants.ATTR_DEFAULT_ROOT_PRIVILEGE_NAME; @@ -45,7 +45,15 @@ import org.opends.server.api.Backend; import org.opends.server.api.Backupable; import org.opends.server.api.ClientConnection; import org.opends.server.core.ConfigurationBackend.ConfigurationBackendCfg; import org.opends.server.backends.ConfigurationBackend.ConfigurationBackendCfg; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.AddOperation; import org.opends.server.core.DeleteOperation; import org.opends.server.core.DirectoryServer; import org.opends.server.core.ModifyDNOperation; import org.opends.server.core.ModifyOperation; import org.opends.server.core.SearchOperation; import org.opends.server.core.ServerContext; import org.opends.server.types.BackupConfig; import org.opends.server.types.BackupDirectory; import org.opends.server.types.DirectoryException; opendj-server-legacy/src/main/java/org/opends/server/config/ConfigurationHandler.java
File was renamed from opendj-server-legacy/src/main/java/org/opends/server/core/ConfigurationHandler.java @@ -13,22 +13,13 @@ * * Copyright 2014-2016 ForgeRock AS. */ package org.opends.server.core; package org.opends.server.config; import static org.opends.messages.ConfigMessages.ERR_CONFIG_FILE_ADD_NO_PARENT; import static org.opends.messages.ConfigMessages.ERR_CONFIG_FILE_ADD_NO_PARENT_DN; import static org.opends.messages.ConfigMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.ServerConstants.ALERT_DESCRIPTION_CANNOT_WRITE_CONFIGURATION; import static org.opends.server.util.ServerConstants.ALERT_DESCRIPTION_MANUAL_CONFIG_EDIT_HANDLED; import static org.opends.server.util.ServerConstants.ALERT_DESCRIPTION_MANUAL_CONFIG_EDIT_LOST; import static org.opends.server.util.ServerConstants.ALERT_TYPE_MANUAL_CONFIG_EDIT_HANDLED; import static org.opends.server.util.ServerConstants.ALERT_TYPE_MANUAL_CONFIG_EDIT_LOST; import static org.opends.server.util.ServerConstants.ALERT_TYPE_CANNOT_WRITE_CONFIGURATION; import static org.opends.server.util.StaticUtils.getExceptionMessage; import static org.opends.server.util.StaticUtils.renameFile; import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString; import static org.opends.server.extensions.ExtensionsConstants.MESSAGE_DIGEST_ALGORITHM_SHA_1; import static org.opends.server.extensions.ExtensionsConstants.*; import static org.opends.server.util.ServerConstants.*; import static org.opends.server.util.StaticUtils.*; import java.io.File; import java.io.FileInputStream; @@ -94,6 +85,9 @@ import org.forgerock.util.Utils; import org.forgerock.util.annotations.VisibleForTesting; import org.opends.server.api.AlertGenerator; import org.opends.server.core.DirectoryServer; import org.opends.server.core.SearchOperation; import org.opends.server.core.ServerContext; import org.opends.server.schema.GeneralizedTimeSyntax; import org.opends.server.tools.LDIFModify; import org.opends.server.types.DirectoryEnvironmentConfig; @@ -174,8 +168,8 @@ * Bootstraps the server configuration. * <p> * The returned ConfigurationHandler is initialized with a partial schema and must be later * re-initialized with the full schema by calling {@code reInitializeWithFullSchema()} method * once the schema has been fully loaded. * re-initialized with the full schema by calling {@link #reinitializeWithFullSchema(Schema)} * method once the schema has been fully loaded. * * @param serverContext * The server context. @@ -195,8 +189,8 @@ } catch (ConfigException e) { // TODO : fix the message throw new InitializationException(LocalizableMessage.raw("Cannot initialize configuration framework"), e); LocalizableMessage msg = ERR_CANNOT_INITIALIZE_CONFIGURATION_FRAMEWORK.get(stackTraceToSingleLineString(e)); throw new InitializationException(msg, e); } final ConfigurationHandler configHandler = new ConfigurationHandler(serverContext); @@ -207,10 +201,13 @@ /** * Initializes the configuration with an incomplete schema. * <p> * As configuration contains schema-related items, the initialization of the configuration * can only be performed with an incomplete schema before a complete schema is available. * Once a complete schema is available, the {@link #reinitializeWithFullSchema(Schema)} method * should be called to have a fully validated configuration. * As configuration contains schema-related items, the initialization of the configuration can * only be performed with an incomplete schema before a complete schema is available. Once a * complete schema is available, the {@link #reinitializeWithFullSchema(Schema)} method should be * called to have a fully validated configuration. * * @throws InitializationException * If an error occurs. */ @VisibleForTesting void initializeWithPartialSchema() throws InitializationException @@ -319,8 +316,7 @@ } return children; } // TODO : fix message throw new ConfigException(LocalizableMessage.raw("Unable to retrieve children of configuration entry : %s", dn), throw new ConfigException(ERR_UNABLE_TO_RETRIEVE_CHILDREN_OF_CONFIGURATION_ENTRY.get(dn), resultHandler.getResultError()); } @@ -433,9 +429,8 @@ { return searchHandler.getEntries().size(); } // TODO : fix the message throw new ConfigException(LocalizableMessage .raw("Unable to retrieve children of configuration entry : %s", entryDN), resultHandler.getResultError()); throw new ConfigException(ERR_UNABLE_TO_RETRIEVE_CHILDREN_OF_CONFIGURATION_ENTRY.get(entryDN), resultHandler.getResultError()); } /** @@ -458,7 +453,7 @@ throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, ERR_CONFIG_FILE_ADD_ALREADY_EXISTS.get(entryDN)); } final DN parentDN = retrieveParentDN(entryDN); final DN parentDN = retrieveParentDNForAdd(entryDN); // Iterate through add listeners to make sure the new entry is acceptable. final List<ConfigAddListener> addListeners = getAddListeners(parentDN); @@ -478,7 +473,6 @@ if (!resultHandler.hasCompletedSuccessfully()) { // TODO fix the message : error when adding config entry LdapException ex = resultHandler.getResultError(); throw new DirectoryException(ex.getResult().getResultCode(), ERR_CONFIG_FILE_ADD_FAILED.get(entryDN, parentDN, ex.getLocalizedMessage()), ex); @@ -532,14 +526,11 @@ } catch (ConfigException e) { // TODO : i18n throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, LocalizableMessage.raw("Backend config error when trying to delete an entry: %s", stackTraceToSingleLineString(e)), e); ERR_CONFIG_BACKEND_CANNOT_DELETE_ENTRY.get(stackTraceToSingleLineString(e)), e); } // TODO : pass in the localizable message (2) final DN parentDN = retrieveParentDN(dn); final DN parentDN = retrieveParentDNForDelete(dn); // Iterate through delete listeners to make sure the deletion is acceptable. final List<ConfigDeleteListener> deleteListeners = getDeleteListeners(parentDN); @@ -1232,8 +1223,8 @@ } catch (Exception e) { // TODO : fix message throw new InitializationException(LocalizableMessage.raw("Unable to load config-enabled schema"), e); throw new InitializationException( ERR_UNABLE_TO_LOAD_CONFIGURATION_ENABLED_SCHEMA.get(stackTraceToSingleLineString(e)), e); } } @@ -1609,14 +1600,11 @@ if (!successful) { // FIXME -- Log each error message and throw an exception. for (LocalizableMessage s : errorList) { logger.error(ERR_CONFIG_ERROR_APPLYING_STARTUP_CHANGE, s); } LocalizableMessage message = ERR_CONFIG_UNABLE_TO_APPLY_CHANGES_FILE.get(); throw new LDIFException(message); throw new LDIFException(ERR_CONFIG_UNABLE_TO_APPLY_CHANGES_FILE.get(Utils.joinAsString("; ", errorList))); } // Move the current config file out of the way and replace it with the updated version. @@ -1725,7 +1713,7 @@ * @throws DirectoryException * If entry has no parent or parent entry does not exist. */ private DN retrieveParentDN(final DN entryDN) throws DirectoryException private DN retrieveParentDNForAdd(final DN entryDN) throws DirectoryException { final DN parentDN = entryDN.parent(); if (parentDN == null) @@ -1740,6 +1728,30 @@ return parentDN; } /** * Returns the parent DN of the configuration entry corresponding to the provided DN. * * @param entryDN * DN of entry to retrieve the parent from. * @return the parent DN * @throws DirectoryException * If entry has no parent or parent entry does not exist. */ private DN retrieveParentDNForDelete(final DN entryDN) throws DirectoryException { final DN parentDN = entryDN.parent(); if (parentDN == null) { throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, ERR_CONFIG_FILE_DELETE_NO_PARENT_DN.get(entryDN)); } if (!backend.contains(parentDN)) { throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, ERR_CONFIG_FILE_DELETE_NO_PARENT.get(entryDN), getMatchedDN(parentDN), null); } return parentDN; } /** Returns the matched DN that is available in the configuration for the provided DN. */ private DN getMatchedDN(final DN dn) { opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -42,6 +42,7 @@ import org.forgerock.opendj.server.config.server.RootCfg; import org.opends.server.api.Backend; import org.opends.server.api.BackendInitializationListener; import org.opends.server.backends.ConfigurationBackend; import org.opends.server.config.ConfigConstants; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -120,8 +120,10 @@ import org.opends.server.api.plugin.InternalDirectoryServerPlugin; import org.opends.server.api.plugin.PluginResult; import org.opends.server.api.plugin.PluginType; import org.opends.server.backends.ConfigurationBackend; import org.opends.server.backends.RootDSEBackend; import org.opends.server.config.AdministrationConnector; import org.opends.server.config.ConfigurationHandler; import org.opends.server.config.JMXMBean; import org.opends.server.controls.PasswordPolicyErrorType; import org.opends.server.controls.PasswordPolicyResponseControl; opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -86,9 +86,9 @@ import org.opends.server.api.SynchronizationProvider; import org.opends.server.backends.task.Task; import org.opends.server.config.ConfigConstants; import org.opends.server.config.ConfigurationHandler; import org.opends.server.controls.PagedResultsControl; import org.opends.server.core.AddOperation; import org.opends.server.core.ConfigurationHandler; import org.opends.server.core.DeleteOperation; import org.opends.server.core.DirectoryServer; import org.opends.server.core.LockFileManager; opendj-server-legacy/src/main/java/org/opends/server/tasks/TaskUtils.java
@@ -35,7 +35,7 @@ import org.opends.server.api.Backend; import org.opends.server.tools.BackendToolUtils; import org.opends.server.types.Entry; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.core.ModifyOperation; import org.opends.server.types.Attribute; opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -26,7 +26,7 @@ import org.forgerock.opendj.server.config.server.BackendCfg; import org.forgerock.opendj.server.config.server.RootCfg; import org.opends.server.api.Backend; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Attribute; import org.opends.server.types.Entry; opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -61,7 +61,7 @@ import org.forgerock.opendj.server.config.meta.CryptoManagerCfgDefn; import org.forgerock.opendj.server.config.server.BackendCfg; import org.opends.quicksetup.installer.Installer; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.core.LockFileManager; import org.opends.server.extensions.SaltedSHA512PasswordStorageScheme; opendj-server-legacy/src/main/java/org/opends/server/tools/ListBackends.java
@@ -39,7 +39,7 @@ import org.forgerock.opendj.config.server.ConfigException; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.DN; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.DirectoryServer; import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; import org.opends.server.loggers.JDKLogging; opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
@@ -29,11 +29,11 @@ import org.opends.server.api.AccessControlHandler; import org.opends.server.api.Backend; import org.opends.server.api.ClientConnection; import org.opends.server.backends.ConfigurationBackend; import org.opends.server.controls.LDAPAssertionRequestControl; import org.opends.server.core.AccessControlConfigManager; import org.opends.server.core.CompareOperation; import org.opends.server.core.CompareOperationWrapper; import org.opends.server.core.ConfigurationBackend; import org.opends.server.core.DirectoryServer; import org.opends.server.types.Attribute; import org.opends.server.types.CanceledOperationException; opendj-server-legacy/src/messages/org/opends/messages/config.properties
@@ -525,7 +525,7 @@ ERR_CONFIG_ERROR_APPLYING_STARTUP_CHANGE_564=Unable to apply a change \ at server startup: %s ERR_CONFIG_UNABLE_TO_APPLY_CHANGES_FILE_565=One or more errors occurred \ while applying changes on server startup while applying changes on server startup: %s ERR_CONFIG_BACKEND_MODE_INVALID_567=Configuration entry %s does not \ contain a valid value for configuration attribute ds-cfg-db-directory-permissions (It \ should be an UNIX permission mode in three-digit octal notation.) @@ -818,3 +818,11 @@ defined in %s is invalid: %s ERR_CONFIG_REST2LDAP_MALFORMED_URL_742=Invalid configuration URL in the REST2LDAP endpoint \ configuration entry %s: %s ERR_CANNOT_INITIALIZE_CONFIGURATION_FRAMEWORK_743=Cannot initialize the \ configuration framework: %s ERR_UNABLE_TO_RETRIEVE_CHILDREN_OF_CONFIGURATION_ENTRY_744=Unable to retrieve \ children of configuration entry with dn: %s ERR_UNABLE_TO_LOAD_CONFIGURATION_ENABLED_SCHEMA_745=Unable to load the \ configuration-enabled schema: %s ERR_CONFIG_BACKEND_CANNOT_DELETE_ENTRY_746=Backend config error when trying to \ delete an entry: %s opendj-server-legacy/src/test/java/org/opends/server/ServerContextBuilder.java
@@ -20,7 +20,7 @@ import java.io.File; import org.forgerock.opendj.config.server.ServerManagementContext; import org.opends.server.core.ConfigurationHandler; import org.opends.server.config.ConfigurationHandler; import org.opends.server.core.ServerContext; import org.opends.server.types.DirectoryEnvironmentConfig; import org.opends.server.types.InitializationException; opendj-server-legacy/src/test/java/org/opends/server/core/ConfigurationHandlerTestCase.java
File was deleted