Package org.ldaptive
Class SingleConnectionFactory
- java.lang.Object
-
- org.ldaptive.DefaultConnectionFactory
-
- org.ldaptive.SingleConnectionFactory
-
- All Implemented Interfaces:
ConnectionFactory
public class SingleConnectionFactory extends DefaultConnectionFactory
Creates a single connection which is proxied for LDAP operations.- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SingleConnectionFactory.Builder
protected static class
SingleConnectionFactory.ConnectionProxy
Contains the connection used by this factory.
-
Field Summary
-
Fields inherited from class org.ldaptive.DefaultConnectionFactory
logger
-
-
Constructor Summary
Constructors Constructor Description SingleConnectionFactory()
Default constructor.SingleConnectionFactory(java.lang.String ldapUrl)
Creates a new single connection factory.SingleConnectionFactory(java.lang.String ldapUrl, Transport t)
Creates a new single connection factory.SingleConnectionFactory(ConnectionConfig cc)
Creates a new single connection factory.SingleConnectionFactory(ConnectionConfig cc, Transport t)
Creates a new single connection factory.SingleConnectionFactory(Transport t)
Creates a new single connection factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SingleConnectionFactory.Builder
builder()
Creates a builder for this class.static SingleConnectionFactory.Builder
builder(Transport t)
Creates a builder for this class.void
close()
Free any resources associated with this factory.Connection
getConnection()
Creates a new connection.boolean
getFailFastInitialize()
Returns whetherinitialize()
should throw if the connection cannot be opened.boolean
getNonBlockingInitialize()
Returns whetherinitialize()
should execute on a separate thread.void
initialize()
Prepares this factory for use.boolean
isInitialized()
Returns whether this factory has been initialized.void
setFailFastInitialize(boolean b)
Sets whetherinitialize()
should throw if the connection cannot be opened.void
setNonBlockingInitialize(boolean b)
Sets whetherinitialize()
should execute on a separate thread.java.lang.String
toString()
-
Methods inherited from class org.ldaptive.DefaultConnectionFactory
getConnectionConfig, getTransport, setConnectionConfig
-
-
-
-
Constructor Detail
-
SingleConnectionFactory
public SingleConnectionFactory()
Default constructor.
-
SingleConnectionFactory
public SingleConnectionFactory(Transport t)
Creates a new single connection factory.- Parameters:
t
- transport
-
SingleConnectionFactory
public SingleConnectionFactory(java.lang.String ldapUrl)
Creates a new single connection factory.- Parameters:
ldapUrl
- to connect to
-
SingleConnectionFactory
public SingleConnectionFactory(java.lang.String ldapUrl, Transport t)
Creates a new single connection factory.- Parameters:
ldapUrl
- to connect tot
- transport
-
SingleConnectionFactory
public SingleConnectionFactory(ConnectionConfig cc)
Creates a new single connection factory.- Parameters:
cc
- connection configuration
-
SingleConnectionFactory
public SingleConnectionFactory(ConnectionConfig cc, Transport t)
Creates a new single connection factory.- Parameters:
cc
- connection configurationt
- transport
-
-
Method Detail
-
getFailFastInitialize
public boolean getFailFastInitialize()
Returns whetherinitialize()
should throw if the connection cannot be opened.- Returns:
- whether
initialize()
should throw
-
setFailFastInitialize
public void setFailFastInitialize(boolean b)
Sets whetherinitialize()
should throw if the connection cannot be opened.- Parameters:
b
- whetherinitialize()
should throw
-
getNonBlockingInitialize
public boolean getNonBlockingInitialize()
Returns whetherinitialize()
should execute on a separate thread.- Returns:
- whether
initialize()
should block
-
setNonBlockingInitialize
public void setNonBlockingInitialize(boolean b)
Sets whetherinitialize()
should execute on a separate thread.- Parameters:
b
- whetherinitialize()
should block
-
isInitialized
public boolean isInitialized()
Returns whether this factory has been initialized.- Returns:
- whether this factory has been initialized
-
initialize
public void initialize() throws LdapException
Prepares this factory for use.- Throws:
LdapException
- if the connection cannot be opened
-
getConnection
public Connection getConnection()
Description copied from class:DefaultConnectionFactory
Creates a new connection. Connections returned from this method must be opened before they can perform ldap operations.- Specified by:
getConnection
in interfaceConnectionFactory
- Overrides:
getConnection
in classDefaultConnectionFactory
- Returns:
- connection
-
close
public void close()
Description copied from interface:ConnectionFactory
Free any resources associated with this factory.- Specified by:
close
in interfaceConnectionFactory
- Overrides:
close
in classDefaultConnectionFactory
-
toString
public java.lang.String toString()
- Overrides:
toString
in classDefaultConnectionFactory
-
builder
public static SingleConnectionFactory.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
builder
public static SingleConnectionFactory.Builder builder(Transport t)
Creates a builder for this class.- Parameters:
t
- transport- Returns:
- new builder
-
-