public class BackendConfigManager extends Object implements ConfigurationChangeListener<BackendCfg>, ConfigurationAddListener<BackendCfg>, ConfigurationDeleteListener<BackendCfg>
It performs the necessary initialization of the backends when the server is first started, and then manages any changes to them while the server is running.
Modifier and Type | Field and Description |
---|---|
static Predicate<org.opends.server.core.BackendConfigManager.NamingContext> |
LOCAL
A naming suffix corresponding to a local backend.
|
static Predicate<org.opends.server.core.BackendConfigManager.NamingContext> |
PRIVATE
A naming context corresponding to a private backend.
|
static Predicate<org.opends.server.core.BackendConfigManager.NamingContext> |
PUBLIC
A public naming context (strict opposite of private).
|
static Predicate<org.opends.server.core.BackendConfigManager.NamingContext> |
TOP_LEVEL
A top-level naming context, which is not a subordinate of another naming context.
|
Constructor and Description |
---|
BackendConfigManager(ServerContext serverContext)
Creates a new instance of this backend config manager.
|
Modifier and Type | Method and Description |
---|---|
void |
activateBackend(String backendId)
Loads and registers a configured and enabled backend.
|
ConfigChangeResult |
applyConfigurationAdd(BackendCfg cfg)
Adds a new configuration to this add listener.
|
ConfigChangeResult |
applyConfigurationChange(BackendCfg cfg)
Applies the configuration changes to this change listener.
|
ConfigChangeResult |
applyConfigurationDelete(BackendCfg cfg)
Deletes an existing configuration from this delete listener.
|
boolean |
containsLocalNamingContext(Dn dn)
Indicates whether the specified DN is contained in the local backends as a naming context.
|
void |
deactivateBackend(String backendId)
Deregisters and finalizes a configured and active backend.
|
void |
deregisterBackend(Backend<? extends BackendCfg> backend)
Deregisters a backend.
|
void |
deregisterBaseDNs(Backend<? extends BackendCfg> backend)
Deregisters all the base DNs for the provided backend.
|
void |
deregisterLocalBackendInitializationListener(LocalBackendInitializationListener listener)
Deregisters a local backend initialization listener.
|
Backend<?> |
findBackendForEntry(Dn entryDn)
Retrieves the backend that should be used to handle operations on the specified entry.
|
LocalBackend<?> |
findLocalBackendForEntry(Dn entryDn)
Retrieves the local backend and the corresponding baseDN that should be used to handle operations on the
specified entry.
|
Dn |
findNamingContextForEntry(Dn entryDn)
Retrieves the naming context that should be used to handle operations on the specified entry.
|
Iterator<Dn> |
findSubordinateNamingContextsForEntry(Dn entryDn)
Retrieves the set of local naming contexts that are subordinates of the naming context that should be used to
handle operations on the specified entry.
|
Set<Backend<?>> |
getAllBackends()
Returns the set of all backends.
|
Backend<?> |
getBackendWithBaseDn(Dn baseDn)
Retrieves the backend with the specified base DN.
|
LocalBackend<?> |
getLocalBackendById(String backendId)
Retrieves a local backend provided its identifier.
|
LocalBackend<?> |
getLocalBackendWithBaseDN(Dn baseDn)
Retrieves the local backend with the specified base DN.
|
Set<Dn> |
getNamingContexts(Predicate<org.opends.server.core.BackendConfigManager.NamingContext> filter)
Retrieves naming contexts corresponding to backends, according to the specified filter.
|
Dn |
getParentDNInSuffix(Dn dn)
Retrieves the DN that is the immediate parent for this DN.
|
RootDSEBackend |
getRootDSEBackend()
Retrieves the Root DSE backend.
|
Set<Backend<?>> |
getSubordinateBackends(Backend<?> backend)
Retrieves the set of subordinate backends of the provided backend.
|
boolean |
hasBackend(String backendId)
Indicates whether the backend with the provided id exists.
|
void |
initializeBackendConfig(Collection<String> backendIdsToStart)
Initializes the configuration associated with the Directory Server backends.
|
void |
initializeBackends(Collection<String> backendIDsToStart,
RootCfg root)
Initializes specified backends.
|
boolean |
isConfigurationAddAcceptable(BackendCfg backendCfg,
List<LocalizableMessage> unacceptableReason)
Indicates whether the proposed addition of a new configuration is
acceptable to this add listener.
|
boolean |
isConfigurationChangeAcceptable(BackendCfg backendCfg,
List<LocalizableMessage> unacceptableReason)
Indicates whether the proposed change to the configuration is acceptable
to this change listener.
|
boolean |
isConfigurationDeleteAcceptable(BackendCfg cfg,
List<LocalizableMessage> unacceptableReason)
Indicates whether the proposed deletion of an existing configuration is
acceptable to this delete listener.
|
void |
registerBackend(Backend<? extends BackendCfg> backend)
Registers a backend.
|
Pair<Set<Dn>,Set<Dn>> |
registerBaseDNs(Backend<? extends BackendCfg> backend,
Set<Dn> newBaseDns)
Registers the provided base DNs for the provided backend.
|
void |
registerLocalBackendInitializationListener(LocalBackendInitializationListener listener)
Registers a local backend initialization listener.
|
void |
shutdownBackends()
Shutdown all backends.
|
public static final Predicate<org.opends.server.core.BackendConfigManager.NamingContext> PRIVATE
public static final Predicate<org.opends.server.core.BackendConfigManager.NamingContext> PUBLIC
public static final Predicate<org.opends.server.core.BackendConfigManager.NamingContext> TOP_LEVEL
public static final Predicate<org.opends.server.core.BackendConfigManager.NamingContext> LOCAL
public BackendConfigManager(ServerContext serverContext)
serverContext
- The server context.public void initializeBackendConfig(Collection<String> backendIdsToStart) throws ConfigException, InitializationException
backendIdsToStart
- The list of backendID to start. Everything will be started if empty.ConfigException
- If a critical configuration problem prevents the backend initialization from succeeding.InitializationException
- If a problem occurs while initializing the backends that is not related to the server configuration.public void initializeBackends(Collection<String> backendIDsToStart, RootCfg root) throws ConfigException
backendIDsToStart
- The list of backendID to start. Everything will be started if empty.root
- The configuration of the server's Root backendConfigException
- If a critical configuration problem prevents the backend initialization from succeeding.public Set<Backend<?>> getAllBackends()
public LocalBackend<?> getLocalBackendWithBaseDN(Dn baseDn)
baseDn
- The DN that is registered as one of the base DNs for the backend to retrieve.null
if there is no active local backend for the
specified base DN.public Backend<?> getBackendWithBaseDn(Dn baseDn) throws LdapException
baseDn
- The DN that is registered as one of the base DNs for the backend to retrieve.null
if none existLdapException
- if no backend is found with the specified base DNpublic RootDSEBackend getRootDSEBackend()
public Dn getParentDNInSuffix(Dn dn)
dn
- thenull
if this DN does not have a parent
(either because there is only a single RDN component or because this DN is a suffix defined in the
server).public Backend<?> findBackendForEntry(Dn entryDn)
entryDn
- The DN of the entry for which to retrieve the corresponding backend.null
if no appropriate backend is registered with the server.public Dn findNamingContextForEntry(Dn entryDn)
entryDn
- The DN of the entry for which to retrieve the corresponding naming context.null
if no appropriate naming context is registered with the server.public LocalBackend<?> findLocalBackendForEntry(Dn entryDn)
entryDn
- The DN of the entry for which to retrieve the corresponding backend.null
if no appropriate local backend is registered
with the server.public LocalBackend<?> getLocalBackendById(String backendId)
backendId
- Identifier of the backendnull
if there is no local backend registered with the specified id.public boolean hasBackend(String backendId)
backendId
- The backend ID for which to make the determination.true
if a backend with the specified backend ID exists, false
otherwisepublic Set<Backend<?>> getSubordinateBackends(Backend<?> backend)
backend
- The backend for which to retrieve the subordinates backends.null
public Iterator<Dn> findSubordinateNamingContextsForEntry(Dn entryDn)
entryDn
- The DN of the entry for which to retrieve the corresponding naming contexts.null
if no appropriate naming context is registered with the server.public Set<Dn> getNamingContexts(Predicate<org.opends.server.core.BackendConfigManager.NamingContext> filter)
filter
- filter the naming contextsNamingContext
public boolean containsLocalNamingContext(Dn dn)
dn
- The DN for which to make the determination.true
if the specified DN is a naming context in one backend, or false
if it is not.public void registerLocalBackendInitializationListener(LocalBackendInitializationListener listener)
listener
- The listener to register.public void deregisterLocalBackendInitializationListener(LocalBackendInitializationListener listener)
listener
- The listener to deregister.public boolean isConfigurationChangeAcceptable(BackendCfg backendCfg, List<LocalizableMessage> unacceptableReason)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<BackendCfg>
backendCfg
- The new configuration containing the changes.unacceptableReason
- A list that can be used to hold messages about why the
provided configuration is not acceptable.true
if the proposed change is acceptable,
or false
if it is not.public Pair<Set<Dn>,Set<Dn>> registerBaseDNs(Backend<? extends BackendCfg> backend, Set<Dn> newBaseDns) throws LdapException
Backends should call this method when their baseDNs are updated.
backend
- The non-null
backend responsible for the provided base DNs.newBaseDns
- the new base DNs for the backend. An empty set asks to deregister this backend.LdapException
- If a problem occurs while attempting to register the provided base DNs.public void deregisterBaseDNs(Backend<? extends BackendCfg> backend)
backend
- The non-null
backend for which to deregister al the base DNs.public ConfigChangeResult applyConfigurationChange(BackendCfg cfg)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<BackendCfg>
cfg
- The new configuration containing the changes.public void activateBackend(String backendId) throws LdapException
Load the backend's implementation class,
configures
,
opens
and registers it.
Trying to activate a backend which is already activated does nothing.
backendId
- Identifies the backend to be activated.LdapException
- If the backend cannot be loaded or registered because it does not exist
(NO_SUCH_OBJECT
) or OTHER
for all other
reasons.public void deactivateBackend(String backendId) throws LdapException
backendId
- Identifies the backend to be deactivated.LdapException
- If the backend cannot be found (ResultCode.NO_SUCH_OBJECT
NO_SUCH_OBJECT).
ResultCode.OTHER
is used for all other reasons.public void registerBackend(Backend<? extends BackendCfg> backend) throws LdapException
Register an already initialized backend. The backend will then be in charge of processing operations targeting entries with a DN being a subordinate of the base DNs this backend declares being in charge of.
backend
- The backend to register with the server. Neither the backend nor its backend ID may be
null
.LdapException
- If the backend ID for the provided backend conflicts with the backend ID of an already
registered backend.public boolean isConfigurationAddAcceptable(BackendCfg backendCfg, List<LocalizableMessage> unacceptableReason)
ConfigurationAddListener
isConfigurationAddAcceptable
in interface ConfigurationAddListener<BackendCfg>
backendCfg
- The configuration that will be added.unacceptableReason
- A list that can be used to hold messages about why the
provided configuration is not acceptable.true
if the proposed addition is acceptable,
or false
if it is not.public ConfigChangeResult applyConfigurationAdd(BackendCfg cfg)
ConfigurationAddListener
applyConfigurationAdd
in interface ConfigurationAddListener<BackendCfg>
cfg
- The configuration that will be added.public boolean isConfigurationDeleteAcceptable(BackendCfg cfg, List<LocalizableMessage> unacceptableReason)
ConfigurationDeleteListener
isConfigurationDeleteAcceptable
in interface ConfigurationDeleteListener<BackendCfg>
cfg
- The configuration that will be deleted.unacceptableReason
- A list that can be used to hold messages about why the
provided configuration is not acceptable.true
if the proposed deletion is acceptable,
or false
if it is not.public ConfigChangeResult applyConfigurationDelete(BackendCfg cfg)
ConfigurationDeleteListener
applyConfigurationDelete
in interface ConfigurationDeleteListener<BackendCfg>
cfg
- The existing configuration that will be deleted.public void deregisterBackend(Backend<? extends BackendCfg> backend)
backend
- The backend to deregister with the server. It must not be null
.public void shutdownBackends()
Copyright 2010-2022 ForgeRock AS.