Package org.ldaptive.provider.unboundid
Class UnboundIDConnection
- java.lang.Object
-
- org.ldaptive.provider.unboundid.UnboundIDConnection
-
- All Implemented Interfaces:
ProviderConnection
public class UnboundIDConnection extends Object implements ProviderConnection
Unbound ID provider implementation of ldap operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
UnboundIDConnection.AbstractUnboundIDSearch
Common search functionality for unbound id iterators and listeners.protected class
UnboundIDConnection.AggregateDisconnectHandler
Allows the use of multiple disconnect handlers per connection.protected class
UnboundIDConnection.AggregateUnsolicitedNotificationHandler
Allows the use of multiple unsolicited notification handlers per connection.protected class
UnboundIDConnection.UnboundIDAsyncRequest
Async request to invoke abandons.protected class
UnboundIDConnection.UnboundIDAsyncSearchListener
Search listener for unbound id async search results.protected class
UnboundIDConnection.UnboundIDSearchIterator
Search iterator for unbound id search results.
-
Field Summary
Fields Modifier and Type Field Description private UnboundIDProviderConfig
config
Provider configuration.private com.unboundid.ldap.sdk.LDAPConnection
connection
Ldap connection.private UnboundIDConnection.AggregateDisconnectHandler
disconnectHandler
Receives disconnect notifications.protected Logger
logger
Logger for this class.private UnboundIDConnection.AggregateUnsolicitedNotificationHandler
notificationHandler
Receives unsolicited notifications.
-
Constructor Summary
Constructors Constructor Description UnboundIDConnection(com.unboundid.ldap.sdk.LDAPConnection lc, UnboundIDProviderConfig pc)
Creates a new unboundid ldap connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abandon(int messageId, RequestControl[] controls)
Abandon an operation.Response<Void>
add(AddRequest request)
Add an entry to an ldap.void
addUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Adds a listener to receive unsolicited notifications.protected Response<Void>
anonymousBind(BindRequest request)
Performs an anonymous bind.Response<Void>
bind(BindRequest request)
Bind to the ldap.void
close(RequestControl[] controls)
Tear down this connection to an LDAP.Response<Boolean>
compare(CompareRequest request)
Compare an entry in the ldap.protected <T> Response<T>
createResponse(Request request, T result, com.unboundid.ldap.sdk.LDAPResult ldapResult)
Creates an operation response with the supplied response data.Response<Void>
delete(DeleteRequest request)
Delete an entry in the ldap.Response<?>
extendedOperation(ExtendedRequest request)
Perform an extended operation in the ldap.com.unboundid.ldap.sdk.LDAPConnection
getLdapConnection()
Returns the underlying ldap connection.Response<Void>
modify(ModifyRequest request)
Modify an entry in the ldap.Response<Void>
modifyDn(ModifyDnRequest request)
Modify the DN of an entry in the ldap.protected void
processLDAPException(Request request, com.unboundid.ldap.sdk.LDAPException e)
Determines if the supplied ldap exception should result in an operation retry.void
removeUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Removes a listener from receiving unsolicited notifications.protected Response<Void>
saslBind(BindRequest request)
Performs a sasl bind.SearchIterator
search(SearchRequest request)
Search the ldap.void
searchAsync(SearchRequest request, SearchListener listener)
Search the ldap asynchronously.protected Response<Void>
simpleBind(BindRequest request)
Performs a simple bind.
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
connection
private com.unboundid.ldap.sdk.LDAPConnection connection
Ldap connection.
-
config
private final UnboundIDProviderConfig config
Provider configuration.
-
notificationHandler
private final UnboundIDConnection.AggregateUnsolicitedNotificationHandler notificationHandler
Receives unsolicited notifications.
-
disconnectHandler
private final UnboundIDConnection.AggregateDisconnectHandler disconnectHandler
Receives disconnect notifications.
-
-
Constructor Detail
-
UnboundIDConnection
public UnboundIDConnection(com.unboundid.ldap.sdk.LDAPConnection lc, UnboundIDProviderConfig pc)
Creates a new unboundid ldap connection.- Parameters:
lc
- ldap connectionpc
- provider configuration
-
-
Method Detail
-
getLdapConnection
public com.unboundid.ldap.sdk.LDAPConnection getLdapConnection()
Returns the underlying ldap connection.- Returns:
- ldap connection
-
close
public void close(RequestControl[] controls) throws LdapException
Description copied from interface:ProviderConnection
Tear down this connection to an LDAP.- Specified by:
close
in interfaceProviderConnection
- Parameters:
controls
- request controls- Throws:
LdapException
- if an LDAP error occurs
-
bind
public Response<Void> bind(BindRequest request) throws LdapException
Description copied from interface:ProviderConnection
Bind to the ldap.- Specified by:
bind
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the bind operation
- Throws:
LdapException
- if an error occurs
-
anonymousBind
protected Response<Void> anonymousBind(BindRequest request) throws LdapException
Performs an anonymous bind.- Parameters:
request
- to bind with- Returns:
- bind response
- Throws:
LdapException
- if an error occurs
-
simpleBind
protected Response<Void> simpleBind(BindRequest request) throws LdapException
Performs a simple bind.- Parameters:
request
- to bind with- Returns:
- bind response
- Throws:
LdapException
- if an error occurs
-
saslBind
protected Response<Void> saslBind(BindRequest request) throws LdapException
Performs a sasl bind.- Parameters:
request
- to bind with- Returns:
- bind response
- Throws:
LdapException
- if an error occurs
-
add
public Response<Void> add(AddRequest request) throws LdapException
Description copied from interface:ProviderConnection
Add an entry to an ldap.- Specified by:
add
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the add operation
- Throws:
LdapException
- if an error occurs
-
compare
public Response<Boolean> compare(CompareRequest request) throws LdapException
Description copied from interface:ProviderConnection
Compare an entry in the ldap.- Specified by:
compare
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the compare operation
- Throws:
LdapException
- if an error occurs
-
delete
public Response<Void> delete(DeleteRequest request) throws LdapException
Description copied from interface:ProviderConnection
Delete an entry in the ldap.- Specified by:
delete
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the delete operation
- Throws:
LdapException
- if an error occurs
-
modify
public Response<Void> modify(ModifyRequest request) throws LdapException
Description copied from interface:ProviderConnection
Modify an entry in the ldap.- Specified by:
modify
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the modify operation
- Throws:
LdapException
- if an error occurs
-
modifyDn
public Response<Void> modifyDn(ModifyDnRequest request) throws LdapException
Description copied from interface:ProviderConnection
Modify the DN of an entry in the ldap.- Specified by:
modifyDn
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the modify dn operation
- Throws:
LdapException
- if an error occurs
-
search
public SearchIterator search(SearchRequest request) throws LdapException
Description copied from interface:ProviderConnection
Search the ldap.- Specified by:
search
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- search iterator
- Throws:
LdapException
- if an error occurs
-
searchAsync
public void searchAsync(SearchRequest request, SearchListener listener) throws LdapException
Description copied from interface:ProviderConnection
Search the ldap asynchronously.- Specified by:
searchAsync
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operationlistener
- to be notified as results arrive- Throws:
LdapException
- if an error occurs
-
abandon
public void abandon(int messageId, RequestControl[] controls) throws LdapException
Description copied from interface:ProviderConnection
Abandon an operation.- Specified by:
abandon
in interfaceProviderConnection
- Parameters:
messageId
- of the operation to abandoncontrols
- request controls- Throws:
LdapException
- if an error occurs
-
extendedOperation
public Response<?> extendedOperation(ExtendedRequest request) throws LdapException
Description copied from interface:ProviderConnection
Perform an extended operation in the ldap.- Specified by:
extendedOperation
in interfaceProviderConnection
- Parameters:
request
- containing the data necessary to perform the operation- Returns:
- response associated with the extended operation
- Throws:
LdapException
- if an error occurs
-
addUnsolicitedNotificationListener
public void addUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Description copied from interface:ProviderConnection
Adds a listener to receive unsolicited notifications.- Specified by:
addUnsolicitedNotificationListener
in interfaceProviderConnection
- Parameters:
listener
- to receive unsolicited notifications
-
removeUnsolicitedNotificationListener
public void removeUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Description copied from interface:ProviderConnection
Removes a listener from receiving unsolicited notifications.- Specified by:
removeUnsolicitedNotificationListener
in interfaceProviderConnection
- Parameters:
listener
- that was registered to receive unsolicited notifications
-
createResponse
protected <T> Response<T> createResponse(Request request, T result, com.unboundid.ldap.sdk.LDAPResult ldapResult)
Creates an operation response with the supplied response data.- Type Parameters:
T
- type of response- Parameters:
request
- containing controlsresult
- of the operationldapResult
- provider result- Returns:
- operation response
-
processLDAPException
protected void processLDAPException(Request request, com.unboundid.ldap.sdk.LDAPException e) throws LdapException
Determines if the supplied ldap exception should result in an operation retry.- Parameters:
request
- that produced the exceptione
- that was produced- Throws:
LdapException
- wrapping the ldap exception
-
-