C
- the type of the BackendCfg for the current backend@PublicAPI(stability=VOLATILE, mayInstantiate=false, mayExtend=true, mayInvoke=false) public abstract class Backend<C extends Configuration> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Backend.BackendOperation
Enumeration of optional backend operations.
|
Constructor and Description |
---|
Backend() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend.
|
void |
addSubordinateBackend(Backend<?> subordinateBackend)
Adds the provided backend to the set of subordinate backends for
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 |
configureBackend(C cfg,
ServerContext serverContext)
Configure this backend based on the information in the provided configuration.
|
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(DN entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
boolean |
entryExists(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.
|
String |
getBackendID()
Retrieves the unique identifier for this backend.
|
BackendMonitor |
getBackendMonitor()
Retrieves the backend monitor that is associated with this
backend.
|
abstract DN[] |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within 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.
|
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.
|
Backend<?> |
getParentBackend()
Retrieves the parent backend for this backend.
|
Queue<PersistentSearch> |
getPersistentSearches()
Returns the persistent searches currently active against this local
backend.
|
Backend<?>[] |
getSubordinateBackends()
Retrieves the set of subordinate backends for this backend.
|
abstract Set<String> |
getSupportedControls()
Retrieves the OIDs of the controls that may be supported by this
backend.
|
abstract Set<String> |
getSupportedFeatures()
Retrieves the OIDs of the features that may be supported by this
backend.
|
WritabilityMode |
getWritabilityMode()
Retrieves the writability mode for 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 org.forgerock.opendj.ldap.ConditionResult |
hasSubordinates(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.
|
boolean |
isConfigurationAcceptable(C configuration,
List<LocalizableMessage> unacceptableReasons,
ServerContext serverContext)
Indicates whether the provided configuration is acceptable for
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(SearchFilter filter)
Indicates whether a subtree search using the provided filter
would be indexed in this backend.
|
boolean |
isPrivateBackend()
Indicates whether this backend holds private data or user data.
|
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 |
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.
|
void |
removeSubordinateBackend(Backend<?> subordinateBackend)
Removes the provided backend from the set of subordinate backends
for this backend.
|
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.
|
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 |
setBackendID(String backendID)
Specifies the unique identifier for this backend.
|
void |
setBackendMonitor(BackendMonitor backendMonitor)
Sets the backend monitor for this backend.
|
void |
setParentBackend(Backend<?> parentBackend)
Specifies the parent backend for this backend.
|
void |
setPrivateBackend(boolean isPrivateBackend)
Specifies whether this backend holds private data or user data.
|
void |
setWritabilityMode(WritabilityMode writabilityMode)
Specifies the writability mode for this backend.
|
abstract boolean |
supports(Backend.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.
|
public Backend()
public abstract void configureBackend(C cfg, ServerContext serverContext) throws org.forgerock.opendj.config.server.ConfigException
cfg
- The configuration of this backend.serverContext
- The server context for this instanceorg.forgerock.opendj.config.server.ConfigException
- If there is an error in the configuration.public boolean isConfigurationAcceptable(C configuration, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)
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 contexttrue
if the provided configuration is acceptable
for this backend, or false
if not.public abstract void openBackend() throws org.forgerock.opendj.config.server.ConfigException, InitializationException
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.configureBackend(C, org.opends.server.core.ServerContext)
public final void finalizeBackend()
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.
public void closeBackend()
It will be called as final step of finalizeBackend()
,
so subclasses might override it.
public abstract DN[] getBaseDNs()
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(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 Entry getEntry(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 org.forgerock.opendj.ldap.ConditionResult hasSubordinates(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(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(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(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 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(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(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 Set<String> getSupportedControls()
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 abstract Set<String> getSupportedFeatures()
public abstract boolean supports(Backend.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 Backend.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 Backend.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
Backend.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 Backend.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 String getBackendID()
public final void setBackendID(String backendID)
backendID
- The unique identifier for this backend.public final boolean isPrivateBackend()
true
if this backend holds private data, or
false
if it holds user data.public final void setPrivateBackend(boolean isPrivateBackend)
isPrivateBackend
- Specifies whether this backend holds
private data or user data.public final WritabilityMode getWritabilityMode()
public final void setWritabilityMode(WritabilityMode writabilityMode)
writabilityMode
- The writability mode for this backend.public final BackendMonitor getBackendMonitor()
null
if none has been assigned.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 final void setBackendMonitor(BackendMonitor backendMonitor)
backendMonitor
- The backend monitor for this backend.public abstract long getEntryCount()
public final Backend<?> getParentBackend()
null
if
there is none.public final void setParentBackend(Backend<?> parentBackend)
parentBackend
- The parent backend for this backend.public final Backend<?>[] getSubordinateBackends()
public final void addSubordinateBackend(Backend<?> subordinateBackend)
subordinateBackend
- The backend to add to the set of
subordinate backends for this
backend.public final void removeSubordinateBackend(Backend<?> subordinateBackend)
subordinateBackend
- The backend to remove from the set of
subordinate backends for this
backend.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 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-2016 ForgeRock AS. All Rights Reserved.