Package com.unboundid.ldap.sdk
Class AbstractConnectionPool
- java.lang.Object
-
- com.unboundid.ldap.sdk.AbstractConnectionPool
-
- All Implemented Interfaces:
FullLDAPInterface
,LDAPInterface
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
LDAPConnectionPool
,LDAPThreadLocalConnectionPool
@NotExtensible @ThreadSafety(level=INTERFACE_NOT_THREADSAFE) public abstract class AbstractConnectionPool extends java.lang.Object implements FullLDAPInterface, java.io.Closeable
This class provides the base class for LDAP connection pool implementations provided by the LDAP SDK for Java.
-
-
Constructor Summary
Constructors Constructor Description AbstractConnectionPool()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description LDAPResult
add(AddRequest addRequest)
Processes the provided add request using a connection from this connection pool.LDAPResult
add(Entry entry)
Processes an add operation with the provided information using a connection from this connection pool.LDAPResult
add(ReadOnlyAddRequest addRequest)
Processes the provided add request using a connection from this connection pool.LDAPResult
add(java.lang.String... ldifLines)
Processes an add operation with the provided information using a connection from this connection pool.LDAPResult
add(java.lang.String dn, Attribute... attributes)
Processes an add operation with the provided information using a connection from this connection pool.LDAPResult
add(java.lang.String dn, java.util.Collection<Attribute> attributes)
Processes an add operation with the provided information using a connection from this connection pool.BindResult
bind(BindRequest bindRequest)
Processes the provided bind request using a connection from this connection pool.BindResult
bind(java.lang.String bindDN, java.lang.String password)
Processes a simple bind request with the provided DN and password using a connection from this connection pool.abstract void
close()
Closes this connection pool.abstract void
close(boolean unbind, int numThreads)
Closes this connection pool, optionally using multiple threads to close the connections in parallel.CompareResult
compare(CompareRequest compareRequest)
Processes the provided compare request using a connection from this connection pool.CompareResult
compare(ReadOnlyCompareRequest compareRequest)
Processes the provided compare request using a connection from this connection pool.CompareResult
compare(java.lang.String dn, java.lang.String attributeName, java.lang.String assertionValue)
Processes a compare operation with the provided information using a connection from this connection pool.LDAPResult
delete(DeleteRequest deleteRequest)
Processes the provided delete request using a connection from this connection pool.LDAPResult
delete(ReadOnlyDeleteRequest deleteRequest)
Processes the provided delete request using a connection from this connection pool.LDAPResult
delete(java.lang.String dn)
Deletes the entry with the specified DN using a connection from this connection pool.protected abstract void
doHealthCheck()
Performs a health check against all connections currently available in this connection pool.abstract LDAPConnection
getConnection()
Retrieves an LDAP connection from the pool.abstract java.lang.String
getConnectionPoolName()
Retrieves the user-friendly name that has been assigned to this connection pool.abstract LDAPConnectionPoolStatistics
getConnectionPoolStatistics()
Retrieves the set of statistics maintained for this LDAP connection pool.abstract int
getCurrentAvailableConnections()
Retrieves the number of connections that are currently available for use in this connection pool, if applicable.SearchResultEntry
getEntry(java.lang.String dn)
Retrieves the entry with the specified DN using a connection from this connection pool.SearchResultEntry
getEntry(java.lang.String dn, java.lang.String... attributes)
Retrieves the entry with the specified DN using a connection from this connection pool.abstract LDAPConnectionPoolHealthCheck
getHealthCheck()
Retrieves the health check implementation for this connection pool.abstract long
getHealthCheckIntervalMillis()
Retrieves the length of time in milliseconds between periodic background health checks against the available connections in this pool.abstract int
getMaximumAvailableConnections()
Retrieves the maximum number of connections to be maintained in this connection pool, which is the maximum number of available connections that should be available at any time, if applicable.abstract java.util.Set<OperationType>
getOperationTypesToRetryDueToInvalidConnections()
Retrieves the set of operation types for which operations should be retried if the initial attempt fails in a manner that indicates that the connection used to process the request may no longer be valid.RootDSE
getRootDSE()
Retrieves the directory server root DSE using a connection from this connection pool.Schema
getSchema()
Retrieves the directory server schema definitions using a connection from this connection pool, using the subschema subentry DN contained in the server's root DSE.Schema
getSchema(java.lang.String entryDN)
Retrieves the directory server schema definitions that govern the specified entry using a connection from this connection pool.abstract boolean
isClosed()
Indicates whether this connection pool has been closed.LDAPResult
modify(ModifyRequest modifyRequest)
Processes the provided modify request using a connection from this connection pool.LDAPResult
modify(ReadOnlyModifyRequest modifyRequest)
Processes the provided modify request using a connection from this connection pool.LDAPResult
modify(java.lang.String... ldifModificationLines)
Processes a modify request from the provided LDIF representation of the changes using a connection from this connection pool.LDAPResult
modify(java.lang.String dn, Modification mod)
Applies the provided modification to the specified entry using a connection from this connection pool.LDAPResult
modify(java.lang.String dn, Modification... mods)
Applies the provided set of modifications to the specified entry using a connection from this connection pool.LDAPResult
modify(java.lang.String dn, java.util.List<Modification> mods)
Applies the provided set of modifications to the specified entry using a connection from this connection pool.LDAPResult
modifyDN(ModifyDNRequest modifyDNRequest)
Processes the provided modify DN request using a connection from this connection pool.LDAPResult
modifyDN(ReadOnlyModifyDNRequest modifyDNRequest)
Processes the provided modify DN request using a connection from this connection pool.LDAPResult
modifyDN(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN)
Performs a modify DN operation with the provided information using a connection from this connection pool.LDAPResult
modifyDN(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN, java.lang.String newSuperiorDN)
Performs a modify DN operation with the provided information using a connection from this connection pool.ExtendedResult
processExtendedOperation(ExtendedRequest extendedRequest)
Processes the provided extended request using a connection from this connection pool.ExtendedResult
processExtendedOperation(java.lang.String requestOID)
Processes an extended operation with the provided request OID using a connection from this connection pool.ExtendedResult
processExtendedOperation(java.lang.String requestOID, ASN1OctetString requestValue)
Processes an extended operation with the provided request OID and value using a connection from this connection pool.java.util.List<LDAPResult>
processRequests(java.util.List<LDAPRequest> requests, boolean continueOnError)
Processes multiple requests in the order they are provided over a single connection from this pool.java.util.List<AsyncRequestID>
processRequestsAsync(java.util.List<LDAPRequest> requests, long maxWaitTimeMillis)
Processes multiple requests over a single connection from this pool using asynchronous processing to cause the operations to be processed concurrently.abstract void
releaseConnection(LDAPConnection connection)
Releases the provided connection back to this pool.void
releaseConnectionAfterException(LDAPConnection connection, LDAPException exception)
Releases the provided connection back to the pool after an exception has been encountered while processing an operation on that connection.abstract void
releaseDefunctConnection(LDAPConnection connection)
Indicates that the provided connection is no longer in use, but is also no longer fit for use.abstract LDAPConnection
replaceDefunctConnection(LDAPConnection connection)
Releases the provided connection as defunct and creates a new connection to replace it, if possible, optionally connected to a different directory server instance than the instance with which the original connection was established.boolean
retryFailedOperationsDueToInvalidConnections()
Indicates whether attempts to process operations should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process that request may no longer be valid.SearchResult
search(ReadOnlySearchRequest searchRequest)
Processes the provided search request using a connection from this connection pool.SearchResult
search(SearchRequest searchRequest)
Processes the provided search request using a connection from this connection pool.SearchResult
search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResult
search(java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(ReadOnlySearchRequest searchRequest)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(SearchRequest searchRequest)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.SearchResultEntry
searchForEntry(java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes)
Processes a search operation with the provided information using a connection from this connection pool.abstract void
setConnectionPoolName(java.lang.String connectionPoolName)
Specifies the user-friendly name that should be used for this connection pool.abstract void
setHealthCheckIntervalMillis(long healthCheckInterval)
Specifies the length of time in milliseconds between periodic background health checks against the available connections in this pool.void
setRetryFailedOperationsDueToInvalidConnections(boolean retryFailedOperationsDueToInvalidConnections)
Specifies whether attempts to process operations should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process that request may no longer be valid.abstract void
setRetryFailedOperationsDueToInvalidConnections(java.util.Set<OperationType> operationTypes)
Specifies the types of operations that should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process the request may no longer be valid.java.lang.String
toString()
Retrieves a string representation of this connection pool.abstract void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this connection pool to the provided buffer.
-
-
-
Constructor Detail
-
AbstractConnectionPool
public AbstractConnectionPool()
-
-
Method Detail
-
close
public abstract void close()
Closes this connection pool. All connections currently held in the pool that are not in use will be closed, and any outstanding connections will be automatically closed when they are released back to the pool.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceFullLDAPInterface
-
close
public abstract void close(boolean unbind, int numThreads)
Closes this connection pool, optionally using multiple threads to close the connections in parallel.- Parameters:
unbind
- Indicates whether to try to send an unbind request to the server before closing the connection.numThreads
- The number of threads to use when closing the connections.
-
isClosed
public abstract boolean isClosed()
Indicates whether this connection pool has been closed.- Returns:
true
if this connection pool has been closed, orfalse
if not.
-
getConnection
public abstract LDAPConnection getConnection() throws LDAPException
Retrieves an LDAP connection from the pool.- Returns:
- The LDAP connection taken from the pool.
- Throws:
LDAPException
- If no connection is available, or a problem occurs while creating a new connection to return.
-
releaseConnection
public abstract void releaseConnection(LDAPConnection connection)
Releases the provided connection back to this pool.- Parameters:
connection
- The connection to be released back to the pool.
-
releaseDefunctConnection
public abstract void releaseDefunctConnection(LDAPConnection connection)
Indicates that the provided connection is no longer in use, but is also no longer fit for use. The provided connection will be terminated and a new connection will be created and added to the pool in its place.- Parameters:
connection
- The defunct connection being released.
-
releaseConnectionAfterException
public final void releaseConnectionAfterException(LDAPConnection connection, LDAPException exception)
Releases the provided connection back to the pool after an exception has been encountered while processing an operation on that connection. The connection pool health check instance associated with this pool will be used to determine whether the provided connection is still valid and will either release it back for use in processing other operations on the connection or will terminate the connection and create a new one to take its place.- Parameters:
connection
- The connection to be evaluated and released back to the pool or replaced with a new connection.exception
- The exception caught while processing an operation on the connection.
-
replaceDefunctConnection
public abstract LDAPConnection replaceDefunctConnection(LDAPConnection connection) throws LDAPException
Releases the provided connection as defunct and creates a new connection to replace it, if possible, optionally connected to a different directory server instance than the instance with which the original connection was established.- Parameters:
connection
- The defunct connection to be replaced.- Returns:
- The newly-created connection intended to replace the provided connection.
- Throws:
LDAPException
- If a problem is encountered while trying to create the new connection. Note that even if an exception is thrown, then the provided connection must have been properly released as defunct.
-
retryFailedOperationsDueToInvalidConnections
public final boolean retryFailedOperationsDueToInvalidConnections()
Indicates whether attempts to process operations should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process that request may no longer be valid. Only a single retry will be attempted for any operation.
Note that this only applies to methods used to process operations in the context pool (e.g., using methods that are part ofLDAPInterface
), and will not automatically be used for operations processed on connections checked out of the pool.
This method is provided for the purpose of backward compatibility, but new functionality has been added to control retry on a per-operation-type basis via thesetRetryFailedOperationsDueToInvalidConnections(Set)
method. If retry is enabled for any operation type, then this method will returntrue
, and it will only returnfalse
if retry should not be used for any operation type. To determine the operation types for which failed operations may be retried, use thegetOperationTypesToRetryDueToInvalidConnections()
method.- Returns:
true
if the connection pool should attempt to retry operations on a newly-created connection if they fail in a way that indicates the associated connection may no longer be usable, orfalse
if operations should only be attempted once.
-
getOperationTypesToRetryDueToInvalidConnections
public abstract java.util.Set<OperationType> getOperationTypesToRetryDueToInvalidConnections()
Retrieves the set of operation types for which operations should be retried if the initial attempt fails in a manner that indicates that the connection used to process the request may no longer be valid.- Returns:
- The set of operation types for which operations should be retried if the initial attempt fails in a manner that indicates that the connection used to process the request may no longer be valid, or an empty set if retries should not be performed for any type of operation.
-
setRetryFailedOperationsDueToInvalidConnections
public final void setRetryFailedOperationsDueToInvalidConnections(boolean retryFailedOperationsDueToInvalidConnections)
Specifies whether attempts to process operations should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process that request may no longer be valid. Only a single retry will be attempted for any operation.
Note that this only applies to methods used to process operations in the context pool (e.g., using methods that are part ofLDAPInterface
), and will not automatically be used for operations processed on connections checked out of the pool.
This method is provided for the purpose of backward compatibility, but new functionality has been added to control retry on a per-operation-type basis via thesetRetryFailedOperationsDueToInvalidConnections(Set)
method. If this is called with a value oftrue
, then retry will be enabled for all types of operations. If it is called with a value offalse
, then retry will be disabled for all types of operations.- Parameters:
retryFailedOperationsDueToInvalidConnections
- Indicates whether attempts to process operations should be retried on a newly-created connection if they fail in a way that indicates the associated connection may no longer be usable.
-
setRetryFailedOperationsDueToInvalidConnections
public abstract void setRetryFailedOperationsDueToInvalidConnections(java.util.Set<OperationType> operationTypes)
Specifies the types of operations that should be retried on a newly-created connection if the initial attempt fails in a manner that indicates that the connection used to process the request may no longer be valid. Only a single retry will be attempted for any operation.
Note that this only applies to methods used to process operations in the context pool (e.g., using methods that are part ofLDAPInterface
), and will not automatically be used for operations processed on connections checked out of the pool.- Parameters:
operationTypes
- The types of operations for which to retry failed operations if they fail in a way that indicates the associated connection may no longer be usable. It may benull
or empty to indicate that no types of operations should be retried.
-
getCurrentAvailableConnections
public abstract int getCurrentAvailableConnections()
Retrieves the number of connections that are currently available for use in this connection pool, if applicable.- Returns:
- The number of connections that are currently available for use in this connection pool, or -1 if that is not applicable for this type of connection pool.
-
getMaximumAvailableConnections
public abstract int getMaximumAvailableConnections()
Retrieves the maximum number of connections to be maintained in this connection pool, which is the maximum number of available connections that should be available at any time, if applicable.- Returns:
- The number of connections to be maintained in this connection pool, or -1 if that is not applicable for this type of connection pool.
-
getConnectionPoolStatistics
public abstract LDAPConnectionPoolStatistics getConnectionPoolStatistics()
Retrieves the set of statistics maintained for this LDAP connection pool.- Returns:
- The set of statistics maintained for this LDAP connection pool.
-
getConnectionPoolName
public abstract java.lang.String getConnectionPoolName()
Retrieves the user-friendly name that has been assigned to this connection pool.- Returns:
- The user-friendly name that has been assigned to this connection
pool, or
null
if none has been assigned.
-
setConnectionPoolName
public abstract void setConnectionPoolName(java.lang.String connectionPoolName)
Specifies the user-friendly name that should be used for this connection pool. This name may be used in debugging to help identify the purpose of this connection pool. It will also be assigned to all connections associated with this connection pool.- Parameters:
connectionPoolName
- The user-friendly name that should be used for this connection pool.
-
getHealthCheck
public abstract LDAPConnectionPoolHealthCheck getHealthCheck()
Retrieves the health check implementation for this connection pool.- Returns:
- The health check implementation for this connection pool.
-
getHealthCheckIntervalMillis
public abstract long getHealthCheckIntervalMillis()
Retrieves the length of time in milliseconds between periodic background health checks against the available connections in this pool.- Returns:
- The length of time in milliseconds between the periodic background health checks against the available connections in this pool.
-
setHealthCheckIntervalMillis
public abstract void setHealthCheckIntervalMillis(long healthCheckInterval)
Specifies the length of time in milliseconds between periodic background health checks against the available connections in this pool.- Parameters:
healthCheckInterval
- The length of time in milliseconds between periodic background health checks against the available connections in this pool. The provided value must be greater than zero.
-
doHealthCheck
protected abstract void doHealthCheck()
Performs a health check against all connections currently available in this connection pool. This should only be invoked by the connection pool health check thread.
-
getRootDSE
public final RootDSE getRootDSE() throws LDAPException
Retrieves the directory server root DSE using a connection from this connection pool.- Specified by:
getRootDSE
in interfaceLDAPInterface
- Returns:
- The directory server root DSE, or
null
if it is not available. - Throws:
LDAPException
- If a problem occurs while attempting to retrieve the server root DSE.
-
getSchema
public final Schema getSchema() throws LDAPException
Retrieves the directory server schema definitions using a connection from this connection pool, using the subschema subentry DN contained in the server's root DSE. For directory servers containing a single schema, this should be sufficient for all purposes. For servers with multiple schemas, it may be necessary to specify the DN of the target entry for which to obtain the associated schema.- Specified by:
getSchema
in interfaceLDAPInterface
- Returns:
- The directory server schema definitions, or
null
if the schema information could not be retrieved (e.g, the client does not have permission to read the server schema). - Throws:
LDAPException
- If a problem occurs while attempting to retrieve the server schema.
-
getSchema
public final Schema getSchema(java.lang.String entryDN) throws LDAPException
Retrieves the directory server schema definitions that govern the specified entry using a connection from this connection pool. The subschemaSubentry attribute will be retrieved from the target entry, and then the appropriate schema definitions will be loaded from the entry referenced by that attribute. This may be necessary to ensure correct behavior in servers that support multiple schemas.- Specified by:
getSchema
in interfaceLDAPInterface
- Parameters:
entryDN
- The DN of the entry for which to retrieve the associated schema definitions. It may benull
or an empty string if the subschemaSubentry attribute should be retrieved from the server's root DSE.- Returns:
- The directory server schema definitions, or
null
if the schema information could not be retrieved (e.g, the client does not have permission to read the server schema). - Throws:
LDAPException
- If a problem occurs while attempting to retrieve the server schema.
-
getEntry
public final SearchResultEntry getEntry(java.lang.String dn) throws LDAPException
Retrieves the entry with the specified DN using a connection from this connection pool. All user attributes will be requested in the entry to return.- Specified by:
getEntry
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to retrieve. It must not benull
.- Returns:
- The requested entry, or
null
if the target entry does not exist or no entry was returned (e.g., if the authenticated user does not have permission to read the target entry). - Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
getEntry
public final SearchResultEntry getEntry(java.lang.String dn, java.lang.String... attributes) throws LDAPException
Retrieves the entry with the specified DN using a connection from this connection pool.- Specified by:
getEntry
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to retrieve. It must not benull
.attributes
- The set of attributes to request for the target entry. If it isnull
, then all user attributes will be requested.- Returns:
- The requested entry, or
null
if the target entry does not exist or no entry was returned (e.g., if the authenticated user does not have permission to read the target entry). - Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
add
public final LDAPResult add(java.lang.String dn, Attribute... attributes) throws LDAPException
Processes an add operation with the provided information using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to add. It must not benull
.attributes
- The set of attributes to include in the entry to add. It must not benull
.- Returns:
- The result of processing the add operation.
- Throws:
LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
add
public final LDAPResult add(java.lang.String dn, java.util.Collection<Attribute> attributes) throws LDAPException
Processes an add operation with the provided information using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to add. It must not benull
.attributes
- The set of attributes to include in the entry to add. It must not benull
.- Returns:
- The result of processing the add operation.
- Throws:
LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
add
public final LDAPResult add(Entry entry) throws LDAPException
Processes an add operation with the provided information using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
entry
- The entry to add. It must not benull
.- Returns:
- The result of processing the add operation.
- Throws:
LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
add
public final LDAPResult add(java.lang.String... ldifLines) throws LDIFException, LDAPException
Processes an add operation with the provided information using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
ldifLines
- The lines that comprise an LDIF representation of the entry to add. It must not be empty ornull
.- Returns:
- The result of processing the add operation.
- Throws:
LDIFException
- If the provided entry lines cannot be decoded as an entry in LDIF form.LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
add
public final LDAPResult add(AddRequest addRequest) throws LDAPException
Processes the provided add request using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
addRequest
- The add request to be processed. It must not benull
.- Returns:
- The result of processing the add operation.
- Throws:
LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
add
public final LDAPResult add(ReadOnlyAddRequest addRequest) throws LDAPException
Processes the provided add request using a connection from this connection pool.- Specified by:
add
in interfaceLDAPInterface
- Parameters:
addRequest
- The add request to be processed. It must not benull
.- Returns:
- The result of processing the add operation.
- Throws:
LDAPException
- If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
-
bind
public final BindResult bind(java.lang.String bindDN, java.lang.String password) throws LDAPException
Processes a simple bind request with the provided DN and password using a connection from this connection pool. Note that this will impact the state of the connection in the pool, and therefore this method should only be used if this connection pool is used exclusively for processing bind operations, or if the retain identity request control (a proprietary control for use with the Ping Identity, UnboundID, or Nokia/Alcatel-Lucent 8661 Directory Server) is included in the bind request to ensure that the authentication state is not impacted.- Specified by:
bind
in interfaceFullLDAPInterface
- Parameters:
bindDN
- The bind DN for the bind operation.password
- The password for the simple bind operation.- Returns:
- The result of processing the bind operation.
- Throws:
LDAPException
- If the server rejects the bind request, or if a problem occurs while sending the request or reading the response.
-
bind
public final BindResult bind(BindRequest bindRequest) throws LDAPException
Processes the provided bind request using a connection from this connection pool. Note that this will impact the state of the connection in the pool, and therefore this method should only be used if this connection pool is used exclusively for processing bind operations, or if the retain identity request control (a proprietary control for use with the Ping Identity, UnboundID, or Nokia/Alcatel-Lucent 8661 Directory Server) is included in the bind request to ensure that the authentication state is not impacted.- Specified by:
bind
in interfaceFullLDAPInterface
- Parameters:
bindRequest
- The bind request to be processed. It must not benull
.- Returns:
- The result of processing the bind operation.
- Throws:
LDAPException
- If the server rejects the bind request, or if a problem occurs while sending the request or reading the response.
-
compare
public final CompareResult compare(java.lang.String dn, java.lang.String attributeName, java.lang.String assertionValue) throws LDAPException
Processes a compare operation with the provided information using a connection from this connection pool.- Specified by:
compare
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry in which to make the comparison. It must not benull
.attributeName
- The attribute name for which to make the comparison. It must not benull
.assertionValue
- The assertion value to verify in the target entry. It must not benull
.- Returns:
- The result of processing the compare operation.
- Throws:
LDAPException
- If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
-
compare
public final CompareResult compare(CompareRequest compareRequest) throws LDAPException
Processes the provided compare request using a connection from this connection pool.- Specified by:
compare
in interfaceLDAPInterface
- Parameters:
compareRequest
- The compare request to be processed. It must not benull
.- Returns:
- The result of processing the compare operation.
- Throws:
LDAPException
- If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
-
compare
public final CompareResult compare(ReadOnlyCompareRequest compareRequest) throws LDAPException
Processes the provided compare request using a connection from this connection pool.- Specified by:
compare
in interfaceLDAPInterface
- Parameters:
compareRequest
- The compare request to be processed. It must not benull
.- Returns:
- The result of processing the compare operation.
- Throws:
LDAPException
- If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
-
delete
public final LDAPResult delete(java.lang.String dn) throws LDAPException
Deletes the entry with the specified DN using a connection from this connection pool.- Specified by:
delete
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to delete. It must not benull
.- Returns:
- The result of processing the delete operation.
- Throws:
LDAPException
- If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
-
delete
public final LDAPResult delete(DeleteRequest deleteRequest) throws LDAPException
Processes the provided delete request using a connection from this connection pool.- Specified by:
delete
in interfaceLDAPInterface
- Parameters:
deleteRequest
- The delete request to be processed. It must not benull
.- Returns:
- The result of processing the delete operation.
- Throws:
LDAPException
- If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
-
delete
public final LDAPResult delete(ReadOnlyDeleteRequest deleteRequest) throws LDAPException
Processes the provided delete request using a connection from this connection pool.- Specified by:
delete
in interfaceLDAPInterface
- Parameters:
deleteRequest
- The delete request to be processed. It must not benull
.- Returns:
- The result of processing the delete operation.
- Throws:
LDAPException
- If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
-
processExtendedOperation
public final ExtendedResult processExtendedOperation(java.lang.String requestOID) throws LDAPException
Processes an extended operation with the provided request OID using a connection from this connection pool. Note that this method should not be used to perform any operation that will alter the state of the connection in the pool (e.g., a StartTLS operation) or that involves multiple distinct operations on the same connection (e.g., LDAP transactions).- Specified by:
processExtendedOperation
in interfaceFullLDAPInterface
- Parameters:
requestOID
- The OID for the extended request to process. It must not benull
.- Returns:
- The extended result object that provides information about the result of the request processing.
- Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
processExtendedOperation
public final ExtendedResult processExtendedOperation(java.lang.String requestOID, ASN1OctetString requestValue) throws LDAPException
Processes an extended operation with the provided request OID and value using a connection from this connection pool. Note that this method should not be used to perform any operation that will alter the state of the connection in the pool (e.g., a StartTLS operation) or that involves multiple distinct operations on the same connection (e.g., LDAP transactions).- Specified by:
processExtendedOperation
in interfaceFullLDAPInterface
- Parameters:
requestOID
- The OID for the extended request to process. It must not benull
.requestValue
- The encoded value for the extended request to process. It may benull
if there does not need to be a value for the requested operation.- Returns:
- The extended result object that provides information about the result of the request processing.
- Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
processExtendedOperation
public final ExtendedResult processExtendedOperation(ExtendedRequest extendedRequest) throws LDAPException
Processes the provided extended request using a connection from this connection pool. Note that this method should not be used to perform any operation that will alter the state of the connection in the pool (e.g., a StartTLS operation) or that involves multiple distinct operations on the same connection (e.g., LDAP transactions).- Specified by:
processExtendedOperation
in interfaceFullLDAPInterface
- Parameters:
extendedRequest
- The extended request to be processed. It must not benull
.- Returns:
- The extended result object that provides information about the result of the request processing.
- Throws:
LDAPException
- If a problem occurs while sending the request or reading the response.
-
modify
public final LDAPResult modify(java.lang.String dn, Modification mod) throws LDAPException
Applies the provided modification to the specified entry using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to modify. It must not benull
.mod
- The modification to apply to the target entry. It must not benull
.- Returns:
- The result of processing the modify operation.
- Throws:
LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modify
public final LDAPResult modify(java.lang.String dn, Modification... mods) throws LDAPException
Applies the provided set of modifications to the specified entry using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to modify. It must not benull
.mods
- The set of modifications to apply to the target entry. It must not benull
or empty. *- Returns:
- The result of processing the modify operation.
- Throws:
LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modify
public final LDAPResult modify(java.lang.String dn, java.util.List<Modification> mods) throws LDAPException
Applies the provided set of modifications to the specified entry using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
dn
- The DN of the entry to modify. It must not benull
.mods
- The set of modifications to apply to the target entry. It must not benull
or empty.- Returns:
- The result of processing the modify operation.
- Throws:
LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modify
public final LDAPResult modify(java.lang.String... ldifModificationLines) throws LDIFException, LDAPException
Processes a modify request from the provided LDIF representation of the changes using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
ldifModificationLines
- The lines that comprise an LDIF representation of a modify change record. It must not benull
or empty.- Returns:
- The result of processing the modify operation.
- Throws:
LDIFException
- If the provided set of lines cannot be parsed as an LDIF modify change record.LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modify
public final LDAPResult modify(ModifyRequest modifyRequest) throws LDAPException
Processes the provided modify request using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
modifyRequest
- The modify request to be processed. It must not benull
.- Returns:
- The result of processing the modify operation.
- Throws:
LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modify
public final LDAPResult modify(ReadOnlyModifyRequest modifyRequest) throws LDAPException
Processes the provided modify request using a connection from this connection pool.- Specified by:
modify
in interfaceLDAPInterface
- Parameters:
modifyRequest
- The modify request to be processed. It must not benull
.- Returns:
- The result of processing the modify operation.
- Throws:
LDAPException
- If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
-
modifyDN
public final LDAPResult modifyDN(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN) throws LDAPException
Performs a modify DN operation with the provided information using a connection from this connection pool.- Specified by:
modifyDN
in interfaceLDAPInterface
- Parameters:
dn
- The current DN for the entry to rename. It must not benull
.newRDN
- The new RDN to use for the entry. It must not benull
.deleteOldRDN
- Indicates whether to delete the current RDN value from the entry.- Returns:
- The result of processing the modify DN operation.
- Throws:
LDAPException
- If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
-
modifyDN
public final LDAPResult modifyDN(java.lang.String dn, java.lang.String newRDN, boolean deleteOldRDN, java.lang.String newSuperiorDN) throws LDAPException
Performs a modify DN operation with the provided information using a connection from this connection pool.- Specified by:
modifyDN
in interfaceLDAPInterface
- Parameters:
dn
- The current DN for the entry to rename. It must not benull
.newRDN
- The new RDN to use for the entry. It must not benull
.deleteOldRDN
- Indicates whether to delete the current RDN value from the entry.newSuperiorDN
- The new superior DN for the entry. It may benull
if the entry is not to be moved below a new parent.- Returns:
- The result of processing the modify DN operation.
- Throws:
LDAPException
- If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
-
modifyDN
public final LDAPResult modifyDN(ModifyDNRequest modifyDNRequest) throws LDAPException
Processes the provided modify DN request using a connection from this connection pool.- Specified by:
modifyDN
in interfaceLDAPInterface
- Parameters:
modifyDNRequest
- The modify DN request to be processed. It must not benull
.- Returns:
- The result of processing the modify DN operation.
- Throws:
LDAPException
- If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
-
modifyDN
public final LDAPResult modifyDN(ReadOnlyModifyDNRequest modifyDNRequest) throws LDAPException
Processes the provided modify DN request using a connection from this connection pool.- Specified by:
modifyDN
in interfaceLDAPInterface
- Parameters:
modifyDNRequest
- The modify DN request to be processed. It must not benull
.- Returns:
- The result of processing the modify DN operation.
- Throws:
LDAPException
- If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
-
search
public final SearchResult search(java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. The search result entries and references will be collected internally and included in theSearchResult
object that is returned.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
search
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. The search result entries and references will be collected internally and included in theSearchResult
object that is returned.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
search
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchResultListener
- The search result listener that should be used to return results to the client. It may benull
if the search results should be collected internally and returned in theSearchResult
object.baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchResultListener
- The search result listener that should be used to return results to the client. It may benull
if the search results should be collected internally and returned in theSearchResult
object.baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. The search result entries and references will be collected internally and included in theSearchResult
object that is returned.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
search
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.sizeLimit
- The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. The search result entries and references will be collected internally and included in theSearchResult
object that is returned.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
search
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.sizeLimit
- The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchResultListener
- The search result listener that should be used to return results to the client. It may benull
if the search results should be collected internally and returned in theSearchResult
object.baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.sizeLimit
- The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(SearchResultListener searchResultListener, java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchResultListener
- The search result listener that should be used to return results to the client. It may benull
if the search results should be collected internally and returned in theSearchResult
object.baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.sizeLimit
- The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(SearchRequest searchRequest) throws LDAPSearchException
Processes the provided search request using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchRequest
- The search request to be processed. It must not benull
.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
search
public final SearchResult search(ReadOnlySearchRequest searchRequest) throws LDAPSearchException
Processes the provided search request using a connection from this connection pool.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through thegetSearchEntries
andgetSearchReferences
methods).- Specified by:
search
in interfaceLDAPInterface
- Parameters:
searchRequest
- The search request to be processed. It must not benull
.- Returns:
- A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
- Throws:
LDAPSearchException
- If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(java.lang.String baseDN, SearchScope scope, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(java.lang.String baseDN, SearchScope scope, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, java.lang.String filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The string representation of the filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(java.lang.String baseDN, SearchScope scope, DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, Filter filter, java.lang.String... attributes) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
baseDN
- The base DN for the search request. It must not benull
.scope
- The scope that specifies the range of entries that should be examined for the search.derefPolicy
- The dereference policy the server should use for any aliases encountered while processing the search.timeLimit
- The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.typesOnly
- Indicates whether to return only attribute names in matching entries, or both attribute names and values.filter
- The filter to use to identify matching entries. It must not benull
.attributes
- The set of attributes that should be returned in matching entries. It may benull
or empty if the default attribute set (all user attributes) is to be requested.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(SearchRequest searchRequest) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
searchRequest
- The search request to be processed. If it is configured with a search result listener or a size limit other than one, then the provided request will be duplicated with the appropriate settings.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
searchForEntry
public final SearchResultEntry searchForEntry(ReadOnlySearchRequest searchRequest) throws LDAPSearchException
Processes a search operation with the provided information using a connection from this connection pool. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, anLDAPSearchException
will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, theLDAPSearchException
methods likegetEntryCount
,getSearchEntries
,getReferenceCount
, andgetSearchReferences
may be used to obtain information about those entries and references.- Specified by:
searchForEntry
in interfaceLDAPInterface
- Parameters:
searchRequest
- The search request to be processed. If it is configured with a search result listener or a size limit other than one, then the provided request will be duplicated with the appropriate settings.- Returns:
- The entry that was returned from the search, or
null
if no entry was returned or the base entry does not exist. - Throws:
LDAPSearchException
- If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then theLDAPSearchException
object may be examined to obtain information about those entries and/or references.
-
processRequests
public final java.util.List<LDAPResult> processRequests(java.util.List<LDAPRequest> requests, boolean continueOnError) throws LDAPException
Processes multiple requests in the order they are provided over a single connection from this pool. Note that theretryFailedOperationsDueToInvalidConnections()
setting will be ignored when processing the provided operations, so that any failed operations will not be retried.- Parameters:
requests
- The list of requests to be processed. It must not benull
or empty.continueOnError
- Indicates whether to attempt to process subsequent requests if any of the operations does not complete successfully.- Returns:
- The set of results from the requests that were processed. The
order of result objects will correspond to the order of the
request objects, although the list of results may contain fewer
elements than the list of requests if an error occurred during
processing and
continueOnError
isfalse
. - Throws:
LDAPException
- If a problem occurs while trying to obtain a connection to use for the requests.
-
processRequestsAsync
public final java.util.List<AsyncRequestID> processRequestsAsync(java.util.List<LDAPRequest> requests, long maxWaitTimeMillis) throws LDAPException
Processes multiple requests over a single connection from this pool using asynchronous processing to cause the operations to be processed concurrently. The list of requests may contain only add, compare, delete, modify, modify DN, and search operations (and any search operations to be processed must be configured with anAsyncSearchResultListener
. This method will not return until all operations have completed, or until the specified timeout period has elapsed. The order of elements in the list of theAsyncRequestID
objects returned will correspond to the order of elements in the list of requests. The operation results may be obtained from the returnedAsyncRequestID
objects using thejava.util.concurrent.Future
API.- Parameters:
requests
- The list of requests to be processed. It must not benull
or empty, and it must contain only add, compare, modify, modify DN, and search requests. Any search requests must be configured with anAsyncSearchResultListener
.maxWaitTimeMillis
- The maximum length of time in milliseconds to wait for the operations to complete before returning. A value that is less than or equal to zero indicates that the client should wait indefinitely for the operations to complete.- Returns:
- The list of
AsyncRequestID
objects that may be used to retrieve the results for the operations. The order of elements in this list will correspond to the order of the provided requests. - Throws:
LDAPException
- If there is a problem with any of the requests, or if connections in the pool are configured to use synchronous mode and therefore cannot be used to process asynchronous operations.
-
toString
public final java.lang.String toString()
Retrieves a string representation of this connection pool.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this connection pool.
-
toString
public abstract void toString(java.lang.StringBuilder buffer)
Appends a string representation of this connection pool to the provided buffer.- Parameters:
buffer
- The buffer to which the string representation should be appended.
-
-