Provides utility classes for use by LDAP applications. This package includes the DN class and RDN class supporting DN and RDN encapsulation respectively. The package also includes classes supporting the export and import of directory data via DSML v2.0 and LDIF version 1.

The import and export of directory data is accomplished by classes that implement the interfaces LDAPReader and LDAPWriter. The LDAPReader interface designates the framework used for reading modifications and entries from exported sources and applying them to the directory. The LDAPWriter interface designates the framework used for writing directory entries and modifications to a destination supporting an exported format.

LDIF supports two data types, content and change. DSML supports two corresponding data types, request and response. LDIF content represents only LDAP search response entries (i.e. the data returned from a search) and LDIF change data supports only add, delete, modify, and rename (modifyDN) LDAP requests. On the other hand, DSML represents all the LDAP requests and responses. Thus, LDIF content corresponds in a limited way to DSML response data and LDIF change data corresponds in a limited way to DSML request data. You cannot mix response data and request data.

To represent request data, additional classes have been added to the com.novell.ldap package. These classes are:

- LDAPAbandonRequest
- LDAPAddRequest
- LDAPBindRequest
- LDAPCompareRequest
- LDAPDeleteRequest
- LDAPExtendedRequest
- LDAPModifyDNRequest
- LDAPModifyRequest
- LDAPSearchRequest
- LDAPUnbindRequest

  Requests received from an exported source are decoded and read by calling the readMessage method of a class that implements the LDAPReader interface. This package provides three classes that implement the LDAPReader interface:

- DOMReader
- DSMLReader
- LDIFReader
  The message is returned by readMessage to the application as one of the above request classes and can be applied to the directory using the sendRequest method of LDAPConnection.

  LDAP entries read from the directory as LDAPMessage objects or LDAPEntry objects are written to an export destination via the writeEntry or the writeMessage methods of classes that implement the LDAPWriter. interface. This package provides three classes that implement the LDAPWriter interface:

- DOMWriter
- DSMLWriter
- LDIFWriter

  The following code snippet demonstrates reading exported request data, submitting the request to the directory, and writing the response to a destination.

                  LDAPMessage inMessage, outMessage;
                  inMessage = in.readMessage();  // Read first message
                  while( inMessage != null ){
                      LDAPMessageQueue queue =
                          lc.sendRequest( inMessage, null, null); // Send to directory
                      while (( outMessage = queue.getResponse()) != null ) {
                          out.writeMessage( outMessage );  // Write and export
                      }
                      inMessage = in.readMessage(); // Read next message
                  }

  There are several samples that demonstrate how to use this functionality.

- DomDsml2Ldap.java
- Dsml2Ldap.java
- Ldap2Ldif.java
- Ldif2Ldap.java

  The jldapsearch utility can display search results in DSML or LDIF format to standard output, which can be redirected to a file. The utilities are found in the bin directory of the API download.

  ## Package Specification

  This package is designed to work with LDAPv3 specifications.