Name

DirContext

Synopsis

This interface provides a Java representation of a directory entry and is a subclass of javax.naming.Context. The practical difference between a Context and a DirContext is the association of attributes with a DirContext and the consequent methods for retrieving and modifying attribute data.

The directory schema determines the classes of directory entries that can be present in a directory. You can access the directory schema using getSchema(). The class of a directory entry is its object class definition. You can access the object class definition using the getSchemaClassDefinition() method. Most directory providers distribute documents that describe their directory schemae. Consult your directory service provider for a schema definition.

The getAttributes() method returns an Attributes object that contains either all the attributes of an entry or just those attributes specified in a String array. createSubcontext() creates a new directory entry, while modifyAttributes() changes attributes values. The various search() methods allow you to search directory entries, using optional search filters and SearchControls objects.

                  
public interface DirContext extends javax.naming.Context {
// Public Constants
   public static final int ADD_ATTRIBUTE;                        // =1
   public static final int REMOVE_ATTRIBUTE;                     // =3
   public static final int REPLACE_ATTRIBUTE;                    // =2
                  // Public Instance ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.