Package org.ldaptive
Class DefaultConnectionFactory
- java.lang.Object
-
- org.ldaptive.AbstractFreezable
-
- org.ldaptive.DefaultConnectionFactory
-
- All Implemented Interfaces:
ConnectionFactory
,Freezable
- Direct Known Subclasses:
SingleConnectionFactory
public class DefaultConnectionFactory extends AbstractFreezable implements ConnectionFactory
Creates connections for performing ldap operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultConnectionFactory.Builder
-
Constructor Summary
Constructors Constructor Description DefaultConnectionFactory()
Default constructor.DefaultConnectionFactory(String ldapUrl)
Creates a new default connection factory.DefaultConnectionFactory(String ldapUrl, Transport t)
Creates a new default connection factory.DefaultConnectionFactory(ConnectionConfig cc)
Creates a new default connection factory.DefaultConnectionFactory(ConnectionConfig cc, Transport t)
Creates a new default connection factory.DefaultConnectionFactory(Transport t)
Creates a new default connection factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultConnectionFactory.Builder
builder()
Creates a builder for this class.static DefaultConnectionFactory.Builder
builder(Transport t)
Creates a builder for this class.void
close()
Free any resources associated with this factory.void
freeze()
Freezes this object, making it immutable.Connection
getConnection()
Creates a new connection.ConnectionConfig
getConnectionConfig()
Returns the connection configuration used to create connections.Transport
getTransport()
Returns the ldap transport.void
setConnectionConfig(ConnectionConfig cc)
Sets the connection config.String
toString()
-
Methods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
transport
private final Transport transport
Transport used by this factory.
-
config
private ConnectionConfig config
Connection configuration used by this factory.
-
-
Constructor Detail
-
DefaultConnectionFactory
public DefaultConnectionFactory()
Default constructor.
-
DefaultConnectionFactory
public DefaultConnectionFactory(Transport t)
Creates a new default connection factory. Be sure to invokeclose()
if the supplied transport has resources to cleanup.- Parameters:
t
- transport
-
DefaultConnectionFactory
public DefaultConnectionFactory(String ldapUrl)
Creates a new default connection factory.- Parameters:
ldapUrl
- to connect to
-
DefaultConnectionFactory
public DefaultConnectionFactory(String ldapUrl, Transport t)
Creates a new default connection factory. Be sure to invokeclose()
if the supplied transport has resources to cleanup.- Parameters:
ldapUrl
- to connect tot
- transport
-
DefaultConnectionFactory
public DefaultConnectionFactory(ConnectionConfig cc)
Creates a new default connection factory.- Parameters:
cc
- connection configuration
-
DefaultConnectionFactory
public DefaultConnectionFactory(ConnectionConfig cc, Transport t)
Creates a new default connection factory. Be sure to invokeclose()
if the supplied transport has resources to cleanup.- Parameters:
cc
- connection configurationt
- transport
-
-
Method Detail
-
freeze
public void freeze()
Description copied from interface:Freezable
Freezes this object, making it immutable.- Specified by:
freeze
in interfaceFreezable
- Overrides:
freeze
in classAbstractFreezable
-
getConnectionConfig
public ConnectionConfig getConnectionConfig()
Description copied from interface:ConnectionFactory
Returns the connection configuration used to create connections.- Specified by:
getConnectionConfig
in interfaceConnectionFactory
- Returns:
- connection config
-
setConnectionConfig
public void setConnectionConfig(ConnectionConfig cc)
Sets the connection config. Once invoked the supplied connection config is made immutable. SeeConnectionConfig.freeze()
.- Parameters:
cc
- connection config
-
getTransport
public Transport getTransport()
Returns the ldap transport.- Returns:
- ldap transport
-
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 interfaceConnectionFactory
- Returns:
- connection
-
close
public void close()
Description copied from interface:ConnectionFactory
Free any resources associated with this factory.- Specified by:
close
in interfaceConnectionFactory
-
builder
public static DefaultConnectionFactory.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
builder
public static DefaultConnectionFactory.Builder builder(Transport t)
Creates a builder for this class.- Parameters:
t
- transport- Returns:
- new builder
-
-