Chapter 3. Simpler Attribute Access and Manipulation with DirContextAdapter

Table of Contents

Introduction
Search and Lookup Using ContextMapper
The AbstractContextMapper
Binding and Modifying Using DirContextAdapter
Binding
Modifying
A Complete PersonDao Class

Introduction

A little-known--and probably underestimated--feature of the Java LDAP API is the ability to register a DirObjectFactory to automatically create objects from found contexts. One of the reasons why it is seldom used is that you will need an implementation of DirObjectFactory that creates instances of a meaningful implementation of DirContext. The Spring LDAP library provides the missing pieces: a default implementation of DirContext called DirContextAdapter, and a corresponding implementation of DirObjectFactory called DefaultDirObjectFactory. Used together with DefaultDirObjectFactory, the DirContextAdapter can be a very powerful tool.