com.atlassian.crowd.embedded.core
Class CrowdDirectoryServiceImpl

java.lang.Object
  extended by com.atlassian.crowd.embedded.core.CrowdDirectoryServiceImpl
All Implemented Interfaces:
CrowdDirectoryService

public class CrowdDirectoryServiceImpl
extends Object
implements CrowdDirectoryService


Constructor Summary
CrowdDirectoryServiceImpl(ApplicationFactory applicationFactory, DirectoryInstanceLoader directoryInstanceLoader, DirectoryManager directoryManager, ApplicationManager applicationManager)
           
 
Method Summary
 Directory addDirectory(Directory directory)
          Will add a new Directory into the local database.
 List<Directory> findAllDirectories()
          Will return a List<Directory> ordered by the order specified by the application.
 Directory findDirectoryById(long directoryId)
          Will return a Directory based on the given directoryId
 DirectorySynchronisationInformation getDirectorySynchronisationInformation(long directoryId)
          Returns the synchronisation information for the directory.
 ConnectionPoolProperties getStoredConnectionPoolProperties()
          Retrieves the stored LDAP connection pool properties which will be applied when the system restarts.
 ConnectionPoolProperties getSystemConnectionPoolProperties()
          Retrieves the system LDAP connection pool properties (i.e.
 boolean isDirectorySynchronisable(long directoryId)
          Returns true if the underlying directory implementation supports manual synchronisation of the directory's local cache.
 boolean isDirectorySynchronising(long directoryId)
          Returns true if the given Directory is currently synchronising.
 boolean removeDirectory(long directoryId)
          Will remove a directory from the Application, this will also remove all associated entities (users/groups/memberships).
 void setConnectionPoolProperties(ConnectionPoolProperties poolProperties)
          Stores the provided LDAP connection pool properties so they can be applied when the system next restarts.
 void setDirectoryPosition(long directoryId, int position)
          Will place the directory with the given directoryId and the passed in position in the current list of directories configured for an application.
 boolean supportsNestedGroups(long directoryId)
          Returns true if the underlying directory implementation supports nested groups.
 void synchroniseDirectory(long directoryId)
          Requests that this directory should update its cache by synchronising with the remote server.
 void synchroniseDirectory(long directoryId, boolean runInBackground)
          Requests that this directory should update its cache by synchronising with the remote server.
 void testConnection(Directory directory)
          Test if a connection to the directory server can be established.
 Directory updateDirectory(Directory directory)
          Will update the Directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrowdDirectoryServiceImpl

public CrowdDirectoryServiceImpl(ApplicationFactory applicationFactory,
                                 DirectoryInstanceLoader directoryInstanceLoader,
                                 DirectoryManager directoryManager,
                                 ApplicationManager applicationManager)
Method Detail

addDirectory

public Directory addDirectory(Directory directory)
                       throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Will add a new Directory into the local database.

Specified by:
addDirectory in interface CrowdDirectoryService
Parameters:
directory - The directory to be saved
Returns:
the persisted Directory
Throws:
OperationFailedException - if the operation failed for any reason

testConnection

public void testConnection(Directory directory)
                    throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Test if a connection to the directory server can be established.

Specified by:
testConnection in interface CrowdDirectoryService
Parameters:
directory - Directory to test
Throws:
OperationFailedException - underlying directory implementation failed to execute the operation.

findAllDirectories

public List<Directory> findAllDirectories()
Description copied from interface: CrowdDirectoryService
Will return a List<Directory> ordered by the order specified by the application.

Specified by:
findAllDirectories in interface CrowdDirectoryService
Returns:
a List<Directory> or if there are no directories, an empty list (this should never happen)

findDirectoryById

public Directory findDirectoryById(long directoryId)
Description copied from interface: CrowdDirectoryService
Will return a Directory based on the given directoryId

Specified by:
findDirectoryById in interface CrowdDirectoryService
Parameters:
directoryId - the id of the directory
Returns:
the directory or null if the directory is not found

updateDirectory

public Directory updateDirectory(Directory directory)
                          throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Will update the Directory. The Directory must have at the bare minimum an Directory.getId(), Directory.getName(), Directory.getType() and Directory.getImplementationClass()}

Specified by:
updateDirectory in interface CrowdDirectoryService
Parameters:
directory - the directory to update
Returns:
the updated directory
Throws:
OperationFailedException - if the directory does not exist or the operation failed for any other reason.

setDirectoryPosition

public void setDirectoryPosition(long directoryId,
                                 int position)
                          throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Will place the directory with the given directoryId and the passed in position in the current list of directories configured for an application.

Specified by:
setDirectoryPosition in interface CrowdDirectoryService
Parameters:
directoryId - the id of the directory
position - the position in the list of directories where you would like this one to be
Throws:
OperationFailedException - if the directory does not exist or the operation failed for any other reason

removeDirectory

public boolean removeDirectory(long directoryId)
                        throws DirectoryCurrentlySynchronisingException,
                               OperationFailedException
Description copied from interface: CrowdDirectoryService
Will remove a directory from the Application, this will also remove all associated entities (users/groups/memberships). TODO: We should discuss this

Specified by:
removeDirectory in interface CrowdDirectoryService
Parameters:
directoryId - the directory id of the Directory to remove.
Returns:
true if the directory and associated entities were removed, or false otherwise
Throws:
DirectoryCurrentlySynchronisingException - if the Directory is currently synchronising.
OperationFailedException - if the directory does not exist or the operation failed for any other reason

supportsNestedGroups

public boolean supportsNestedGroups(long directoryId)
                             throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Returns true if the underlying directory implementation supports nested groups.

Specified by:
supportsNestedGroups in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory.
Returns:
true if the directory supports nested groups
Throws:
OperationFailedException - if the operation failed for any reason

isDirectorySynchronisable

public boolean isDirectorySynchronisable(long directoryId)
                                  throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Returns true if the underlying directory implementation supports manual synchronisation of the directory's local cache.

Specified by:
isDirectorySynchronisable in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory.
Returns:
true if the directory supports synchronisation
Throws:
OperationFailedException - if the operation failed for any reason

synchroniseDirectory

public void synchroniseDirectory(long directoryId)
                          throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Requests that this directory should update its cache by synchronising with the remote server. The synchronisation will occur asynchronously, i.e. this method returns immediately and the synchronization continues in the background.

If a synchronisation is currently in progress when this method is called, then this method does nothing.

Specified by:
synchroniseDirectory in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory.
Throws:
OperationFailedException - if the operation failed for any reason

synchroniseDirectory

public void synchroniseDirectory(long directoryId,
                                 boolean runInBackground)
                          throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Requests that this directory should update its cache by synchronising with the remote server.

If a synchronisation is currently in progress when this method is called, then this method does nothing if runInBackGround is true, otherwise it will throw OperationFailedException.

Specified by:
synchroniseDirectory in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory.
runInBackground - If True the synchronise will happen asynchronously.
Throws:
OperationFailedException - if the operation failed for any reason

isDirectorySynchronising

public boolean isDirectorySynchronising(long directoryId)
                                 throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Returns true if the given Directory is currently synchronising.

Specified by:
isDirectorySynchronising in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory.
Returns:
true if the given Directory is currently synchronising.
Throws:
OperationFailedException - if the operation failed for any reason

getDirectorySynchronisationInformation

public DirectorySynchronisationInformation getDirectorySynchronisationInformation(long directoryId)
                                                                           throws OperationFailedException
Description copied from interface: CrowdDirectoryService
Returns the synchronisation information for the directory. This includes the last sync start time and duration, and the current sync start time (if directory is currently synchronising).

Specified by:
getDirectorySynchronisationInformation in interface CrowdDirectoryService
Parameters:
directoryId - ID of directory
Returns:
a DirectorySynchronisationInformation object that contains the synchronisation information for the directory. null if the RemoteDirectory is not an instance of SynchronisableDirectory
Throws:
OperationFailedException - if the operation failed for any reason

setConnectionPoolProperties

public void setConnectionPoolProperties(ConnectionPoolProperties poolProperties)
Description copied from interface: CrowdDirectoryService
Stores the provided LDAP connection pool properties so they can be applied when the system next restarts.

Specified by:
setConnectionPoolProperties in interface CrowdDirectoryService
Parameters:
poolProperties - the LDAP connection pool properties to be stored and applied on the next restart
See Also:
CrowdDirectoryService.getStoredConnectionPoolProperties(), CrowdDirectoryService.getSystemConnectionPoolProperties()

getStoredConnectionPoolProperties

public ConnectionPoolProperties getStoredConnectionPoolProperties()
Description copied from interface: CrowdDirectoryService
Retrieves the stored LDAP connection pool properties which will be applied when the system restarts.

Specified by:
getStoredConnectionPoolProperties in interface CrowdDirectoryService
Returns:
LdapPoolProperties the stored connection pool settings
See Also:
to retrieve the currently active settings

getSystemConnectionPoolProperties

public ConnectionPoolProperties getSystemConnectionPoolProperties()
Description copied from interface: CrowdDirectoryService
Retrieves the system LDAP connection pool properties (i.e. the currently active settings).

Specified by:
getSystemConnectionPoolProperties in interface CrowdDirectoryService
Returns:
LdapPoolProperties the system connection pool settings
See Also:
to retrieve the stored configuration which will be applied when the system next restarts


Copyright © 2013 Atlassian. All Rights Reserved.