Class ConfigurationBackend

All Implemented Interfaces:
HealthStatusProvider

public final class ConfigurationBackend extends LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
Back-end responsible for management of configuration entries.
  • Field Details

    • CONFIG_BACKEND_ID

      public static final String CONFIG_BACKEND_ID
      The backend ID for the configuration backend.

      Try to avoid potential conflict with user backend identifiers.

      See Also:
  • Constructor Details

    • ConfigurationBackend

      public ConfigurationBackend(ServerContext serverContext)
      Creates and initializes a new instance of this backend.
      Parameters:
      serverContext - The server context.
  • Method Details

    • getBackendCfg

      Returns:
      a new ConfigurationBackend.ConfigurationBackendCfg for this ConfigurationBackend
    • closeBackend

      protected void closeBackend()
      Description copied from class: LocalBackend
      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.

      It will be called as final step of finalizeBackend(), so subclasses might override it.

      Specified by:
      closeBackend in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
    • configureBackend

      public void configureBackend(ConfigurationBackend.ConfigurationBackendCfg cfg, ServerContext serverContext)
      Description copied from class: Backend
      Configure this backend based on the information in the provided configuration. When the method returns, the backend will have been configured (ready to be opened) but still unable to process operations.
      Specified by:
      configureBackend in class Backend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      cfg - The configuration of this backend.
      serverContext - The server context for this instance
    • getServerContext

      protected ServerContext getServerContext()
      Description copied from class: LocalBackend
      Returns the server context used by this backend.
      Overrides:
      getServerContext in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Returns:
      the server context used by this backend
    • openBackend

      public void openBackend() throws InitializationException
      Description copied from class: LocalBackend
      Opens this backend based on the information provided when the backend was configured. It also should open any underlying storage and register all suffixes with the server.
      Specified by:
      openBackend in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Throws:
      InitializationException - If a problem occurs during opening that is not related to the server configuration.
      See Also:
    • isPublicBackend

      public boolean isPublicBackend()
      Description copied from class: Backend
      Indicates whether the base DNs of this backend should be considered public or private.

      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.

      Specified by:
      isPublicBackend in class Backend<ConfigurationBackend.ConfigurationBackendCfg>
      Returns:
      true if this backend's baseDNs could be exposed as a public naming context, false if they must remain private naming contexts.
    • getBaseDNs

      public Set<Dn> getBaseDNs()
      Description copied from class: Backend
      Retrieves the set of base-level DNs that may be used within this backend.
      Specified by:
      getBaseDNs in class Backend<ConfigurationBackend.ConfigurationBackendCfg>
      Returns:
      The set of base-level DNs that may be used within this backend.
    • getEntry

      public Entry getEntry(Dn entryDN)
      Description copied from class: LocalBackend
      Retrieves the requested entry from this backend. The caller is not required to hold any locks on the specified DN.
      Specified by:
      getEntry in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      entryDN - The distinguished name of the entry to retrieve.
      Returns:
      The requested entry, or null if the entry does not exist.
    • getEntryCount

      public long getEntryCount()
      Description copied from class: LocalBackend
      Retrieves the total number of entries contained in this backend, if that information is available.
      Specified by:
      getEntryCount in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Returns:
      The total number of entries contained in this backend, or -1 if that information is not available.
    • getNumberOfChildren

      public long getNumberOfChildren(Dn parentDN) throws LdapException
      Description copied from class: LocalBackend
      Retrieves the number of subordinates immediately below the requested entry.
      Specified by:
      getNumberOfChildren in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      parentDN - The distinguished name of the parent.
      Returns:
      The number of subordinate entries for the requested entry.
      Throws:
      LdapException - If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the entry.
    • getNumberOfEntriesInBaseDN

      public long getNumberOfEntriesInBaseDN(Dn baseDN) throws LdapException
      Description copied from class: LocalBackend
      Retrieves the number of entries for the specified base DN including all entries from the requested entry to the lowest level in the tree.
      Specified by:
      getNumberOfEntriesInBaseDN in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      baseDN - The base distinguished name.
      Returns:
      The number of subordinate entries including the base dn.
      Throws:
      LdapException - If baseDN isn't a base dn managed by this backend or if a problem occurs while trying to retrieve the entry.
    • hasSubordinates

      public ConditionResult hasSubordinates(Dn entryDN) throws LdapException
      Description copied from class: LocalBackend
      Indicates whether the requested entry has any subordinates.
      Specified by:
      hasSubordinates in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      entryDN - The distinguished name of the entry.
      Returns:
      ConditionResult.TRUE if the entry has one or more subordinates or ConditionResult.FALSE otherwise or ConditionResult.UNDEFINED if it can not be determined.
      Throws:
      LdapException - If a problem occurs while trying to retrieve the entry.
    • isIndexed

      public boolean isIndexed(AttributeType attributeType, IndexType indexType)
      Description copied from class: LocalBackend
      Indicates whether search operations which target the specified attribute in the indicated manner would be considered indexed in this backend. The operation should be considered indexed only if the specified operation can be completed efficiently within the backend.

      Note that this method should return a general result that covers all values of the specified attribute. If a the specified attribute is indexed in the indicated manner but some particular values may still be treated as unindexed (e.g., if the number of entries with that attribute value exceeds some threshold), then this method should still return true for the specified attribute and index type.
      Specified by:
      isIndexed in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      attributeType - The attribute type for which to make the determination.
      indexType - The index type for which to make the determination.
      Returns:
      true if search operations targeting the specified attribute in the indicated manner should be considered indexed, or false if not.
    • isIndexed

      public boolean isIndexed(AttributeType attributeType, MatchingRule matchingRule)
      Description copied from class: LocalBackend
      Indicates whether extensible match search operations that target the specified attribute with the given matching rule should be considered indexed in this backend.
      Specified by:
      isIndexed in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      attributeType - The attribute type for which to make the determination.
      matchingRule - The matching rule for which to make the determination.
      Returns:
      true if extensible match search operations targeting the specified attribute with the given matching rule should be considered indexed, or false if not.
    • entryExists

      public boolean entryExists(Dn entryDN)
      Description copied from class: LocalBackend
      Indicates whether an entry with the specified DN exists in the backend. The default implementation calls 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.
      Overrides:
      entryExists in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      entryDN - The DN of the entry for which to determine existence.
      Returns:
      true if the specified entry exists in this backend, or false if it does not.
    • supports

      public boolean supports(LocalBackend.BackendOperation backendOperation)
      Description copied from class: LocalBackend
      Indicates whether this backend supports the provided backend operation.
      Overrides:
      supports in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      backendOperation - the backend operation
      Returns:
      true if this backend supports the provided backend operation, false otherwise.
    • search

      public void search(SearchOperation searchOperation) throws LdapException
      Description copied from class: LocalBackend
      Processes the specified search in this backend. Matching entries should be provided back to the core server using the SearchOperation.returnEntry method. The caller is not required to have any locks when calling this operation.
      Specified by:
      search in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      searchOperation - The search operation to be processed.
      Throws:
      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.
    • addEntry

      public void addEntry(Entry entry, AddOperation addOperation) throws LdapException
      Description copied from class: LocalBackend
      Adds the provided entry to this backend. This method must ensure that the entry is appropriate for the backend and that no entry already exists with the same DN. The caller must hold a write lock on the DN of the provided entry.
      Specified by:
      addEntry in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      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.
      Throws:
      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.
    • deleteEntry

      public void deleteEntry(Dn entryDN, DeleteOperation deleteOperation) throws LdapException
      Description copied from class: LocalBackend
      Removes the specified entry from this backend. This method must ensure that the entry exists and that it does not have any subordinate entries (unless the backend supports a subtree delete operation and the client included the appropriate information in the request). The caller must hold a write lock on the provided entry DN.
      Specified by:
      deleteEntry in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      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.
      Throws:
      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.
    • replaceEntry

      public void replaceEntry(Entry oldEntry, Entry newEntry, ModifyOperation modifyOperation) throws LdapException
      Description copied from class: LocalBackend
      Replaces the specified entry with the provided entry in this backend. The backend must ensure that an entry already exists with the same DN as the provided entry. The caller must hold a write lock on the DN of the provided entry.
      Specified by:
      replaceEntry in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      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.
      Throws:
      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.
    • renameEntry

      public void renameEntry(Dn currentDN, Entry entry, ModifyDnOperation modifyDNOperation) throws LdapException
      Description copied from class: LocalBackend
      Moves and/or renames the provided entry in this backend, altering any subordinate entries as necessary. This must ensure that an entry already exists with the provided current DN, and that no entry exists with the target DN of the provided entry. The caller must hold write locks on both the current DN and the new DN for the entry.
      Specified by:
      renameEntry in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      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.
      Throws:
      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.
    • exportLDIF

      public void exportLDIF(LDIFExportConfig exportConfig) throws LdapException
      Description copied from class: LocalBackend
      Exports the contents of this backend to LDIF. This method should only be called if LocalBackend.supports(BackendOperation) with LocalBackend.BackendOperation.LDIF_EXPORT returns true.

      Note that the server will not explicitly initialize this backend before calling this method.

      Overrides:
      exportLDIF in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      exportConfig - The configuration to use when performing the export.
      Throws:
      LdapException - If a problem occurs while performing the LDIF export.
    • importLDIF

      public LocalBackend.LDIFImportResult importLDIF(LDIFImportConfig importConfig, ServerContext serverContext) throws LdapException
      Description copied from class: LocalBackend
      Imports information from an LDIF file into this backend. This method should only be called if LocalBackend.supports(BackendOperation) with LocalBackend.BackendOperation.LDIF_IMPORT returns true.

      Note that the server will not explicitly initialize this backend before calling this method.

      Overrides:
      importLDIF in class LocalBackend<ConfigurationBackend.ConfigurationBackendCfg>
      Parameters:
      importConfig - The configuration to use when performing the import.
      serverContext - The server context
      Returns:
      Information about the result of the import processing.
      Throws:
      LdapException - If a problem occurs while performing the LDIF import.