Class UsnChangedCacheRefresher
java.lang.Object
com.atlassian.crowd.directory.synchronisation.cache.AbstractCacheRefresher<LDAPGroupWithAttributes>
com.atlassian.crowd.directory.synchronisation.cache.UsnChangedCacheRefresher
- All Implemented Interfaces:
CacheRefresher
public class UsnChangedCacheRefresher
extends AbstractCacheRefresher<LDAPGroupWithAttributes>
implements CacheRefresher
Retrieves the latest changes from MS Active Directory in order to allow "delta" cache refreshes.
See this and this for details on polling Microsoft Active Directory.
This class is guaranteed to be run from a single thread at a time by per directory. This means it does not need to worry about race-conditions, but still must consider safe publication of variables (per directory).
The incremental sync of users comes in two flavors: see SystemProperties.USE_LEGACY_AD_INCREMENTAL_SYNC
.
-
Field Summary
Fields inherited from class com.atlassian.crowd.directory.synchronisation.cache.AbstractCacheRefresher
remoteDirectory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Iterable<Membership>
getMemberships
(Collection<LDAPGroupWithAttributes> groupsToInclude, boolean isFullSync) synchroniseAll
(DirectoryCache directoryCache) Will visit all Users and Groups in the external directory in order to do a Full refresh.synchroniseAllGroups
(DirectoryCache directoryCache) This method is expected to fetch the groups to update (or all currently in the remote directory) and update the directory cache (call the appropriate method for deleting and then the appropriate method for updating/adding).protected PartialSynchronisationResult<? extends UserWithAttributes>
synchroniseAllUsers
(DirectoryCache directoryCache) This method is expected to fetch the users to update (or all currently in the remote directory) and update the directory cache (call the appropriate method for deleting and then the appropriate method for updating/adding).synchroniseChanges
(DirectoryCache directoryCache, String highestCommittedUsn) Attempts to synchronise changes since the last refresh as opposed to performing a full synchronisation.protected void
synchroniseMemberships
(Collection<LDAPGroupWithAttributes> remoteGroups, DirectoryCache directoryCache, boolean isFullSync) Methods inherited from class com.atlassian.crowd.directory.synchronisation.cache.AbstractCacheRefresher
directoryDescription, isGroupAttributeSynchronisationEnabled, isIncrementalSyncEnabled, isUserAttributeSynchronisationEnabled, synchroniseAllGroupAttributes, synchroniseAllUserAttributes
-
Constructor Details
-
UsnChangedCacheRefresher
-
-
Method Details
-
synchroniseChanges
public CacheSynchronisationResult synchroniseChanges(DirectoryCache directoryCache, @Nullable String highestCommittedUsn) throws OperationFailedException Description copied from interface:CacheRefresher
Attempts to synchronise changes since the last refresh as opposed to performing a full synchronisation. Returns true if changes since the last refresh were synchronised successfully.- Specified by:
synchroniseChanges
in interfaceCacheRefresher
- Parameters:
directoryCache
- the DirectoryCache to update.- Returns:
- result of the synchronisation
- Throws:
OperationFailedException
- if there was an error processing the operation
-
synchroniseAll
public CacheSynchronisationResult synchroniseAll(DirectoryCache directoryCache) throws OperationFailedException Description copied from interface:CacheRefresher
Will visit all Users and Groups in the external directory in order to do a Full refresh.- Specified by:
synchroniseAll
in interfaceCacheRefresher
- Overrides:
synchroniseAll
in classAbstractCacheRefresher<LDAPGroupWithAttributes>
- Parameters:
directoryCache
- the DirectoryCache to update.- Returns:
- result of synchronisation
- Throws:
OperationFailedException
- if there was an error processing the operation
-
synchroniseAllUsers
protected PartialSynchronisationResult<? extends UserWithAttributes> synchroniseAllUsers(DirectoryCache directoryCache) throws OperationFailedException Description copied from class:AbstractCacheRefresher
This method is expected to fetch the users to update (or all currently in the remote directory) and update the directory cache (call the appropriate method for deleting and then the appropriate method for updating/adding). This will only fetch user attributes when user attribute synchronisation is enabled. User attributes will be updated if fetched inAbstractCacheRefresher.synchroniseAll(DirectoryCache)
if the directory allows that.- Specified by:
synchroniseAllUsers
in classAbstractCacheRefresher<LDAPGroupWithAttributes>
- Parameters:
directoryCache
- the cache which this method should update- Returns:
- list of users that were passed into the directory cache and an optional sync token if the directory has separate sync tokens for users and groups
- Throws:
OperationFailedException
-
synchroniseAllGroups
protected PartialSynchronisationResult<LDAPGroupWithAttributes> synchroniseAllGroups(DirectoryCache directoryCache) throws OperationFailedException Description copied from class:AbstractCacheRefresher
This method is expected to fetch the groups to update (or all currently in the remote directory) and update the directory cache (call the appropriate method for deleting and then the appropriate method for updating/adding). This will only fetch group attributes when group attribute synchronisation is enabled. Group attributes will be updated if fetched inAbstractCacheRefresher.synchroniseAll(DirectoryCache)
if the directory allows that.- Specified by:
synchroniseAllGroups
in classAbstractCacheRefresher<LDAPGroupWithAttributes>
- Parameters:
directoryCache
- the cache which this method should update- Returns:
- list of groups that were passed into the directory cache and an optional sync token if the directory has separate sync tokens for users and groups
- Throws:
OperationFailedException
-
synchroniseMemberships
protected void synchroniseMemberships(Collection<LDAPGroupWithAttributes> remoteGroups, DirectoryCache directoryCache, boolean isFullSync) throws OperationFailedException - Overrides:
synchroniseMemberships
in classAbstractCacheRefresher<LDAPGroupWithAttributes>
- Throws:
OperationFailedException
-
getMemberships
protected Iterable<Membership> getMemberships(Collection<LDAPGroupWithAttributes> groupsToInclude, boolean isFullSync) throws OperationFailedException - Overrides:
getMemberships
in classAbstractCacheRefresher<LDAPGroupWithAttributes>
- Throws:
OperationFailedException
-