|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opends.server.api.Backend
org.opends.server.api.ConfigHandler
org.opends.server.extensions.ConfigFileHandler
public class ConfigFileHandler
This class defines a simple configuration handler for the Directory Server that will read the server configuration from an LDIF file.
Constructor Summary | |
---|---|
ConfigFileHandler()
Creates a new instance of this config file handler. |
Method Summary | |
---|---|
void |
addEntry(Entry entry,
AddOperation addOperation)
Adds the provided entry to this backend. |
void |
configureBackend(Configuration cfg)
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. |
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. |
void |
exportLDIF(LDIFExportConfig exportConfig)
Exports the contents of this backend to LDIF. |
void |
finalizeBackend()
Performs any necessary work to finalize this backend, including closing any underlying databases or connections and deregistering any suffixes that it manages with the Directory Server. |
void |
finalizeConfigHandler()
Finalizes this configuration handler so that it will release any resources associated with it so that it will no longer be used. |
java.util.LinkedHashMap<java.lang.String,java.lang.String> |
getAlerts()
Retrieves information about the set of alerts that this generator may produce. |
DN[] |
getBaseDNs()
Retrieves the set of base-level DNs that may be used within this backend. |
java.lang.String |
getClassName()
Retrieves the fully-qualified name of the Java class for this alert generator implementation. |
DN |
getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated. |
ConfigEntry |
getConfigEntry(DN entryDN)
Retrieves the requested entry from the configuration. |
ConfigEntry |
getConfigRootEntry()
Retrieves the entry that is at the root of the Directory Server configuration. |
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. |
java.lang.String |
getServerRoot()
Retrieves the absolute path of the Directory Server instance root. |
java.util.HashSet<java.lang.String> |
getSupportedControls()
Retrieves the OIDs of the controls that may be supported by this backend. |
java.util.HashSet<java.lang.String> |
getSupportedFeatures()
Retrieves the OIDs of the features that may be supported by this backend. |
void |
handleConfigChangeResult(ConfigChangeResult result,
DN entryDN,
java.lang.String className,
java.lang.String methodName)
Examines the provided result and logs a message if appropriate. |
ConditionResult |
hasSubordinates(DN entryDN)
Indicates whether the requested entry has any subordinates. |
LDIFImportResult |
importLDIF(LDIFImportConfig importConfig)
Imports information from an LDIF file into this backend. |
void |
initializeBackend()
Initializes this backend based on the information provided when the backend was configured. |
void |
initializeConfigHandler(java.lang.String configFile,
boolean checkSchema)
Bootstraps this configuration handler using the information in the provided configuration file. |
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 |
isLocal()
Indicates whether the data associated with this backend may be considered local (i.e., in a repository managed by the Directory Server) rather than remote (i.e., in an external repository accessed by the Directory Server but managed through some other means). |
long |
numSubordinates(DN entryDN,
boolean subtree)
Retrieves the number of subordinates for the requested entry. |
void |
preloadEntryCache()
Attempts to pre-load all the entries stored within this backend into the entry cache. |
void |
removeBackup(BackupDirectory backupDirectory,
java.lang.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 entry,
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 |
supportsBackup()
Indicates whether this backend provides a backup mechanism of any kind. |
boolean |
supportsBackup(BackupConfig backupConfig,
java.lang.StringBuilder unsupportedReason)
Indicates whether this backend provides a mechanism to perform a backup of its contents in a form that can be restored later, based on the provided configuration. |
boolean |
supportsLDIFExport()
Indicates whether this backend provides a mechanism to export the data it contains to an LDIF file. |
boolean |
supportsLDIFImport()
Indicates whether this backend provides a mechanism to import its data from an LDIF file. |
boolean |
supportsRestore()
Indicates whether this backend provides a mechanism to restore a backup. |
void |
writeSuccessfulStartupConfig()
Indicates that the Directory Server has started successfully and that the configuration handler should save a copy of the current configuration for use as a "last known good" reference. |
void |
writeUpdatedConfig()
Writes an updated version of the Directory Server configuration to the repository. |
Methods inherited from class org.opends.server.api.Backend |
---|
addSubordinateBackend, getBackendID, getBackendMonitor, getParentBackend, getSubordinateBackends, getWritabilityMode, handlesEntry, handlesEntry, hasSubSuffix, isConfigurationAcceptable, isIndexed, isIndexed, isPrivateBackend, removeSubordinateBackend, removeSubSuffix, setBackendID, setBackendMonitor, setParentBackend, setPrivateBackend, setSubordinateBackends, setWritabilityMode, supportsControl, supportsFeature |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConfigFileHandler()
initializeConfigHandler
method.
Method Detail |
---|
public void initializeConfigHandler(java.lang.String configFile, boolean checkSchema) throws InitializationException
initializeConfigHandler
in class ConfigHandler
configFile
- The path to the file to use to initialize
this configuration handler.checkSchema
- Indicates whether to perform schema checking
on the configuration data.
InitializationException
- If a problem occurs while
attempting to initialize this
configuration handler.public void finalizeConfigHandler()
finalizeConfigHandler
in class ConfigHandler
public void finalizeBackend()
finalizeBackend
in class Backend
public ConfigEntry getConfigRootEntry() throws ConfigException
getConfigRootEntry
in class ConfigHandler
ConfigException
- If a problem occurs while interacting
with the configuration.public ConfigEntry getConfigEntry(DN entryDN) throws ConfigException
getConfigEntry
in class ConfigHandler
entryDN
- The distinguished name of the configuration
entry to retrieve.
ConfigException
- If a problem occurs while interacting
with the configuration.public java.lang.String getServerRoot()
getServerRoot
in class ConfigHandler
public void configureBackend(Configuration cfg) throws ConfigException
configureBackend
in class Backend
cfg
- The configuration of this backend.
ConfigException
- If there is an error in the configuration.public void initializeBackend() throws ConfigException, InitializationException
initializeBackend
in class Backend
ConfigException
- If an unrecoverable problem arises in
the process of performing the
initialization.
InitializationException
- If a problem occurs during
initialization that is not
related to the server
configuration.Backend.configureBackend(org.opends.server.admin.Configuration)
public DN[] getBaseDNs()
getBaseDNs
in class Backend
public long getEntryCount()
getEntryCount
in class Backend
public boolean isLocal()
isLocal
in class Backend
true
if the data associated with this backend
may be considered local, or false
if it is
remote.public boolean isIndexed(AttributeType attributeType, IndexType indexType)
true
for the specified
attribute and index type.
isIndexed
in class Backend
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 ConditionResult hasSubordinates(DN entryDN) throws DirectoryException
hasSubordinates
in class Backend
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 numSubordinates(DN entryDN, boolean subtree) throws DirectoryException
numSubordinates
in class Backend
entryDN
- The distinguished name of the entry.subtree
- true
to include all entries from the
requested entry to the lowest level in the
tree or false
to only include
the entries immediately below the requested
entry.
DirectoryException
- If a problem occurs while trying to
retrieve the entry.public Entry getEntry(DN entryDN) throws DirectoryException
getEntry
in class Backend
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 boolean entryExists(DN entryDN) throws DirectoryException
getEntry
, but backend implementations may override this
with a more efficient version that does not require a lock. The
caller is not required to hold any locks on the specified DN.
entryExists
in class Backend
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 void addEntry(Entry entry, AddOperation addOperation) throws DirectoryException
addEntry
in class Backend
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.public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) throws DirectoryException
deleteEntry
in class Backend
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.public void replaceEntry(Entry entry, ModifyOperation modifyOperation) throws DirectoryException
replaceEntry
in class Backend
entry
- 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.public void renameEntry(DN currentDN, Entry entry, ModifyDNOperation modifyDNOperation) throws DirectoryException
renameEntry
in class Backend
currentDN
- The current DN of the entry to be
replaced.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.public void search(SearchOperation searchOperation) throws DirectoryException
SearchOperation.returnEntry
method. The caller is not
required to have any locks when calling this operation.
search
in class Backend
searchOperation
- The search operation to be processed.
DirectoryException
- If a problem occurs while processing
the search.public void writeUpdatedConfig() throws DirectoryException
writeUpdatedConfig
in class ConfigHandler
DirectoryException
- If a problem is encountered while
writing the updated configuration.public void writeSuccessfulStartupConfig()
writeSuccessfulStartupConfig
in class ConfigHandler
public java.util.HashSet<java.lang.String> getSupportedControls()
getSupportedControls
in class Backend
public java.util.HashSet<java.lang.String> getSupportedFeatures()
getSupportedFeatures
in class Backend
public boolean supportsLDIFExport()
supportsLDIFExport
in class Backend
true
if this backend provides an LDIF export
mechanism, or false
if not.public void exportLDIF(LDIFExportConfig exportConfig) throws DirectoryException
supportsLDIFExport
returns
true
. Note that the server will not explicitly
initialize this backend before calling this method.
exportLDIF
in class Backend
exportConfig
- The configuration to use when performing
the export.
DirectoryException
- If a problem occurs while performing
the LDIF export.public boolean supportsLDIFImport()
supportsLDIFImport
in class Backend
true
if this backend provides an LDIF import
mechanism, or false
if not.public LDIFImportResult importLDIF(LDIFImportConfig importConfig) throws DirectoryException
supportsLDIFImport
returns true
. Note that the server will not explicitly
initialize this backend before calling this method.
importLDIF
in class Backend
importConfig
- The configuration to use when performing
the import.
DirectoryException
- If a problem occurs while performing
the LDIF import.public boolean supportsBackup()
true
for backends that
it is not possible to archive directly (e.g., those that don't
store their data locally, but rather pass through requests to
some other repository).
supportsBackup
in class Backend
true
if this backend provides any kind of backup
mechanism, or false
if it does not.public boolean supportsBackup(BackupConfig backupConfig, java.lang.StringBuilder unsupportedReason)
supportsBackup
in class Backend
backupConfig
- The configuration of the backup for
which to make the determination.unsupportedReason
- A buffer to which a message can be
appended
explaining why the requested backup is
not supported.
true
if this backend provides a mechanism for
performing backups with the provided configuration, or
false
if not.public void createBackup(BackupConfig backupConfig) throws DirectoryException
supportsBackup
returns true
.
Note that the server will not explicitly initialize this backend
before calling this method.
createBackup
in class Backend
backupConfig
- The configuration to use when performing
the backup.
DirectoryException
- If a problem occurs while performing
the backup.public void removeBackup(BackupDirectory backupDirectory, java.lang.String backupID) throws DirectoryException
removeBackup
in class Backend
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 boolean supportsRestore()
supportsRestore
in class Backend
true
if this backend provides a mechanism for
restoring backups, or false
if not.public void restoreBackup(RestoreConfig restoreConfig) throws DirectoryException
supportsRestore
returns
true
. Note that the server will not explicitly
initialize this backend before calling this method.
restoreBackup
in class Backend
restoreConfig
- The configuration to use when performing
the restore.
DirectoryException
- If a problem occurs while performing
the restore.public DN getComponentEntryDN()
getComponentEntryDN
in interface AlertGenerator
public java.lang.String getClassName()
getClassName
in interface AlertGenerator
public java.util.LinkedHashMap<java.lang.String,java.lang.String> getAlerts()
getAlerts
in interface AlertGenerator
public void handleConfigChangeResult(ConfigChangeResult result, DN entryDN, java.lang.String className, java.lang.String methodName)
SUCCESS
, then it will log an
error message. If the operation was successful but admin action is
required, then it will log a warning message. If no action is required but
messages were generated, then it will log an informational message.
result
- The config change result object thatentryDN
- The DN of the entry that was added, deleted, or
modified.className
- The name of the class for the object that generated the
provided result.methodName
- The name of the method that generated the provided
result.public void preloadEntryCache() throws java.lang.UnsupportedOperationException
preloadEntryCache
in class Backend
java.lang.UnsupportedOperationException
- if backend does not
support this operation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |