| java.lang.Object org.apache.naming.core.BaseNaming org.apache.naming.core.BaseContext org.apache.naming.core.BaseDirContext
All known Subclasses: org.apache.naming.modules.memory.MemoryNamingContext, org.apache.naming.modules.fs.FileDirContext,
BaseDirContext | public class BaseDirContext extends BaseContext implements DirContext(Code) | | Base Directory Context implementation. All j-t-c/naming contexts should
extend it.
Implements all JNDI methods - if you just extend it you'll get UnsuportedOperation.
XXX Should it also act as introspector proxy or should we use a separate context ?
The intention is to allow use 'introspection magic' and bean-like DirContexts.
IMPORTANT: all contexts should use setters/getters for configuration, instead
of the Hashtable. The default constructor will use introspection to configure
and may provide ( via a hook ? ) JMX management on all contexts.
You must extend and override few methods. Of course, you can also override any other
method and provide a more optimal implementation, but in most cases you only
need the minimal set.
All methods use Name variant. They should expect an arbitrary implementation, but
it's recommended to check if ServerName is used - and take advantage of the
specific features ( MessageBytes, etc ).
author: Remy Maucherat author: Costin Manolache |
Method Summary | |
public void | bind(Name name, Object obj, Attributes attrs) Binds a name to an object, along with associated attributes. | public void | bind(String name, Object obj, Attributes attrs) | public DirContext | createSubcontext(String name, Attributes attrs) Creates and binds a new context, along with associated attributes.
This method creates a new subcontext with the given name, binds it in
the target context (that named by all but terminal atomic component of
the name), and associates the supplied attributes with the newly
created object. | public Attributes | getAttributes(Name name) Retrieves all of the attributes associated with a named object. | public Attributes | getAttributes(String name) Retrieves all of the attributes associated with a named object. | public Attributes | getAttributes(String name, String[] attrIds) Retrieves selected attributes associated with a named object.
See the class description regarding attribute models, attribute type
names, and operational attributes.
the requested attributes; never null Parameters: name - the name of the object from which to retrieve attributes Parameters: attrIds - the identifiers of the attributes to retrieve. | public Attributes | getAttributes(Name name, String[] attrIds) | public DirContext | getSchema(Name name) Retrieves the schema associated with the named object. | public DirContext | getSchema(String name) Retrieves the schema associated with the named object. | public DirContext | getSchemaClassDefinition(Name name) Retrieves a context containing the schema objects of the named
object's class definitions. | public DirContext | getSchemaClassDefinition(String name) Retrieves a context containing the schema objects of the named
object's class definitions. | public void | modifyAttributes(Name name, int mod_op, Attributes attrs) Modifies the attributes associated with a named object. | public void | modifyAttributes(String name, int mod_op, Attributes attrs) | public void | modifyAttributes(Name name, ModificationItem[] mods) Modifies the attributes associated with a named object using an an
ordered list of modifications. | public void | modifyAttributes(String name, ModificationItem[] mods) | public void | rebind(Name name, Object obj, Attributes attrs) Binds a name to an object, along with associated attributes,
overwriting any existing binding. | public void | rebind(String name, Object obj, Attributes attrs) | public NamingEnumeration | search(Name name, Attributes matchingAttributes, String[] attributesToReturn) Searches in a single context for objects that contain a specified set
of attributes, and retrieves selected attributes. | public NamingEnumeration | search(String name, Attributes matchingAttributes, String[] attributesToReturn) Searches in a single context for objects that contain a specified set
of attributes, and retrieves selected attributes.
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. | public NamingEnumeration | search(Name name, Attributes matchingAttributes) Searches in a single context for objects that contain a specified set
of attributes. | public NamingEnumeration | search(String name, Attributes matchingAttributes) Searches in a single context for objects that contain a specified set
of attributes.
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. | public NamingEnumeration | search(Name name, String filter, SearchControls cons) Searches in the named context or object for entries that satisfy the
given search filter. | public NamingEnumeration | search(String name, String filter, SearchControls cons) Searches in the named context or object for entries that satisfy the
given search filter. | public NamingEnumeration | search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) Searches in the named context or object for entries that satisfy the
given search filter. | public NamingEnumeration | search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) Searches in the named context or object for entries that satisfy the
given search filter. |
BaseDirContext | public BaseDirContext()(Code) | | |
bind | public void bind(Name name, Object obj, Attributes attrs) throws NamingException(Code) | | Binds a name to an object, along with associated attributes. If attrs
is null, the resulting binding will have the attributes associated
with obj if obj is a DirContext, and no attributes otherwise. If attrs
is non-null, the resulting binding will have attrs as its attributes;
any attributes associated with obj are ignored.
Parameters: name - the name to bind; may not be empty Parameters: obj - the object to bind; possibly null Parameters: attrs - the attributes to associate with the binding exception: javax.naming.NameAlreadyBoundException - if name is already bound exception: InvalidAttributesException - if some "mandatory" attributesof the binding are not supplied exception: javax.naming.NamingException - if a naming exception is encountered |
createSubcontext | public DirContext createSubcontext(String name, Attributes attrs) throws NamingException(Code) | | Creates and binds a new context, along with associated attributes.
This method creates a new subcontext with the given name, binds it in
the target context (that named by all but terminal atomic component of
the name), and associates the supplied attributes with the newly
created object. All intermediate and target contexts must already
exist. If attrs is null, this method is equivalent to
Context.createSubcontext().
Parameters: name - the name of the context to create; may not be empty Parameters: attrs - the attributes to associate with the newly created context the newly created context exception: javax.naming.NameAlreadyBoundException - if the name is already bound exception: InvalidAttributesException - if attrs does not contain allthe mandatory attributes required for creation exception: javax.naming.NamingException - if a naming exception is encountered |
getAttributes | public Attributes getAttributes(Name name) throws NamingException(Code) | | Retrieves all of the attributes associated with a named object.
the set of attributes associated with name.Returns an empty attribute set if name has no attributes; never null. Parameters: name - the name of the object from which to retrieve attributes exception: javax.naming.NamingException - if a naming exception is encountered |
getAttributes | public Attributes getAttributes(String name) throws NamingException(Code) | | Retrieves all of the attributes associated with a named object.
the set of attributes associated with name Parameters: name - the name of the object from which to retrieve attributes exception: javax.naming.NamingException - if a naming exception is encountered |
getAttributes | public Attributes getAttributes(String name, String[] attrIds) throws NamingException(Code) | | Retrieves selected attributes associated with a named object.
See the class description regarding attribute models, attribute type
names, and operational attributes.
the requested attributes; never null Parameters: name - the name of the object from which to retrieve attributes Parameters: attrIds - the identifiers of the attributes to retrieve. nullindicates that all attributes should be retrieved; an empty arrayindicates that none should be retrieved exception: javax.naming.NamingException - if a naming exception is encountered |
getSchema | public DirContext getSchema(Name name) throws NamingException(Code) | | Retrieves the schema associated with the named object. The schema
describes rules regarding the structure of the namespace and the
attributes stored within it. The schema specifies what types of
objects can be added to the directory and where they can be added;
what mandatory and optional attributes an object can have. The range
of support for schemas is directory-specific.
Parameters: name - the name of the object whose schema is to be retrieved the schema associated with the context; never null exception: javax.naming.OperationNotSupportedException - if schema not supported exception: javax.naming.NamingException - if a naming exception is encountered |
modifyAttributes | public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException(Code) | | Modifies the attributes associated with a named object. The order of
the modifications is not specified. Where possible, the modifications
are performed atomically.
Parameters: name - the name of the object whose attributes will be updated Parameters: mod_op - the modification operation, one of: ADD_ATTRIBUTE,REPLACE_ATTRIBUTE, REMOVE_ATTRIBUTE Parameters: attrs - the attributes to be used for the modification; may notbe null exception: AttributeModificationException - if the modification cannot becompleted successfully exception: javax.naming.NamingException - if a naming exception is encountered |
modifyAttributes | public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException(Code) | | Modifies the attributes associated with a named object using an an
ordered list of modifications. The modifications are performed in the
order specified. Each modification specifies a modification operation
code and an attribute on which to operate. Where possible, the
modifications are performed atomically.
Parameters: name - the name of the object whose attributes will be updated Parameters: mods - an ordered sequence of modifications to be performed; maynot be null exception: AttributeModificationException - if the modification cannot becompleted successfully exception: javax.naming.NamingException - if a naming exception is encountered |
rebind | public void rebind(Name name, Object obj, Attributes attrs) throws NamingException(Code) | | Binds a name to an object, along with associated attributes,
overwriting any 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 object
already bound in the directory remain unchanged. If attrs is non-null,
any existing attributes associated with the object already bound in
the directory are removed and attrs is associated with the named
object. If obj is a DirContext and attrs is non-null, the attributes
of obj are ignored.
Parameters: name - the name to bind; may not be empty Parameters: obj - the object to bind; possibly null Parameters: attrs - the attributes to associate with the binding exception: InvalidAttributesException - if some "mandatory" attributesof the binding are not supplied exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException(Code) | | Searches in a single context for objects that contain a specified set
of attributes, and retrieves selected attributes. The search is
performed using the default SearchControls settings.
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. If empty ornull, all objects in the target context are returned. Parameters: attributesToReturn - the attributes to return. null indicatesthat all attributes are to be returned; an empty array indicates thatnone are to be returned. a non-null enumeration of SearchResult objects. EachSearchResult contains the attributes identified by attributesToReturnand the name of the corresponding object, named relative to thecontext named by name. exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException(Code) | | Searches in a single context for objects that contain a specified set
of attributes, and retrieves selected attributes.
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. If empty ornull, all objects in the target context are returned. Parameters: attributesToReturn - the attributes to return. null indicatesthat all attributes are to be returned; an empty array indicates thatnone are to be returned. a non-null enumeration of SearchResult objects. EachSearchResult contains the attributes identified by attributesToReturnand the name of the corresponding object, named relative to thecontext named by name. exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException(Code) | | Searches in a single context for objects that contain a specified set
of attributes. This method returns all the attributes of such objects.
It is equivalent to supplying null as the atributesToReturn parameter
to the method search(Name, Attributes, String[]).
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. If empty ornull, all objects in the target context are returned. a non-null enumeration of SearchResult objects. EachSearchResult contains the attributes identified by attributesToReturnand the name of the corresponding object, named relative to thecontext named by name. exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException(Code) | | Searches in a single context for objects that contain a specified set
of attributes.
Parameters: name - the name of the context to search Parameters: matchingAttributes - the attributes to search for. If empty ornull, all objects in the target context are returned. a non-null enumeration of SearchResult objects. EachSearchResult contains the attributes identified by attributesToReturnand the name of the corresponding object, named relative to thecontext named by name. exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException(Code) | | Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by the search
controls.
Parameters: name - the name of the context or object to search Parameters: filter - the filter expression to use for the search; may not benull Parameters: cons - the search controls that control the search. If null,the default search controls are used (equivalent to(new SearchControls())). an enumeration of SearchResults of the objects that satisfythe filter; never null exception: InvalidSearchFilterException - if the search filter specifiedis not supported or understood by the underlying directory exception: InvalidSearchControlsException - if the search controlscontain invalid settings exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException(Code) | | Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by the search
controls.
Parameters: name - the name of the context or object to search Parameters: filter - the filter expression to use for the search; may not benull Parameters: cons - the search controls that control the search. If null,the default search controls are used (equivalent to(new SearchControls())). an enumeration of SearchResults of the objects that satisfythe filter; never null exception: InvalidSearchFilterException - if the search filterspecified is not supported or understood by the underlying directory exception: InvalidSearchControlsException - if the search controlscontain invalid settings exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException(Code) | | Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by the search
controls.
Parameters: name - the name of the context or object to search Parameters: filterExpr - the filter expression to use for the search.The expression may contain variables of the form "{i}" where i is anonnegative integer. May not be null. Parameters: filterArgs - the array of arguments to substitute for thevariables in filterExpr. The value of filterArgs[i] will replace eachoccurrence of "{i}". If null, equivalent to an empty array. Parameters: cons - the search controls that control the search. If null, thedefault search controls are used (equivalent to (new SearchControls())). an enumeration of SearchResults of the objects that satisy thefilter; never null exception: java.lang.ArrayIndexOutOfBoundsException - if filterExpr contains {i}expressions where i is outside the bounds of the array filterArgs exception: InvalidSearchControlsException - if cons contains invalidsettings exception: InvalidSearchFilterException - if filterExpr with filterArgsrepresents an invalid search filter exception: javax.naming.NamingException - if a naming exception is encountered |
search | public NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException(Code) | | Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by the search
controls.
Parameters: name - the name of the context or object to search Parameters: filterExpr - the filter expression to use for the search.The expression may contain variables of the form "{i}" where i is anonnegative integer. May not be null. Parameters: filterArgs - the array of arguments to substitute for thevariables in filterExpr. The value of filterArgs[i] will replace eachoccurrence of "{i}". If null, equivalent to an empty array. Parameters: cons - the search controls that control the search. If null, thedefault search controls are used (equivalent to (new SearchControls())). an enumeration of SearchResults of the objects that satisy thefilter; never null exception: java.lang.ArrayIndexOutOfBoundsException - if filterExpr contains {i}expressions where i is outside the bounds of the array filterArgs exception: InvalidSearchControlsException - if cons contains invalidsettings exception: InvalidSearchFilterException - if filterExpr with filterArgsrepresents an invalid search filter exception: javax.naming.NamingException - if a naming exception is encountered |
Methods inherited from org.apache.naming.core.BaseContext | public Object addToEnvironment(String propName, Object propVal) throws NamingException(Code)(Java Doc) public void bind(Name name, Object obj) throws NamingException(Code)(Java Doc) public void bind(String name, Object obj) throws NamingException(Code)(Java Doc) public void close() throws NamingException(Code)(Java Doc) public Name composeName(Name name, Name prefix) throws NamingException(Code)(Java Doc) public String composeName(String name, String prefix) throws NamingException(Code)(Java Doc) public Context createSubcontext(Name name) throws NamingException(Code)(Java Doc) public Context createSubcontext(String name) throws NamingException(Code)(Java Doc) public void destroySubcontext(Name name) throws NamingException(Code)(Java Doc) public void destroySubcontext(String name) throws NamingException(Code)(Java Doc) public Hashtable getEnvironment() throws NamingException(Code)(Java Doc) public String getNameInNamespace() throws NamingException(Code)(Java Doc) public NameParser getNameParser(Name name) throws NamingException(Code)(Java Doc) public NameParser getNameParser(String name) throws NamingException(Code)(Java Doc) public NamingEnumeration list(String name) throws NamingException(Code)(Java Doc) public NamingEnumeration list(Name name) throws NamingException(Code)(Java Doc) public NamingEnumeration listBindings(Name name) throws NamingException(Code)(Java Doc) public NamingEnumeration listBindings(String name) throws NamingException(Code)(Java Doc) public Object lookup(Name name) throws NamingException(Code)(Java Doc) public Object lookup(String name) throws NamingException(Code)(Java Doc) public Object lookupLink(Name name) throws NamingException(Code)(Java Doc) public Object lookupLink(String name) throws NamingException(Code)(Java Doc) public void rebind(Name name, Object obj) throws NamingException(Code)(Java Doc) public void rebind(String name, Object obj) throws NamingException(Code)(Java Doc) public Object removeFromEnvironment(String propName) throws NamingException(Code)(Java Doc) public void rename(String oldName, String newName) throws NamingException(Code)(Java Doc) public void rename(Name oldName, Name newName) throws NamingException(Code)(Java Doc) public NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException(Code)(Java Doc) public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException(Code)(Java Doc) public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException(Code)(Java Doc) public NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException(Code)(Java Doc) public void unbind(Name name) throws NamingException(Code)(Java Doc) public void unbind(String name) throws NamingException(Code)(Java Doc)
|
|
|