public class TrustStoreBackend extends LocalBackend<TrustStoreBackendCfg> implements ConfigurationChangeListener<TrustStoreBackendCfg>
LocalBackend.BackendOperation
Constructor and Description |
---|
TrustStoreBackend()
Creates a new backend.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend.
|
ConfigChangeResult |
applyConfigurationChange(TrustStoreBackendCfg cfg)
Applies the configuration changes to this change listener.
|
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(TrustStoreBackendCfg config,
ServerContext serverContext)
Configure this backend based on the information in the provided configuration.
|
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.
|
static void |
createDefaultTrustStorePinFileIfDoesNotExist(Path instanceRoot)
Creates the default trust store pin file if it does not already exists.
|
void |
deleteEntry(Dn entryDN,
DeleteOperation deleteOperation)
Removes the specified entry from this backend.
|
Set<Dn> |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within this backend.
|
Entry |
getEntry(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.
|
Key |
getKey(String alias)
Returns the key associated with the given alias, using the trust store pin to recover it.
|
KeyManager[] |
getKeyManagers()
Retrieves a set of
KeyManager objects that may be used for interactions requiring access to a key
manager. |
long |
getNumberOfChildren(Dn parentDN)
Retrieves the number of subordinates immediately below the requested entry.
|
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.
|
TrustManager[] |
getTrustManagers()
Retrieves a set of
TrustManager objects that may be used for interactions requiring access to a trust
manager. |
ConditionResult |
hasSubordinates(Dn entryDN)
Indicates whether the requested entry has any subordinates.
|
boolean |
isConfigurationChangeAcceptable(TrustStoreBackendCfg configuration,
List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable
to this change listener.
|
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 |
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 |
removeBackup(BackupDirectory backupDirectory,
String backupID)
Removes the specified backup if it is possible to do so.
|
void |
renameEntry(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.
|
deregisterBackendMonitor, entryExists, exportLDIF, finalizeBackend, getLocalBackendMonitor, getPersistentSearches, getWritabilityMode, handle, handlesEntry, handlesEntry, importLDIF, isIndexed, rebuildBackend, registerBackendMonitor, registerPersistentSearch, setWritabilityMode, supportsControl, verifyBackend
getBackendID, getHealthStatus, getSupportedControls, getSupportedFeatures, isConfigurationAcceptable, setBackendID, toString
public TrustStoreBackend()
super()
to invoke this constructor.public void configureBackend(TrustStoreBackendCfg config, ServerContext serverContext) throws ConfigException
Backend
configureBackend
in class Backend<TrustStoreBackendCfg>
config
- The configuration of this backend.serverContext
- The server context for this instanceConfigException
- If there is an error in the configuration.public void openBackend() throws InitializationException
LocalBackend
openBackend
in class LocalBackend<TrustStoreBackendCfg>
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<TrustStoreBackendCfg>
true
if this backend's baseDNs could be exposed as a public naming context, false
if they
must remain private naming contexts.public static void createDefaultTrustStorePinFileIfDoesNotExist(Path instanceRoot) throws InitializationException
instanceRoot
- The root path of the server instance.InitializationException
- If an error occurs while creating the filepublic void closeBackend()
LocalBackend
It will be called as final step of finalizeBackend()
, so subclasses might override it.
closeBackend
in class LocalBackend<TrustStoreBackendCfg>
public Set<Dn> getBaseDNs()
Backend
getBaseDNs
in class Backend<TrustStoreBackendCfg>
public long getEntryCount()
LocalBackend
getEntryCount
in class LocalBackend<TrustStoreBackendCfg>
public boolean isIndexed(AttributeType attributeType, IndexType indexType)
LocalBackend
true
for the specified attribute and index type.isIndexed
in class LocalBackend<TrustStoreBackendCfg>
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 Entry getEntry(Dn entryDN) throws LdapException
LocalBackend
getEntry
in class LocalBackend<TrustStoreBackendCfg>
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 void addEntry(Entry entry, AddOperation addOperation) throws LdapException
LocalBackend
addEntry
in class LocalBackend<TrustStoreBackendCfg>
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 void deleteEntry(Dn entryDN, DeleteOperation deleteOperation) throws LdapException
LocalBackend
deleteEntry
in class LocalBackend<TrustStoreBackendCfg>
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 void replaceEntry(Entry oldEntry, Entry newEntry, ModifyOperation modifyOperation) throws LdapException
LocalBackend
replaceEntry
in class LocalBackend<TrustStoreBackendCfg>
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 void renameEntry(Dn currentDN, Entry entry, ModifyDnOperation modifyDNOperation) throws LdapException
LocalBackend
renameEntry
in class LocalBackend<TrustStoreBackendCfg>
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 void search(SearchOperation searchOperation) throws LdapException
LocalBackend
SearchOperation.returnEntry
method. The caller is not required to have any locks when calling this
operation.search
in class LocalBackend<TrustStoreBackendCfg>
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 ConditionResult hasSubordinates(Dn entryDN) throws LdapException
LocalBackend
hasSubordinates
in class LocalBackend<TrustStoreBackendCfg>
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 long getNumberOfEntriesInBaseDN(Dn baseDN) throws LdapException
LocalBackend
getNumberOfEntriesInBaseDN
in class LocalBackend<TrustStoreBackendCfg>
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.public long getNumberOfChildren(Dn parentDN) throws LdapException
LocalBackend
getNumberOfChildren
in class LocalBackend<TrustStoreBackendCfg>
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.public boolean isConfigurationChangeAcceptable(TrustStoreBackendCfg configuration, List<LocalizableMessage> unacceptableReasons)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<TrustStoreBackendCfg>
configuration
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the
provided configuration is not acceptable.true
if the proposed change is acceptable,
or false
if it is not.public ConfigChangeResult applyConfigurationChange(TrustStoreBackendCfg cfg)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<TrustStoreBackendCfg>
cfg
- The new configuration containing the changes.public KeyManager[] getKeyManagers() throws LdapException
KeyManager
objects that may be used for interactions requiring access to a key
manager.KeyManager
objects that may be used for interactions requiring access to a key
manager.LdapException
- If a problem occurs while attempting to obtain the set of key managers.public TrustManager[] getTrustManagers() throws LdapException
TrustManager
objects that may be used for interactions requiring access to a trust
manager.TrustManager
objects that may be used for interactions requiring access to a trust
manager.LdapException
- If a problem occurs while attempting to obtain the set of trust managers.public Key getKey(String alias) throws LdapException
alias
- The alias name.LdapException
- If an error occurs while retrieving the key.public boolean supports(LocalBackend.BackendOperation backendOperation)
LocalBackend
supports
in class LocalBackend<TrustStoreBackendCfg>
backendOperation
- the backend operationtrue
if this backend supports the provided backend operation, false
otherwise.public void createBackup(BackupConfig backupConfig) throws LdapException
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<TrustStoreBackendCfg>
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
LocalBackend
removeBackup
in class LocalBackend<TrustStoreBackendCfg>
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
LocalBackend
LocalBackend.supports(BackendOperation)
with BackendOperation#RESTORE
returns true
.
Note that the server will not explicitly initialize this backend before calling this method.
restoreBackup
in class LocalBackend<TrustStoreBackendCfg>
restoreConfig
- The configuration to use when performing the restore.LdapException
- If a problem occurs while performing the restore.Copyright 2010-2022 ForgeRock AS.