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 classSingleConnectionFactory.Builderprotected static classSingleConnectionFactory.ConnectionProxyContains 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.Builderbuilder()Creates a builder for this class.static SingleConnectionFactory.Builderbuilder(Transport t)Creates a builder for this class.voidclose()Free any resources associated with this factory.ConnectiongetConnection()Creates a new connection.booleangetFailFastInitialize()Returns whetherinitialize()should throw if the connection cannot be opened.booleangetNonBlockingInitialize()Returns whetherinitialize()should execute on a separate thread.voidinitialize()Prepares this factory for use.booleanisInitialized()Returns whether this factory has been initialized.voidsetFailFastInitialize(boolean b)Sets whetherinitialize()should throw if the connection cannot be opened.voidsetNonBlockingInitialize(boolean b)Sets whetherinitialize()should execute on a separate thread.java.lang.StringtoString()-
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 LdapExceptionPrepares this factory for use.- Throws:
LdapException- if the connection cannot be opened
-
getConnection
public Connection getConnection()
Description copied from class:DefaultConnectionFactoryCreates a new connection. Connections returned from this method must be opened before they can perform ldap operations.- Specified by:
getConnectionin interfaceConnectionFactory- Overrides:
getConnectionin classDefaultConnectionFactory- Returns:
- connection
-
close
public void close()
Description copied from interface:ConnectionFactoryFree any resources associated with this factory.- Specified by:
closein interfaceConnectionFactory- Overrides:
closein classDefaultConnectionFactory
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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
-
-