Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.ldap
Class LdapDirectorySetImpl

java.lang.Object
  extended by net.java.sip.communicator.service.ldap.event.DefaultLdapEventManager
      extended by net.java.sip.communicator.impl.ldap.LdapDirectorySetImpl
All Implemented Interfaces:
Iterable<LdapDirectory>, EventListener, LdapEventManager, LdapListener, LdapConstants, LdapDirectorySet

public class LdapDirectorySetImpl
extends DefaultLdapEventManager
implements LdapDirectorySet, LdapConstants

A thread-safe implementation of LdapDirectorySet, backed by a TreeMap

Author:
Sebastien Mazy
See Also:
net.java.sip.communicator.service.ldap

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.java.sip.communicator.service.ldap.LdapConstants
LdapConstants.Auth, LdapConstants.Encryption, LdapConstants.Scope
 
Field Summary
 
Fields inherited from class net.java.sip.communicator.service.ldap.event.DefaultLdapEventManager
ldapListeners
 
Fields inherited from interface net.java.sip.communicator.service.ldap.LdapConstants
LDAP_CONNECT_TIMEOUT, LDAP_READ_TIMEOUT
 
Constructor Summary
LdapDirectorySetImpl()
          A simple constructor for this class
LdapDirectorySetImpl(ConfigurationService configService)
          Use this constructor if you want every change to the LdapDirectorySet to be propagated in the user preferences files
 
Method Summary
 boolean addServer(LdapDirectory server)
          Tries to add an LdapDirectory to the LdapDirectorySet
 boolean containsServerWithName(String name)
           
 SortedSet<LdapDirectory> getDisabledServers()
          Required by LdapDirectorySet interface.
 SortedSet<LdapDirectory> getEnabledServers()
          Required by LdapDirectorySet interface.
 LdapDirectory getServerWithName(String name)
           
 Iterator<LdapDirectory> iterator()
           
 void ldapEventReceived(LdapEvent event)
          Required by LdapListener.
 LdapDirectory removeServerWithName(String name)
          Tries to remove an LdapDirectory from the LdapDirectorySet using the name given by the getName method.
 void searchPerson(LdapQuery query, LdapListener caller, LdapSearchSettings searchSettings)
          Performs a search on every enabled LdapDirectory of this set.
 void searchPerson(Set<LdapDirectory> servers, LdapQuery query, LdapListener caller, LdapSearchSettings searchSettings)
          Performs a search on every LdapDirectory provided
 int size()
          Returns number of LdapDirectory(s) in the LdapDirectorySet.
 
Methods inherited from class net.java.sip.communicator.service.ldap.event.DefaultLdapEventManager
addLdapListener, fireLdapEvent, fireLdapEvent, removeLdapListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.ldap.event.LdapEventManager
addLdapListener, fireLdapEvent, fireLdapEvent, removeLdapListener
 

Constructor Detail

LdapDirectorySetImpl

public LdapDirectorySetImpl()
A simple constructor for this class


LdapDirectorySetImpl

public LdapDirectorySetImpl(ConfigurationService configService)
Use this constructor if you want every change to the LdapDirectorySet to be propagated in the user preferences files

Parameters:
configService - the configuration service to use
Method Detail

getServerWithName

public LdapDirectory getServerWithName(String name)
Specified by:
getServerWithName in interface LdapDirectorySet
Parameters:
name - server name
Returns:
the LdapDirectory with name name or null if it isn't present in the LdapDirectorySet

removeServerWithName

public LdapDirectory removeServerWithName(String name)
Tries to remove an LdapDirectory from the LdapDirectorySet using the name given by the getName method.

Specified by:
removeServerWithName in interface LdapDirectorySet
Parameters:
name - name of the LdapDirectory to remove
Returns:
LdapDirectory removed LdapDirectory or null if failed

addServer

public boolean addServer(LdapDirectory server)
Tries to add an LdapDirectory to the LdapDirectorySet

Specified by:
addServer in interface LdapDirectorySet
Parameters:
server - the server to be added
Returns:
whether it succeeded

containsServerWithName

public boolean containsServerWithName(String name)
Specified by:
containsServerWithName in interface LdapDirectorySet
Parameters:
name - of the server to check presence in the LdapDirectorySet
Returns:
whether the server is in the LdapDirectorySet

size

public int size()
Returns number of LdapDirectory(s) in the LdapDirectorySet.

Specified by:
size in interface LdapDirectorySet
Returns:
the number of LdapDirectory(s) in the LdapDirectorySet

getEnabledServers

public SortedSet<LdapDirectory> getEnabledServers()
Required by LdapDirectorySet interface. Returns a set of the marked enabled LdapDirectory(s) alphabetically sorted

Specified by:
getEnabledServers in interface LdapDirectorySet
Returns:
a set of the enabled LdapDirectory(s)

getDisabledServers

public SortedSet<LdapDirectory> getDisabledServers()
Required by LdapDirectorySet interface. Returns a set of the marked disabled LdapDirectory(s) alphabetically sorted

Specified by:
getDisabledServers in interface LdapDirectorySet
Returns:
a set of the disabled LdapDirectory(s)

iterator

public Iterator<LdapDirectory> iterator()
Specified by:
iterator in interface Iterable<LdapDirectory>
Returns:
an iterator on all the LdapDirectory(s) alphabetically sorted

searchPerson

public void searchPerson(Set<LdapDirectory> servers,
                         LdapQuery query,
                         LdapListener caller,
                         LdapSearchSettings searchSettings)
Performs a search on every LdapDirectory provided

Specified by:
searchPerson in interface LdapDirectorySet
Parameters:
servers - a set of LdapDirectory to search for the person
query - the query to perform
caller - the LdapListener that will receive the results
searchSettings - the custom settings for this search, or null for the defaults

searchPerson

public void searchPerson(LdapQuery query,
                         LdapListener caller,
                         LdapSearchSettings searchSettings)
Performs a search on every enabled LdapDirectory of this set.

Specified by:
searchPerson in interface LdapDirectorySet
Parameters:
query - the query to perform
caller - the LdapListener that will receive the results
searchSettings - the custom settings for this search

ldapEventReceived

public void ldapEventReceived(LdapEvent event)
Required by LdapListener. Dispatches event received from LdapDirectory-s to real search initiators (the search dialog for example)

Specified by:
ldapEventReceived in interface LdapListener
Parameters:
event - An LdapEvent probably sent by an LdapDirectory

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.