C
- the type of the BackendCfg for the current backend@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=true, mayInvoke=false) public abstract class LocalBackend<C extends org.forgerock.opendj.config.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.
|
abstract 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(org.forgerock.opendj.ldap.Dn entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
void |
deregisterBackendMonitor()
Deregisters the backend monitor of this backend.
|
boolean |
entryExists(org.forgerock.opendj.ldap.Dn entryDN)
Indicates whether an entry with the specified DN exists in the backend.
|
abstract 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(org.forgerock.opendj.ldap.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.
|
abstract long |
getNumberOfChildren(org.forgerock.opendj.ldap.Dn parentDN)
Retrieves the number of subordinates immediately below the requested entry.
|
abstract long |
getNumberOfEntriesInBaseDN(org.forgerock.opendj.ldap.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.
|
io.reactivex.Flowable<org.forgerock.opendj.ldap.messages.Response> |
handle(org.forgerock.services.context.Context context,
org.forgerock.opendj.ldap.messages.Request request)
Processes the provided request in a reactive way within this backend.
|
boolean |
handlesEntry(org.forgerock.opendj.ldap.Dn entryDN)
Indicates whether this backend should be used to handle
operations for the provided entry.
|
static boolean |
handlesEntry(org.forgerock.opendj.ldap.Dn entryDN,
Collection<org.forgerock.opendj.ldap.Dn> baseDNs,
Collection<org.forgerock.opendj.ldap.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 org.forgerock.opendj.ldap.ConditionResult |
hasSubordinates(org.forgerock.opendj.ldap.Dn entryDN)
Indicates whether the requested entry has any subordinates.
|
abstract LDIFImportResult |
importLDIF(LDIFImportConfig importConfig,
ServerContext serverContext)
Imports information from an LDIF file into this backend.
|
abstract boolean |
isIndexed(org.forgerock.opendj.ldap.schema.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(SearchFilter 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.
|
abstract void |
removeBackup(BackupDirectory backupDirectory,
String backupID)
Removes the specified backup if it is possible to do so.
|
abstract void |
renameEntry(org.forgerock.opendj.ldap.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.
|
abstract 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.
|
abstract 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, getSupportedControls, getSupportedFeatures, isConfigurationAcceptable, isPublicBackend, setBackendID
public LocalBackend()
public io.reactivex.Flowable<org.forgerock.opendj.ldap.messages.Response> handle(org.forgerock.services.context.Context context, org.forgerock.opendj.ldap.messages.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 org.forgerock.opendj.config.server.ConfigException, InitializationException
openBackend
in class Backend<C extends org.forgerock.opendj.config.Configuration>
org.forgerock.opendj.config.server.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 final 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 org.forgerock.opendj.config.Configuration>
public void closeBackend()
It will be called as final step of finalizeBackend()
,
so subclasses might override it.
public abstract boolean isIndexed(org.forgerock.opendj.ldap.schema.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(SearchFilter 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 org.forgerock.opendj.ldap.ConditionResult hasSubordinates(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
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.DirectoryException
- If a problem occurs while trying to
retrieve the entry.public abstract long getNumberOfChildren(org.forgerock.opendj.ldap.Dn parentDN) throws DirectoryException
parentDN
- The distinguished name of the parent.DirectoryException
- 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(org.forgerock.opendj.ldap.Dn baseDN) throws DirectoryException
baseDN
- The base distinguished name.DirectoryException
- 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(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
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.DirectoryException
- If a problem occurs while trying to make the determination.public abstract Entry getEntry(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
entryDN
- The distinguished name of the entry to retrieve.null
if the entry does not exist.DirectoryException
- If a problem occurs while trying to retrieve the entry.public abstract void addEntry(Entry entry, AddOperation addOperation) throws DirectoryException, CanceledOperationException
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.DirectoryException
- If a problem occurs while trying to
add the entry.CanceledOperationException
- If this backend noticed and
reacted to a request to
cancel or abandon the add
operation.public abstract void deleteEntry(org.forgerock.opendj.ldap.Dn entryDN, DeleteOperation deleteOperation) throws DirectoryException, CanceledOperationException
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.DirectoryException
- If a problem occurs while trying to
remove the entry.CanceledOperationException
- 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 DirectoryException, CanceledOperationException
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.DirectoryException
- If a problem occurs while trying to replace the entry.CanceledOperationException
- If this backend noticed and reacted to a request to
cancel or abandon the modify operation.public abstract void renameEntry(org.forgerock.opendj.ldap.Dn currentDN, Entry entry, ModifyDNOperation modifyDNOperation) throws DirectoryException, CanceledOperationException
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.DirectoryException
- If a problem occurs while trying to perform the rename.CanceledOperationException
- If this backend noticed and reacted to a request to
cancel or abandon the modify DN operation.public abstract void search(SearchOperation searchOperation) throws DirectoryException, CanceledOperationException
SearchOperation.returnEntry
method. The caller is not
required to have any locks when calling this operation.searchOperation
- The search operation to be processed.DirectoryException
- If a problem occurs while processing
the search.CanceledOperationException
- If this backend noticed and
reacted to a request to
cancel or abandon the
search operation.public abstract boolean supports(LocalBackend.BackendOperation backendOperation)
backendOperation
- the backend operationtrue
if this backend supports the provided backend operation, false
otherwise.public abstract void exportLDIF(LDIFExportConfig exportConfig) throws DirectoryException
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.DirectoryException
- If a problem occurs while performing the LDIF export.public abstract LDIFImportResult importLDIF(LDIFImportConfig importConfig, ServerContext serverContext) throws DirectoryException
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 contextDirectoryException
- If a problem occurs while performing the LDIF import.public long verifyBackend(VerifyConfig verifyConfig) throws InitializationException, org.forgerock.opendj.config.server.ConfigException, DirectoryException
verifyConfig
- The verify configuration.org.forgerock.opendj.config.server.ConfigException
- If an unrecoverable problem arises during initialization.InitializationException
- If a problem occurs during initialization that is not related to the server
configuration.DirectoryException
- If a Directory Server error occurs.public void rebuildBackend(RebuildConfig rebuildConfig, ServerContext serverContext) throws InitializationException, org.forgerock.opendj.config.server.ConfigException, DirectoryException
rebuildConfig
- The rebuild configuration.serverContext
- The server context for this instanceorg.forgerock.opendj.config.server.ConfigException
- If an unrecoverable problem arises during initialization.InitializationException
- If a problem occurs during initialization that is not related to the server
configuration.DirectoryException
- If a Directory Server error occurs.public abstract void createBackup(BackupConfig backupConfig) throws DirectoryException
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.DirectoryException
- If a problem occurs while performing the backup.public abstract void removeBackup(BackupDirectory backupDirectory, String backupID) throws DirectoryException
backupDirectory
- The backup directory structure with
which the specified backup is
associated.backupID
- The backup ID for the backup to be
removed.DirectoryException
- 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 abstract void restoreBackup(RestoreConfig restoreConfig) throws DirectoryException
supports(BackendOperation)
with LocalBackend.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.DirectoryException
- 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 DirectoryException
persistentSearch
- The persistent search operation to register with this backendDirectoryException
- If a problem occurs while registering the persistent searchpublic Queue<PersistentSearch> getPersistentSearches()
public abstract long getEntryCount()
public final boolean handlesEntry(org.forgerock.opendj.ldap.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 org.forgerock.opendj.config.Configuration>
public void deregisterBackendMonitor()
Backend
deregisterBackendMonitor
in class Backend<C extends org.forgerock.opendj.config.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(org.forgerock.opendj.ldap.Dn entryDN, Collection<org.forgerock.opendj.ldap.Dn> baseDNs, Collection<org.forgerock.opendj.ldap.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-2017 ForgeRock AS. All Rights Reserved.