Preparatory commit for OPENDJ-1727, propagating a serverContext to all backends and storages to access
informations about the current running environment.
Changes in API only.
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.BackupDirectory; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(BackendCfg cfg) throws ConfigException |
| | | public void configureBackend(BackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | } |
| | | |
| | |
| | | import org.opends.server.core.PersistentSearch; |
| | | import org.opends.server.core.PersistentSearch.CancellationCallback; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.monitors.BackendMonitor; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.BackupConfig; |
| | |
| | | new ConcurrentLinkedQueue<PersistentSearch>(); |
| | | |
| | | /** |
| | | * Temporarily sets up the server context for the first phase of add of a new configuration entry. |
| | | * Will be needed for checking storage parameters before committing the change in configuration. |
| | | * |
| | | * @param context the server context for this instance |
| | | */ |
| | | public void setServerContext(ServerContext context) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Configure this backend based on the information in the provided |
| | | * configuration. |
| | | * |
| | | * @param cfg The configuration of this backend. |
| | | * @param serverContext The server context for this instance |
| | | * |
| | | * @throws ConfigException |
| | | * If there is an error in the configuration. |
| | | */ |
| | | public abstract void configureBackend(C cfg) throws ConfigException; |
| | | public abstract void configureBackend(C cfg, ServerContext serverContext) throws ConfigException; |
| | | |
| | | /** |
| | | * Indicates whether the provided configuration is acceptable for |
| | |
| | | * related to the server |
| | | * configuration. |
| | | */ |
| | | public abstract void initializeBackend() |
| | | throws ConfigException, InitializationException; |
| | | public abstract void initializeBackend() throws ConfigException, InitializationException; |
| | | |
| | | /** |
| | | * Performs any necessary work to finalize this backend, including |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | | import org.opends.server.types.*; |
| | | |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(BackupBackendCfg config) throws ConfigException |
| | | public void configureBackend(BackupBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | // Make sure that a configuration entry was provided. If not, then we will |
| | | // not be able to complete initialization. |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.PersistentSearch; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.replication.common.CSN; |
| | | import org.opends.server.replication.common.MultiDomainServerState; |
| | | import org.opends.server.replication.common.ServerState; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(final Configuration config) throws ConfigException |
| | | public void configureBackend(final Configuration config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | throw new UnsupportedOperationException("The changelog backend is not configurable"); |
| | | } |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(LDIFBackendCfg config) throws ConfigException |
| | | public void configureBackend(LDIFBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | if (config != null) |
| | | { |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.BackupDirectory; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(MemoryBackendCfg config) throws ConfigException |
| | | public void configureBackend(MemoryBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | if (config != null) |
| | | { |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(final MonitorBackendCfg config) |
| | | public void configureBackend(final MonitorBackendCfg config, ServerContext serverContext) |
| | | throws ConfigException |
| | | { |
| | | Reject.ifNull(config); |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.BackupDirectory; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(BackendCfg config) throws ConfigException |
| | | public void configureBackend(BackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | if (config != null) |
| | | { |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.BuildVersion; |
| | | import org.opends.server.util.LDIFWriter; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(RootDSEBackendCfg config) throws ConfigException |
| | | public void configureBackend(RootDSEBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | Reject.ifNull(config); |
| | | currentConfig = config; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeBackend() |
| | | throws ConfigException, InitializationException |
| | | public void initializeBackend() throws ConfigException, InitializationException |
| | | { |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigEntry(configEntryDN); |
| | |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.schema.AttributeTypeSyntax; |
| | | import org.opends.server.schema.DITContentRuleSyntax; |
| | | import org.opends.server.schema.DITStructureRuleSyntax; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(SchemaBackendCfg cfg) throws ConfigException |
| | | public void configureBackend(SchemaBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | // Make sure that a configuration entry was provided. If not, then we will |
| | | // not be able to complete initialization. |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeBackend() |
| | | throws ConfigException, InitializationException |
| | | public void initializeBackend() throws ConfigException, InitializationException |
| | | { |
| | | // Register each of the suffixes with the Directory Server. Also, register |
| | | // the first one as the schema base. |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.CertificateManager; |
| | | import org.opends.server.util.SetupUtils; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(TrustStoreBackendCfg config) throws ConfigException |
| | | public void configureBackend(TrustStoreBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | Reject.ifNull(config); |
| | | configuration = config; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeBackend() |
| | | throws ConfigException, InitializationException |
| | | public void initializeBackend() throws ConfigException, InitializationException |
| | | { |
| | | DN configEntryDN = configuration.dn(); |
| | | |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(LocalDBBackendCfg cfg) throws ConfigException |
| | | public void configureBackend(LocalDBBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | Reject.ifNull(cfg); |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | 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.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | |
| | | import org.opends.server.backends.pluggable.spi.UpdateFunction; |
| | | import org.opends.server.backends.pluggable.spi.WriteOperation; |
| | | import org.opends.server.backends.pluggable.spi.WriteableStorage; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.FilePermission; |
| | |
| | | * |
| | | * @param cfg |
| | | * The configuration. |
| | | * @param serverContext |
| | | * This server instance context |
| | | * @throws ConfigException if memory cannot be reserved |
| | | */ |
| | | // FIXME: should be package private once importer is decoupled. |
| | | public PersistItStorage(final PersistitBackendCfg cfg) |
| | | public PersistItStorage(final PersistitBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | backendDirectory = new File(getFileForPath(cfg.getDBDirectory()), cfg.getBackendId()); |
| | | config = cfg; |
| | |
| | | @Override |
| | | protected Storage configureStorage(PersistitBackendCfg cfg) throws ConfigException |
| | | { |
| | | return new PersistItStorage(cfg); |
| | | return new PersistItStorage(cfg, serverContext); |
| | | } |
| | | } |
| | |
| | | OID_SERVER_SIDE_SORT_REQUEST_CONTROL, |
| | | OID_VLV_REQUEST_CONTROL)); |
| | | |
| | | /** The server context for this directory server. */ |
| | | protected ServerContext serverContext; |
| | | |
| | | /** |
| | | * Begin a Backend API method that accesses the database and returns the <code>EntryContainer</code> for |
| | | * <code>entryDN</code>. |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(C cfg) throws ConfigException |
| | | public void configureBackend(C cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | Reject.ifNull(cfg); |
| | | |
| | | this.cfg = cfg; |
| | | this.serverContext = serverContext; |
| | | baseDNs = this.cfg.getBaseDN().toArray(new DN[0]); |
| | | storage = new TracedStorage(configureStorage(cfg), cfg.getBackendId()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeBackend() |
| | | throws ConfigException, InitializationException |
| | | public void initializeBackend() throws ConfigException, InitializationException |
| | | { |
| | | if (mustOpenRootContainer()) |
| | | { |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setServerContext(ServerContext context) |
| | | { |
| | | this.serverContext = context; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons) |
| | | { |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | |
| | | returnValues.put("isDBTxnNoSync", true); |
| | | try |
| | | { |
| | | storage = new PersistItStorage(newPersistitBackendCfgProxy(returnValues)); |
| | | storage = new PersistItStorage(newPersistitBackendCfgProxy(returnValues), |
| | | DirectoryServer.getInstance().getServerContext()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(TaskBackendCfg cfg) throws ConfigException |
| | | public void configureBackend(TaskBackendCfg cfg, ServerContext serverContext) throws ConfigException |
| | | { |
| | | Reject.ifNull(cfg); |
| | | |
| | |
| | | } |
| | | |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | private static void initializeBackend(Backend backend, BackendCfg cfg) |
| | | private void initializeBackend(Backend backend, BackendCfg cfg) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | backend.configureBackend(cfg); |
| | | backend.configureBackend(cfg, serverContext); |
| | | backend.initializeBackend(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | rootDSEBackend = new RootDSEBackend(); |
| | | rootDSEBackend.configureBackend(rootDSECfg); |
| | | rootDSEBackend.configureBackend(rootDSECfg, serverContext); |
| | | rootDSEBackend.initializeBackend(); |
| | | } |
| | | |
| | |
| | | throw new InitializationException(message, e); |
| | | } |
| | | rootDSEBackend = new RootDSEBackend(); |
| | | rootDSEBackend.configureBackend(rootDSECfg); |
| | | rootDSEBackend.configureBackend(rootDSECfg, serverContext); |
| | | rootDSEBackend.initializeBackend(); |
| | | } |
| | | |
| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | | import org.opends.server.tools.LDIFModify; |
| | | import org.opends.server.types.*; |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(ConfigFileHandlerBackendCfg cfg) |
| | | public void configureBackend(ConfigFileHandlerBackendCfg cfg, ServerContext serverContext) |
| | | throws ConfigException |
| | | { |
| | | // No action is required. |
| | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeBackend() |
| | | throws ConfigException, InitializationException |
| | | public void initializeBackend() throws ConfigException, InitializationException |
| | | { |
| | | // No action is required, since all initialization was performed in the |
| | | // initializeConfigHandler method. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | backend = (Backend) backendClass.newInstance(); |
| | | backend.setBackendID(backendID); |
| | | cfg = root.getBackend(backendID); |
| | | backend.configureBackend(cfg); |
| | | backend.configureBackend(cfg, DirectoryServer.getInstance().getServerContext()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | backend.setBackendID(backendID); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | try { |
| | | backend.configureBackend(backendCfg); |
| | | backend.configureBackend(backendCfg, directoryServer.getServerContext()); |
| | | backend.initializeBackend(); |
| | | } catch (Exception e) { |
| | | LocalizableMessage msg = ERR_CONFIG_BACKEND_CANNOT_INITIALIZE.get(className, backendCfg.dn(), |
| | |
| | | throws Exception |
| | | { |
| | | SchemaBackend schemaBackend = new SchemaBackend(); |
| | | schemaBackend.configureBackend(null); |
| | | schemaBackend.configureBackend(null, null); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | PitBackend b = new PitBackend(); |
| | | b.setBackendID(backendCfg.getBackendId()); |
| | | b.configureBackend((PersistitBackendCfg)backendCfg); |
| | | b.configureBackend((PersistitBackendCfg)backendCfg, DirectoryServer.getInstance().getServerContext()); |
| | | return b; |
| | | } |
| | | |