All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javax.naming.directory.InitialDirContext

java.lang.Object
   |
   +----javax.naming.InitialContext
           |
           +----javax.naming.directory.InitialDirContext

public class InitialDirContext
extends InitialContext
implements DirContext
This class is the starting context for performing directory operations. The documentation in the class description of InitialContext (including those for synchronization) apply here.

See Also:
InitialContext

Constructor Index

 o InitialDirContext()
Constructs an initial DirContext.
 o InitialDirContext(Hashtable)
Constructs an initial DirContext using information supplied in 'environment'.

Method Index

 o bind(Name, Object, Attributes)
Binds 'name' to the object 'obj' and associate the attributes 'attrs' with the named object.
 o bind(String, Object, Attributes)
Binds 'name' to the object 'obj' and associate the attributes 'attrs' with the named object.
 o createSubcontext(Name, Attributes)
Creates a new subcontext with the given name resolved relative to the initial context, and associates the attributes 'attrs' with the named object.
 o createSubcontext(String, Attributes)
Creates a new subcontext with the given name resolved relative to the initial context, and associates the attributes 'attrs' with the named object.
 o getAttributes(Name)
Retrieves all the attributes associated with named object.
 o getAttributes(Name, String[])
Retrieves the attributes listed in attrIds associated with named object.
 o getAttributes(String)
Retrieves all the attributes associated with named object.
 o getAttributes(String, String[])
Retrieves the attributes listed in attrIds associated with named object.
 o getSchema(Name)
Retrieves the schema associated with this initial DirContext.
 o getSchema(String)
Retrieves the schema associated with this initial DirContext.
 o getSchemaClassDefinition(Name)
Retrieves the schema class definition associated with this initial context.
 o getSchemaClassDefinition(String)
Retrieves the schema class definition associated with this initial context.
 o modifyAttributes(Name, int, Attributes)
Modifies according to mod_op and attrs the attributes associated with the named object.
 o modifyAttributes(Name, ModificationItem[])
Modifies according to mods the attributes associated with the named object.
 o modifyAttributes(String, int, Attributes)
Modifies according to mod_op and attrs the attributes associated with the named object.
 o modifyAttributes(String, ModificationItem[])
Modifies according to mods the attributes associated with the named object.
 o rebind(Name, Object, Attributes)
Binds 'name' to the object 'obj' and associates the attributes 'attrs' with the named object.
 o rebind(String, Object, Attributes)
Binds 'name' to the object 'obj' and associates the attributes 'attrs' with the named object.
 o search(Name, Attributes)
Searches for named objects that contain a set of attributes in a single context.
 o search(Name, Attributes, String[])
Searches for named objects that contain a set of attributes in a single context.
 o search(Name, String, Object[], SearchControls)
Search in the context named by 'name' entries with that satisfies the given 'filter'.
 o search(Name, String, SearchControls)
Search in the context named by 'name' entries with that satisfies the given string 'filter'.
 o search(String, Attributes)
Searches for named objects that contain a set of attributes in a single context.
 o search(String, Attributes, String[])
Searches for named objects that contain a set of attributes in a single context.
 o search(String, String, Object[], SearchControls)
Search in the context named by 'name' entries with that satisfies the given 'filter'.
 o search(String, String, SearchControls)
Search in the context named by 'name' entries with that satisfies the given string 'filter'.

Constructors

 o InitialDirContext
 public InitialDirContext() throws NamingException
Constructs an initial DirContext. The environment of the new context are set to null.

Throws: NamingException
If a problem was encountered while creating the initial context.
 o InitialDirContext
 public InitialDirContext(Hashtable environment) throws NamingException
Constructs an initial DirContext using information supplied in 'environment'.

Parameters:
environment - The possibly null environment used for creating the initial context (such as user name, password, etc.)
Throws: NamingException
If a problem was encountered while creating the initial context.

Methods

 o getAttributes
 public Attributes getAttributes(String name) throws NamingException
Retrieves all the attributes associated with named object.

Parameters:
name - The non-null string name of the object for which to retrieve the attributes. name is resolved relative to the initial context.
Returns:
The attributes associated with 'name'.
Throws: NamingException
If a naming exception occurs.
See Also:
getAttributes
 o getAttributes
 public Attributes getAttributes(String name,
                                 String attrIds[]) throws NamingException
Retrieves the attributes listed in attrIds associated with named object.

Parameters:
name - The non-null string name of the object for which to retrieve the attributes. name is resolved relative to the initial context.
attrIds - The attribute ids of the attributes to retrieve. Possibly null.
Returns:
The attributes identified by attrIds (or a subset thereof if some attributes are not found). Can be empty but not null.
Throws: NamingException
If a naming exception occurs.
 o getAttributes
 public Attributes getAttributes(Name name) throws NamingException
Retrieves all the attributes associated with named object.

Parameters:
name - The non-null name of the object for which to retrieve the attributes. name is resolved relative to the initial context.
Returns:
The attributes associated with 'name'. Can be empty but not null.
Throws: NamingException
If a naming exception occurs.
 o getAttributes
 public Attributes getAttributes(Name name,
                                 String attrIds[]) throws NamingException
Retrieves the attributes listed in attrIds associated with named object.

Parameters:
name - The non-null name of the object for which to retrieve the attributes. name is resolved relative to the initial context.
attrIds - The attribute ids of the attributes to retrieve. Can be null.
Returns:
The attributes identified by attrIds (or a subset thereof if some attributes are not found). Can be empty but not null.
Throws: NamingException
If a naming exception occurs.
 o modifyAttributes
 public void modifyAttributes(String name,
                              int mod_op,
                              Attributes attrs) throws NamingException
Modifies according to mod_op and attrs the attributes associated with the named object. The order of the modifications within attrs are not specified. Where possible, the modifications are performed atomically. If the operation fails to complete, AttributeModificationException or another subclass of NamingException is thrown containing details of the failure.

Parameters:
name - The string name of the object whose attributes will be updated. name is resolved relative to the initial context.
mod_op - The modification operation. It is one of ADD_ATTRIBUTE, REPLACE_ATTRIBUTE, DELETE_ATTRIBUTE.
attrs - The non-null set of attributes to use for the modification.
Throws: NamingException
If a naming exception occurs.
 o modifyAttributes
 public void modifyAttributes(Name name,
                              int mod_op,
                              Attributes attrs) throws NamingException
Modifies according to mod_op and attrs the attributes associated with the named object. The order of the modifications within attrs are not specified. Where possible, the modifications are performed atomically. If the operation fails to complete, AttributeModificationException or another subclass of NamingException is thrown containing details of the failure.

Parameters:
name - The non-null name of the object whose attributes will be updated. name is resolved relative to the initial context.
attrs - The non-null attributes to use for the modification.
mod_op - The modification code.
Throws: AttributeModificationException
If modification could not be completed successfully.
Throws: NamingException
If a naming exception occurred.
 o modifyAttributes
 public void modifyAttributes(String name,
                              ModificationItem mods[]) throws NamingException
Modifies according to mods the attributes associated with the named object. Where possible, the modifications are performed atomically. If the operation fails to complete, AttributeModificationException or another subclass of NamingException is thrown containing details of the failure.

Parameters:
name - The non-null string name of the object whose attributes will be updated. name is resolved relative to the initial context.
mods - The non-null list of modifications to apply.
Throws: AttributeModificationException
If modification could not be completed successfully.
Throws: NamingException
If a naming exception occurred.
 o modifyAttributes
 public void modifyAttributes(Name name,
                              ModificationItem mods[]) throws NamingException
Modifies according to mods the attributes associated with the named object. Where possible, the modifications are performed atomically. If the operation fails to complete, AttributeModificationException or another subclass of NamingException is thrown containing details of the failure.

Parameters:
name - The non-null name of the object whose attributes will be updated. name is resolved relative to the initial context.
mods - The non-null list of modifications to apply.
Throws: AttributeModificationException
If modification could not be completed successfully.
Throws: NamingException
If a naming exception occurred.
 o bind
 public void bind(String name,
                  Object obj,
                  Attributes attrs) throws NamingException
Binds 'name' to the object 'obj' and associate the attributes 'attrs' with the named object. If 'attrs' is null, the resulting binding will have the attributes associated with 'obj' if 'obj' is a DirContext. If 'obj' is not a DirContext and 'attrs' is null, the resulting binding will have no attributes. If 'attrs' is non-null, the resulting binding will have 'attrs' as its attributes and any attributes associated with 'obj' are ignored.

Parameters:
name - The non-null name to bind, resolved relative to the initial context. It cannot be empty.
obj - The possibly null object to bind.
attrs - The possibly null set of attributes to associate with the bound object.
Throws: NameAlreadyBoundException
If name is already bound.
Throws: InvalidAttributesException
If the attributes specified by 'attrs', or 'obj' if 'attrs' is null, are not sufficient to create the binding.
Throws: NamingException
If a naming exception occurs.
 o bind
 public void bind(Name name,
                  Object obj,
                  Attributes attrs) throws NamingException
Binds 'name' to the object 'obj' and associate the attributes 'attrs' with the named object. If 'attrs' is null, the resulting binding will have the attributes associated with 'obj' if 'obj' is a DirContext. If 'obj' is not a DirContext and 'attrs' is null, the resulting binding will have no attributes. If 'attrs' is non-null, the resulting binding will have 'attrs' as its attributes and any attributes associated with 'obj' are ignored.

Parameters:
name - The non-null name to bind, resolved relative to the initial context. It cannot be empty.
obj - The possibly null object to bind.
attrs - The possibly null set of attributes to associate with the bound object.
Throws: NameAlreadyBoundException
If name is already bound.
Throws: InvalidAttributesException
If the attributes specified by 'attrs', or 'obj' if 'attrs' is null, are not sufficient to create the binding.
Throws: NamingException
If a naming exception occurs.
 o rebind
 public void rebind(String name,
                    Object obj,
                    Attributes attrs) throws NamingException
Binds 'name' to the object 'obj' and associates the attributes 'attrs' with the named object. If 'name' is already bound, 'obj' overwrites the existing binding. If 'attrs' is null and 'obj' is a DirContext, the attributes from 'obj' are used. If 'attrs' is null and 'obj' is not a DirContext, any existing attributes associated with the already bound object remain unchanged. If 'attrs' is non-null, any existing attributes associated with the already bound object are removed and 'attrs' is associated with the named object. If 'obj' is a DirContext and 'attrs' is non-null, obj's attributes are ignored.

Parameters:
name - The non-null name to bind, resolved relative to the initial context.
obj - The possibly null object to bind.
attrs - The possibly null set of attributes to associate with the bound object.
Throws: NamingException
If a naming exception occurs.
 o rebind
 public void rebind(Name name,
                    Object obj,
                    Attributes attrs) throws NamingException
Binds 'name' to the object 'obj' and associates the attributes 'attrs' with the named object. If 'name' is already bound, 'obj' overwrites the existing binding. If 'attrs' is null and 'obj' is a DirContext, the attributes from 'obj' are used. any existing attributes associated with the already bound object remain unchanged. If 'attrs' is non-null, any existing attributes associated with the already bound object are removed and 'attrs' is associated with the named object. If 'obj' is a DirContext and 'attrs' is non-null, obj's attributes are ignored.

Parameters:
name - The non-null name to bind, resolved relative to the initial context.
obj - The possibly null object to bind.
attrs - The possibly null attributes to associate with the bound object.
Throws: NamingException
If a naming exception occurs.
 o createSubcontext
 public DirContext createSubcontext(String name,
                                    Attributes attrs) throws NamingException
Creates a new subcontext with the given name resolved relative to the initial context, and associates the attributes 'attrs' with the named object. If 'name' is already bound, throws NameAlreadyBoundException.

Parameters:
name - The non-null string name to use when creating the new context. name is resolved relative to the initial context.
attrs - The attributes to associate with the newly created context. Can be null.
Returns:
The non-null newly created context.
Throws: NameAlreadyBoundException
name is already bound.
Throws: InvalidAttributesException
If 'attrs' does not contain all the mandatory attributes required for creation.
Throws: NamingException
If a naming exception occurs.
 o createSubcontext
 public DirContext createSubcontext(Name name,
                                    Attributes attrs) throws NamingException
Creates a new subcontext with the given name resolved relative to the initial context, and associates the attributes 'attrs' with the named object.

Parameters:
name - The non-null name to use when creating the new context. name is resolved relative to the initial context.
attrs - The attributes to associate with the newly created context. Can be null.
Returns:
The non-null newly created context.
Throws: NameAlreadyBoundException
If name is already bound.
Throws: InvalidAttributesException
If 'attrs' does not contain all the mandatory attributes required for creation.
Throws: NamingException
If a naming exception occurs.
 o getSchema
 public DirContext getSchema(String name) throws NamingException
Retrieves the schema associated with this initial DirContext.

Parameters:
name - The non-null name of context.
Returns:
The non-null schema associated with this initial DirContext.
Throws: NamingException
If a naming exception occurs.
 o getSchema
 public DirContext getSchema(Name name) throws NamingException
Retrieves the schema associated with this initial DirContext.

Parameters:
name - The non-null name of context.
Returns:
The non-null schema associated with this initial DirContext.
Throws: NamingException
If a naming exception occurs.
 o getSchemaClassDefinition
 public DirContext getSchemaClassDefinition(String name) throws NamingException
Retrieves the schema class definition associated with this initial context.

Parameters:
name - The non-null name of context.
Returns:
The schema class definition associated with this initial context.
Throws: NamingException
If a naming exception occurs.
 o getSchemaClassDefinition
 public DirContext getSchemaClassDefinition(Name name) throws NamingException
Retrieves the schema class definition associated with this initial context.

Parameters:
name - The non-null name of context.
Returns:
The schema class definition associated with this initial context.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(String name,
                                 Attributes matchingAttributes) throws NamingException
Searches for named objects that contain a set of attributes in a single context. See descriptions in DirContext for details.

Parameters:
name - The non-null string name of the context to search. name is resolved relative to the initial context.
matchingAttributes - The possibly null set of attributes to search for.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(Name name,
                                 Attributes matchingAttributes) throws NamingException
Searches for named objects that contain a set of attributes in a single context. See descriptions in DirContext for details.

Parameters:
name - The non-null name of the context to search. name is resolved relative to the initial context.
matchingAttributes - The possibly null set of attributes to search for.
Returns:
A non-null enumeration of SearchResult.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(String name,
                                 Attributes matchingAttributes,
                                 String attributesToReturn[]) throws NamingException
Searches for named objects that contain a set of attributes in a single context. See descriptions in DirContext for details.

Parameters:
name - The non-null name of the context to search. name is resolved relative to the initial context.
matchingAttributes - The attributes to search for. Possibly null.
attributesToReturn - The attributes to return. Possibly null.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(Name name,
                                 Attributes matchingAttributes,
                                 String attributesToReturn[]) throws NamingException
Searches for named objects that contain a set of attributes in a single context. See descriptions in DirContext for details.

Parameters:
name - The non-null name of the context to search. name is resolved relative to the initial context.
matchingAttributes - The attributes to search for. Possibly null.
attributesToReturn - The attributes to return. Possibly null.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(String name,
                                 String filter,
                                 SearchControls cons) throws NamingException
Search in the context named by 'name' entries with that satisfies the given string 'filter'. Perform the search according to parameters specified in the search constraints 'cons'. See descriptions in DirContext for details.

Parameters:
name - The non-null string name of the context/object to start the search. name is resolved relative to the initial context.
filter - The non-null string filter to use for the search. The syntax used for the filter is the LDAP filter syntax (RFC 2254).
cons - The search constraints to be applied to this search. Can be null.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(Name name,
                                 String filter,
                                 SearchControls cons) throws NamingException
Search in the context named by 'name' entries with that satisfies the given string 'filter'. Perform the search according to parameters specified in the search constraints 'cons'.

Parameters:
name - The non-null name of the context/object to start the search. name is resolved relative to the initial context.
filter - The non-null string filter to use for the search. The syntax used for the filter is the LDAP filter syntax (RFC 2254).
cons - The possibly null search constraints to be applied to this search.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(String name,
                                 String filterExpr,
                                 Object filterArgs[],
                                 SearchControls cons) throws NamingException
Search in the context named by 'name' entries with that satisfies the given 'filter'. Perform the search according to parameters specified in the search constraints 'cons'. See descriptions in DirContext for details.

Parameters:
name - The non-null string name of the context/object to start the search. name is resolved relative to the initial context.
filter - The non-null filter to use for the search.
cons - The possibly null search constraints to be applied to this search.
Returns:
A non-null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.
 o search
 public NamingEnumeration search(Name name,
                                 String filterExpr,
                                 Object filterArgs[],
                                 SearchControls cons) throws NamingException
Search in the context named by 'name' entries with that satisfies the given 'filter'. Perform the search according to parameters specified in the search constraints 'cons'. See descriptions in DirContext for details.

Parameters:
name - The non-null name of the context/object to start the search. name is resolved relative to the initial context.
filter - The non-null filter to use for the search.
cons - The possibly null search constraints to be applied to this search.
Returns:
A non null enumeration of SearchResults.
Throws: NamingException
If a naming exception occurs.

All Packages  Class Hierarchy  This Package  Previous  Next  Index