| | |
| | | public void initializeConfigHandler(String configFile, boolean checkSchema) |
| | | throws InitializationException |
| | | { |
| | | |
| | | |
| | | // Initialize the config lock. |
| | | configLock = new ReentrantLock(); |
| | | |
| | |
| | | private void applyChangesFile(File sourceFile, File changesFile) |
| | | throws IOException, LDIFException |
| | | { |
| | | |
| | | |
| | | // FIXME -- Do we need to do anything special for configuration archiving? |
| | | |
| | | |
| | |
| | | */ |
| | | public void finalizeConfigHandler() |
| | | { |
| | | |
| | | try |
| | | { |
| | | DirectoryServer.deregisterBaseDN(configRootEntry.getDN(), false); |
| | |
| | | public ConfigEntry getConfigRootEntry() |
| | | throws ConfigException |
| | | { |
| | | |
| | | return configRootEntry; |
| | | } |
| | | |
| | |
| | | public ConfigEntry getConfigEntry(DN entryDN) |
| | | throws ConfigException |
| | | { |
| | | |
| | | return configEntries.get(entryDN); |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getServerRoot() |
| | | { |
| | | |
| | | return serverRoot; |
| | | } |
| | | |
| | |
| | | public void initializeBackend(ConfigEntry configEntry, DN[] baseDNs) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | |
| | | // No action is required, since all initialization was performed in the |
| | | // initializeConfigHandler method. |
| | | } |
| | |
| | | */ |
| | | public DN[] getBaseDNs() |
| | | { |
| | | |
| | | return baseDNs; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getEntryCount() |
| | | { |
| | | |
| | | return configEntries.size(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean isLocal() |
| | | { |
| | | |
| | | // The configuration information will always be local. |
| | | return true; |
| | | } |
| | |
| | | public Entry getEntry(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | ConfigEntry configEntry = configEntries.get(entryDN); |
| | | if (configEntry == null) |
| | | { |
| | |
| | | public boolean entryExists(DN entryDN) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | return configEntries.containsKey(entryDN); |
| | | } |
| | | |
| | |
| | | public void addEntry(Entry entry, AddOperation addOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // If there is an add operation, then make sure that the associated user has |
| | | // both the CONFIG_READ and CONFIG_WRITE privileges. |
| | | if (addOperation != null) |
| | |
| | | public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // If there is a delete operation, then make sure that the associated user |
| | | // has both the CONFIG_READ and CONFIG_WRITE privileges. |
| | | if (deleteOperation != null) |
| | |
| | | public void replaceEntry(Entry entry, ModifyOperation modifyOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // If there is a modify operation, then make sure that the associated user |
| | | // has both the CONFIG_READ and CONFIG_WRITE privileges. Also, if the |
| | | // operation targets the set of root privileges then make sure the user has |
| | |
| | | ModifyDNOperation modifyDNOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // If there is a modify DN operation, then make sure that the associated |
| | | // user has both the CONFIG_READ and CONFIG_WRITE privileges. |
| | | if (modifyDNOperation != null) |
| | |
| | | public void search(SearchOperation searchOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Make sure that the associated user has the CONFIG_READ privilege. |
| | | ClientConnection clientConnection = searchOperation.getClientConnection(); |
| | | if (! clientConnection.hasPrivilege(Privilege.CONFIG_READ, searchOperation)) |
| | |
| | | SearchOperation searchOperation) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | Entry e = baseEntry.getEntry(); |
| | | if (filter.matchesEntry(e)) |
| | | { |
| | |
| | | public void writeUpdatedConfig() |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // FIXME -- This needs support for encryption. |
| | | |
| | | |
| | |
| | | */ |
| | | public boolean supportsLDIFExport() |
| | | { |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | LDIFExportConfig exportConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | LDIFWriter writer; |
| | | try |
| | | { |
| | |
| | | private void writeEntryAndChildren(LDIFWriter writer, ConfigEntry configEntry) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | try |
| | | { |
| | | // Write the entry itself to LDIF. |
| | |
| | | */ |
| | | public boolean supportsLDIFImport() |
| | | { |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | LDIFImportConfig importConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | int msgID = MSGID_CONFIG_FILE_UNWILLING_TO_IMPORT; |
| | | String message = getMessage(msgID); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | |
| | | */ |
| | | public boolean supportsBackup() |
| | | { |
| | | |
| | | // We do support an online backup mechanism for the configuration. |
| | | return true; |
| | | } |
| | |
| | | public boolean supportsBackup(BackupConfig backupConfig, |
| | | StringBuilder unsupportedReason) |
| | | { |
| | | |
| | | |
| | | // We should support online backup for the configuration in any form. This |
| | | // implementation does not support incremental backups, but in this case |
| | | // even if we're asked to do an incremental we'll just do a full backup |
| | |
| | | public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // Get the properties to use for the backup. We don't care whether or not |
| | | // it's incremental, so there's no need to get that. |
| | | String backupID = backupConfig.getBackupID(); |
| | |
| | | String backupID) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // NYI |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean supportsRestore() |
| | | { |
| | | |
| | | |
| | | // We will provide a restore, but only for offline operations. |
| | | return true; |
| | | } |
| | |
| | | RestoreConfig restoreConfig) |
| | | throws DirectoryException |
| | | { |
| | | |
| | | |
| | | // First, make sure that the requested backup exists. |
| | | BackupDirectory backupDirectory = restoreConfig.getBackupDirectory(); |
| | | String backupPath = backupDirectory.getPath(); |
| | |
| | | */ |
| | | public DN getComponentEntryDN() |
| | | { |
| | | |
| | | return configRootEntry.getDN(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getClassName() |
| | | { |
| | | |
| | | return CLASS_NAME; |
| | | } |
| | | |
| | |
| | | */ |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | |
| | | alerts.put(ALERT_TYPE_CANNOT_WRITE_CONFIGURATION, |