Runtime tools : Service components : LDAP Access Service : Tasks : Obtaining an LDAP request model
  
Obtaining an LDAP request model
For each of the LDAP request types supported by the LDAP Access Service, there is a supporting subclass of the abstract class LDAPRequest that contains the data needed by that request type. These subclasses are referred to as request models. The appropriate model for a request type can be obtained by instantiating the appropriate subclass of LDAPRequest, or it is instantiated as a new object based on externalized data.
For example: the LDAPLookupRequest class supports the lookup request type and is a subclass of the LDAPRequest class. The following code shows how to obtain a request model for the lookup request using instantiation:
LDAPLookupRequest req = new LDAPLookupRequest();
The following code shows how to obtain a request model for the lookup request using externalized data:
LDAPLookupRequest request = null;
LDAPRequestFormat aFormat = (LDAPRequestFormat) FormatElement.readObject("anLdapReqFmt");
request = aFormat.format(opContext);
The actual work of creating the model and populating it with data is done using an LDAP request formatter. This is a toolkit formatter element that can read an external definition of a LDAP request, and create a request model from the definitions. It is implemented in the com.ibm.btt.services..ldap.LDAPRequestFormat class.
In the above example, 'anLdapReqFmt' is the name of an appropriately defined LDAP request format, and opContext is the context of the operation using the LDAP Access Service. See LDAP service definitions for more details on defining an LDAP request format.
Go up to
Tasks