Wren:DS Core APIs 5.1.1-SNAPSHOT Documentation
The OpenDJ SDK for Java provides a high performance easy to use
library of classes and interfaces for accessing and implementing
LDAP Directory Services as defined in RFC 4510.
Getting Started
The following example shows how the OpenDJ SDK may be used to connect to a directory server, authenticate, and then perform a search. The search results are output as LDIF to the standard output:
// Create an LDIF writer which will write the search results to stdout.
final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
Connection connection = null;
try
{
// Connect and bind to the server.
final LDAPConnectionFactory factory = new LDAPConnectionFactory("localhost", 1389);
connection = factory.getConnection();
connection.bind(userName, password);
// Read the entries and output them as LDIF.
final ConnectionEntryReader reader = connection.search(baseDN, scope, filter, attributes);
while (reader.hasNext())
{
if (reader.isEntry())
{
// Got an entry.
final SearchResultEntry entry = reader.readEntry();
writer.writeComment("Search result entry: " + entry.getName().toString());
writer.writeEntry(entry);
}
else
{
// Got a continuation reference.
final SearchResultReference ref = reader.readReference();
writer.writeComment("Search result reference: " + ref.getURIs().toString());
}
}
writer.flush();
}
catch (final Exception e)
{
// Handle exceptions...
System.err.println(e.getMessage());
}
finally
{
if (connection != null)
{
connection.close();
}
}
|
Creating Connections
The following classes can be used to create and manage connections to LDAP directory servers:Creating Requests
The following classes can be used to create LDAP requests:Using Controls
Common LDAP control implementations can be found inorg.forgerock.opendj.ldap.controls.
Core Types
The following classes and interfaces represent core types:- See Also:
Packages
Package
Description
Classes and interfaces providing I/O functionality.
Classes and interfaces for core types including connections, entries, and
attributes.
Classes and interfaces for common LDAP controls.
Classes and interfaces for core LDAP requests.
Classes and interfaces for core LDAP responses.
Classes and interfaces for constructing and querying LDAP schemas.
Interfaces and classes for service providers.
Classes and interfaces for reading and writing LDIF.
An LDAP based security provider having the name "OpenDJ" and exposing an LDAP/LDIF based
KeyStore service.