Package org.ldaptive.provider.jldap
Class JLdapConnection
- java.lang.Object
-
- org.ldaptive.provider.jldap.JLdapConnection
-
- All Implemented Interfaces:
ProviderConnection
- Direct Known Subclasses:
JLdapSSLConnection,JLdapStartTLSConnection
public class JLdapConnection extends Object implements ProviderConnection
JLDAP provider implementation of ldap operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJLdapConnection.AbstractJLdapSearchCommon search functionality for jldap iterators and listeners.protected classJLdapConnection.AggregateUnsolicitedNotificationListenerAllows the use of multiple unsolicited notification handlers per connection.protected classJLdapConnection.JLdapAsyncRequestAsync request to invoke abandons.protected classJLdapConnection.JLdapAsyncSearchListenerAsync search listener for JLdap search results.protected classJLdapConnection.JLdapSearchIteratorSearch iterator for JLdap search results.private static classJLdapConnection.SaslCallbackHandlerCallback handler used by SASL mechanisms.protected static classJLdapConnection.SearchResultIteratorIterates over an ldap search queue.
-
Field Summary
Fields Modifier and Type Field Description private JLdapProviderConfigconfigProvider configuration.private com.novell.ldap.LDAPConnectionconnectionLdap connection.protected LoggerloggerLogger for this class.private JLdapConnection.AggregateUnsolicitedNotificationListenernotificationListenerReceives unsolicited notifications.
-
Constructor Summary
Constructors Constructor Description JLdapConnection(com.novell.ldap.LDAPConnection conn, JLdapProviderConfig pc)Creates a new jldap connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabandon(int messageId, RequestControl[] controls)Response<Void>add(AddRequest request)voidaddUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)protected Response<Void>anonymousBind(BindRequest request)Performs an anonymous bind.Response<Void>bind(BindRequest request)voidclose(RequestControl[] controls)Response<Boolean>compare(CompareRequest request)protected <T> Response<T>createResponse(Request request, T result, com.novell.ldap.LDAPResponse ldapResponse)Creates an operation response with the supplied response data.Response<Void>delete(DeleteRequest request)Response<?>extendedOperation(ExtendedRequest request)com.novell.ldap.LDAPConnectiongetLDAPConnection()Returns the underlying ldap connection.protected com.novell.ldap.LDAPConstraintsgetLDAPConstraints(RequestControl[] controls)Returns an ldap constraints object configured with the supplied controls.protected com.novell.ldap.LDAPConstraintsgetLDAPConstraints(Request request)Returns an ldap constraints object configured with the supplied request.Response<Void>modify(ModifyRequest request)Response<Void>modifyDn(ModifyDnRequest request)protected voidprocessLDAPException(com.novell.ldap.LDAPException e)Determines if the supplied ldap exception should result in an operation retry.voidremoveUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)protected Response<Void>saslBind(BindRequest request)Performs a sasl bind.SearchIteratorsearch(SearchRequest request)voidsearchAsync(SearchRequest request, SearchListener listener)protected Response<Void>simpleBind(BindRequest request)Performs a simple bind.protected voidthrowOperationException(Request request, com.novell.ldap.LDAPResponse ldapResponse)Determines if the supplied response should result in an operation retry.
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
connection
private com.novell.ldap.LDAPConnection connection
Ldap connection.
-
config
private final JLdapProviderConfig config
Provider configuration.
-
notificationListener
private final JLdapConnection.AggregateUnsolicitedNotificationListener notificationListener
Receives unsolicited notifications.
-
-
Constructor Detail
-
JLdapConnection
public JLdapConnection(com.novell.ldap.LDAPConnection conn, JLdapProviderConfig pc)Creates a new jldap connection.- Parameters:
conn- ldap connectionpc- provider configuration
-
-
Method Detail
-
getLDAPConnection
public com.novell.ldap.LDAPConnection getLDAPConnection()
Returns the underlying ldap connection.- Returns:
- ldap connection
-
close
public void close(RequestControl[] controls) throws LdapException
- Specified by:
closein interfaceProviderConnection- Throws:
LdapException
-
bind
public Response<Void> bind(BindRequest request) throws LdapException
- Specified by:
bindin interfaceProviderConnection- Throws:
LdapException
-
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
- Specified by:
addin interfaceProviderConnection- Throws:
LdapException
-
compare
public Response<Boolean> compare(CompareRequest request) throws LdapException
- Specified by:
comparein interfaceProviderConnection- Throws:
LdapException
-
delete
public Response<Void> delete(DeleteRequest request) throws LdapException
- Specified by:
deletein interfaceProviderConnection- Throws:
LdapException
-
modify
public Response<Void> modify(ModifyRequest request) throws LdapException
- Specified by:
modifyin interfaceProviderConnection- Throws:
LdapException
-
modifyDn
public Response<Void> modifyDn(ModifyDnRequest request) throws LdapException
- Specified by:
modifyDnin interfaceProviderConnection- Throws:
LdapException
-
search
public SearchIterator search(SearchRequest request) throws LdapException
- Specified by:
searchin interfaceProviderConnection- Throws:
LdapException
-
searchAsync
public void searchAsync(SearchRequest request, SearchListener listener) throws LdapException
- Specified by:
searchAsyncin interfaceProviderConnection- Throws:
LdapException
-
abandon
public void abandon(int messageId, RequestControl[] controls) throws LdapException- Specified by:
abandonin interfaceProviderConnection- Throws:
LdapException
-
extendedOperation
public Response<?> extendedOperation(ExtendedRequest request) throws LdapException
- Specified by:
extendedOperationin interfaceProviderConnection- Throws:
LdapException
-
addUnsolicitedNotificationListener
public void addUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
- Specified by:
addUnsolicitedNotificationListenerin interfaceProviderConnection
-
removeUnsolicitedNotificationListener
public void removeUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
- Specified by:
removeUnsolicitedNotificationListenerin interfaceProviderConnection
-
getLDAPConstraints
protected com.novell.ldap.LDAPConstraints getLDAPConstraints(Request request)
Returns an ldap constraints object configured with the supplied request.- Parameters:
request- request containing configuration to create constraints- Returns:
- ldap constraints
-
getLDAPConstraints
protected com.novell.ldap.LDAPConstraints getLDAPConstraints(RequestControl[] controls)
Returns an ldap constraints object configured with the supplied controls.- Parameters:
controls- to sets in the constraints- Returns:
- ldap constraints
-
throwOperationException
protected void throwOperationException(Request request, com.novell.ldap.LDAPResponse ldapResponse) throws LdapException
Determines if the supplied response should result in an operation retry.- Parameters:
request- that produced the exceptionldapResponse- provider response- Throws:
LdapException- wrapping the ldap exception
-
createResponse
protected <T> Response<T> createResponse(Request request, T result, com.novell.ldap.LDAPResponse ldapResponse)
Creates an operation response with the supplied response data.- Type Parameters:
T- type of response- Parameters:
request- containing controlsresult- of the operationldapResponse- provider response- Returns:
- operation response
-
processLDAPException
protected void processLDAPException(com.novell.ldap.LDAPException e) throws LdapExceptionDetermines if the supplied ldap exception should result in an operation retry.- Parameters:
e- that was produced- Throws:
LdapException- wrapping the ldap exception
-
-