Class CacheableDirectoryInstanceLoader
java.lang.Object
com.atlassian.confluence.impl.user.crowd.CacheableDirectoryInstanceLoader
- All Implemented Interfaces:
com.atlassian.crowd.directory.loader.DirectoryInstanceLoader
public class CacheableDirectoryInstanceLoader
extends Object
implements com.atlassian.crowd.directory.loader.DirectoryInstanceLoader
Caches the underlying remote directory base by id.
Note, this caching refers to holding the RemoteDirectory
instances in memory, not the
db caching which may occur in underlying implementations.
The problem with this approach is that every DC node is going to have it's own directory instance.
- Since:
- 5.10
-
Constructor Summary
ConstructorsConstructorDescriptionCacheableDirectoryInstanceLoader
(com.atlassian.crowd.directory.loader.DelegatingDirectoryInstanceLoader delegate, com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar, com.atlassian.cache.CacheFactory cacheFactory) -
Method Summary
Modifier and TypeMethodDescriptionboolean
com.atlassian.crowd.directory.RemoteDirectory
getDirectory
(com.atlassian.crowd.embedded.api.Directory directory) Create a directory instance from configurationcom.atlassian.crowd.directory.RemoteDirectory
void
handleEvent
(com.atlassian.crowd.event.directory.DirectoryDeletedEvent event) void
handleEvent
(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent event) void
void
-
Constructor Details
-
CacheableDirectoryInstanceLoader
public CacheableDirectoryInstanceLoader(com.atlassian.crowd.directory.loader.DelegatingDirectoryInstanceLoader delegate, com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar, com.atlassian.cache.CacheFactory cacheFactory)
-
-
Method Details
-
registerForEvents
@PostConstruct public void registerForEvents() -
unregisterForEvents
@PreDestroy public void unregisterForEvents() -
getDirectory
public com.atlassian.crowd.directory.RemoteDirectory getDirectory(com.atlassian.crowd.embedded.api.Directory directory) throws com.atlassian.crowd.exception.DirectoryInstantiationException Create a directory instance from configurationWe MUST only serve a single instance of
DbCachingRemoteDirectory
per directory ID because of concurrency controls on theDbCachingRemoteDirectory
sync refresh. This is achieved by atomically creatingRemoteDirectory
only if it hasn't exist yet- Specified by:
getDirectory
in interfacecom.atlassian.crowd.directory.loader.DirectoryInstanceLoader
- Parameters:
directory
- directory configuration- Returns:
- new of already computed instance of RemoteDirectory
- Throws:
com.atlassian.crowd.exception.DirectoryInstantiationException
- if directory creation failed for whatever reason
-
getRawDirectory
public com.atlassian.crowd.directory.RemoteDirectory getRawDirectory(Long id, String className, Map<String, String> attributes) throws com.atlassian.crowd.exception.DirectoryInstantiationException- Specified by:
getRawDirectory
in interfacecom.atlassian.crowd.directory.loader.DirectoryInstanceLoader
- Throws:
com.atlassian.crowd.exception.DirectoryInstantiationException
-
canLoad
- Specified by:
canLoad
in interfacecom.atlassian.crowd.directory.loader.DirectoryInstanceLoader
-
handleEvent
@EventListener public void handleEvent(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent event) -
handleEvent
@EventListener public void handleEvent(com.atlassian.crowd.event.directory.DirectoryDeletedEvent event)
-