Fix compilation errors
Removed ConfigHandler and ReadOnlyConfigFileHandler replaced by
ConfigurationBackend
8 files deleted
68 files modified
| | |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static com.forgerock.opendj.util.StaticUtils.*; |
| | | |
| | | import static org.forgerock.opendj.ldap.LdapException.*; |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | |
| | | import org.forgerock.opendj.ldap.responses.Responses; |
| | | import org.forgerock.opendj.ldap.responses.Result; |
| | | import org.forgerock.opendj.ldap.responses.SearchResultEntry; |
| | | import org.forgerock.opendj.server.config.meta.BackendVLVIndexCfgDefn; |
| | | import org.forgerock.util.Reject; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | * The server scope value. |
| | | * @return The SDK scope value. |
| | | */ |
| | | public static SearchScope from(org.opends.server.admin.std.meta.VirtualAttributeCfgDefn.Scope srvScope) { |
| | | public static SearchScope from(VirtualAttributeCfgDefn.Scope srvScope) { |
| | | if (srvScope != null) { |
| | | switch (srvScope) { |
| | | case BASE_OBJECT: |
| | |
| | | } |
| | | return ByteString.empty(); |
| | | } |
| | | |
| | | /** |
| | | * Converts from OpenDJ server |
| | | * {@link org.opends.server.admin.std.meta.BackendVLVIndexCfgDefn.Scope} to |
| | | * {@link org.forgerock.opendj.server.config.meta.BackendVLVIndexCfgDefn.Scope}. |
| | | * |
| | | * @param scope |
| | | * The scope value. |
| | | * @return The converted scope value. |
| | | */ |
| | | public static BackendVLVIndexCfgDefn.Scope from( |
| | | final org.opends.server.admin.std.meta.BackendVLVIndexCfgDefn.Scope scope) { |
| | | Reject.ifNull(scope, "Provided scope to convert is null"); |
| | | switch (scope) { |
| | | case BASE_OBJECT: |
| | | return BackendVLVIndexCfgDefn.Scope.BASE_OBJECT; |
| | | case SINGLE_LEVEL: |
| | | return BackendVLVIndexCfgDefn.Scope.SINGLE_LEVEL; |
| | | case SUBORDINATE_SUBTREE: |
| | | return BackendVLVIndexCfgDefn.Scope.SUBORDINATE_SUBTREE; |
| | | case WHOLE_SUBTREE: |
| | | return BackendVLVIndexCfgDefn.Scope.WHOLE_SUBTREE; |
| | | default: |
| | | throw new IllegalArgumentException("Impossible to convert the unknown scope: " + scope); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | import com.forgerock.opendj.util.OperatingSystem; |
| | |
| | | private String instancePath; |
| | | private String openDSVersion; |
| | | private String javaVersion; |
| | | private ArrayList<OpenDsException> exceptions = new ArrayList<>(); |
| | | private ArrayList<Exception> exceptions = new ArrayList<>(); |
| | | private boolean isWindowsServiceEnabled; |
| | | private boolean isSchemaEnabled; |
| | | private Schema schema; |
| | |
| | | * Returns the exceptions that occurred while reading the configuration. |
| | | * @return the exceptions that occurred while reading the configuration. |
| | | */ |
| | | public List<OpenDsException> getExceptions() |
| | | public List<Exception> getExceptions() |
| | | { |
| | | return Collections.unmodifiableList(exceptions); |
| | | } |
| | |
| | | * @param exceptions exceptions that occurred while reading the |
| | | * configuration. |
| | | */ |
| | | public void setExceptions(Collection<OpenDsException> exceptions) |
| | | public void setExceptions(Collection<Exception> exceptions) |
| | | { |
| | | this.exceptions.clear(); |
| | | this.exceptions.addAll(exceptions); |
| | |
| | | } |
| | | }); |
| | | |
| | | getInfo().getDirContext().modifyAttributes( |
| | | getInfo().getConnection().getLdapContext().modifyAttributes( |
| | | Utilities.getJNDIName(groupDn.toString()), mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | |
| | | }); |
| | | String filter = BrowserController.ALL_OBJECTS_FILTER; |
| | | NamingEnumeration<SearchResult> result = |
| | | getInfo().getDirContext().search( |
| | | getInfo().getConnection().getLdapContext().search( |
| | | Utilities.getJNDIName(groupDn.toString()), |
| | | filter, ctls); |
| | | |
| | |
| | | |
| | | String backendName = backend.getBackendID(); |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backendName + ",cn=Backends,cn=config"); |
| | | Entry configEntry = DirectoryServer.getConfigHandler().getConfigEntry(dn); |
| | | Entry configEntry = DirectoryServer.getConfigurationHandler().getConfigEntry(dn); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute( |
| | |
| | | INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), |
| | | true, true, false, newBaseDNs); |
| | | configEntry.putConfigAttribute(baseDNAttr); |
| | | DirectoryServer.getConfigHandler().writeUpdatedConfig(); |
| | | DirectoryServer.getConfigurationHandler().writeUpdatedConfig(); |
| | | } |
| | | |
| | | /** |
| | |
| | | private void deleteBackend(BackendDescriptor backend) throws OpenDsException, ConfigException |
| | | { |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backend.getBackendID() + ",cn=Backends,cn=config"); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigHandler(), dn); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigurationHandler(), dn); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | domainName.set(dName); |
| | | DN entryDN = domain.dn(); |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), entryDN); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigurationHandler(), entryDN); |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | dn = "ds-cfg-attribute" + "=" + index.getName() + ",cn=Index," + backendId + ",cn=Backends,cn=config"; |
| | | } |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.valueOf(dn), null); |
| | | DirectoryServer.getConfigurationHandler().deleteEntry(DN.valueOf(dn), null); |
| | | } |
| | | |
| | | /** |
| | |
| | | BasicAttribute attr = new BasicAttribute(getSchemaFileAttributeName(element)); |
| | | attr.add(getSchemaFileAttributeValue(element)); |
| | | ModificationItem mod = new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr); |
| | | getInfo().getDirContext().modifyAttributes( |
| | | getInfo().getConnection().getLdapContext().modifyAttributes( |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, |
| | | new ModificationItem[] { mod }); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | ctx = getInfo().getDirContext(); |
| | | ctx = getInfo().getConnection().getLdapContext(); |
| | | useAdminCtx = true; |
| | | } |
| | | BasicAttributes attrs = new BasicAttributes(); |
| | |
| | | final BasicAttribute attr = new BasicAttribute(schemaElement.getAttributeName()); |
| | | attr.add(getElementDefinition(schemaElement)); |
| | | final ModificationItem mod = new ModificationItem(DirContext.ADD_ATTRIBUTE, attr); |
| | | getInfo().getDirContext().modifyAttributes( |
| | | getInfo().getConnection().getLdapContext().modifyAttributes( |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, new ModificationItem[] { mod }); |
| | | } |
| | | catch (NamingException ne) |
| | |
| | | // The connections must be updated, just update the environment, which |
| | | // is what we use to clone connections and to launch scripts. |
| | | // The environment will also be used if we want to reconnect. |
| | | getInfo().getDirContext().addToEnvironment( |
| | | getInfo().getConnection().getLdapContext().addToEnvironment( |
| | | Context.SECURITY_CREDENTIALS, |
| | | String.valueOf(newPassword)); |
| | | if (getInfo().getUserDataDirContext() != null) |
| | |
| | | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.*; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.io.File; |
| | |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.UserData; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.types.Schema; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.SetupUtils; |
| | |
| | | { |
| | | List<String> args = new ArrayList<>(); |
| | | args.add("--configClass"); |
| | | args.add(org.opends.server.extensions.ConfigFileHandler.class.getName()); |
| | | args.add(ConfigurationHandler.class.getName()); |
| | | args.add("--configFile"); |
| | | args.add(ConfigReader.configFile); |
| | | return args; |
| | |
| | | |
| | | if (useAdminConnector) |
| | | { |
| | | ctx = getInfo().getDirContext(); |
| | | ctx = getInfo().getConnection().getLdapContext(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.LDAPProfile; |
| | | import org.forgerock.opendj.config.PropertyException; |
| | | import org.forgerock.opendj.config.client.ManagementContext; |
| | |
| | | |
| | | if (isCreation || indexToModify.getScope() != searchScope) |
| | | { |
| | | index.setScope(Converters.from(VLVIndexDescriptor.getBackendVLVIndexScope(searchScope))); |
| | | index.setScope(VLVIndexDescriptor.getBackendVLVIndexScope(searchScope)); |
| | | } |
| | | |
| | | if (isCreation || !indexToModify.getSortOrder().equals(sortOrder)) |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.forgerock.opendj.ldap.LdapException; |
| | | import org.forgerock.util.Utils; |
| | | |
| | | /** |
| | | * The panel displaying the general status of the server (started/stopped), |
| | |
| | | pos = Utilities.getViewPositions(this); |
| | | } |
| | | |
| | | Collection<OpenDsException> exceptions = desc.getExceptions(); |
| | | Collection<Exception> exceptions = desc.getExceptions(); |
| | | if (exceptions.isEmpty()) |
| | | { |
| | | boolean errorPaneVisible = false; |
| | |
| | | } |
| | | else |
| | | { |
| | | ArrayList<LocalizableMessage> msgs = new ArrayList<>(); |
| | | for (OpenDsException oe : exceptions) |
| | | ArrayList<String> msgs = new ArrayList<>(); |
| | | for (Exception e : exceptions) |
| | | { |
| | | msgs.add(oe.getMessageObject()); |
| | | msgs.add(e instanceof LdapException ? ((LdapException) e).getLocalizedMessage() : e.getMessage()); |
| | | } |
| | | LocalizableMessage title = ERR_CTRL_PANEL_ERROR_READING_CONFIGURATION_SUMMARY.get(); |
| | | LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); |
| | | for (LocalizableMessage error : msgs) |
| | | { |
| | | if (mb.length() > 0) |
| | | { |
| | | mb.append("<br>"); |
| | | } |
| | | mb.append(error); |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | Utils.joinAsString("<br>", msgs); |
| | | if (desc.getStatus() == ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | | if (!desc.isAuthenticated()) |
| | | { |
| | | mb.append("<br>"); |
| | | mb.append(INFO_CTRL_PANEL_AUTH_REQUIRED_TO_BROWSE_MONITORING_SUMMARY.get()); |
| | | mb.append("<br><br>").append(getAuthenticateHTML()); |
| | | sb.append("<br>"); |
| | | sb.append(INFO_CTRL_PANEL_AUTH_REQUIRED_TO_BROWSE_MONITORING_SUMMARY.get()); |
| | | sb.append("<br><br>").append(getAuthenticateHTML()); |
| | | } |
| | | } |
| | | else if (desc.getStatus() == |
| | | ServerDescriptor.ServerStatus.NOT_CONNECTED_TO_REMOTE) |
| | | { |
| | | mb.append("<br>"); |
| | | mb.append(INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | mb.append("<br><br>").append(getAuthenticateHTML()); |
| | | sb.append("<br>"); |
| | | sb.append(INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname())); |
| | | sb.append("<br><br>").append(getAuthenticateHTML()); |
| | | } |
| | | updateErrorPane(errorPane, title, ColorAndFontConstants.errorTitleFont, |
| | | mb.toMessage(), ColorAndFontConstants.defaultFont); |
| | | LocalizableMessage.raw(sb), ColorAndFontConstants.defaultFont); |
| | | |
| | | if (!errorPane.isVisible()) |
| | | { |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | import org.opends.guitools.controlpanel.task.OfflineUpdateException; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.AdministrationConnectorCfg; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | |
| | | { |
| | | logger.warn(LocalizableMessage.raw("Error reading configuration: " + oe, oe)); |
| | | } |
| | | exceptions = Collections.unmodifiableList(errors); |
| | | exceptions.addAll(errors); |
| | | exceptions = Collections.unmodifiableList(exceptions); |
| | | administrativeUsers = Collections.unmodifiableSet(alternateBindDNs); |
| | | listeners = Collections.unmodifiableSet(connectionHandlers); |
| | | backends = Collections.unmodifiableSet(backendDescriptors); |
| | |
| | | final List<OpenDsException> errors) throws OpenDsException, ConfigException |
| | | { |
| | | // Get the Directory Server configuration handler and use it. |
| | | final RootCfg root = ServerManagementContext.getInstance().getRootConfiguration(); |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | readAdminConnector(root, errors); |
| | | readConnectionHandlers(connectionHandlers, root, errors); |
| | | isSchemaEnabled = root.getGlobalConfiguration().isCheckSchema(); |
| | |
| | | import org.opends.guitools.controlpanel.datamodel.VLVSortOrder; |
| | | import org.opends.guitools.controlpanel.task.OfflineUpdateException; |
| | | import org.forgerock.opendj.server.config.meta.AdministrationConnectorCfgDefn; |
| | | import org.opends.server.core.ConfigurationBackend; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.tasks.TaskEntry; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | Utilities.getInstanceRootDirectory(installRoot).getAbsolutePath(); |
| | | configFile = instanceRoot + File.separator + "config" + File.separator + |
| | | "config.ldif"; |
| | | configClassName = ReadOnlyConfigFileHandler.class.getName(); |
| | | configClassName = ConfigurationBackend.class.getName(); |
| | | try |
| | | { |
| | | DirectoryEnvironmentConfig env = DirectoryServer.getEnvironmentConfig(); |
| | |
| | | /** |
| | | * The exceptions that occurred reading the configuration. |
| | | */ |
| | | protected List<OpenDsException> exceptions = Collections.emptyList(); |
| | | protected List<Exception> exceptions = Collections.emptyList(); |
| | | |
| | | /** |
| | | * Whether the configuration has already been read or not. |
| | |
| | | * @return the list of exceptions that were encountered reading the |
| | | * configuration. |
| | | */ |
| | | public List<OpenDsException> getExceptions() |
| | | public List<Exception> getExceptions() |
| | | { |
| | | return exceptions; |
| | | } |
| | |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.forgerock.opendj.config.ConfigurationFramework; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.admin.ClassLoaderProvider; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.schema.SomeSchemaElement; |
| | |
| | | * @throws OpenDsException if an error occurs. |
| | | * @throws ConfigException if an error occurs. |
| | | */ |
| | | public static void deleteConfigSubtree(ConfigHandler confHandler, DN dn) |
| | | public static void deleteConfigSubtree(ConfigurationHandler confHandler, DN dn) |
| | | throws OpenDsException, ConfigException |
| | | { |
| | | Entry confEntry = confHandler.getConfigEntry(dn); |
| | | org.forgerock.opendj.ldap.Entry confEntry = confHandler.getEntry(dn); |
| | | if (confEntry != null) |
| | | { |
| | | // Copy the values to avoid problems with this recursive method. |
| | | ArrayList<DN> childDNs = new ArrayList<>(confEntry.getChildren().keySet()); |
| | | for (DN childDN : childDNs) |
| | | for (DN childDN : new ArrayList<>(confHandler.getChildren(dn))) |
| | | { |
| | | deleteConfigSubtree(confHandler, childDN); |
| | | } |
| | | confHandler.deleteEntry(dn, null); |
| | | confHandler.deleteEntry(dn); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | // Read the configuration file. |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backendName + ",cn=Backends,cn=config"); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigHandler(), dn); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigurationHandler(), dn); |
| | | } |
| | | catch (OpenDsException | ConfigException ode) |
| | | { |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.forgerock.opendj.ldap.AddressMask; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.server.config.meta.LDAPConnectionHandlerCfgDefn.SSLClientAuthPolicy; |
| | | import org.forgerock.opendj.server.config.server.AdministrationConnectorCfg; |
| | | import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg; |
| | |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.core.SynchronousStrategy; |
| | | import org.opends.server.protocols.ldap.LDAPConnectionHandler; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilePermission; |
| | | import org.opends.server.types.InitializationException; |
| | |
| | | * This private class implements a fake LDAP connection Handler configuration. |
| | | * This allows to re-use the LDAPConnectionHandler as it is. |
| | | */ |
| | | private static class LDAPConnectionCfgAdapter implements |
| | | LDAPConnectionHandlerCfg |
| | | private static class LDAPConnectionCfgAdapter implements LDAPConnectionHandlerCfg |
| | | { |
| | | private final AdministrationConnectorCfg config; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | RootCfg root = ServerManagementContext.getInstance() |
| | | .getRootConfiguration(); |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | AdministrationConnectorCfg config = root.getAdministrationConnector(); |
| | | |
| | | // Check if certificate generation is needed |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.operation.*; |
| | | |
| | |
| | | /** The plugin types for which this plugin is registered. */ |
| | | private Set<PluginType> pluginTypes; |
| | | |
| | | |
| | | /** The server context. */ |
| | | private ServerContext serverContext; |
| | | |
| | | /** |
| | | * Creates a new instance of this Directory Server plugin. Every |
| | |
| | | { |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the server context. |
| | | * |
| | | * @return the server context. |
| | | */ |
| | | protected ServerContext getServerContext() |
| | | { |
| | | return serverContext; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided configuration is acceptable for |
| | |
| | | * plugins regardless of type. This should only be called by the |
| | | * core Directory Server code during the course of loading a plugin. |
| | | * |
| | | * @param serverContext |
| | | * The server context. |
| | | * @param pluginDN |
| | | * The configuration entry name of this plugin. |
| | | * @param pluginTypes |
| | |
| | | mayInstantiate=false, |
| | | mayExtend=false, |
| | | mayInvoke=false) |
| | | public final void initializeInternal(DN pluginDN, |
| | | public final void initializeInternal(ServerContext serverContext, DN pluginDN, |
| | | Set<PluginType> pluginTypes, boolean invokeForInternalOps) |
| | | { |
| | | this.serverContext = serverContext; |
| | | this.pluginDN = pluginDN; |
| | | this.pluginTypes = pluginTypes; |
| | | this.invokeForInternalOps = invokeForInternalOps; |
| | |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | /** |
| | |
| | | protected InternalDirectoryServerPlugin(DN componentDN, |
| | | Set<PluginType> pluginTypes, boolean invokeForInternalOps) |
| | | { |
| | | initializeInternal(componentDN, pluginTypes, |
| | | // TODO: server context should be provided in constructor |
| | | initializeInternal(DirectoryServer.getInstance().getServerContext(), componentDN, pluginTypes, |
| | | invokeForInternalOps); |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.DseeCompatAccessControlHandlerCfg; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.backends.pluggable.SuffixContainer; |
| | | import org.opends.server.controls.GetEffectiveRightsRequestControl; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.ConfigurationBackend; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | |
| | | LinkedList<LocalizableMessage> failedACIMsgs = new LinkedList<>(); |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | ConfigHandler<?> configBackend = DirectoryServer.getConfigHandler(); |
| | | Backend<?> configBackend = DirectoryServer.getBackend(ConfigurationBackend.CONFIG_BACKEND_ID); |
| | | for (DN baseDN : configBackend.getBaseDNs()) |
| | | { |
| | | try |
| | |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | 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.*; |
| | |
| | | import org.opends.server.backends.pluggable.spi.ReadableTransaction; |
| | | import org.opends.server.backends.pluggable.spi.StorageRuntimeException; |
| | | import org.opends.server.backends.pluggable.spi.TreeName; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.tools.BackendToolUtils; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildArgument(); |
| | | configFile = |
| | |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // If this backend is a configuration manager, then we don't want to do |
| | | // If this backend is the configuration backend, then we don't want to do |
| | | // any more with it because the configuration will have already been started. |
| | | if (backend instanceof ConfigHandler) |
| | | if (backend instanceof ConfigurationBackend) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import java.lang.reflect.Constructor; |
| | | |
| | | import static org.opends.messages.CoreMessages.ERR_CANNOT_INSTANTIATE_CONFIG_HANDLER; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.ConfigurationFramework; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | |
| | | public class ConfigurationBootstrapper |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Bootstrap the server configuration. |
| | | * <p> |
| | |
| | | * |
| | | * @param serverContext |
| | | * The server context. |
| | | * @param configClass |
| | | * The actual configuration class to use. |
| | | * @return the server management context |
| | | * @throws InitializationException |
| | | * If an error occurs during bootstrapping. |
| | | */ |
| | | public static ServerManagementContext bootstrap(ServerContext serverContext) throws InitializationException { |
| | | public static ServerManagementContext bootstrap(ServerContext serverContext, Class<ConfigurationHandler> configClass) |
| | | throws InitializationException { |
| | | final ConfigurationFramework configFramework = ConfigurationFramework.getInstance(); |
| | | try |
| | | { |
| | |
| | | catch (ConfigException e) |
| | | { |
| | | // TODO : fix the message |
| | | throw new InitializationException(LocalizableMessage.raw("Cannot initialize config framework"), e); |
| | | throw new InitializationException(LocalizableMessage.raw("Cannot initialize configuration framework"), e); |
| | | } |
| | | |
| | | final ConfigurationHandler configurationHandler = new ConfigurationHandler(serverContext); |
| | | // Load and instantiate the configuration handler class. |
| | | Class<ConfigurationHandler> handlerClass = configClass; |
| | | final ConfigurationHandler configurationHandler; |
| | | try |
| | | { |
| | | Constructor<ConfigurationHandler> cons = handlerClass.getConstructor(ServerContext.class); |
| | | configurationHandler = cons.newInstance(serverContext); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | LocalizableMessage message = ERR_CANNOT_INSTANTIATE_CONFIG_HANDLER.get(configClass, e.getLocalizedMessage()); |
| | | throw new InitializationException(message, e); |
| | | } |
| | | configurationHandler.initialize(); |
| | | |
| | | return new ServerManagementContext(configurationHandler); |
| | | } |
| | | } |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClassType; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.admin.AdministrationDataSync; |
| | | import org.forgerock.opendj.config.ConfigurationFramework; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.AlertHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.CryptoManagerCfg; |
| | |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.forgerock.opendj.server.config.server.RootDSEBackendCfg; |
| | | import org.forgerock.opendj.server.config.server.SynchronizationProviderCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.admin.AdministrationConnector; |
| | | import org.opends.server.admin.AdministrationDataSync; |
| | | import org.opends.server.admin.ClassLoaderProvider; |
| | | import org.opends.server.api.AccessControlHandler; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.opends.server.api.AlertGenerator; |
| | |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.CompressedSchema; |
| | | import org.opends.server.api.ConfigAddListener; |
| | | import org.opends.server.api.ConfigChangeListener; |
| | | import org.opends.server.api.ConfigDeleteListener; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.api.DirectoryServerMBean; |
| | | import org.opends.server.api.EntryCache; |
| | |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.backends.RootDSEBackend; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.config.JMXMBean; |
| | | import org.opends.server.controls.PasswordPolicyErrorType; |
| | | import org.opends.server.controls.PasswordPolicyResponseControl; |
| | | import org.opends.server.crypto.CryptoManagerImpl; |
| | | import org.opends.server.crypto.CryptoManagerSync; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.opends.server.extensions.JMXAlertHandler; |
| | | import org.opends.server.loggers.AccessLogger; |
| | |
| | | import org.opends.server.util.ActivateOnceNewConfigFrameworkIsUsed; |
| | | import org.opends.server.util.ActivateOnceSDKSchemaIsUsed; |
| | | import org.opends.server.util.BuildVersion; |
| | | import org.opends.server.util.ModifyOnceSDKSchemaIsUsed; |
| | | import org.opends.server.util.MultiOutputStream; |
| | | import org.opends.server.util.RuntimeInformation; |
| | | import org.opends.server.util.SetupUtils; |
| | |
| | | private CertificateMapperConfigManager certificateMapperConfigManager; |
| | | |
| | | /** The class used to provide the config handler implementation. */ |
| | | private Class<ConfigHandler> configClass; |
| | | private Class<ConfigurationHandler> configClass; |
| | | |
| | | /** The configuration handler for the Directory Server. */ |
| | | private ConfigHandler configHandler; |
| | | private ConfigurationHandler configurationHandler; |
| | | |
| | | /** The set of account status notification handlers defined in the server. */ |
| | | private ConcurrentMap<DN, AccountStatusNotificationHandler> |
| | |
| | | |
| | | environmentConfig.setConfigClass(cfgClass); |
| | | environmentConfig.setConfigFile(cfgFile); |
| | | |
| | | initializeConfiguration(); |
| | | } |
| | | |
| | |
| | | * @throws InitializationException |
| | | */ |
| | | @ActivateOnceNewConfigFrameworkIsUsed("it will need adaptation to be activated before sdk schema is ready") |
| | | @ActivateOnceSDKSchemaIsUsed |
| | | @ModifyOnceSDKSchemaIsUsed |
| | | private void initializeNG() throws InitializationException |
| | | { |
| | | serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext); |
| | | initializeSchemaNG(); |
| | | //serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext); |
| | | //initializeSchemaNG(); |
| | | |
| | | // TODO : config backend should be initialized later, with the other backends |
| | | //ConfigBackend configBackend = new ConfigBackend(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Instantiates the configuration handler and loads the Directory Server |
| | | * configuration. |
| | | * |
| | | * @throws InitializationException If a problem occurs while trying to |
| | | * initialize the config handler. |
| | | */ |
| | | public void initializeConfiguration() |
| | | throws InitializationException |
| | | public void initializeConfiguration() throws InitializationException |
| | | { |
| | | this.configClass = environmentConfig.getConfigClass(); |
| | | this.configFile = environmentConfig.getConfigFile(); |
| | | |
| | | // Make sure that administration framework definition classes are loaded. |
| | | ClassLoaderProvider provider = ClassLoaderProvider.getInstance(); |
| | | if (! provider.isEnabled()) |
| | | { |
| | | provider.enable(); |
| | | } |
| | | |
| | | // Load and instantiate the configuration handler class. |
| | | Class<ConfigHandler> handlerClass = configClass; |
| | | try |
| | | { |
| | | configHandler = handlerClass.newInstance(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = |
| | | ERR_CANNOT_INSTANTIATE_CONFIG_HANDLER.get(configClass, e.getLocalizedMessage()); |
| | | throw new InitializationException(message, e); |
| | | } |
| | | |
| | | // Perform the handler-specific initialization. |
| | | try |
| | | { |
| | | String path; |
| | | try |
| | | { |
| | | path = configFile.getCanonicalPath(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | path = configFile.getAbsolutePath(); |
| | | } |
| | | configHandler.initializeConfigHandler(path, false); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | logger.traceException(ie); |
| | | |
| | | throw ie; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = |
| | | ERR_CANNOT_INITIALIZE_CONFIG_HANDLER.get( |
| | | configClass, configFile, e.getLocalizedMessage()); |
| | | throw new InitializationException(message, e); |
| | | } |
| | | serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext, configClass); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | initializeSchema(); |
| | | |
| | | commonAudit = new CommonAudit(); |
| | | commonAudit = new CommonAudit(serverContext); |
| | | |
| | | // Allow internal plugins to be registered. |
| | | pluginConfigManager.initializePluginConfigManager(); |
| | |
| | | // Initialize both subentry manager and group manager |
| | | // for the configuration backend. |
| | | // TODO : why do we initialize these now ? Can't we do them after backend initialization ? |
| | | subentryManager.performBackendPreInitializationProcessing(configHandler); |
| | | groupManager.performBackendPreInitializationProcessing(configHandler); |
| | | |
| | | Backend<?> configBackend = getConfigurationBackend(); |
| | | subentryManager.performBackendPreInitializationProcessing(configBackend); |
| | | groupManager.performBackendPreInitializationProcessing(configBackend); |
| | | |
| | | AccessControlConfigManager.getInstance().initializeAccessControl(serverContext); |
| | | |
| | |
| | | // Write a copy of the config if needed. |
| | | if (saveConfigOnSuccessfulStartup) |
| | | { |
| | | configHandler.writeSuccessfulStartupConfig(); |
| | | configurationHandler.writeSuccessfulStartupConfig(); |
| | | } |
| | | |
| | | isRunning = true; |
| | |
| | | /** Delete "server.starting" and "hostname" files if they are present. */ |
| | | private void deleteUnnecessaryFiles() |
| | | { |
| | | File serverStartingFile = new File(configHandler.getInstanceRoot() + File.separator + "logs" |
| | | File serverStartingFile = new File(environmentConfig.getInstanceRoot() + File.separator + "logs" |
| | | + File.separator + "server.starting"); |
| | | if (serverStartingFile.exists()) |
| | | { |
| | | serverStartingFile.delete(); |
| | | } |
| | | |
| | | File hostNameFile = new File(configHandler.getInstanceRoot() + File.separator + SetupUtils.HOST_NAME_FILE); |
| | | File hostNameFile = new File(environmentConfig.getInstanceRoot() + File.separator + SetupUtils.HOST_NAME_FILE); |
| | | if (hostNameFile.exists()) |
| | | { |
| | | hostNameFile.delete(); |
| | |
| | | |
| | | // With server schema in place set compressed schema. |
| | | compressedSchema = new DefaultCompressedSchema(serverContext); |
| | | |
| | | // At this point we have a problem, because none of the configuration is |
| | | // usable because it was all read before we had a schema (and therefore all |
| | | // of the attribute types and objectclasses are bogus and won't let us find |
| | | // anything). So we have to re-read the configuration so that we can |
| | | // continue the necessary startup process. In the process, we want to |
| | | // preserve any configuration add/delete/change listeners that might have |
| | | // been registered with the old configuration (which will primarily be |
| | | // schema elements) so they can be re-registered with the new configuration. |
| | | Map<String, List<ConfigAddListener>> addListeners = new LinkedHashMap<>(); |
| | | Map<String, List<ConfigDeleteListener>> deleteListeners = new LinkedHashMap<>(); |
| | | Map<String, List<ConfigChangeListener>> changeListeners = new LinkedHashMap<>(); |
| | | getChangeListeners(configHandler.getConfigRootEntry(), addListeners, |
| | | deleteListeners, changeListeners); |
| | | |
| | | try |
| | | { |
| | | configHandler.finalizeConfigHandler(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | } |
| | | |
| | | try |
| | | { |
| | | configHandler.initializeConfigHandler(configFile.getAbsolutePath(), true); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | | logger.traceException(ie); |
| | | |
| | | throw ie; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | throw new InitializationException(ERR_CANNOT_INITIALIZE_CONFIG_HANDLER.get( |
| | | configClass, configFile, e.getLocalizedMessage())); |
| | | } |
| | | |
| | | // Re-register all of the change listeners with the configuration. |
| | | for (String dnStr : addListeners.keySet()) |
| | | { |
| | | for (ConfigAddListener listener : addListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerAddListener(listener); |
| | | } |
| | | } |
| | | |
| | | for (String dnStr : deleteListeners.keySet()) |
| | | { |
| | | for (ConfigDeleteListener listener : deleteListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerDeleteListener(listener); |
| | | } |
| | | } |
| | | |
| | | for (String dnStr : changeListeners.keySet()) |
| | | { |
| | | for (ConfigChangeListener listener : changeListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(toDn(dnStr)).registerChangeListener(listener); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private DN toDn(String dn) throws InitializationException |
| | |
| | | return directoryServer.compressedSchema; |
| | | } |
| | | |
| | | /** |
| | | * Gets all of the add, delete, and change listeners from the provided |
| | | * configuration entry and all of its descendants and puts them in the |
| | | * appropriate lists. |
| | | * |
| | | * @param configEntry The configuration entry to be processed, along |
| | | * with all of its descendants. |
| | | * @param addListeners The set of add listeners mapped to the DN of the |
| | | * corresponding configuration entry. |
| | | * @param deleteListeners The set of delete listeners mapped to the DN of |
| | | * the corresponding configuration entry. |
| | | * @param changeListeners The set of change listeners mapped to the DN of |
| | | * the corresponding configuration entry. |
| | | */ |
| | | private void getChangeListeners(Entry configEntry, |
| | | Map<String, List<ConfigAddListener>> addListeners, |
| | | Map<String, List<ConfigDeleteListener>> deleteListeners, |
| | | Map<String, List<ConfigChangeListener>> changeListeners) |
| | | private Backend<?> getConfigurationBackend() |
| | | { |
| | | put(addListeners, configEntry, configEntry.getAddListeners()); |
| | | put(deleteListeners, configEntry, configEntry.getDeleteListeners()); |
| | | put(changeListeners, configEntry, configEntry.getChangeListeners()); |
| | | |
| | | for (Entry child : configEntry.getChildren().values()) |
| | | { |
| | | getChangeListeners(child, addListeners, deleteListeners, changeListeners); |
| | | } |
| | | } |
| | | |
| | | private <T> void put(Map<String, List<T>> listeners, Entry configEntry, List<T> cfgListeners) |
| | | { |
| | | if (cfgListeners != null && !cfgListeners.isEmpty()) |
| | | { |
| | | listeners.put(configEntry.getName().toString(), cfgListeners); |
| | | } |
| | | return getBackend(ConfigurationBackend.CONFIG_BACKEND_ID); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | try |
| | | { |
| | | createAndRegisterWorkflows(configHandler); |
| | | createAndRegisterWorkflows(getConfigurationBackend()); |
| | | createAndRegisterWorkflows(rootDSEBackend); |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | |
| | | // The configuration backend has already been registered by this point |
| | | // so we need to handle it explicitly. |
| | | // Because subentryManager may depend on the groupManager, let's |
| | | // delay this. |
| | | // groupManager.performBackendPreInitializationProcessing(configHandler); |
| | | // Because subentryManager may depend on the groupManager, let's delay this. |
| | | // groupManager.performBackendPreInitializationProcessing(configurationHandler); |
| | | } |
| | | |
| | | /** |
| | |
| | | // at this point so we need to handle it explicitly here. |
| | | // However, subentryManager may have dependencies on the |
| | | // groupManager. So lets delay the backend initialization until then. |
| | | // subentryManager.performBackendPreInitializationProcessing( |
| | | // configHandler); |
| | | // subentryManager.performBackendPreInitializationProcessing(configurationHandler); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * @return A reference to the Directory Server configuration handler. |
| | | */ |
| | | public static ConfigHandler getConfigHandler() |
| | | public static ConfigurationHandler getConfigurationHandler() |
| | | { |
| | | return directoryServer.configHandler; |
| | | return directoryServer.configurationHandler; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Deprecated |
| | | public static Entry getConfigEntry(DN entryDN) throws ConfigException |
| | | { |
| | | return directoryServer.configHandler.getConfigEntry(entryDN); |
| | | return Converters.to(directoryServer.configurationHandler.getEntry(entryDN)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | else |
| | | { |
| | | for (AlertHandler alertHandler : directoryServer.alertHandlers) |
| | | for (AlertHandler<?> alertHandler : directoryServer.alertHandlers) |
| | | { |
| | | AlertHandlerCfg config = alertHandler.getAlertHandlerConfiguration(); |
| | | Set<String> enabledAlerts = config.getEnabledAlertType(); |
| | |
| | | * @return The requested password storage scheme, or {@code null} if no such |
| | | * scheme is defined. |
| | | */ |
| | | public static PasswordStorageScheme getPasswordStorageScheme(DN configEntryDN) |
| | | public static PasswordStorageScheme<?> getPasswordStorageScheme(DN configEntryDN) |
| | | { |
| | | return directoryServer.passwordStorageSchemesByDN.get(configEntryDN); |
| | | } |
| | |
| | | * @param handler The connection handler to register with the Directory |
| | | * Server. |
| | | */ |
| | | public static void registerConnectionHandler( |
| | | ConnectionHandler<? extends ConnectionHandlerCfg> |
| | | public static void registerConnectionHandler(ConnectionHandler<? extends ConnectionHandlerCfg> |
| | | handler) |
| | | { |
| | | synchronized (directoryServer.connectionHandlers) |
| | |
| | | |
| | | configClass = null; |
| | | configFile = null; |
| | | configHandler = null; |
| | | configurationHandler = null; |
| | | coreConfigManager = null; |
| | | compressedSchema = null; |
| | | cryptoManager = null; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (configHandler == null) |
| | | if (configurationHandler == null) |
| | | { |
| | | // The config handler hasn't been initialized yet. Just return the DN |
| | | // of the root DSE. |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | return configHandler.getConfigRootEntry().getDN(); |
| | | return configurationHandler.getRootEntry().getName(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | .description(INFO_DSCORE_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | { |
| | | theDirectoryServer.setEnvironmentConfig(environmentConfig); |
| | | theDirectoryServer.bootstrapServer(); |
| | | theDirectoryServer.initializeConfiguration(configClass.getValue(), |
| | | configFile.getValue()); |
| | | theDirectoryServer.initializeConfiguration(configClass.getValue(), configFile.getValue()); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.server.config.meta.MatchingRuleCfgDefn; |
| | |
| | | public void initializeMatchingRules() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | RootCfg rootConfiguration = ServerManagementContext.getInstance().getRootConfiguration(); |
| | | RootCfg rootConfiguration = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | |
| | | |
| | | // Register as an add and delete listener with the root configuration so we |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | plugin.initializeInternal(configuration.dn(), pluginTypes, |
| | | plugin.initializeInternal(serverContext, configuration.dn(), pluginTypes, |
| | | configuration.isInvokeForInternalOperations()); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | } |
| | |
| | | // this class as a backend and not as the config handler. We need it as a |
| | | // config handler to determine the path to the config file, so we can get |
| | | // that from the Directory Server object. |
| | | return new File(((ConfigFileHandler) DirectoryServer.getConfigHandler()).configFile); |
| | | return new File(((ConfigFileHandler) DirectoryServer.getConfigurationHandler()).configFile); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg; |
| | | import org.forgerock.opendj.server.config.server.TimeLimitLogRotationPolicyCfg; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | |
| | | |
| | | private final AtomicBoolean trustTransactionIds = new AtomicBoolean(false); |
| | | |
| | | private final ServerContext serverContext; |
| | | |
| | | /** |
| | | * Creates the common audit. |
| | | * |
| | | * @param serverContext |
| | | * The server context. |
| | | * |
| | | * @throws ConfigException |
| | | * If an error occurs. |
| | | */ |
| | | public CommonAudit() throws ConfigException |
| | | public CommonAudit(ServerContext serverContext) throws ConfigException |
| | | { |
| | | this.serverContext = serverContext; |
| | | configurationFramework = ConfigurationFramework.getInstance(); |
| | | this.dependencyProvider = new CommonAuditDependencyProvider(); |
| | | this.httpAccessAuditService = createAuditServiceWithoutHandlers(); |
| | |
| | | */ |
| | | public RequestHandler getRequestHandler(LogPublisherCfg config) throws ConfigException |
| | | { |
| | | if (new PublisherConfig(config).isHttpAccessLog()) |
| | | if (new PublisherConfig(serverContext, config).isHttpAccessLog()) |
| | | { |
| | | return httpAccessAuditService; |
| | | } |
| | |
| | | logger.trace(String.format("Setting up common audit for configuration entry: %s", newConfig.dn())); |
| | | try |
| | | { |
| | | final PublisherConfig newPublisher = new PublisherConfig(newConfig); |
| | | final PublisherConfig newPublisher = new PublisherConfig(serverContext, newConfig); |
| | | String normalizedName = getConfigNormalizedName(newConfig); |
| | | if (newPublisher.isHttpAccessLog()) |
| | | { |
| | |
| | | */ |
| | | public boolean isCommonAuditConfig(LogPublisherCfg config) throws ConfigException |
| | | { |
| | | return new PublisherConfig(config).isCommonAudit(); |
| | | return new PublisherConfig(serverContext, config).isCommonAudit(); |
| | | } |
| | | |
| | | /** |
| | |
| | | private LogType logType; |
| | | private AuditType auditType; |
| | | |
| | | PublisherConfig(LogPublisherCfg config) throws ConfigException |
| | | PublisherConfig(ServerContext serverContext, LogPublisherCfg config) throws ConfigException |
| | | { |
| | | this.config = config; |
| | | Entry configEntry = DirectoryServer.getConfigEntry(config.dn()); |
| | | if (configEntry.hasObjectClass("ds-cfg-csv-file-access-log-publisher")) |
| | | if (hasObjectClass(serverContext,configEntry, "ds-cfg-csv-file-access-log-publisher")) |
| | | { |
| | | auditType = AuditType.CSV; |
| | | logType = LogType.ACCESS; |
| | | } |
| | | else if (configEntry.hasObjectClass("ds-cfg-csv-file-http-access-log-publisher")) |
| | | else if (hasObjectClass(serverContext,configEntry, "ds-cfg-csv-file-http-access-log-publisher")) |
| | | { |
| | | auditType = AuditType.CSV; |
| | | logType = LogType.HTTP_ACCESS; |
| | | } |
| | | else if (configEntry.hasObjectClass("ds-cfg-external-access-log-publisher")) |
| | | else if (hasObjectClass(serverContext,configEntry, "ds-cfg-external-access-log-publisher")) |
| | | { |
| | | auditType = AuditType.EXTERNAL; |
| | | logType = LogType.ACCESS; |
| | | } |
| | | else if (configEntry.hasObjectClass("ds-cfg-external-http-access-log-publisher")) |
| | | else if (hasObjectClass(serverContext,configEntry, "ds-cfg-external-http-access-log-publisher")) |
| | | { |
| | | auditType = AuditType.EXTERNAL; |
| | | logType = LogType.HTTP_ACCESS; |
| | |
| | | isCommonAudit = auditType != null; |
| | | } |
| | | |
| | | private boolean hasObjectClass(ServerContext serverContext, Entry entry, String objectClassName) |
| | | { |
| | | ObjectClass objectClass = serverContext.getSchema().getObjectClass(objectClassName); |
| | | return objectClass != null && entry.hasObjectClass(objectClass); |
| | | } |
| | | |
| | | DN getDn() |
| | | { |
| | | return config.dn(); |
| | |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.replication.plugin.LDAPReplicationDomain.FractionalConfig; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | |
| | | * passed entry. Null if no configuration is found for the domain |
| | | * (not a replicated domain). |
| | | */ |
| | | private static FractionalConfig getStaticReplicationDomainFractionalConfig( |
| | | private static FractionalConfig getStaticReplicationDomainFractionalConfig(ServerContext serverContext, |
| | | Entry entry) throws Exception { |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | ReplicationSynchronizationProviderCfg sync = |
| | |
| | | try |
| | | { |
| | | localFractionalConfig = |
| | | getStaticReplicationDomainFractionalConfig(entry); |
| | | getStaticReplicationDomainFractionalConfig(getServerContext(), entry); |
| | | } catch (Exception ex) |
| | | { |
| | | return PluginResult.ImportLDIF.stopEntryProcessing( |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.AVA; |
| | |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.forgerock.opendj.server.config.server.ExternalChangelogDomainCfg; |
| | |
| | | import org.opends.server.config.ConfigConstants; |
| | | 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; |
| | |
| | | try |
| | | { |
| | | DN eclConfigEntryDN = DN.valueOf("cn=external changeLog," + config.dn()); |
| | | if (DirectoryServer.getConfigHandler().entryExists(eclConfigEntryDN)) |
| | | if (DirectoryServer.getConfigurationHandler().hasEntry(eclConfigEntryDN)) |
| | | { |
| | | DirectoryServer.getConfigHandler().deleteEntry(eclConfigEntryDN, null); |
| | | DirectoryServer.getConfigurationHandler().deleteEntry(eclConfigEntryDN); |
| | | } |
| | | } |
| | | catch(Exception e) |
| | |
| | | try |
| | | { |
| | | DN configDn = config.dn(); |
| | | if (DirectoryServer.getConfigHandler().entryExists(configDn)) |
| | | ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler(); |
| | | if (configHandler.hasEntry(config.dn())) |
| | | { |
| | | try |
| | | { eclDomCfg = domCfg.getExternalChangelogDomain(); |
| | |
| | | // no ECL config provided hence create a default one |
| | | // create the default one |
| | | DN eclConfigEntryDN = DN.valueOf("cn=external changelog," + configDn); |
| | | if (!DirectoryServer.getConfigHandler().entryExists(eclConfigEntryDN)) |
| | | if (!configHandler.hasEntry(eclConfigEntryDN)) |
| | | { |
| | | // no entry exist yet for the ECL config for this domain |
| | | // create it |
| | |
| | | ldifImportConfig.setValidateSchema(false); |
| | | LDIFReader reader = new LDIFReader(ldifImportConfig); |
| | | Entry eclEntry = reader.readEntry(); |
| | | DirectoryServer.getConfigHandler().addEntry(eclEntry, null); |
| | | configHandler.addEntry(Converters.from(eclEntry)); |
| | | ldifImportConfig.close(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_ID; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.messages.TaskMessages; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | 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.tools.BackendToolUtils; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.types.Attribute; |
| | |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.requests.Requests.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.TaskMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | { |
| | | try |
| | | { |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute( |
| | | ATTR_BACKEND_ID, |
| | | INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | return idAttr.activeValue(); |
| | | } |
| | | catch (org.opends.server.config.ConfigException ce) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, configEntry.getName(), ce.getMessage()); |
| | | return null; |
| | | return BackendToolUtils.getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_ID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return configEntries; |
| | | } |
| | | |
| | | Entry baseEntry; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | logger.error(ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, DN_BACKEND_BASE, ce.getMessage()); |
| | | return configEntries; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, DN_BACKEND_BASE, getExceptionMessage(e)); |
| | | return configEntries; |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | for (Entry configEntry : baseEntry.getChildren().values()) |
| | | try |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID; |
| | | try |
| | | ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler(); |
| | | for (DN childrenDn : configHandler.getChildren(backendBaseDN)) |
| | | { |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute( |
| | | ATTR_BACKEND_ID, |
| | | INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(), |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | Entry configEntry = null; |
| | | String backendID; |
| | | try |
| | | { |
| | | configEntry = Converters.to(configHandler.getEntry(childrenDn)); |
| | | backendID = BackendToolUtils.getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_ID); |
| | | if (backendID == null) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, childrenDn, getExceptionMessage(e)); |
| | | continue; |
| | | } |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | catch (org.opends.server.config.ConfigException ce) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, configEntry.getName(), ce.getMessage()); |
| | | continue; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, configEntry.getName(), getExceptionMessage(e)); |
| | | continue; |
| | | } |
| | | |
| | | configEntries.put(backendID, configEntry); |
| | | configEntries.put(backendID, configEntry); |
| | | } |
| | | } |
| | | catch (ConfigException e) |
| | | { |
| | | logger.error(ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY, DN_BACKEND_BASE, e.getMessage()); |
| | | } |
| | | |
| | | return configEntries; |
| | |
| | | */ |
| | | public static BackendCfg getConfigEntry(Backend<?> backend) |
| | | { |
| | | RootCfg root = ServerManagementContext.getInstance(). |
| | | getRootConfiguration(); |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | return root.getBackend(backend.getBackendID()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private static ServerManagementContext getServerManagementContext() |
| | | { |
| | | return DirectoryServer.getInstance().getServerContext().getServerManagementContext(); |
| | | } |
| | | |
| | | /** |
| | | * Enables a backend using an internal modify operation on the |
| | |
| | | throws DirectoryException |
| | | { |
| | | DN configEntryDN; |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | BackendCfg cfg = root.getBackend(backendID); |
| | |
| | | public static void disableBackend(String backendID) throws DirectoryException |
| | | { |
| | | DN configEntryDN; |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = getServerManagementContext().getRootConfiguration(); |
| | | try |
| | | { |
| | | BackendCfg cfg = root.getBackend(backendID); |
| | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | 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.*; |
| | |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.DebugLogger; |
| | | import org.opends.server.loggers.ErrorLogPublisher; |
| | | import org.opends.server.loggers.ErrorLogger; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | 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.types.Entry; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | { |
| | | try |
| | | { |
| | | final DN backendBaseDN = getBackendBaseDN(); |
| | | final Entry baseEntry = getBaseEntry(backendBaseDN); |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as backends. |
| | | final RootCfg root = ServerManagementContext.getInstance().getRootConfiguration(); |
| | | for (final Entry configEntry : baseEntry.getChildren().values()) |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler(); |
| | | final DN backendBaseDN = getBackendBaseDN(); |
| | | for (final DN childrenDn : configHandler.getChildren(backendBaseDN)) |
| | | { |
| | | Entry configEntry = Converters.to(configHandler.getEntry(childrenDn)); |
| | | final String backendID = getBackendID(configEntry); |
| | | final String backendClassName = getBackendClassName(configEntry); |
| | | if (backendID == null || backendClassName == null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns a string from the single valued attribute in provided entry. |
| | | * |
| | | * @param entry the entry |
| | | * @param attrName the attribute name |
| | | * @return the string value if available or {@code null} |
| | | */ |
| | | public static String getStringSingleValuedAttribute(Entry entry, String attrName) |
| | | { |
| | | List<Attribute> attributes = entry.getAttribute(attrName); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | Attribute attribute = attributes.get(0); |
| | | for (ByteString byteString : attribute) |
| | | { |
| | | return byteString.toString(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static List<DN> getBaseDNsForEntry(final Entry configEntry) throws Exception |
| | | { |
| | | try |
| | | { |
| | | final DNConfigAttribute baseDNStub = new DNConfigAttribute( |
| | | ATTR_BACKEND_BASE_DN, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), true, true, true); |
| | | final DNConfigAttribute baseDNAttr = (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr != null) |
| | | List<Attribute> attributes = configEntry.getAttribute(ATTR_BACKEND_BASE_DN); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | return baseDNAttr.activeValues(); |
| | | Attribute attribute = attributes.get(0); |
| | | List<DN> dns = new ArrayList<>(); |
| | | for (ByteString byteString : attribute) |
| | | { |
| | | dns.add(DN.valueOf(byteString.toString())); |
| | | } |
| | | return dns; |
| | | } |
| | | logger.error(ERR_NO_BASES_FOR_BACKEND, configEntry.getName()); |
| | | return null; |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute classStub = new StringConfigAttribute( |
| | | ATTR_BACKEND_CLASS, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS.get(), true, false, false); |
| | | final StringConfigAttribute classAttr = (StringConfigAttribute) configEntry.getConfigAttribute(classStub); |
| | | return classAttr != null ? classAttr.activeValue() : null; |
| | | } |
| | | catch (final org.opends.server.config.ConfigException ce) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_CLASS, configEntry.getName(), ce.getMessage()); |
| | | throw ce; |
| | | return getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_CLASS); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute idStub = new StringConfigAttribute( |
| | | ATTR_BACKEND_ID, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(), true, false, true); |
| | | final StringConfigAttribute idAttr = (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | return idAttr != null ? idAttr.activeValue() : null; |
| | | } |
| | | catch (final org.opends.server.config.ConfigException ce) |
| | | { |
| | | logger.error(ERR_CANNOT_DETERMINE_BACKEND_ID, configEntry.getName(), ce.getMessage()); |
| | | throw ce; |
| | | return getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_ID); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | import static com.forgerock.opendj.cli.CliMessages.INFO_JMXPORT_PLACEHOLDER; |
| | | import static com.forgerock.opendj.cli.CliMessages.INFO_PORT_PLACEHOLDER; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.ManagedObjectDefinition; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.LinkedAttribute; |
| | | import org.forgerock.opendj.ldap.LinkedHashMapEntry; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.forgerock.opendj.server.config.client.BackendCfgClient; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.quicksetup.installer.Installer; |
| | | import org.forgerock.opendj.config.DefaultBehaviorProvider; |
| | | import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider; |
| | | import org.forgerock.opendj.config.StringPropertyDefinition; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.server.config.meta.CryptoManagerCfgDefn; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.config.BooleanConfigAttribute; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.IntegerConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.extensions.SaltedSHA512PasswordStorageScheme; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.types.DirectoryEnvironmentConfig; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.NullOutputStream; |
| | |
| | | } |
| | | } |
| | | |
| | | //FIXME: Find a better way to do to prevent hardcoded ldif entries. |
| | | private static final String NEW_LINE = System.getProperty("line.separator"); |
| | | |
| | | // FIXME: Find a better way to prevent hardcoded ldif entries. |
| | | private static final String JCKES_KEY_MANAGER_DN = "cn=JCEKS,cn=Key Manager Providers,cn=config"; |
| | | private static final String JCKES_KEY_MANAGER_LDIF_ENTRY = |
| | | "dn: " + JCKES_KEY_MANAGER_DN + NEW_LINE |
| | |
| | | |
| | | private final String serverLockFileName = LockFileManager.getServerLockFileName(); |
| | | private final StringBuilder failureReason = new StringBuilder(); |
| | | private ConfigHandler<?> configHandler; |
| | | private ConfigurationHandler configHandler; |
| | | |
| | | private ConfigureDS(final String[] args, final OutputStream outStream, final OutputStream errStream) |
| | | { |
| | |
| | | |
| | | // Get the Directory Server configuration handler and use it to make the |
| | | // appropriate configuration changes. |
| | | configHandler = DirectoryServer.getConfigHandler(); |
| | | configHandler = DirectoryServer.getConfigurationHandler(); |
| | | |
| | | checkManagerProvider(keyManagerProviderDN, JCKES_KEY_MANAGER_DN, JCKES_KEY_MANAGER_LDIF_ENTRY, true); |
| | | checkManagerProvider(trustManagerProviderDN, JCKES_TRUST_MANAGER_DN, JCKES_TRUST_MANAGER_LDIF_ENTRY, false); |
| | |
| | | updateRootUser(rootDN, rootPW); |
| | | addFQDNDigestMD5(); |
| | | updateCryptoCipher(); |
| | | writeUpdatedConfiguration(); |
| | | printWrappedText(out, INFO_CONFIGDS_WROTE_UPDATED_CONFIG.get()); |
| | | |
| | | return SUCCESS; |
| | | } |
| | |
| | | .shortIdentifier(OPTION_SHORT_CONFIG_CLASS) |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | |
| | | String defaultHostName; |
| | | try |
| | | { |
| | |
| | | Entry mangerConfigEntry; |
| | | while ((mangerConfigEntry = reader.readEntry()) != null) |
| | | { |
| | | configHandler.addEntry(mangerConfigEntry, null); |
| | | configHandler.addEntry(Converters.from(mangerConfigEntry)); |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | |
| | | { |
| | | try |
| | | { |
| | | configHandler.getConfigEntry(dn); |
| | | getConfigEntry(dn); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final IntegerConfigAttribute portAttr = new IntegerConfigAttribute( |
| | | ATTR_LISTEN_PORT, INFO_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, 65535, ldapPort.getIntValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAP_CONNECTION_HANDLER)); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_LDAP_CONNECTION_HANDLER, ATTR_LISTEN_PORT, |
| | | DirectoryServer.getDefaultIntegerSyntax(), |
| | | ByteString.valueOfInt(ldapPort.getIntValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final IntegerConfigAttribute portAttr = new IntegerConfigAttribute( |
| | | ATTR_LISTEN_PORT, INFO_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, 65535, adminConnectorPort.getIntValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_ADMIN_CONNECTOR)); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_ADMIN_CONNECTOR, |
| | | ATTR_LISTEN_PORT, |
| | | DirectoryServer.getDefaultIntegerSyntax(), |
| | | ByteString.valueOfInt(adminConnectorPort.getIntValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final IntegerConfigAttribute portAttr = new IntegerConfigAttribute( |
| | | ATTR_LISTEN_PORT, INFO_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, 65535, ldapsPort.getIntValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAPS_CONNECTION_HANDLER)); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_LDAPS_CONNECTION_HANDLER, |
| | | ATTR_LISTEN_PORT, |
| | | DirectoryServer.getDefaultIntegerSyntax(), |
| | | ByteString.valueOfInt(ldapsPort.getIntValue())); |
| | | |
| | | final BooleanConfigAttribute enablePortAttr = new BooleanConfigAttribute( |
| | | ATTR_CONNECTION_HANDLER_ENABLED, INFO_LDAPS_CONNHANDLER_DESCRIPTION_ENABLE.get(), true, true); |
| | | configEntry.putConfigAttribute(enablePortAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_LDAPS_CONNECTION_HANDLER, |
| | | ATTR_CONNECTION_HANDLER_ENABLED, |
| | | DirectoryServer.getDefaultBooleanSyntax(), |
| | | ByteString.valueOfUtf8("TRUE")); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | updateConfigEntryWithAttribute( |
| | | DN_JMX_CONNECTION_HANDLER, |
| | | ATTR_LISTEN_PORT, |
| | | DirectoryServer.getDefaultIntegerSyntax(), |
| | | ByteString.valueOfInt(jmxPort.getIntValue())); |
| | | |
| | | final IntegerConfigAttribute portAttr = new IntegerConfigAttribute( |
| | | ATTR_LISTEN_PORT, INFO_JMX_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, 65535, jmxPort.getIntValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_JMX_CONNECTION_HANDLER)); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | |
| | | final BooleanConfigAttribute enablePortAttr = new BooleanConfigAttribute( |
| | | ATTR_CONNECTION_HANDLER_ENABLED, INFO_JMX_CONNHANDLER_DESCRIPTION_ENABLE.get(), true, true); |
| | | configEntry.putConfigAttribute(enablePortAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_JMX_CONNECTION_HANDLER, |
| | | ATTR_CONNECTION_HANDLER_ENABLED, |
| | | DirectoryServer.getDefaultBooleanSyntax(), |
| | | ByteString.valueOfUtf8("TRUE")); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final BooleanConfigAttribute startTLS = new BooleanConfigAttribute( |
| | | ATTR_ALLOW_STARTTLS, INFO_LDAP_CONNHANDLER_DESCRIPTION_ALLOW_STARTTLS.get(), true, true); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAP_CONNECTION_HANDLER)); |
| | | configEntry.putConfigAttribute(startTLS); |
| | | updateConfigEntryWithAttribute( |
| | | DN_LDAP_CONNECTION_HANDLER, |
| | | ATTR_ALLOW_STARTTLS, |
| | | DirectoryServer.getDefaultBooleanSyntax(), |
| | | ByteString.valueOfUtf8("TRUE")); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | try |
| | | { |
| | | // Enable the key manager |
| | | final BooleanConfigAttribute enableAttr = new BooleanConfigAttribute( |
| | | ATTR_KEYMANAGER_ENABLED, INFO_CONFIG_KEYMANAGER_DESCRIPTION_ENABLED.get(), true, true); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(keyManagerProviderDN.getValue())); |
| | | configEntry.putConfigAttribute(enableAttr); |
| | | updateConfigEntryWithAttribute( |
| | | keyManagerProviderDN.getValue(), |
| | | ATTR_KEYMANAGER_ENABLED, |
| | | DirectoryServer.getDefaultBooleanSyntax(), |
| | | ByteString.valueOfUtf8("TRUE")); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute pathAttr = new StringConfigAttribute( |
| | | ATTR_KEYSTORE_FILE, INFO_FILE_KEYMANAGER_DESCRIPTION_FILE.get(), |
| | | true, true, true, keyManagerPath.getValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(keyManagerProviderDN.getValue())); |
| | | configEntry.putConfigAttribute(pathAttr); |
| | | updateConfigEntryWithAttribute( |
| | | keyManagerProviderDN.getValue(), |
| | | ATTR_KEYSTORE_FILE, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(keyManagerPath.getValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute keyManagerProviderAttr = new StringConfigAttribute( |
| | | ATTR_KEYMANAGER_DN, INFO_LDAP_CONNHANDLER_DESCRIPTION_KEYMANAGER_DN.get(), |
| | | false, false, true, keyManagerProviderDN.getValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(attributeDN)); |
| | | configEntry.putConfigAttribute(keyManagerProviderAttr); |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_KEYMANAGER_DN, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(keyManagerProviderDN.getValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final BooleanConfigAttribute enableAttr = new BooleanConfigAttribute( |
| | | ATTR_TRUSTMANAGER_ENABLED, ERR_CONFIG_TRUSTMANAGER_DESCRIPTION_ENABLED.get(), true, true); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(trustManagerProviderDN.getValue())); |
| | | configEntry.putConfigAttribute(enableAttr); |
| | | updateConfigEntryWithAttribute( |
| | | trustManagerProviderDN.getValue(), |
| | | ATTR_TRUSTMANAGER_ENABLED, |
| | | DirectoryServer.getDefaultBooleanSyntax(), |
| | | ByteString.valueOfUtf8("TRUE")); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | |
| | | if (certNickNames.isPresent()) |
| | | { |
| | | final StringConfigAttribute certNickNamesAttr = new StringConfigAttribute( |
| | | ATTR_SSL_CERT_NICKNAME, INFO_LDAP_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME.get(), |
| | | false, true, true, certNickNames.getValues()); |
| | | updateCertNicknameEntry(ldapPort, DN_LDAP_CONNECTION_HANDLER, certNickNamesAttr); |
| | | updateCertNicknameEntry(ldapsPort, DN_LDAPS_CONNECTION_HANDLER, certNickNamesAttr); |
| | | updateCertNicknameEntry(certNickNames, DN_HTTP_CONNECTION_HANDLER, certNickNamesAttr); |
| | | |
| | | final StringConfigAttribute certNickNamesJmxAttr = new StringConfigAttribute( |
| | | ATTR_SSL_CERT_NICKNAME, INFO_JMX_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME.get(), |
| | | false, false, true, certNickNames.getValues()); |
| | | updateCertNicknameEntry(jmxPort, DN_JMX_CONNECTION_HANDLER, certNickNamesJmxAttr); |
| | | updateCertNicknameEntry(ldapPort, DN_LDAP_CONNECTION_HANDLER, ATTR_SSL_CERT_NICKNAME, certNickNames.getValues()); |
| | | updateCertNicknameEntry(ldapsPort, DN_LDAPS_CONNECTION_HANDLER, ATTR_SSL_CERT_NICKNAME, certNickNames.getValues()); |
| | | updateCertNicknameEntry(certNickNames, DN_HTTP_CONNECTION_HANDLER, ATTR_SSL_CERT_NICKNAME, certNickNames.getValues()); |
| | | updateCertNicknameEntry(jmxPort, DN_JMX_CONNECTION_HANDLER, ATTR_SSL_CERT_NICKNAME, certNickNames.getValues()); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute trustManagerProviderAttr = new StringConfigAttribute( |
| | | ATTR_TRUSTMANAGER_DN, INFO_LDAP_CONNHANDLER_DESCRIPTION_TRUSTMANAGER_DN.get(), |
| | | false, false, true, trustManagerProviderDN.getValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(attributeDN)); |
| | | configEntry.putConfigAttribute(trustManagerProviderAttr); |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | ATTR_TRUSTMANAGER_DN, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(trustManagerProviderDN.getValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | } |
| | | |
| | | private void updateCertNicknameEntry(final Argument arg, final String attributeDN, |
| | | final StringConfigAttribute configAttr) throws ConfigureDSException |
| | | final String attrName, final List<String> attrValues) throws ConfigureDSException |
| | | { |
| | | try |
| | | { |
| | | Entry configEntry = configHandler.getConfigEntry(DN.valueOf(attributeDN)); |
| | | if (arg.isPresent()) |
| | | { |
| | | configEntry.putConfigAttribute(configAttr); |
| | | Object[] values = new ByteString[attrValues.size()]; |
| | | int index = 0; |
| | | for (String attrValue : attrValues) |
| | | { |
| | | values[index++] = ByteString.valueOfUtf8(attrValue); |
| | | } |
| | | updateConfigEntryWithAttribute( |
| | | attributeDN, |
| | | attrName, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | values); |
| | | } |
| | | else |
| | | { |
| | | configEntry.removeConfigAttribute(ATTR_SSL_CERT_NICKNAME); |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_SSL_CERT_NICKNAME); |
| | | } |
| | | } |
| | | catch (final Exception e) |
| | |
| | | { |
| | | try |
| | | { |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(attributeDN)); |
| | | configEntry.removeConfigAttribute(ATTR_SSL_CERT_NICKNAME.toLowerCase()); |
| | | updateConfigEntryByRemovingAttribute(attributeDN, ATTR_SSL_CERT_NICKNAME); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final DNConfigAttribute bindDNAttr = new DNConfigAttribute( |
| | | ATTR_ROOTDN_ALTERNATE_BIND_DN, INFO_CONFIG_ROOTDN_DESCRIPTION_ALTERNATE_BIND_DN.get(), |
| | | false, true, false, rootDN); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_ROOT_USER)); |
| | | configEntry.putConfigAttribute(bindDNAttr); |
| | | |
| | | updateConfigEntryWithAttribute( |
| | | DN_ROOT_USER, |
| | | ATTR_ROOTDN_ALTERNATE_BIND_DN, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(rootDN.toString())); |
| | | final String encodedPassword = SaltedSHA512PasswordStorageScheme.encodeOffline(getBytes(rootPW)); |
| | | final StringConfigAttribute bindPWAttr = new StringConfigAttribute( |
| | | ATTR_USER_PASSWORD, LocalizableMessage.EMPTY, false, false, false, encodedPassword); |
| | | configEntry.putConfigAttribute(bindPWAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_ROOT_USER, |
| | | ATTR_USER_PASSWORD, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(encodedPassword)); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute fqdnAttr = new StringConfigAttribute( |
| | | "ds-cfg-server-fqdn", LocalizableMessage.EMPTY, false, false, false, hostName.getValue()); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_DIGEST_MD5_SASL_MECHANISM)); |
| | | configEntry.putConfigAttribute(fqdnAttr); |
| | | updateConfigEntryWithAttribute( |
| | | DN_DIGEST_MD5_SASL_MECHANISM, |
| | | "ds-cfg-server-fqdn", |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(hostName.getValue())); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | final StringConfigAttribute keyWrappingTransformation = new StringConfigAttribute( |
| | | ATTR_CRYPTO_CIPHER_KEY_WRAPPING_TRANSFORMATION, LocalizableMessage.EMPTY, |
| | | false, false, true, alternativeCipher); |
| | | final Entry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_CRYPTO_MANAGER)); |
| | | configEntry.putConfigAttribute(keyWrappingTransformation); |
| | | updateConfigEntryWithAttribute( |
| | | DN_CRYPTO_MANAGER, |
| | | ATTR_CRYPTO_CIPHER_KEY_WRAPPING_TRANSFORMATION, |
| | | DirectoryServer.getDefaultStringSyntax(), |
| | | ByteString.valueOfUtf8(alternativeCipher)); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void writeUpdatedConfiguration() throws ConfigureDSException |
| | | /** Update a config entry with the provided attribute parameters. */ |
| | | private void updateConfigEntryWithAttribute(String entryDn, String attributeName, Syntax syntax, Object...values) |
| | | throws DirectoryException, ConfigException |
| | | { |
| | | try |
| | | org.forgerock.opendj.ldap.Entry configEntry = getConfigEntry(DN.valueOf(entryDn)); |
| | | final org.forgerock.opendj.ldap.Entry newEntry = putAttribute(configEntry, attributeName, syntax, values); |
| | | configHandler.replaceEntry(configEntry, newEntry); |
| | | } |
| | | |
| | | /** Update a config entry by removing the provided attribute. */ |
| | | private void updateConfigEntryByRemovingAttribute(String entryDn, String attributeName) |
| | | throws DirectoryException, ConfigException |
| | | { |
| | | final org.forgerock.opendj.ldap.Entry configEntry = getConfigEntry(DN.valueOf(entryDn)); |
| | | final Entry newEntry = removeAttribute(Converters.to(configEntry), attributeName); |
| | | configHandler.replaceEntry(configEntry, Converters.from(newEntry)); |
| | | } |
| | | |
| | | private org.forgerock.opendj.ldap.Entry getConfigEntry(DN dn) throws ConfigException |
| | | { |
| | | return configHandler.getEntry(dn); |
| | | } |
| | | |
| | | /** |
| | | * Duplicate the provided entry, and put an attribute to the duplicated entry. |
| | | * <p> |
| | | * Provided entry is not modified. |
| | | * |
| | | * @return the duplicate entry, modified with the attribute |
| | | */ |
| | | private org.forgerock.opendj.ldap.Entry putAttribute( |
| | | org.forgerock.opendj.ldap.Entry configEntry, String attrName, Syntax syntax, Object...values) |
| | | { |
| | | org.forgerock.opendj.ldap.Entry newEntry = new LinkedHashMapEntry(configEntry); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName, syntax); |
| | | newEntry.replaceAttribute(new LinkedAttribute(AttributeDescription.create(attrType), values)); |
| | | return newEntry; |
| | | } |
| | | |
| | | /** |
| | | * Duplicate the provided entry, and remove an attribute to the duplicated entry. |
| | | * <p> |
| | | * Provided entry is not modified. |
| | | * |
| | | * @return the duplicate entry, with removed attribute |
| | | */ |
| | | private Entry removeAttribute(Entry entry, String attrName) |
| | | { |
| | | Entry duplicateEntry = entry.duplicate(false); |
| | | for (AttributeType t : entry.getUserAttributes().keySet()) |
| | | { |
| | | configHandler.writeUpdatedConfig(); |
| | | printWrappedText(out, INFO_CONFIGDS_WROTE_UPDATED_CONFIG.get()); |
| | | if (t.hasNameOrOID(attrName)) |
| | | { |
| | | entry.getUserAttributes().remove(t); |
| | | return duplicateEntry; |
| | | } |
| | | } |
| | | catch (final DirectoryException de) |
| | | |
| | | for (AttributeType t : entry.getOperationalAttributes().keySet()) |
| | | { |
| | | throw new ConfigureDSException(de, ERR_CONFIGDS_CANNOT_WRITE_UPDATED_CONFIG.get(de.getMessageObject())); |
| | | if (t.hasNameOrOID(attrName)) |
| | | { |
| | | entry.getOperationalAttributes().remove(t); |
| | | return duplicateEntry; |
| | | } |
| | | } |
| | | return duplicateEntry; |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.forgerock.opendj.server.config.server.LDIFBackendCfg; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.core.PasswordStorageSchemeConfigManager; |
| | | import org.opends.server.crypto.CryptoManagerSync; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.schema.AuthPasswordSyntax; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | throws InitializationException, ConfigException { |
| | | directoryServer.initializeRootDSE(); |
| | | |
| | | RootCfg root = serverContext.getServerManagementContext().getRootConfiguration(); |
| | | RootCfg root = directoryServer.getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | Entry backendRoot; |
| | | try { |
| | | DN configEntryDN = DN.valueOf(ConfigConstants.DN_BACKEND_BASE); |
| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | 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.*; |
| | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.DebugLogger; |
| | | import org.opends.server.loggers.ErrorLogPublisher; |
| | | import org.opends.server.loggers.ErrorLogger; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | |
| | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.core.PluginConfigManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.ErrorLogPublisher; |
| | | import org.opends.server.loggers.ErrorLogger; |
| | | import org.opends.server.loggers.JDKLogging; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | |
| | | .shortIdentifier(OPTION_SHORT_CONFIG_CLASS) |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | |
| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | 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.*; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | |
| | | .shortIdentifier(OPTION_SHORT_CONFIG_CLASS) |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | sourceFile = |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | |
| | | .shortIdentifier(OPTION_SHORT_CONFIG_CLASS) |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | filterFile = |
| | |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_BACKEND_BASE_DN; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | |
| | | |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | | import org.opends.server.util.BuildVersion; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | throw new ConfigException(message, e); |
| | | } |
| | | |
| | | Entry baseEntry = null; |
| | | try |
| | | { |
| | | baseEntry = DirectoryServer.getConfigEntry(backendBaseDN); |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY.get( |
| | | DN_BACKEND_BASE, ce.getMessage()); |
| | | throw new ConfigException(message, ce); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_RETRIEVE_BACKEND_BASE_ENTRY.get( |
| | | DN_BACKEND_BASE, getExceptionMessage(e)); |
| | | throw new ConfigException(message, e); |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as backends. |
| | | TreeMap<String,TreeSet<DN>> backendMap = new TreeMap<>(); |
| | | for (Entry configEntry : baseEntry.getChildren().values()) |
| | | ConfigurationHandler configHandler = DirectoryServer.getConfigurationHandler(); |
| | | for (DN childrenDn : configHandler.getChildren(backendBaseDN)) |
| | | { |
| | | Entry configEntry = Converters.to(configHandler.getEntry(childrenDn)); |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | | // skip the entry. |
| | | String backendID = null; |
| | | try |
| | | { |
| | | LocalizableMessage msg = INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(); |
| | | StringConfigAttribute idStub = |
| | | new StringConfigAttribute(ATTR_BACKEND_ID, msg, |
| | | true, false, true); |
| | | StringConfigAttribute idAttr = |
| | | (StringConfigAttribute) configEntry.getConfigAttribute(idStub); |
| | | if (idAttr == null) |
| | | backendID = BackendToolUtils.getStringSingleValuedAttribute(configEntry, ATTR_BACKEND_ID); |
| | | if (backendID == null) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | backendID = idAttr.activeValue(); |
| | | } |
| | | } |
| | | catch (ConfigException ce) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_DETERMINE_BACKEND_ID.get(configEntry.getName(), ce.getMessage()); |
| | | throw new ConfigException(message, ce); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | TreeSet<DN> baseDNs = new TreeSet<>(); |
| | | try |
| | | { |
| | | LocalizableMessage msg = INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(); |
| | | DNConfigAttribute baseDNStub = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, msg, |
| | | true, true, true); |
| | | DNConfigAttribute baseDNAttr = |
| | | (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); |
| | | if (baseDNAttr != null) |
| | | List<Attribute> attributes = configEntry.getAttribute(ATTR_BACKEND_BASE_DN); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | baseDNs.addAll(baseDNAttr.activeValues()); |
| | | Attribute attribute = attributes.get(0); |
| | | for (ByteString byteString : attribute) |
| | | { |
| | | baseDNs.add(DN.valueOf(byteString.toString())); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | | |
| | |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.backends.RebuildConfig; |
| | | import org.opends.server.backends.RebuildConfig.RebuildMode; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.DebugLogger; |
| | | import org.opends.server.loggers.ErrorLogPublisher; |
| | | import org.opends.server.loggers.ErrorLogger; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | 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.*; |
| | |
| | | import org.forgerock.opendj.server.config.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.DebugLogger; |
| | | import org.opends.server.loggers.ErrorLogPublisher; |
| | | import org.opends.server.loggers.ErrorLogger; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | | import org.opends.server.backends.VerifyConfig; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.CoreConfigManager; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.NullOutputStream; |
| | |
| | | .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) |
| | | .hidden() |
| | | .required() |
| | | .defaultValue(ConfigFileHandler.class.getName()) |
| | | .defaultValue(ConfigurationHandler.class.getName()) |
| | | .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) |
| | | .buildAndAddToParser(argParser); |
| | | configFile = |
| | |
| | | import org.opends.server.admin.client.cli.SecureConnectionCliArgs; |
| | | import org.opends.server.admin.client.cli.SecureConnectionCliParser; |
| | | import org.opends.server.admin.client.cli.TaskScheduleArgs; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.tasks.PurgeConflictsHistoricalTask; |
| | | |
| | | import com.forgerock.opendj.cli.Argument; |
| | |
| | | defaultArgs.add(index++, advancedArg); |
| | | |
| | | configClassArg = |
| | | configClassArgument(ConfigFileHandler.class.getName()); |
| | | configClassArgument(ConfigurationHandler.class.getName()); |
| | | defaultArgs.add(index++, configClassArg); |
| | | |
| | | configFileArg = configFileArgument(); |
| | |
| | | import static com.forgerock.opendj.cli.Utils.*; |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | | import static javax.security.auth.callback.TextOutputCallback.*; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.tools.upgrade.FormattedNotificationCallback.*; |
| | | import static org.opends.server.tools.upgrade.Upgrade.*; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.messages.RuntimeMessages; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.JDKLogging; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | |
| | | { |
| | | if (!globalArgumentsInitialized) |
| | | { |
| | | configClass = configClassArgument(ConfigFileHandler.class.getName()); |
| | | configClass = configClassArgument(ConfigurationHandler.class.getName()); |
| | | configFile = configFileArgument(); |
| | | noPrompt = noPromptArgument(); |
| | | verbose = verboseArgument(); |
| | |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.api.AlertGenerator; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.api.ExtendedOperationHandler; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.api.ServerShutdownListener; |
| | |
| | | return DirectoryServer.getOperatingSystem(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a reference to the Directory Server configuration |
| | | * handler. |
| | | * |
| | | * @return A reference to the Directory Server configuration |
| | | * handler. |
| | | */ |
| | | public static ConfigHandler getConfigHandler() |
| | | { |
| | | return DirectoryServer.getConfigHandler(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the requested entry from the Directory Server |
| | | * configuration. |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.ConfigFileHandler; |
| | | |
| | | /** |
| | | * This class provides a set of properties that may control various |
| | |
| | | String className = getProperty(PROPERTY_CONFIG_CLASS); |
| | | if (className == null) |
| | | { |
| | | return ConfigFileHandler.class; |
| | | return ConfigurationHandler.class; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return ConfigFileHandler.class; |
| | | return ConfigurationHandler.class; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | checkServerIsRunning(); |
| | | |
| | | if (!ConfigHandler.class.isAssignableFrom(configClass)) |
| | | if (!ConfigurationHandler.class.isAssignableFrom(configClass)) |
| | | { |
| | | throw new InitializationException( |
| | | ERR_DIRCFG_INVALID_CONFIG_CLASS.get( |
| | | configClass.getName())); |
| | | } |
| | | |
| | | String oldClassName = setProperty(PROPERTY_CONFIG_CLASS, |
| | | configClass.getName()); |
| | | String oldClassName = setProperty(PROPERTY_CONFIG_CLASS, configClass.getName()); |
| | | if (oldClassName == null) |
| | | { |
| | | return null; |
| | |
| | | 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; |
| | |
| | | |
| | | // If the target entry is in the server configuration, then make sure the |
| | | // requester has the CONFIG_READ privilege. |
| | | if (DirectoryServer.getConfigHandler().handlesEntry(entryDN) |
| | | if (DirectoryServer.getBackend(ConfigurationBackend.CONFIG_BACKEND_ID).handlesEntry(entryDN) |
| | | && !clientConnection.hasPrivilege(Privilege.CONFIG_READ, this)) |
| | | { |
| | | appendErrorMessage(ERR_COMPARE_CONFIG_INSUFFICIENT_PRIVILEGES.get()); |
| | |
| | | |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.opends.server.core.ConfigurationBootstrapper; |
| | | import org.opends.server.core.ConfigurationHandler; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.DirectoryEnvironmentConfig; |
| | | import org.opends.server.types.InitializationException; |
| | |
| | | public ServerContextBuilder withConfigurationBootstrapped() |
| | | throws InitializationException |
| | | { |
| | | final ServerManagementContext serverManagementContext = ConfigurationBootstrapper.bootstrap(serverContext); |
| | | final ServerManagementContext serverManagementContext = |
| | | ConfigurationBootstrapper.bootstrap(serverContext, ConfigurationHandler.class); |
| | | when(serverContext.getServerManagementContext()).thenReturn(serverManagementContext); |
| | | return this; |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.client.ManagementContext; |
| | | import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor; |
| | | import org.forgerock.opendj.config.client.ldap.LDAPConnection; |
| | | import org.forgerock.opendj.config.client.ldap.LDAPManagementContext; |
| | | import org.forgerock.opendj.server.config.client.RootCfgClient; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.WorkQueue; |
| | | import org.opends.server.api.plugin.PluginType; |
| | |
| | | import org.opends.server.backends.pluggable.EntryContainer; |
| | | import org.opends.server.backends.pluggable.RootContainer; |
| | | 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.extensions.ConfigFileHandler; |
| | | import org.opends.server.loggers.*; |
| | | import org.opends.server.plugins.InvocationCounterPlugin; |
| | | import org.opends.server.protocols.ldap.BindRequestProtocolOp; |
| | |
| | | config.setInstanceRoot(testInstanceRoot); |
| | | |
| | | config.setForceDaemonThreads(true); |
| | | config.setConfigClass(ConfigFileHandler.class); |
| | | config.setConfigClass(ConfigurationHandler.class); |
| | | config.setConfigFile(new File(testConfigDir, "config.ldif")); |
| | | |
| | | // Initialize the configuration framework for DSConfig. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Gets the root configuration associated with the active server |
| | | * instance. This root configuration can then be used to access and |
| | | * modify the server's configuration using that administration |
| | | * framework's strongly typed API. |
| | | * <p> |
| | | * Note: were possible the {@link #dsconfig(String...)} method |
| | | * should be used in preference to this method in order to perform |
| | | * end-to-end testing. |
| | | * |
| | | * @return Returns the root configuration associated with the active |
| | | * server instance. |
| | | * @throws Exception |
| | | * If the management context could not be initialized |
| | | * against the active server instance. |
| | | */ |
| | | public static RootCfgClient getRootConfiguration() throws Exception |
| | | { |
| | | LDAPConnection connection = JNDIDirContextAdaptor.simpleSSLBind( |
| | | "127.0.0.1", |
| | | serverAdminPort, |
| | | "cn=Directory Manager", |
| | | "password"); |
| | | |
| | | ManagementContext context = LDAPManagementContext.createFromContext(connection); |
| | | return context.getRootConfiguration(); |
| | | } |
| | | |
| | | /** |
| | | * Return a String representation of all of the current threads. |
| | | * @return a dump of all Threads on the server |
| | | */ |
| | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.plugins.NullPlugin; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | Collections.addAll(pluginTypes, PluginType.values()); |
| | | |
| | | nullPlugin.initializeInternal(configuration.dn(), pluginTypes, |
| | | nullPlugin.initializeInternal(DirectoryServer.getInstance().getServerContext(), |
| | | configuration.dn(), pluginTypes, |
| | | configuration.isInvokeForInternalOperations()); |
| | | assertEquals(nullPlugin.getPluginEntryDN(), pluginEntryDN); |
| | | } |
| | |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | Collections.addAll(pluginTypes, PluginType.values()); |
| | | |
| | | nullPlugin.initializeInternal(configuration.dn(), pluginTypes, |
| | | nullPlugin.initializeInternal(DirectoryServer.getInstance().getServerContext(), |
| | | configuration.dn(), pluginTypes, |
| | | configuration.isInvokeForInternalOperations()); |
| | | assertEquals(nullPlugin.getPluginTypes(), pluginTypes); |
| | | } |
| | |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import static org.mockito.Mockito.when; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.ConfigurationMock.mockCfg; |
| | | |
| | | import org.forgerock.opendj.server.config.server.JEBackendCfg; |
| | | import org.opends.server.backends.pluggable.PluggableBackendImplTestCase; |
| | |
| | | @Override |
| | | protected JEBackendCfg createBackendCfg() |
| | | { |
| | | JEBackendCfg backendCfg = legacyMockCfg(JEBackendCfg.class); |
| | | JEBackendCfg backendCfg = mockCfg(JEBackendCfg.class); |
| | | when(backendCfg.getBackendId()).thenReturn("JETestCase"); |
| | | when(backendCfg.getDBDirectory()).thenReturn("JETestCase"); |
| | | when(backendCfg.getDBDirectoryPermissions()).thenReturn("755"); |
| | |
| | | |
| | | import static org.assertj.core.api.Assertions.assertThat; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.ConfigurationMock.mockCfg; |
| | | import static org.opends.server.TestCaseUtils.makeEntry; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.getRootConnection; |
| | | import static org.opends.server.protocols.internal.Requests.newSearchRequest; |
| | |
| | | |
| | | final DN baseDN = DN.valueOf(BACKEND_BASE_DN); |
| | | |
| | | final PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | final PDBBackendCfg backendCfg = mockCfg(PDBBackendCfg.class); |
| | | when(backendCfg.dn()).thenReturn(baseDN); |
| | | when(backendCfg.getBackendId()).thenReturn(BACKEND_NAME); |
| | | when(backendCfg.getBaseDN()).thenReturn(newTreeSet(baseDN)); |
| | |
| | | private void createVlvIndex(final DN baseDN, final PDBBackendCfg backendCfg, final String sortOrder) |
| | | throws ConfigException |
| | | { |
| | | final BackendVLVIndexCfg vlvIndexCfg = legacyMockCfg(BackendVLVIndexCfg.class); |
| | | final BackendVLVIndexCfg vlvIndexCfg = mockCfg(BackendVLVIndexCfg.class); |
| | | when(vlvIndexCfg.getName()).thenReturn(sortOrder); |
| | | when(vlvIndexCfg.getBaseDN()).thenReturn(baseDN); |
| | | when(vlvIndexCfg.getFilter()).thenReturn(VLV_FILTER); |
| | |
| | | import org.testng.annotations.BeforeMethod; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | @Test(groups = { "precommit", "pluggablebackend" }, sequential = true) |
| | | public class DN2IDTest extends DirectoryServerTestCase |
| | | { |
| | |
| | | private static PDBBackendCfg createBackendCfg() throws ConfigException, DirectoryException |
| | | { |
| | | String homeDirName = "pdb_test"; |
| | | PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | PDBBackendCfg backendCfg = mockCfg(PDBBackendCfg.class); |
| | | |
| | | when(backendCfg.getBackendId()).thenReturn("persTest" + homeDirName); |
| | | when(backendCfg.getDBDirectory()).thenReturn(homeDirName); |
| | |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | |
| | | import org.testng.annotations.BeforeMethod; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | @Test(groups = { "precommit", "pluggablebackend" }, sequential = true) |
| | | public class ID2ChildrenCountTest extends DirectoryServerTestCase |
| | | { |
| | |
| | | private PDBBackendCfg createBackendCfg() throws ConfigException, DirectoryException |
| | | { |
| | | String homeDirName = "pdb_test"; |
| | | PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | PDBBackendCfg backendCfg = mockCfg(PDBBackendCfg.class); |
| | | |
| | | when(backendCfg.getBackendId()).thenReturn("persTest" + homeDirName); |
| | | when(backendCfg.getDBDirectory()).thenReturn(homeDirName); |
| | |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | |
| | | private PDBBackendCfg createBackendCfg() throws ConfigException, DirectoryException |
| | | { |
| | | String homeDirName = "pdb_test"; |
| | | PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | PDBBackendCfg backendCfg = mockCfg(PDBBackendCfg.class); |
| | | |
| | | when(backendCfg.getBackendId()).thenReturn("persTest" + homeDirName); |
| | | when(backendCfg.getDBDirectory()).thenReturn(homeDirName); |
| | |
| | | when(backendCfg.listBackendIndexes()).thenReturn(new String[] { "sn" }); |
| | | when(backendCfg.listBackendVLVIndexes()).thenReturn(new String[0]); |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | |
| | | package org.opends.server.backends.pluggable.pdb; |
| | | |
| | | import static org.mockito.Mockito.when; |
| | | import static org.opends.server.ConfigurationMock.legacyMockCfg; |
| | | import static org.opends.server.ConfigurationMock.mockCfg; |
| | | |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.opends.server.backends.pdb.PDBBackend; |
| | |
| | | @Override |
| | | protected PDBBackendCfg createBackendCfg() |
| | | { |
| | | PDBBackendCfg backendCfg = legacyMockCfg(PDBBackendCfg.class); |
| | | PDBBackendCfg backendCfg = mockCfg(PDBBackendCfg.class); |
| | | when(backendCfg.getBackendId()).thenReturn("PDBTestCase"); |
| | | when(backendCfg.getDBDirectory()).thenReturn("PDBTestCase"); |
| | | when(backendCfg.getDBDirectoryPermissions()).thenReturn("755"); |
| | |
| | | public void testInvalidConstructor(Entry e) |
| | | throws Exception |
| | | { |
| | | DN parentDN = DN.valueOf("cn=Password Policies,cn=config"); |
| | | Entry parentEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | Entry configEntry = new Entry(e, parentEntry); |
| | | |
| | | PasswordPolicyCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), |
| | | configEntry); |
| | | AdminTestCaseUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), e); |
| | | |
| | | new PasswordPolicyFactory().createAuthenticationPolicy(configuration); |
| | | } |
| | |
| | | new BcryptPasswordStorageScheme(); |
| | | |
| | | BcryptPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | BcryptPasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry.getEntry() |
| | | ); |
| | | AdminTestCaseUtils.getConfiguration(BcryptPasswordStorageSchemeCfgDefn.getInstance(), configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | |
| | | * Tests to ensure that the notification handler initialization fails with an |
| | | * invalid configuration. |
| | | * |
| | | * @param e The configuration entry to use to initialize the account status |
| | | * @param configEntry The configuration entry to use to initialize the account status |
| | | * notificaton handler. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | |
| | | @Test(dataProvider = "invalidConfigs", |
| | | expectedExceptions = { ConfigException.class, |
| | | InitializationException.class }) |
| | | public void testInalidConfigs(Entry e) |
| | | public void testInvalidConfigs(Entry configEntry) |
| | | throws Exception |
| | | { |
| | | DN parentDN = |
| | | DN.valueOf("cn=Account Status Notification Handlers,cn=config"); |
| | | Entry parentEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | Entry configEntry = new Entry(e, parentEntry); |
| | | |
| | | ErrorLogAccountStatusNotificationHandler handler = |
| | | new ErrorLogAccountStatusNotificationHandler(); |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration = |
| | |
| | | |
| | | DN synchroServerDN = DN.valueOf(synchroServerStringDN); |
| | | |
| | | Entry ecle = DirectoryServer.getConfigHandler().getEntry( |
| | | DN.valueOf("cn=external changelog," + synchroServerStringDN)); |
| | | Entry ecle = DirectoryServer.getConfigEntry(DN.valueOf("cn=external changelog," + synchroServerStringDN)); |
| | | if (ecle!=null) |
| | | { |
| | | DirectoryServer.getConfigHandler().deleteEntry(ecle.getName(), null); |
| | | DirectoryServer.getConfigurationHandler().deleteEntry(ecle.getName()); |
| | | } |
| | | DirectoryServer.getConfigHandler().deleteEntry(synchroServerDN, null); |
| | | DirectoryServer.getConfigurationHandler().deleteEntry(synchroServerDN); |
| | | assertNull(DirectoryServer.getConfigEntry(synchroServerEntry.getName()), |
| | | "Unable to delete the synchronized domain"); |
| | | synchroServerEntry = null; |
| | |
| | | import org.assertj.core.api.Assertions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | Entry repDomainEntry = TestCaseUtils.entryFromLdifString(synchroServerLdif); |
| | | |
| | | // Configure replication domain |
| | | DirectoryServer.getConfigHandler().addEntry(repDomainEntry, null); |
| | | DirectoryServer.getConfigurationHandler().addEntry(Converters.from(repDomainEntry)); |
| | | assertNotNull(DirectoryServer.getConfigEntry(repDomainEntry.getName()), |
| | | "Unable to add the synchronized server"); |
| | | configEntriesToCleanup.add(repDomainEntry.getName()); |
| | |
| | | import org.assertj.core.api.SoftAssertions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | |
| | | { |
| | | if (configEntry != null) |
| | | { |
| | | DirectoryServer.getConfigHandler().addEntry(configEntry, null); |
| | | DirectoryServer.getConfigurationHandler().addEntry(Converters.from(configEntry)); |
| | | assertNotNull(DirectoryServer.getConfigEntry(configEntry.getName()), errorMessage); |
| | | configEntriesToCleanup.add(configEntry.getName()); |
| | | } |
| | |
| | | import org.assertj.core.data.MapEntry; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | |
| | | Entry domainCfgEntry = TestCaseUtils.entryFromLdifString(configEntryLdif); |
| | | |
| | | // Add the config entry to create the replicated domain |
| | | DirectoryServer.getConfigHandler().addEntry(domainCfgEntry, null); |
| | | DirectoryServer.getConfigurationHandler().addEntry(Converters.from(domainCfgEntry)); |
| | | assertNotNull(DirectoryServer.getConfigEntry(domainCfgEntry.getName()), |
| | | "Unable to add the domain config entry: " + configEntryLdif); |
| | | |
| | |
| | | Entry domainCfgEntry = TestCaseUtils.entryFromLdifString(configEntryLdif); |
| | | |
| | | // Add the config entry to create the replicated domain |
| | | DirectoryServer.getConfigHandler().addEntry(domainCfgEntry, null); |
| | | DirectoryServer.getConfigurationHandler().addEntry(Converters.from(domainCfgEntry)); |
| | | assertNotNull(DirectoryServer.getConfigEntry(domainCfgEntry.getName()), |
| | | "Unable to add the domain config entry: " + configEntryLdif); |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | |
| | | fractionalDomainCfgEntry = TestCaseUtils.entryFromLdifString(configEntryLdif); |
| | | |
| | | // Add the config entry to create the replicated domain |
| | | DirectoryServer.getConfigHandler().addEntry(fractionalDomainCfgEntry, null); |
| | | DirectoryServer.getConfigurationHandler().addEntry(Converters.from(fractionalDomainCfgEntry)); |
| | | assertNotNull(DirectoryServer.getConfigEntry(fractionalDomainCfgEntry.getName()), |
| | | "Unable to add the domain config entry: " + configEntryLdif); |
| | | } |
| | |
| | | public Object[][] createSyntaxTest() throws Exception |
| | | { |
| | | // some config object used later in the test |
| | | Entry strictConfig = new Entry(TestCaseUtils.makeEntry( |
| | | Entry strictConfig = TestCaseUtils.makeEntry( |
| | | "dn: cn=Telephone Number,cn=Syntaxes,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-telephone-number-attribute-syntax", |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSyntax", |
| | | "cn: Telephone Number" |
| | | ), null); |
| | | ); |
| | | |
| | | Entry relaxedConfig = new Entry(TestCaseUtils.makeEntry( |
| | | Entry relaxedConfig = TestCaseUtils.makeEntry( |
| | | "dn: cn=Telephone Number,cn=Syntaxes,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-telephone-number-attribute-syntax", |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSyntax", |
| | | "cn: Telephone Number" |
| | | ), null); |
| | | ); |
| | | |
| | | // fill this table with tables containing : |
| | | // - the configEntry that must be applied before the test. |
| | |
| | | import java.io.PrintStream; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.RootCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tasks.TaskUtils; |
| | |
| | | { |
| | | try |
| | | { |
| | | final RootCfg root = ServerManagementContext.getInstance().getRootConfiguration(); |
| | | final RootCfg root = |
| | | DirectoryServer.getInstance().getServerContext().getServerManagementContext().getRootConfiguration(); |
| | | final String errorMsg = "Unexpected content in reject file:\n\n" + readFile(reject) |
| | | + "\n\nThe backend was configured with the following base DNs: " |
| | | + root.getBackend(beID).getBaseDN() + "\n\n"; |