C
- the type of the BackendCfg for the current backendpublic abstract class BackendImpl<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg> extends LocalBackend<C> implements org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.PluggableBackendCfg>
LocalBackend.BackendOperation
Constructor and Description |
---|
BackendImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend.
|
org.forgerock.opendj.config.server.ConfigChangeResult |
applyConfigurationChange(org.forgerock.opendj.server.config.server.PluggableBackendCfg newCfg) |
boolean |
clearBackend()
Clears the contents of this backend, including any database files.
|
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 |
configureBackend(C cfg,
ServerContext serverContext)
Configure this backend based on the information in the provided configuration.
|
protected abstract Storage |
configureStorage(C cfg,
ServerContext serverContext)
Creates the storage engine which will be used by this pluggable backend.
|
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.
|
void |
deleteEntry(org.forgerock.opendj.ldap.Dn entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
boolean |
entryExists(org.forgerock.opendj.ldap.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.
|
Set<org.forgerock.opendj.ldap.Dn> |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within this backend.
|
Entry |
getEntry(org.forgerock.opendj.ldap.Dn entryDN)
Retrieves the requested entry from this backend.
|
long |
getEntryCount()
Retrieves the total number of entries contained in this backend, if that information is available.
|
long |
getNumberOfChildren(org.forgerock.opendj.ldap.Dn parentDN)
Retrieves the number of subordinates immediately below the requested entry.
|
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.
|
Set<String> |
getSupportedControls()
Retrieves the OIDs of the controls that may be supported by this backend.
|
org.forgerock.opendj.ldap.ConditionResult |
hasSubordinates(org.forgerock.opendj.ldap.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.
|
boolean |
isConfigurationAcceptable(C config,
List<LocalizableMessage> unacceptableReasons,
ServerContext serverContext)
Indicates whether the provided configuration is acceptable for this backend.
|
boolean |
isConfigurationChangeAcceptable(org.forgerock.opendj.server.config.server.PluggableBackendCfg cfg,
List<LocalizableMessage> unacceptableReasons) |
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 |
isPublicBackend()
Indicates whether the base DNs of this backend should be considered public or private.
|
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 |
removeBackup(BackupDirectory backupDirectory,
String backupID)
Removes the specified backup if it is possible to do so.
|
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.
|
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.
|
void |
search(SearchOperation searchOperation)
Processes the specified search in this backend.
|
boolean |
supports(LocalBackend.BackendOperation backendOperation)
Indicates whether this backend supports the provided backend operation.
|
long |
verifyBackend(VerifyConfig verifyConfig)
Verify the integrity of the backend instance.
|
deregisterBackendMonitor, finalizeBackend, getPersistentSearches, getWritabilityMode, handle, handlesEntry, handlesEntry, isIndexed, registerBackendMonitor, registerPersistentSearch, setWritabilityMode, supportsControl
getBackendID, getSupportedFeatures, setBackendID
public void configureBackend(C cfg, ServerContext serverContext) throws org.forgerock.opendj.config.server.ConfigException
Backend
configureBackend
in class Backend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 void openBackend() throws org.forgerock.opendj.config.server.ConfigException, InitializationException
LocalBackend
openBackend
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 boolean isPublicBackend()
Backend
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.
isPublicBackend
in class Backend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
true
if this backend's baseDNs could be exposed as a public naming context, false
if they
must remain private naming contexts.public void closeBackend()
LocalBackend
It will be called as final step of finalizeBackend()
, so subclasses might override it.
closeBackend
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
public boolean clearBackend() throws org.forgerock.opendj.config.server.ConfigException, InitializationException
true
if this backend was open at the time of calling.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.public boolean isIndexed(org.forgerock.opendj.ldap.schema.AttributeType attributeType, IndexType indexType)
LocalBackend
true
for the specified attribute and index type.isIndexed
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 supports(LocalBackend.BackendOperation backendOperation)
LocalBackend
supports
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
backendOperation
- the backend operationtrue
if this backend supports the provided backend operation, false
otherwise.public Set<String> getSupportedControls()
Backend
getSupportedControls
in class Backend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
public Set<org.forgerock.opendj.ldap.Dn> getBaseDNs()
Backend
getBaseDNs
in class Backend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
public long getEntryCount()
LocalBackend
getEntryCount
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
public org.forgerock.opendj.ldap.ConditionResult hasSubordinates(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
LocalBackend
hasSubordinates
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 long getNumberOfEntriesInBaseDN(org.forgerock.opendj.ldap.Dn baseDN) throws DirectoryException
LocalBackend
getNumberOfEntriesInBaseDN
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.public long getNumberOfChildren(org.forgerock.opendj.ldap.Dn parentDN) throws DirectoryException
LocalBackend
getNumberOfChildren
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.public boolean entryExists(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
LocalBackend
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.entryExists
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 Entry getEntry(org.forgerock.opendj.ldap.Dn entryDN) throws DirectoryException
LocalBackend
getEntry
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 void addEntry(Entry entry, AddOperation addOperation) throws DirectoryException, org.forgerock.opendj.ldap.CancelledResultException
LocalBackend
addEntry
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.org.forgerock.opendj.ldap.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the add operation.public void deleteEntry(org.forgerock.opendj.ldap.Dn entryDN, DeleteOperation deleteOperation) throws DirectoryException, org.forgerock.opendj.ldap.CancelledResultException
LocalBackend
deleteEntry
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.org.forgerock.opendj.ldap.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the delete operation.public void replaceEntry(Entry oldEntry, Entry newEntry, ModifyOperation modifyOperation) throws DirectoryException, org.forgerock.opendj.ldap.CancelledResultException
LocalBackend
replaceEntry
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.org.forgerock.opendj.ldap.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify operation.public void renameEntry(org.forgerock.opendj.ldap.Dn currentDN, Entry entry, ModifyDNOperation modifyDNOperation) throws DirectoryException, org.forgerock.opendj.ldap.CancelledResultException
LocalBackend
renameEntry
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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.org.forgerock.opendj.ldap.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the modify DN operation.public void search(SearchOperation searchOperation) throws DirectoryException, org.forgerock.opendj.ldap.CancelledResultException
LocalBackend
SearchOperation.returnEntry
method. The caller is not required to have any locks when calling this
operation.search
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
searchOperation
- The search operation to be processed.DirectoryException
- If a problem occurs while processing the search.org.forgerock.opendj.ldap.CancelledResultException
- If this backend noticed and reacted to a request to cancel or abandon the search operation.public void exportLDIF(LDIFExportConfig exportConfig) throws DirectoryException
LocalBackend
LocalBackend.supports(BackendOperation)
with LocalBackend.BackendOperation.LDIF_EXPORT
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
exportLDIF
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
exportConfig
- The configuration to use when performing the export.DirectoryException
- If a problem occurs while performing the LDIF export.public LDIFImportResult importLDIF(LDIFImportConfig importConfig, ServerContext serverContext) throws DirectoryException
LocalBackend
LocalBackend.supports(BackendOperation)
with LocalBackend.BackendOperation.LDIF_IMPORT
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
importLDIF
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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
LocalBackend
verifyBackend
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
verifyConfig
- The verify configuration.InitializationException
- If a problem occurs during initialization that is not related to the server configuration.org.forgerock.opendj.config.server.ConfigException
- If an unrecoverable problem arises during initialization.DirectoryException
- If a Directory Server error occurs.public void rebuildBackend(RebuildConfig rebuildConfig, ServerContext serverContext) throws InitializationException, org.forgerock.opendj.config.server.ConfigException, DirectoryException
LocalBackend
rebuildBackend
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
rebuildConfig
- The rebuild configuration.serverContext
- The server context for this instanceInitializationException
- If a problem occurs during initialization that is not related to the server configuration.org.forgerock.opendj.config.server.ConfigException
- If an unrecoverable problem arises during initialization.DirectoryException
- If a Directory Server error occurs.public void createBackup(BackupConfig backupConfig) throws DirectoryException
LocalBackend
LocalBackend.supports(BackendOperation)
with LocalBackend.BackendOperation.BACKUP
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
createBackup
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
backupConfig
- The configuration to use when performing the backup.DirectoryException
- If a problem occurs while performing the backup.public void removeBackup(BackupDirectory backupDirectory, String backupID) throws DirectoryException
LocalBackend
removeBackup
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
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 void restoreBackup(RestoreConfig restoreConfig) throws DirectoryException
LocalBackend
LocalBackend.supports(BackendOperation)
with LocalBackend.BackendOperation.RESTORE
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
restoreBackup
in class LocalBackend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
restoreConfig
- The configuration to use when performing the restore.DirectoryException
- If a problem occurs while performing the restore.protected abstract Storage configureStorage(C cfg, ServerContext serverContext) throws org.forgerock.opendj.config.server.ConfigException
cfg
- the configuration objectserverContext
- this Directory Server intsance's server contextorg.forgerock.opendj.config.server.ConfigException
- If there is an error in the configuration.public boolean isConfigurationAcceptable(C config, List<LocalizableMessage> unacceptableReasons, ServerContext serverContext)
Backend
isConfigurationAcceptable
in class Backend<C extends org.forgerock.opendj.server.config.server.PluggableBackendCfg>
config
- 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 boolean isConfigurationChangeAcceptable(org.forgerock.opendj.server.config.server.PluggableBackendCfg cfg, List<LocalizableMessage> unacceptableReasons)
isConfigurationChangeAcceptable
in interface org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.PluggableBackendCfg>
public org.forgerock.opendj.config.server.ConfigChangeResult applyConfigurationChange(org.forgerock.opendj.server.config.server.PluggableBackendCfg newCfg)
applyConfigurationChange
in interface org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.PluggableBackendCfg>
Copyright © 2010–2017 ForgeRock AS. All rights reserved.