com.atlassian.crowd.directory.loader
Class InternalDirectoryInstanceLoaderImpl

java.lang.Object
  extended by com.atlassian.crowd.directory.loader.CachingDirectoryInstanceLoader
      extended by com.atlassian.crowd.directory.loader.InternalDirectoryInstanceLoaderImpl
All Implemented Interfaces:
DirectoryInstanceLoader, InternalDirectoryInstanceLoader

public class InternalDirectoryInstanceLoaderImpl
extends CachingDirectoryInstanceLoader
implements InternalDirectoryInstanceLoader

Loads an implementation of a RemoteDirectory for use at runtime by the Crowd security server.

The getDirectory(com.atlassian.crowd.embedded.api.Directory) method caches instances of RemoteDirectory as allowed in the spec of the interface, but getRawDirectory(Long, String, java.util.Map) returns a new instance every time as required. This class listens for update events on EventPublisher to know when to refresh the cache.

This loads both AbstractInternalDirectory and DelegatedAuthenticationDirectory instances.


Constructor Summary
InternalDirectoryInstanceLoaderImpl(InstanceFactory instanceFactory, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 boolean canLoad(String className)
           
 InternalRemoteDirectory getDirectory(Directory directory)
          Loads the RemoteDirectory implementation class for a specific (already saved) Directory configuration.
protected  RemoteDirectory getNewDirectory(Directory directory)
          Always returns a new instance of a RemoteDirectory.
 InternalRemoteDirectory getRawDirectory(Long id, String className, Map<String,String> directoryAttributes)
          Loads a guaranteed un-cached directory implementation for a specific configuration.
 
Methods inherited from class com.atlassian.crowd.directory.loader.CachingDirectoryInstanceLoader
getEventPublisher, handleEvent, handleEvent, handleEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalDirectoryInstanceLoaderImpl

public InternalDirectoryInstanceLoaderImpl(InstanceFactory instanceFactory,
                                           com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

getRawDirectory

public InternalRemoteDirectory getRawDirectory(Long id,
                                               String className,
                                               Map<String,String> directoryAttributes)
                                        throws DirectoryInstantiationException
Description copied from interface: DirectoryInstanceLoader
Loads a guaranteed un-cached directory implementation for a specific configuration.

Specified by:
getRawDirectory in interface DirectoryInstanceLoader
Specified by:
getRawDirectory in interface InternalDirectoryInstanceLoader
Parameters:
id - Directory ID
className - class name of directory.
directoryAttributes - the configuration attributes to pass to the RemoteDirectory
Returns:
instance of InternalRemoteDirectory.
Throws:
DirectoryInstantiationException - if a RemoteDirectory implementation can not be loaded.
See Also:
DirectoryInstanceLoader

canLoad

public boolean canLoad(String className)
Specified by:
canLoad in interface DirectoryInstanceLoader
Parameters:
className - class name of directory.
Returns:
true iff the directory can load the directory of the specified class.

getDirectory

public InternalRemoteDirectory getDirectory(Directory directory)
                                     throws DirectoryInstantiationException
Description copied from interface: DirectoryInstanceLoader
Loads the RemoteDirectory implementation class for a specific (already saved) Directory configuration.

Implementations of this method may choose to cache the RemoteDirectory, so this must only be called for Directories that have been successfully saved.

Specified by:
getDirectory in interface DirectoryInstanceLoader
Specified by:
getDirectory in interface InternalDirectoryInstanceLoader
Overrides:
getDirectory in class CachingDirectoryInstanceLoader
Parameters:
directory - The directory to load the RemoteDirectory implementation from.
Returns:
The RemoteDirectory loaded implementation.
Throws:
DirectoryInstantiationException - If the RemoteDirectory implementation could not be loaded.
See Also:
DirectoryInstanceLoader

getNewDirectory

protected RemoteDirectory getNewDirectory(Directory directory)
                                   throws DirectoryInstantiationException
Description copied from class: CachingDirectoryInstanceLoader
Always returns a new instance of a RemoteDirectory.

Specified by:
getNewDirectory in class CachingDirectoryInstanceLoader
Parameters:
directory - directory configuration
Returns:
new instance of a RemoteDirectory
Throws:
DirectoryInstantiationException - if the directory could not be instantiated.


Copyright © 2013 Atlassian. All Rights Reserved.