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>
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
-
Field Summary
Fields inherited from class AbstractPoolableLdapConnectionFactory
connectionFactory, validator -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionvoidactivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) There is nothing to do to activate a connection.org.apache.commons.pool2.PooledObject<LdapConnection> Specifically, we are creating a new connection based on the LdapConnection Factory we used to create this pool of connections.voidpassivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) We don't do anything with the connection.Methods inherited from class AbstractPoolableLdapConnectionFactory
destroyObject, getLdapApiService, newLdapConnectionFactory, setValidator, validateObjectMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.pool2.PooledObjectFactory
destroyObject
-
Constructor Details
-
ValidatingPoolableLdapConnectionFactory
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. TheconnectionFactoryClassmust have a public constructor accepting anLdapConnectionConfigobject or anIllegalArgumentExceptionwill 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 theconnectionFactoryClassfails.
-
ValidatingPoolableLdapConnectionFactory
Creates a new instance of ValidatingPoolableLdapConnectionFactory.- Parameters:
connectionFactory- the connection factory for creating LdapConnections
-
-
Method Details
-
activateObject
public void activateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) throws org.apache.directory.api.ldap.model.exception.LdapException There is nothing to do to activate a connection. There is nothing to do to activate a connection.- Specified by:
activateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Overrides:
activateObjectin classAbstractPoolableLdapConnectionFactory- Throws:
org.apache.directory.api.ldap.model.exception.LdapException
-
makeObject
public org.apache.commons.pool2.PooledObject<LdapConnection> makeObject() throws org.apache.directory.api.ldap.model.exception.LdapExceptionSpecifically, 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:
makeObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Overrides:
makeObjectin classAbstractPoolableLdapConnectionFactory- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If unable to connect.
-
passivateObject
public void passivateObject(org.apache.commons.pool2.PooledObject<LdapConnection> pooledObject) throws org.apache.directory.api.ldap.model.exception.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:
passivateObjectin interfaceorg.apache.commons.pool2.PooledObjectFactory<LdapConnection>- Overrides:
passivateObjectin classAbstractPoolableLdapConnectionFactory- Throws:
org.apache.directory.api.ldap.model.exception.LdapException- If unable to reconfigure and rebind.
-