C
- the type of the BackendCfg for the current backend@PublicAPI(stability=VOLATILE, mayExtend=true) public abstract class LocalBackend<C extends Configuration> extends Backend<C>
Modifier and Type | Class and Description |
---|---|
static class |
LocalBackend.BackendOperation
Enumeration of optional backend operations.
|
Constructor and Description |
---|
LocalBackend() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend.
|
void |
closeBackend()
Performs any necessary work to finally close this backend, particularly closing any underlying databases or
connections and deregistering any suffixes that it manages with the Directory Server.
|
void |
createBackup(BackupConfig backupConfig)
Creates a backup of the contents of this backend in a form that may be restored at a later date if necessary.
|
abstract void |
deleteEntry(Dn entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
void |
deregisterBackendMonitor()
Deregisters the backend monitor of this backend.
|
boolean |
entryExists(Dn entryDN)
Indicates whether an entry with the specified DN exists in the backend.
|
void |
exportLDIF(LDIFExportConfig exportConfig)
Exports the contents of this backend to LDIF.
|
void |
finalizeBackend()
Performs any necessary work to finalize this backend.
|
abstract Entry |
getEntry(Dn entryDN)
Retrieves the requested entry from this backend.
|
abstract long |
getEntryCount()
Retrieves the total number of entries contained in this backend, if that information is available.
|
protected LocalBackendMonitor<?> |
getLocalBackendMonitor()
Returns the local backend monitor associated with this backend.
|
abstract long |
getNumberOfChildren(Dn parentDN)
Retrieves the number of subordinates immediately below the requested entry.
|
abstract long |
getNumberOfEntriesInBaseDN(Dn baseDN)
Retrieves the number of entries for the specified base DN including all entries from the requested entry to the
lowest level in the tree.
|
Queue<PersistentSearch> |
getPersistentSearches()
Returns the persistent searches currently active against this local backend.
|
WritabilityMode |
getWritabilityMode()
Retrieves the writability mode for this backend.
|
Flowable<Response> |
handle(org.forgerock.services.context.Context context,
Request request)
Processes the provided request in a reactive way within this backend.
|
boolean |
handlesEntry(Dn entryDN)
Indicates whether this backend should be used to handle operations for the provided entry.
|
static boolean |
handlesEntry(Dn entryDN,
Collection<Dn> baseDNs,
Collection<Dn> excludeDNs)
Indicates whether a backend should be used to handle operations for the provided entry given the set of base DNs
and exclude DNs.
|
abstract ConditionResult |
hasSubordinates(Dn entryDN)
Indicates whether the requested entry has any subordinates.
|
LDIFImportResult |
importLDIF(LDIFImportConfig importConfig,
ServerContext serverContext)
Imports information from an LDIF file into this backend.
|
abstract boolean |
isIndexed(AttributeType attributeType,
IndexType indexType)
Indicates whether search operations which target the specified attribute in the indicated manner would be
considered indexed in this backend.
|
boolean |
isIndexed(Filter filter)
Indicates whether a subtree search using the provided filter would be indexed in this backend.
|
abstract void |
openBackend()
Opens this backend based on the information provided when the backend was configured.
|
void |
rebuildBackend(RebuildConfig rebuildConfig,
ServerContext serverContext)
Rebuild indexes in the backend instance.
|
void |
registerBackendMonitor()
Registers a backend monitor for this backend.
|
void |
registerPersistentSearch(PersistentSearch persistentSearch)
Registers the provided persistent search operation with this backend so that it will be notified of any add,
delete, modify, or modify DN operations that are performed.
|
void |
removeBackup(BackupDirectory backupDirectory,
String backupID)
Removes the specified backup if it is possible to do so.
|
abstract void |
renameEntry(Dn currentDN,
Entry entry,
ModifyDnOperation modifyDNOperation)
Moves and/or renames the provided entry in this backend, altering any subordinate entries as necessary.
|
abstract void |
replaceEntry(Entry oldEntry,
Entry newEntry,
ModifyOperation modifyOperation)
Replaces the specified entry with the provided entry in this backend.
|
void |
restoreBackup(RestoreConfig restoreConfig)
Restores a backup of the contents of this backend.
|
abstract void |
search(SearchOperation searchOperation)
Processes the specified search in this backend.
|
void |
setWritabilityMode(WritabilityMode writabilityMode)
Specifies the writability mode for this backend.
|
boolean |
supports(LocalBackend.BackendOperation backendOperation)
Indicates whether this backend supports the provided backend operation.
|
boolean |
supportsControl(String controlOID)
Indicates whether this backend supports the specified control.
|
long |
verifyBackend(VerifyConfig verifyConfig)
Verify the integrity of the backend instance.
|
configureBackend, getBackendID, getBaseDNs, getHealthStatus, getSupportedControls, getSupportedFeatures, isConfigurationAcceptable, isPublicBackend, setBackendID, toString
public Flowable<Response> handle(org.forgerock.services.context.Context context, Request request) throws Exception
context
- The context to process the request, which is expected to contain a RequestDJContext
and a
ClientContext
request
- The request to process.Exception
- If an error occurspublic abstract void openBackend() throws ConfigException, InitializationException
openBackend
in class Backend<C extends Configuration>
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.Backend.configureBackend(C, org.opends.server.core.ServerContext)
public void finalizeBackend()
Backend
configureBackend()
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.
finalizeBackend
in class Backend<C extends Configuration>
public void closeBackend()
It will be called as final step of finalizeBackend()
, so subclasses might override it.
public abstract boolean isIndexed(AttributeType attributeType, IndexType indexType)
true
for the specified attribute and index type.attributeType
- The attribute type for which to make the determination.indexType
- The index type for which to make the determination.true
if search operations targeting the specified attribute in the indicated manner should be
considered indexed, or false
if not.public boolean isIndexed(Filter filter)
filter
- The search filter for which to make the determination.true
if it is believed that the provided filter would be indexed in this backend, or
false
if not.public abstract ConditionResult hasSubordinates(Dn entryDN) throws LdapException
entryDN
- The distinguished name of the entry.ConditionResult.TRUE
if the entry has one or more subordinates or ConditionResult.FALSE
otherwise or ConditionResult.UNDEFINED
if it can not be determined.LdapException
- If a problem occurs while trying to retrieve the entry.public abstract long getNumberOfChildren(Dn parentDN) throws LdapException
parentDN
- The distinguished name of the parent.LdapException
- If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the
entry.NullPointerException
- if baseDN is null.public abstract long getNumberOfEntriesInBaseDN(Dn baseDN) throws LdapException
baseDN
- The base distinguished name.LdapException
- If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the
entry.NullPointerException
- if baseDN is null.public boolean entryExists(Dn entryDN) throws LdapException
getEntry
, but backend implementations may override this with a more efficient version. The caller is not
required to hold any locks on the specified DN.entryDN
- The DN of the entry for which to determine existence.true
if the specified entry exists in this backend, or false
if it does not.LdapException
- If a problem occurs while trying to make the determination.public abstract Entry getEntry(Dn entryDN) throws LdapException
entryDN
- The distinguished name of the entry to retrieve.null
if the entry does not exist.LdapException
- If a problem occurs while trying to retrieve the entry.public abstract void addEntry(Entry entry, AddOperation addOperation) throws LdapException, CancelledResultException
entry
- The entry to add to this backend.addOperation
- The add operation with which the new entry is associated. This may be null
for adds performed
internally.LdapException
- If a problem occurs while trying to add the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the add operation.public abstract void deleteEntry(Dn entryDN, DeleteOperation deleteOperation) throws LdapException, CancelledResultException
entryDN
- The DN of the entry to remove from this backend.deleteOperation
- The delete operation with which this action is associated. This may be null
for deletes
performed internally.LdapException
- If a problem occurs while trying to remove the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the delete operation.public abstract void replaceEntry(Entry oldEntry, Entry newEntry, ModifyOperation modifyOperation) throws LdapException, CancelledResultException
oldEntry
- The original entry that is being replaced.newEntry
- The new entry to use in place of the existing entry with the same DN.modifyOperation
- The modify operation with which this action is associated. This may be null
for modifications
performed internally.LdapException
- If a problem occurs while trying to replace the entry.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify operation.public abstract void renameEntry(Dn currentDN, Entry entry, ModifyDnOperation modifyDNOperation) throws LdapException, CancelledResultException
currentDN
- The current DN of the entry to be moved/renamed.entry
- The new content to use for the entry.modifyDNOperation
- The modify DN operation with which this action is associated. This may be null
for modify DN
operations performed internally.LdapException
- If a problem occurs while trying to perform the rename.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify DN operation.public abstract void search(SearchOperation searchOperation) throws LdapException, CancelledResultException
SearchOperation.returnEntry
method. The caller is not required to have any locks when calling this
operation.searchOperation
- The search operation to be processed.LdapException
- If a problem occurs while processing the search.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the search operation.public boolean supports(LocalBackend.BackendOperation backendOperation)
backendOperation
- the backend operationtrue
if this backend supports the provided backend operation, false
otherwise.public void exportLDIF(LDIFExportConfig exportConfig) throws LdapException
supports(BackendOperation)
with LocalBackend.BackendOperation.LDIF_EXPORT
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
exportConfig
- The configuration to use when performing the export.LdapException
- If a problem occurs while performing the LDIF export.public LDIFImportResult importLDIF(LDIFImportConfig importConfig, ServerContext serverContext) throws LdapException
supports(BackendOperation)
with LocalBackend.BackendOperation.LDIF_IMPORT
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
importConfig
- The configuration to use when performing the import.serverContext
- The server contextLdapException
- If a problem occurs while performing the LDIF import.public long verifyBackend(VerifyConfig verifyConfig) throws InitializationException, ConfigException, LdapException
verifyConfig
- The verify configuration.ConfigException
- If an unrecoverable problem arises during initialization.InitializationException
- If a problem occurs during initialization that is not related to the server configuration.LdapException
- If a Directory Server error occurs.public void rebuildBackend(RebuildConfig rebuildConfig, ServerContext serverContext) throws InitializationException, ConfigException, LdapException
rebuildConfig
- The rebuild configuration.serverContext
- The server context for this instanceConfigException
- If an unrecoverable problem arises during initialization.InitializationException
- If a problem occurs during initialization that is not related to the server configuration.LdapException
- If a Directory Server error occurs.public void createBackup(BackupConfig backupConfig) throws LdapException
supports(BackendOperation)
with LocalBackend.BackendOperation.BACKUP
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
backupConfig
- The configuration to use when performing the backup.LdapException
- If a problem occurs while performing the backup.public void removeBackup(BackupDirectory backupDirectory, String backupID) throws LdapException
backupDirectory
- The backup directory structure with which the specified backup is associated.backupID
- The backup ID for the backup to be removed.LdapException
- If it is not possible to remove the specified backup for some reason (e.g., no such backup exists or
there are other backups that are dependent upon it).public void restoreBackup(RestoreConfig restoreConfig) throws LdapException
supports(BackendOperation)
with BackendOperation#RESTORE
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
restoreConfig
- The configuration to use when performing the restore.LdapException
- If a problem occurs while performing the restore.public final WritabilityMode getWritabilityMode()
public final void setWritabilityMode(WritabilityMode writabilityMode)
writabilityMode
- The writability mode for this backend.public void registerPersistentSearch(PersistentSearch persistentSearch) throws LdapException
persistentSearch
- The persistent search operation to register with this backendLdapException
- If a problem occurs while registering the persistent searchpublic Queue<PersistentSearch> getPersistentSearches()
public abstract long getEntryCount()
public final boolean handlesEntry(Dn entryDN)
entryDN
- The DN of the entry for which to make the determination.true
if this backend handles operations for the provided entry, or false
if it does not.public void registerBackendMonitor()
Backend
registerBackendMonitor
in class Backend<C extends Configuration>
protected LocalBackendMonitor<?> getLocalBackendMonitor()
Implementations may override this method in order to provide custom implementations.
public void deregisterBackendMonitor()
Backend
deregisterBackendMonitor
in class Backend<C extends Configuration>
public final boolean supportsControl(String controlOID)
controlOID
- The OID of the control for which to make the determination.true
if this backends supports the control with the specified OID, or false
if it does
not.public static boolean handlesEntry(Dn entryDN, Collection<Dn> baseDNs, Collection<Dn> excludeDNs)
entryDN
- The DN of the entry for which to make the determination.baseDNs
- The set of base DNs for the backend.excludeDNs
- The set of DNs that should be excluded from the backend.true
if the backend should handle operations for the provided entry, or false
if it does
not.Copyright 2010-2022 ForgeRock AS.