LDAP: The MultiUpdateExtendedRequest

The UnboundID Directory Server supports an extended request called the MultiUpdateExtendedRequest. This extended request packages multiple updates in a single request and provides control over the behavior of the server when errors arise during the processing of the extended request. Examine the following code sample:

// exception handling is not shown
Entry first = LDAPTestUtils.generateUserEntry("first","ou=people," +

Entry second = LDAPTestUtils.generateUserEntry("second","ou=people," +

final String[] dc = {
  "dn: dc=example,dc=com",
  "objectClass: top",
  "objectClass: extensibleObject",
  "objectClass: domain",
  "dc: example",

final String[] people = {
  "dn: ou=people,dc=example,dc=com",
  "objectClass: top",
  "objectClass: organizationalUnit",
  "ou: people",

final MultiUpdateErrorBehavior errorBehavior =
final MultiUpdateExtendedRequest req =
  new MultiUpdateExtendedRequest(errorBehavior,
           new AddRequest(dc),
           new AddRequest(people),
           new AddRequest(first),
           new AddRequest(second));
MultiUpdateExtendedResult result = (MultiUpdateExtendedResult)
if(result.getResultCode().equals(ResultCode.SUCCESS)) {
  switch(result.getChangesApplied()) {
  case NONE:
    // There were no changes applied.
  case ALL:
    // All parts of the update succeeded.
  case PARTIAL:
    // At least one update succeeded, and at least one failed.

The code sample above attempts to create two entries and the superiors of those entries:

  • dc=example,dc=com
  • ou=people,dc=example,dc=com
  • cn=first,ou=people,dc=example,dc=com
  • cn=second,ou=people,dc=example,dc=com

The error behavior is set to CONTINUE_ON_ERROR which causes the requests to continue when any of them fails. This acts like the –continueOnError flag to ldapmodify, or -c in the legacy OpenLDAP ldapmodify tool.

About Terry Gardner

Terry Gardner was a leading directory services architect with experience with many large scale directory services installations and messaging server installations, and was a Subject Matter Expert in the field of Directory Services and Solaris (operating system) performance. Mr. Gardner also participated in the open-source software community. Mr. Gardner passed away in December, 2013.
This entry was posted in Java, LDAP, UnboundID, UnboundID LDAP SDK and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s