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 classDefaultConnectionFactory.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.Builderbuilder()Creates a builder for this class.static DefaultConnectionFactory.Builderbuilder(Transport t)Creates a builder for this class.voidclose()Free any resources associated with this factory.voidfreeze()Freezes this object, making it immutable.ConnectiongetConnection()Creates a new connection.ConnectionConfiggetConnectionConfig()Returns the connection configuration used to create connections.TransportgetTransport()Returns the ldap transport.voidsetConnectionConfig(ConnectionConfig cc)Sets the connection config.StringtoString()-
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:FreezableFreezes this object, making it immutable.- Specified by:
freezein interfaceFreezable- Overrides:
freezein classAbstractFreezable
-
getConnectionConfig
public ConnectionConfig getConnectionConfig()
Description copied from interface:ConnectionFactoryReturns the connection configuration used to create connections.- Specified by:
getConnectionConfigin 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:
getConnectionin interfaceConnectionFactory- Returns:
- connection
-
close
public void close()
Description copied from interface:ConnectionFactoryFree any resources associated with this factory.- Specified by:
closein 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
-
-