LDAP
PROGRAMMING
WITH JAVATM
ROB WELTMAN and TONY DAHBURA
ADDISON–WESLEY
An Imprint of Addison Wesley Longman, Inc.
Reading, Massachusetts • Harlow, England • Menlo Park, California
Berkeley, California Don Mills, Ontario
Sydney
Bonn Amsterdam Tokyo Mexico City
Java is an object-oriented language that lends itself well to encapsulating functional-
ity as components. The JavaBeans specification takes this encapsulation a step fur-
ther, defining how a component publishes its properties and methods and how other
components can discover and access those properties and methods. Many Java devel-
opment environments support the JavaBeans specification. Because of this support,
you can write a component that complies with the specification, and that component
can be dropped into the component palette of any of these Java development environ-
ments. The component you write can be used again in future projects or by other
developers, who need no knowledge about the component’s implementation.
Directory SDK for Java includes a few sample JavaBeans. Although each Java
Bean does very little, each one provides a single piece of commonly used directory
functionality. The JavaBeans also encapsulate some of the implementation details of
LDAP, which means that developers can use these JavaBeans without knowing very
much about LDAP.
Invisible LDAP JavaBeans
The first set of JavaBeans we’ll look at are “invisible Beans.” These JavaBeans wrap
subsets of the SDK functionality, but they provide no GUI interface.
All these invisible JavaBeans extend the common base class
LDAPBasePropertySupport, illustrated in Figure 10-1. This class provides standard
methods for accessing SDK properties, a method for connecting to the directory, and
an event dispatcher for property change events. Property change events are the sim-
plest and probably the most common events used by JavaBeans to notify other com-
ponents of significant changes. Let’s take a look at the implementation of the
LDAPBasePropertySupport class.
Don’t Redo It,
Reuse It: