About this task
For each LDAP request type supported by the LDAP Access Service,
there is a subclass of LDAPResponse that encapsulates the data returned by
the request. Each response model wraps the native data object returned by
LDAP, and also provides its own data object to support externalization and
accessibility. The LDAP response models are provided mainly for the purpose
of externalization. Since the objects returned by JNDI already have access
methods for them, these methods have not been duplicated in the LDAP Access
Service response models. If working with these response models directly, a
call should be made to getLDAPReturnObject() to get the native JDNI. Working
with this object requires knowledge of the JNDI API. For more information,
see the documentation from Sun for JDK 1.5.
The following table shows
the associations between LDAP request types, supporting LDAPResponse subclasses,
and Java packages.
Table 1. LDAP request types, supporting response subclasses, and Java packagesRequest Name |
Supporting Subclass |
Contains |
list | listbindings |
LDAPListResponse |
javax.naming.NamingEnumeration |
lookup |
LDAPLookupResponse |
java.lang.Object |
search |
LDAPSearchResponse |
javax.naming.NamingEnumeration |
create |
LDAPCreateResponse |
javax.naming.directory.DirContext |
destroy |
LDAPDestroyResponse |
N/A |
modify |
LDAPModifyResponse |
N/A |
getattributes |
LDAPGetAttributesResponse |
javax.naming.directory.Attributes |
If the LDAP Access Service output data has been externalized,
then the LDAPResponse object is not used directly. However, for applications
that handle their own response data, the LDAP return object should be obtained
by makint he following call:
responseModel.getLDAPReturnObject()
Cast the object returned by this method to the appropriate
class for the request type. For example, for a search request that uses the
following:
NamingEnumeration results=(NamingEnumeration) searchResponseModel.getLDAPReturnObject();
Consult the JDK 1.5 documentation for information on the
LDAP objects wrapped within the response models.