org.ldaptive
Class DefaultConnectionFactory

java.lang.Object
  extended by org.ldaptive.DefaultConnectionFactory
All Implemented Interfaces:
ConnectionFactory

public class DefaultConnectionFactory
extends Object
implements ConnectionFactory

Creates connections for performing ldap operations.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Nested Class Summary
protected static class DefaultConnectionFactory.DefaultConnection
          Default implementation for managing a connection to an LDAP.
 
Field Summary
protected static Provider<?> DEFAULT_PROVIDER
          Static reference to the default ldap provider.
static String PROVIDER
          Ldap provider class name.
 
Constructor Summary
DefaultConnectionFactory()
          Default constructor.
DefaultConnectionFactory(ConnectionConfig cc)
          Creates a new default connection factory.
DefaultConnectionFactory(ConnectionConfig cc, Provider<?> p)
          Creates a new default connection factory.
DefaultConnectionFactory(String ldapUrl)
          Creates a new default connection factory.
 
Method Summary
 Connection getConnection()
          Creates a new connection.
static Connection getConnection(ConnectionConfig cc)
          Creates a new connection.
static Connection getConnection(String ldapUrl)
          Creates a new connection.
 ConnectionConfig getConnectionConfig()
          Returns the connection config.
static Provider<?> getDefaultProvider()
          The PROVIDER property is checked and that class is loaded if provided.
 Provider<?> getProvider()
          Returns the ldap provider.
 void setConnectionConfig(ConnectionConfig cc)
          Sets the connection config.
 void setProvider(Provider<?> p)
          Sets the ldap provider.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROVIDER

public static final String PROVIDER
Ldap provider class name.

See Also:
Constant Field Values

DEFAULT_PROVIDER

protected static final Provider<?> DEFAULT_PROVIDER
Static reference to the default ldap provider.

Constructor Detail

DefaultConnectionFactory

public DefaultConnectionFactory()
Default constructor.


DefaultConnectionFactory

public DefaultConnectionFactory(String ldapUrl)
Creates a new default connection factory.

Parameters:
ldapUrl - to connect to

DefaultConnectionFactory

public DefaultConnectionFactory(ConnectionConfig cc)
Creates a new default connection factory.

Parameters:
cc - connection configuration

DefaultConnectionFactory

public DefaultConnectionFactory(ConnectionConfig cc,
                                Provider<?> p)
Creates a new default connection factory.

Parameters:
cc - connection configuration
p - provider
Method Detail

getConnectionConfig

public ConnectionConfig getConnectionConfig()
Returns the connection config.

Returns:
connection config

setConnectionConfig

public void setConnectionConfig(ConnectionConfig cc)
Sets the connection config. Once invoked the supplied connection config is made immutable. See AbstractConfig.makeImmutable().

Parameters:
cc - connection config

getProvider

public Provider<?> getProvider()
Returns the ldap provider.

Returns:
ldap provider

setProvider

public void setProvider(Provider<?> p)
Sets the ldap provider.

Parameters:
p - ldap provider to set

getConnection

public Connection getConnection()
Creates a new connection. Connections returned from this method must be opened before they can perform ldap operations.

Specified by:
getConnection in interface ConnectionFactory
Returns:
connection

getConnection

public static Connection getConnection(String ldapUrl)
Creates a new connection. Connections returned from this method must be opened before they can be used.

Parameters:
ldapUrl - to connect to
Returns:
connection

getConnection

public static Connection getConnection(ConnectionConfig cc)
Creates a new connection. Connections returned from this method must be opened before they can be used.

Parameters:
cc - connection configuration
Returns:
connection

getDefaultProvider

public static Provider<?> getDefaultProvider()
The PROVIDER property is checked and that class is loaded if provided. Otherwise the JNDI provider is returned.

Returns:
default provider

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2003-2015 Virginia Tech. All Rights Reserved.