Class ValidatingPoolableLdapConnectionFactory
- java.lang.Object
-
- org.apache.directory.ldap.client.api.AbstractPoolableLdapConnectionFactory
-
- org.apache.directory.ldap.client.api.ValidatingPoolableLdapConnectionFactory
-
- All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<LdapConnection>
public class ValidatingPoolableLdapConnectionFactory extends AbstractPoolableLdapConnectionFactory
A factory for creating LdapConnection objects managed by LdapConnectionPool. A bind operation is executed upon return if any of the following operations were performed on the connection while it was checked out:bind()
anonymousBind()
bind(String)
bind(String, String)
bind(Dn)
bind(Dn, String)
bind(BindRequest)
extended(String)
where oid is StartTLSextended(String, byte[])
where oid is StartTLSextended(String)
where oid is StartTLSextended(String, byte[])
where oid is StartTLSextended(ExtendedRequest)
where ExtendedRequest is StartTLS
DefaultPoolableLdapConnectionFactory
may be the right choice.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description ValidatingPoolableLdapConnectionFactory(LdapConnectionConfig config)
Creates a new instance of ValidatingPoolableLdapConnectionFactory.ValidatingPoolableLdapConnectionFactory(LdapConnectionConfig config, Class<? extends LdapConnectionFactory> connectionFactoryClass)
Creates a new instance of ValidatingPoolableLdapConnectionFactory.ValidatingPoolableLdapConnectionFactory(LdapConnectionFactory connectionFactory)
Creates a new instance of ValidatingPoolableLdapConnectionFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject)
There is nothing to do to activate a connection.org.apache.commons.pool2.PooledObject<LdapConnection>
makeObject()
Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections.void
passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject)
We don't do anything with the connection.-
Methods inherited from class org.apache.directory.ldap.client.api.AbstractPoolableLdapConnectionFactory
destroyObject, getLdapApiService, setValidator, validateObject
-
-
-
-
Constructor Detail
-
ValidatingPoolableLdapConnectionFactory
public ValidatingPoolableLdapConnectionFactory(LdapConnectionConfig config)
Creates a new instance of ValidatingPoolableLdapConnectionFactory.- Parameters:
config
- the configuration for creating LdapConnections
-
ValidatingPoolableLdapConnectionFactory
public ValidatingPoolableLdapConnectionFactory(LdapConnectionConfig config, Class<? extends LdapConnectionFactory> connectionFactoryClass)
Creates a new instance of ValidatingPoolableLdapConnectionFactory. TheconnectionFactoryClass
must have a public constructor accepting anLdapConnectionConfig
object or anIllegalArgumentException
will be thrown.- Parameters:
config
- the configuration for creating LdapConnectionsconnectionFactoryClass
- An implementation class of for the LDAP connection factory.- Throws:
IllegalArgumentException
- If the instantiation of an instance of theconnectionFactoryClass
fails.
-
ValidatingPoolableLdapConnectionFactory
public ValidatingPoolableLdapConnectionFactory(LdapConnectionFactory connectionFactory)
Creates a new instance of ValidatingPoolableLdapConnectionFactory.- Parameters:
connectionFactory
- the connection factory for creating LdapConnections
-
-
Method Detail
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) throws LdapException
There is nothing to do to activate a connection. There is nothing to do to activate a connection.- Specified by:
activateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Overrides:
activateObject
in classAbstractPoolableLdapConnectionFactory
- Throws:
LdapException
-
makeObject
public org.apache.commons.pool2.PooledObject<LdapConnection> makeObject() throws LdapException
Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections. The default is to create bound connections. Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections. The default is to create bound connections.- Specified by:
makeObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Overrides:
makeObject
in classAbstractPoolableLdapConnectionFactory
- Throws:
LdapException
- If unable to connect.
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) throws LdapException
We don't do anything with the connection. It remains in the state it was before being used. Here, passivating a connection means we re-bind it, so that the existing LDAPSession is reset.- Specified by:
passivateObject
in interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>
- Overrides:
passivateObject
in classAbstractPoolableLdapConnectionFactory
- Throws:
LdapException
- If unable to reconfigure and rebind.
-
-