| | |
| | | return (ChangelogBackend) DirectoryServer.getBackend(CHANGELOG_BASE_DN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configureBackend(final Configuration config, ServerContext serverContext) throws ConfigException |
| | | { |
| | | throw new UnsupportedOperationException("The changelog backend is not configurable"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void openBackend() throws InitializationException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void closeBackend() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public DN[] getBaseDNs() |
| | | { |
| | | return baseDNs; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isIndexed(final AttributeType attributeType, final IndexType indexType) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Entry getEntry(final DN entryDN) throws DirectoryException |
| | | { |
| | |
| | | throw new RuntimeException("Not implemented"); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConditionResult hasSubordinates(final DN entryDN) throws DirectoryException |
| | | { |
| | |
| | | { |
| | | final ReplicationDomainDB replicationDomainDB = getChangelogDB().getReplicationDomainDB(); |
| | | CursorOptions options = new CursorOptions(GREATER_THAN_OR_EQUAL_TO_KEY, ON_MATCHING_KEY); |
| | | final MultiDomainDBCursor cursor = replicationDomainDB.getCursorFrom( |
| | | new MultiDomainServerState(), options, getExcludedBaseDNs()); |
| | | try |
| | | try (final MultiDomainDBCursor cursor = |
| | | replicationDomainDB.getCursorFrom(new MultiDomainServerState(), options, getExcludedBaseDNs())) |
| | | { |
| | | baseEntryHasSubordinates = cursor.next(); |
| | | } |
| | | finally |
| | | { |
| | | close(cursor); |
| | | } |
| | | } |
| | | catch (ChangelogException e) |
| | | { |
| | |
| | | return baseEntryHasSubordinates; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getNumberOfEntriesInBaseDN(final DN baseDN) throws DirectoryException |
| | | { |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, ERR_NUM_SUBORDINATES_NOT_SUPPORTED.get()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long getNumberOfChildren(final DN parentDN) throws DirectoryException |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addEntry(Entry entry, AddOperation addOperation) |
| | | throws DirectoryException, CanceledOperationException |
| | |
| | | ERR_BACKEND_ADD_NOT_SUPPORTED.get(String.valueOf(entry.getName()), getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void deleteEntry(DN entryDN, DeleteOperation deleteOperation) |
| | | throws DirectoryException, CanceledOperationException |
| | |
| | | ERR_BACKEND_DELETE_NOT_SUPPORTED.get(String.valueOf(entryDN), getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void replaceEntry(Entry oldEntry, Entry newEntry, |
| | | ModifyOperation modifyOperation) throws DirectoryException, |
| | |
| | | ERR_BACKEND_MODIFY_NOT_SUPPORTED.get(String.valueOf(newEntry.getName()), getBackendID())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void renameEntry(DN currentDN, Entry entry, |
| | | ModifyDNOperation modifyDNOperation) throws DirectoryException, |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getSupportedControls() |
| | | { |
| | | return supportedControls; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Set<String> getSupportedFeatures() |
| | | { |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supports(BackendOperation backendOperation) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void exportLDIF(final LDIFExportConfig exportConfig) |
| | | throws DirectoryException |
| | |
| | | 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) throws DirectoryException |
| | | { |
| | |
| | | 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 long getEntryCount() |
| | | { |
| | |
| | | && filter.getAttributeType().getPrimaryName().equalsIgnoreCase(primaryName); |
| | | } |
| | | |
| | | /** |
| | | * Search the changelog when a cookie control is provided. |
| | | */ |
| | | /** Search the changelog when a cookie control is provided. */ |
| | | private void initialSearchFromCookie(final CookieEntrySender entrySender) |
| | | throws DirectoryException, ChangelogException |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | ECLMultiDomainDBCursor replicaUpdatesCursor = null; |
| | | try |
| | | final ReplicationDomainDB replicationDomainDB = getChangelogDB().getReplicationDomainDB(); |
| | | CursorOptions options = new CursorOptions(GREATER_THAN_OR_EQUAL_TO_KEY, AFTER_MATCHING_KEY); |
| | | try (final MultiDomainDBCursor cursor = |
| | | replicationDomainDB.getCursorFrom(entrySender.cookie, options, entrySender.excludedBaseDNs); |
| | | ECLMultiDomainDBCursor replicaUpdatesCursor = new ECLMultiDomainDBCursor(domainPredicate, cursor)) |
| | | { |
| | | final ReplicationDomainDB replicationDomainDB = getChangelogDB().getReplicationDomainDB(); |
| | | CursorOptions options = new CursorOptions(GREATER_THAN_OR_EQUAL_TO_KEY, AFTER_MATCHING_KEY); |
| | | final MultiDomainDBCursor cursor = replicationDomainDB.getCursorFrom( |
| | | entrySender.cookie, options, entrySender.excludedBaseDNs); |
| | | replicaUpdatesCursor = new ECLMultiDomainDBCursor(domainPredicate, cursor); |
| | | |
| | | if (sendCookieEntriesFromCursor(entrySender, replicaUpdatesCursor)) |
| | | { |
| | | entrySender.transitioningToPersistentSearchPhase(); |
| | |
| | | finally |
| | | { |
| | | entrySender.finalizeInitialSearch(); |
| | | StaticUtils.close(replicaUpdatesCursor); |
| | | } |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void registerPersistentSearch(PersistentSearch pSearch) throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Search the changelog using change number(s). |
| | | */ |
| | | /** Search the changelog using change number(s). */ |
| | | private void initialSearchFromChangeNumber(final ChangeNumberEntrySender entrySender) |
| | | throws ChangelogException, DirectoryException |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | DBCursor<ChangeNumberIndexRecord> cnIndexDBCursor = null; |
| | | final AtomicReference<MultiDomainDBCursor> replicaUpdatesCursor = new AtomicReference<>(); |
| | | try |
| | | try (DBCursor<ChangeNumberIndexRecord> cnIndexDBCursor = getCNIndexDBCursor(entrySender.lowestChangeNumber)) |
| | | { |
| | | cnIndexDBCursor = getCNIndexDBCursor(entrySender.lowestChangeNumber); |
| | | final MultiDomainServerState cookie = new MultiDomainServerState(); |
| | | |
| | | if (sendChangeNumberEntriesFromCursors(entrySender, cnIndexDBCursor, replicaUpdatesCursor, cookie)) |
| | |
| | | finally |
| | | { |
| | | entrySender.finalizeInitialSearch(); |
| | | StaticUtils.close(cnIndexDBCursor, replicaUpdatesCursor.get()); |
| | | StaticUtils.close(replicaUpdatesCursor.get()); |
| | | } |
| | | } |
| | | |
| | |
| | | return cnIndexDB.getCursorFrom(changeNumberToUse); |
| | | } |
| | | |
| | | /** |
| | | * Creates a changelog entry. |
| | | */ |
| | | /** Creates a changelog entry. */ |
| | | private static Entry createEntryFromMsg(final DN baseDN, final long changeNumber, final String cookie, |
| | | final UpdateMsg msg) throws DirectoryException |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Describes the current search phase. |
| | | */ |
| | | /** Describes the current search phase. */ |
| | | private enum SearchPhase |
| | | { |
| | | /** |