Class CacheableDirectoryInstanceLoader

  • All Implemented Interfaces:

    public class CacheableDirectoryInstanceLoader
    extends Object
    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.

    • Constructor Detail

      • CacheableDirectoryInstanceLoader

        public CacheableDirectoryInstanceLoader​( delegate,
                                                com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar,
                                                com.atlassian.cache.CacheFactory cacheFactory)
    • Method Detail

      • registerForEvents

        public void registerForEvents()
      • unregisterForEvents

        public void unregisterForEvents()
      • getDirectory

        public getDirectory​(com.atlassian.crowd.embedded.api.Directory directory)
                                                                   throws com.atlassian.crowd.exception.DirectoryInstantiationException
        Create a directory instance from configuration

        We MUST only serve a single instance of DbCachingRemoteDirectory per directory ID because of concurrency controls on the DbCachingRemoteDirectory sync refresh. This is achieved by atomically creating RemoteDirectory only if it hasn't exist yet

        Specified by:
        getDirectory in interface
        directory - directory configuration
        new of already computed instance of RemoteDirectory
        com.atlassian.crowd.exception.DirectoryInstantiationException - if directory creation failed for whatever reason
      • getRawDirectory

        public getRawDirectory​(Long id,
                                                                             String className,
                                                                             Map<String,​String> attributes)
                                                                      throws com.atlassian.crowd.exception.DirectoryInstantiationException
        Specified by:
        getRawDirectory in interface
      • canLoad

        public boolean canLoad​(String className)
        Specified by:
        canLoad in interface
      • handleEvent

        public void handleEvent​( event)
      • handleEvent

        public void handleEvent​( event)