Package org.opends.server.api
Class Backend<C extends Configuration>
java.lang.Object
org.opends.server.api.Backend<C>
- Type Parameters:
C
- the type of the BackendCfg for the current backend
- All Implemented Interfaces:
HealthStatusProvider
- Direct Known Subclasses:
LocalBackend
,ProxyBackend
public abstract class Backend<C extends Configuration>
extends Object
implements HealthStatusProvider
Represents a directory server backend, which can be either local or remote (proxy). A backend is a LDAP endpoint.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
configureBackend
(C cfg, ServerContext serverContext) Configure this backend based on the information in the provided configuration.void
Deregisters the backend monitor of this backend.abstract void
Performs any necessary work to finalize this backend.final String
Retrieves the unique identifier for this backend.Retrieves the set of base-level DNs that may be used within this backend.Returns theHealthStatus
for the underlying component.Retrieves the OIDs of the controls that may be supported by this backend.Retrieves the OIDs of the features that may be supported by this backend.abstract void
handleRequest
(RequestContext context, Request request, Consumer<ResponseStream> out) Processes a request, publishing the response(s) to the provided consumer.boolean
isConfigurationAcceptable
(C configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext) Indicates whether the provided configuration is acceptable for this backend.abstract boolean
Indicates whether the base DNs of this backend should be considered public or private.abstract void
Opens this backend based on the information provided when the backend was configured.void
Registers a backend monitor for this backend.final void
setBackendID
(String backendID) Specifies the unique identifier for this backend.toString()
-
Constructor Details
-
Backend
public Backend()
-
-
Method Details
-
configureBackend
Configure this backend based on the information in the provided configuration. When the method returns, the backend will have been configured (ready to be opened) but still unable to process operations.- Parameters:
cfg
- The configuration of this backend.serverContext
- The server context for this instance- Throws:
ConfigException
- If there is an error in the configuration.
-
openBackend
Opens this backend based on the information provided when the backend was configured. It also should open any underlying storage and register all suffixes with the server.- Throws:
ConfigException
- If an unrecoverable problem arises while opening the backend.InitializationException
- If a problem occurs during opening that is not related to the server configuration.- See Also:
-
handleRequest
public abstract void handleRequest(RequestContext context, Request request, Consumer<ResponseStream> out) throws LdapException Processes a request, publishing the response(s) to the provided consumer. Implementations may publish response in multiple steps if needed. If the request fails for any reason then the failure must be thrown as anLdapException
.- Parameters:
context
- The request context.request
- The request.out
- A consumer responsible for sending responses to the client.- Throws:
LdapException
- If an error occurred when processing the request.
-
finalizeBackend
public abstract void finalizeBackend()Performs any necessary work to finalize this backend. The backend must be an opened backend, so do not use this method on backends where onlyconfigureBackend()
has been called. This may be called during the Directory Server shutdown process or if a backend is disabled with the server online. It must not return until the backend is closed.This method may not throw any exceptions. If any problems are encountered, then they may be logged but the closure should progress as completely as possible.
-
getBackendID
Retrieves the unique identifier for this backend.- Returns:
- The unique identifier for this backend.
-
getBaseDNs
Retrieves the set of base-level DNs that may be used within this backend.- Returns:
- The set of base-level DNs that may be used within this backend.
-
getSupportedControls
Retrieves the OIDs of the controls that may be supported by this backend.- Returns:
- The OIDs of the controls that may be supported by this backend.
-
getSupportedFeatures
Retrieves the OIDs of the features that may be supported by this backend.- Returns:
- The OIDs of the features that may be supported by this backend.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(C configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext) Indicates whether the provided configuration is acceptable for this backend. It should be possible to call this method on an uninitialized backend instance in order to determine whether the backend would be able to use the provided configuration.- Parameters:
configuration
- The backend configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.serverContext
- this Directory Server instance's server context- Returns:
true
if the provided configuration is acceptable for this backend, orfalse
if not.
-
isPublicBackend
public abstract boolean isPublicBackend()Indicates whether the base DNs of this backend should be considered public or private.This method also controls the visibility of the associated naming contexts. i.e. if any base DN of this backend is a naming context, then it will be public or private, based on the value returned by this method.
Reminder: Public naming contexts are returned when querying the root DSE entry.
- Returns:
true
if this backend's baseDNs could be exposed as a public naming context,false
if they must remain private naming contexts.
-
setBackendID
Specifies the unique identifier for this backend.- Parameters:
backendID
- The unique identifier for this backend.
-
registerBackendMonitor
public void registerBackendMonitor()Registers a backend monitor for this backend. -
deregisterBackendMonitor
public void deregisterBackendMonitor()Deregisters the backend monitor of this backend. -
getHealthStatus
Description copied from interface:HealthStatusProvider
Returns theHealthStatus
for the underlying component.- Specified by:
getHealthStatus
in interfaceHealthStatusProvider
- Returns:
- The
HealthStatus
.
-
toString
-