net.sf.xbus.technical.ldap
Class LDAPConnection

java.lang.Object
  extended by net.sf.xbus.technical.ldap.LDAPConnection
All Implemented Interfaces:
TAResource

public class LDAPConnection
extends java.lang.Object
implements TAResource

Manages connections to LDAP servers.

LDAP connections are not transacted. TAResource is just implemented to open and close the connections.


Method Summary
 void close()
          Closes the connection to the LDAP server
 void commit()
          Empty method, LDAP connections are not transacted.
 javax.naming.directory.DirContext getContext()
          Returns the Context of the current connection to the LDAP server.
static LDAPConnection getInstance(java.lang.String name)
          Delivers an open instance of LDAPConnection.
 javax.naming.directory.SearchControls getSearchControls()
          Creates and returns SearchControls used to search entries in the LDAP server.
 void open()
          Opens a connection to a LDAP server.
 void rollback()
          Empty method, LDAP connections are not transacted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LDAPConnection getInstance(java.lang.String name)
                                  throws XException
Delivers an open instance of LDAPConnection.

If it is the first call with this name for the actual thread, a new LDAPConnection object will be created. Subsequent calls in this thread will deliver the object, that has been created by the first call.

Parameters:
name - name of the LDAPConnection
Returns:
an open LDAPConnection
Throws:
XException - if something goes wrong

open

public void open()
          throws XException
Opens a connection to a LDAP server.

Specified by:
open in interface TAResource
Throws:
XException - if something goes wrong

close

public void close()
Closes the connection to the LDAP server

Specified by:
close in interface TAResource

getContext

public javax.naming.directory.DirContext getContext()
Returns the Context of the current connection to the LDAP server.


getSearchControls

public javax.naming.directory.SearchControls getSearchControls()
                                                        throws XException
Creates and returns SearchControls used to search entries in the LDAP server. Some values are read out of the configuration.

Returns:
new SearchControls, initialized with values of the configuration
Throws:
XException - if something goes wrong

commit

public void commit()
Empty method, LDAP connections are not transacted.

Specified by:
commit in interface TAResource

rollback

public void rollback()
Empty method, LDAP connections are not transacted.

Specified by:
rollback in interface TAResource