| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | |
| | | /** The current configuration state. */ |
| | | private BackupBackendCfg currentConfig; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Creates a new backend with the provided information. All backend |
| | | * implementations must implement a default constructor that use |
| | |
| | | // Perform all initialization in initializeBackend. |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(BackupBackendCfg config, ServerContext serverContext) throws ConfigException |
| | | { |
| | |
| | | currentConfig = config; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void openBackend() |
| | | throws ConfigException, InitializationException |
| | |
| | | |
| | | this.baseDNs = Collections.singleton(backupBaseDN); |
| | | |
| | | |
| | | // Determine the set of backup directories that we will use by default. |
| | | Set<String> values = currentConfig.getBackupDirectory(); |
| | | backupDirectories = new LinkedHashMap<>(values.size()); |
| | |
| | | backupDirectories.put(dir, new CachedBackupDirectory(dir)); |
| | | } |
| | | |
| | | |
| | | // Construct the backup base entry. |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(2); |
| | | objectClasses.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void closeBackend() |
| | | { |
| | |
| | | return numEntries; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIndexed(AttributeType attributeType, IndexType indexType) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult hasSubordinates(DN entryDN) throws DirectoryException |
| | | { |
| | |
| | | return ConditionResult.valueOf(ret != 0); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getNumberOfEntriesInBaseDN(DN baseDN) throws DirectoryException { |
| | | checkNotNull(baseDN, "baseDN must not be null"); |
| | | return getNumberOfSubordinates(baseDN, true) + 1; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getNumberOfChildren(DN parentDN) throws DirectoryException { |
| | | checkNotNull(parentDN, "parentDN must not be null"); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(DN entryDN) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_GET_ENTRY_NULL.get(getBackendID())); |
| | | } |
| | | |
| | | |
| | | // If the requested entry was the backend base entry, then retrieve it. |
| | | if (entryDN.equals(backupBaseDN)) |
| | | { |
| | | return backupBaseEntry.duplicate(true); |
| | | } |
| | | |
| | | |
| | | // See if the requested entry was one level below the backend base entry. |
| | | // If so, then it must point to a backup directory. Otherwise, it must be |
| | | // two levels below the backup base entry and must point to a specific |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates an entry for a backup directory based on the provided DN. The |
| | | * DN must contain an RDN component that specifies the path to the backup |
| | |
| | | backupBaseDN, null); |
| | | } |
| | | |
| | | |
| | | // Get a handle to the backup directory and the information that it |
| | | // contains. |
| | | BackupDirectory backupDirectory; |
| | |
| | | message); |
| | | } |
| | | |
| | | |
| | | // Construct the backup directory entry to return. |
| | | LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2); |
| | | ocMap.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | |
| | | return e; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates an entry for a backup based on the provided DN. The DN must |
| | | * have an RDN component that specifies the backup ID, and the parent DN must |
| | |
| | | return new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addEntry(Entry entry, AddOperation addOperation) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_ADD_NOT_SUPPORTED.get(entry.getName(), getBackendID())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_DELETE_NOT_SUPPORTED.get(entryDN, getBackendID())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void replaceEntry(Entry oldEntry, Entry newEntry, |
| | | ModifyOperation modifyOperation) throws DirectoryException |
| | |
| | | ERR_BACKEND_MODIFY_NOT_SUPPORTED.get(oldEntry.getName(), getBackendID())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void renameEntry(DN currentDN, Entry entry, |
| | | ModifyDNOperation modifyDNOperation) |
| | |
| | | ERR_BACKEND_MODIFY_DN_NOT_SUPPORTED.get(currentDN, getBackendID())); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void search(SearchOperation searchOperation) |
| | | throws DirectoryException |
| | |
| | | DN baseDN = searchOperation.getBaseDN(); |
| | | Entry baseEntry = getEntry(baseDN); |
| | | |
| | | |
| | | // Look at the base DN and see if it's the backup base DN, a backup |
| | | // directory entry DN, or a backup entry DN. |
| | | DN parentDN; |
| | |
| | | continue; |
| | | } |
| | | |
| | | |
| | | DN backupDirDN = makeChildDN(backupBaseDN, backupPathType, |
| | | dir.getAbsolutePath()); |
| | | |
| | |
| | | searchOperation.returnEntry(backupDirEntry, null); |
| | | } |
| | | |
| | | |
| | | if (scope != SearchScope.BASE_OBJECT) |
| | | { |
| | | AttributeType t = |
| | |
| | | ERR_BACKEND_IMPORT_AND_EXPORT_NOT_SUPPORTED.get(getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDIFImportResult importLDIF(LDIFImportConfig importConfig, ServerContext serverContext) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_IMPORT_AND_EXPORT_NOT_SUPPORTED.get(getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void createBackup(BackupConfig backupConfig) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_BACKUP_AND_RESTORE_NOT_SUPPORTED.get(getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void removeBackup(BackupDirectory backupDirectory, |
| | | String backupID) |
| | |
| | | ERR_BACKEND_BACKUP_AND_RESTORE_NOT_SUPPORTED.get(getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void restoreBackup(RestoreConfig restoreConfig) |
| | | throws DirectoryException |
| | |
| | | ERR_BACKEND_BACKUP_AND_RESTORE_NOT_SUPPORTED.get(getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | BackupBackendCfg cfg, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(BackupBackendCfg cfg) |
| | | { |