java.lang.Object | ||
↳ | com.sun.jndi.toolkit.url.GenericURLContext | |
↳ | com.sun.jndi.toolkit.url.GenericURLDirContext |
![]() |
This abstract class is a generic URL DirContext that accepts as the name argument either a string URL or a Name whose first component is a URL. It resolves the URL to a target context and then continues the operation using the remaining name in the target context as if the first component names a junction. A subclass must define getRootURLContext() to process the URL into head/tail pieces. If it wants to control how URL strings are parsed and compared for the rename() operation, then it should override getNonRootURLSuffixes() and urlEquals().
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Binds a name to an object, along with associated attributes.
| |||||||||||
Binds a name to an object, along with associated attributes.
| |||||||||||
Creates and binds a new context, along with associated attributes.
| |||||||||||
Creates and binds a new context, along with associated attributes.
| |||||||||||
Retrieves selected attributes associated with a named object.
| |||||||||||
Retrieves selected attributes associated with a named object.
| |||||||||||
Retrieves all of the attributes associated with a named object.
| |||||||||||
Retrieves all of the attributes associated with a named object.
| |||||||||||
Retrieves the schema associated with the named object.
| |||||||||||
Retrieves the schema associated with the named object.
| |||||||||||
Retrieves a context containing the schema objects of the
named object's class definitions.
| |||||||||||
Retrieves a context containing the schema objects of the
named object's class definitions.
| |||||||||||
Modifies the attributes associated with a named object using
an ordered list of modifications.
| |||||||||||
Modifies the attributes associated with a named object.
| |||||||||||
Modifies the attributes associated with a named object using
an ordered list of modifications.
| |||||||||||
Modifies the attributes associated with a named object.
| |||||||||||
Binds a name to an object, along with associated attributes,
overwriting any existing binding.
| |||||||||||
Binds a name to an object, along with associated attributes,
overwriting any existing binding.
| |||||||||||
Searches in the named context or object for entries that satisfy the
given search filter.
| |||||||||||
Searches in the named context or object for entries that satisfy the
given search filter.
| |||||||||||
Searches in the named context or object for entries that satisfy the
given search filter.
| |||||||||||
Searches in a single context for objects that contain a
specified set of attributes, and retrieves selected attributes.
| |||||||||||
Searches in a single context for objects that contain a
specified set of attributes.
| |||||||||||
Searches in a single context for objects that contain a
specified set of attributes, and retrieves selected attributes.
| |||||||||||
Searches in a single context for objects that contain a
specified set of attributes.
| |||||||||||
Searches in the named context or object for entries that satisfy the
given search filter.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the context in which to continue the operation.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Binds a name to an object, along with associated attributes.
See bind(Name, Object, Attributes)
for details.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
attrs | the attributes to associate with the binding |
NamingException |
---|
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.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
attrs | the attributes to associate with the binding |
NamingException |
---|
Creates and binds a new context, along with associated attributes.
See createSubcontext(Name, Attributes)
for details.
name | the name of the context to create; may not be empty |
---|---|
attrs | the attributes to associate with the newly created context |
NamingException |
---|
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().
name | the name of the context to create; may not be empty |
---|---|
attrs | the attributes to associate with the newly created context |
NamingException |
---|
Retrieves selected attributes associated with a named object.
See getAttributes(Name, String[])
for details.
name | The name of the object from which to retrieve attributes |
---|---|
attrIds | the identifiers of the attributes to retrieve. null indicates that all attributes should be retrieved; an empty array indicates that none should be retrieved. |
NamingException |
---|
Retrieves selected attributes associated with a named object. See the class description regarding attribute models, attribute type names, and operational attributes.
If the object does not have an attribute specified, the directory will ignore the nonexistent attribute and return those requested attributes that the object does have.
A directory might return more attributes than was requested (see Attribute Type Names in the class description), but is not allowed to return arbitrary, unrelated attributes.
See also Operational Attributes in the class description.
name | the name of the object from which to retrieve attributes |
---|---|
attrIds | the identifiers of the attributes to retrieve. null indicates that all attributes should be retrieved; an empty array indicates that none should be retrieved. |
NamingException |
---|
Retrieves all of the attributes associated with a named object.
See getAttributes(Name)
for details.
name | the name of the object from which to retrieve attributes |
---|
name
NamingException |
---|
Retrieves all of the attributes associated with a named object. See the class description regarding attribute models, attribute type names, and operational attributes.
name | the name of the object from which to retrieve attributes |
---|
name
.
Returns an empty attribute set if name has no attributes;
never null.NamingException |
---|
Retrieves the schema associated with the named object.
See getSchema(Name)
for details.
name | the name of the object whose schema is to be retrieved |
---|
NamingException |
---|
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.
This method returns the root of the schema information tree that is applicable to the named object. Several named objects (or even an entire directory) might share the same schema.
Issues such as structure and contents of the schema tree, permission to modify to the contents of the schema tree, and the effect of such modifications on the directory are dependent on the underlying directory.
name | the name of the object whose schema is to be retrieved |
---|
NamingException |
---|
Retrieves a context containing the schema objects of the named object's class definitions.
One category of information found in directory schemas is class definitions. An "object class" definition specifies the object's type and what attributes (mandatory and optional) the object must/can have. Note that the term "object class" being referred to here is in the directory sense rather than in the Java sense. For example, if the named object is a directory object of "Person" class, getSchemaClassDefinition() would return a DirContext representing the (directory's) object class definition of "Person".
The information that can be retrieved from an object class definition is directory-dependent.
Prior to JNDI 1.2, this method returned a single schema object representing the class definition of the named object. Since JNDI 1.2, this method returns a DirContext containing all of the named object's class definitions.
name | the name of the object whose object class definition is to be retrieved |
---|
NamingException |
---|
Retrieves a context containing the schema objects of the
named object's class definitions.
See getSchemaClassDefinition(Name)
for details.
name | the name of the object whose object class definition is to be retrieved |
---|
NamingException |
---|
Modifies the attributes associated with a named object using 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.
name | the name of the object whose attributes will be updated |
---|---|
mods | an ordered sequence of modifications to be performed; may not be null |
NamingException |
---|
Modifies the attributes associated with a named object. The order of the modifications is not specified. Where possible, the modifications are performed atomically.
name | the name of the object whose attributes will be updated |
---|---|
mod_op | the modification operation, one of:
ADD_ATTRIBUTE ,
REPLACE_ATTRIBUTE ,
REMOVE_ATTRIBUTE . |
attrs | the attributes to be used for the modification; may not be null |
NamingException |
---|
Modifies the attributes associated with a named object using
an ordered list of modifications.
See modifyAttributes(Name, ModificationItem[])
for details.
name | the name of the object whose attributes will be updated |
---|---|
mods | an ordered sequence of modifications to be performed; may not be null |
NamingException |
---|
Modifies the attributes associated with a named object.
See modifyAttributes(Name, int, Attributes)
for details.
name | the name of the object whose attributes will be updated |
---|---|
mod_op | the modification operation, one of:
ADD_ATTRIBUTE ,
REPLACE_ATTRIBUTE ,
REMOVE_ATTRIBUTE . |
attrs | the attributes to be used for the modification; may not be null |
NamingException |
---|
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.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
attrs | the attributes to associate with the binding |
NamingException |
---|
Binds a name to an object, along with associated attributes,
overwriting any existing binding.
See rebind(Name, Object, Attributes)
for details.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
attrs | the attributes to associate with the binding |
NamingException |
---|
Searches in the named context or object for entries that satisfy the given search filter. Performs the search as specified by the search controls.
The format and interpretation of filter
follows RFC 2254
with the
following interpretations for attr
and value
mentioned in the RFC.
attr
is the attribute's identifier.
value
is the string representation the attribute's value.
The translation of this string representation into the attribute's value
is directory-specific.
For the assertion "someCount=127", for example, attr
is "someCount" and value
is "127".
The provider determines, based on the attribute ID ("someCount")
(and possibly its schema), that the attribute's value is an integer.
It then parses the string "127" appropriately.
Any non-ASCII characters in the filter string should be represented by the appropriate Java (Unicode) characters, and not encoded as UTF-8 octets. Alternately, the "backslash-hexcode" notation described in RFC 2254 may be used.
If the directory does not support a string representation of
some or all of its attributes, the form of search
that
accepts filter arguments in the form of Objects can be used instead.
The service provider for such a directory would then translate
the filter arguments to its service-specific representation
for filter evaluation.
See search(Name, String, Object[], SearchControls)
.
RFC 2254 defines certain operators for the filter, including substring matches, equality, approximate match, greater than, less than. These operators are mapped to operators with corresponding semantics in the underlying directory. For example, for the equals operator, suppose the directory has a matching rule defining "equality" of the attributes in the filter. This rule would be used for checking equality of the attributes specified in the filter with the attributes of objects in the directory. Similarly, if the directory has a matching rule for ordering, this rule would be used for making "greater than" and "less than" comparisons.
Not all of the operators defined in RFC 2254 are applicable to all
attributes. When an operator is not applicable, the exception
InvalidSearchFilterException
is thrown.
The result is returned in an enumeration of SearchResults.
Each SearchResult contains the name of the object
and other information about the object (see SearchResult).
The name is either relative to the target context of the search
(which is named by the name
parameter), or
it is a URL string. If the target context is included in
the enumeration (as is possible when
cons
specifies a search scope of
SearchControls.OBJECT_SCOPE
or
SearchControls.SUBSTREE_SCOPE
), its name is the empty
string. The SearchResult may also contain attributes of the
matching object if the cons argument specified that attributes
be returned.
If the object does not have a requested attribute, that nonexistent attribute will be ignored. Those requested attributes that the object does have will be returned.
A directory might return more attributes than were requested (see Attribute Type Names in the class description) but is not allowed to return arbitrary, unrelated attributes.
See also Operational Attributes in the class description.
name | the name of the context or object to search |
---|---|
filter | the filter expression to use for the search; may not be null |
cons | the search controls that control the search. If null, the default search controls are used (equivalent to (new SearchControls())). |
NamingException |
---|
Searches in the named context or object for entries that satisfy the given search filter. Performs the search as specified by the search controls.
The interpretation of filterExpr
is based on RFC
2254. It may additionally contain variables of the form
{i}
-- where i
is an integer -- that
refer to objects in the filterArgs
array. The
interpretation of filterExpr
is otherwise
identical to that of the filter
parameter of the
method search(Name, String, SearchControls)
.
When a variable {i}
appears in a search filter, it
indicates that the filter argument filterArgs[i]
is to be used in that place. Such variables may be used
wherever an attr, value, or
matchingrule production appears in the filter grammar
of RFC 2254, section 4. When a string-valued filter argument
is substituted for a variable, the filter is interpreted as if
the string were given in place of the variable, with any
characters having special significance within filters (such as
'*'
) having been escaped according to the rules of
RFC 2254.
For directories that do not use a string representation for some or all of their attributes, the filter argument corresponding to an attribute value may be of a type other than String. Directories that support unstructured binary-valued attributes, for example, should accept byte arrays as filter arguments. The interpretation (if any) of filter arguments of any other type is determined by the service provider for that directory, which maps the filter operations onto operations with corresponding semantics in the underlying directory.
This method returns an enumeration of the results.
Each element in the enumeration contains the name of the object
and other information about the object (see SearchResult
).
The name is either relative to the target context of the search
(which is named by the name
parameter), or
it is a URL string. If the target context is included in
the enumeration (as is possible when
cons
specifies a search scope of
SearchControls.OBJECT_SCOPE
or
SearchControls.SUBSTREE_SCOPE
),
its name is the empty string.
The SearchResult may also contain attributes of the matching object if the cons argument specifies that attributes be returned.
If the object does not have a requested attribute, that nonexistent attribute will be ignored. Those requested attributes that the object does have will be returned.
A directory might return more attributes than were requested (see Attribute Type Names in the class description) but is not allowed to return arbitrary, unrelated attributes.
If a search filter with invalid variable substitutions is provided to this method, the result is undefined. When changes are made to this DirContext, the effect on enumerations returned by prior calls to this method is undefined.
See also Operational Attributes in the class description.
name | the name of the context or object to search |
---|---|
filterExpr | the filter expression to use for the search.
The expression may contain variables of the
form "{i} " where i
is a nonnegative integer. May not be null. |
filterArgs | the array of arguments to substitute for the variables
in filterExpr . The value of
filterArgs[i] will replace each
occurrence of "{i} ".
If null, equivalent to an empty array. |
cons | the search controls that control the search. If null, the default search controls are used (equivalent to (new SearchControls())). |
NamingException |
---|
Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by
the search controls.
See search(Name, String, Object[], SearchControls)
for details.
name | the name of the context or object to search |
---|---|
filterExpr | the filter expression to use for the search.
The expression may contain variables of the
form "{i} " where i
is a nonnegative integer. May not be null. |
filterArgs | the array of arguments to substitute for the variables
in filterExpr . The value of
filterArgs[i] will replace each
occurrence of "{i} ".
If null, equivalent to an empty array. |
cons | the search controls that control the search. If null, the default search controls are used (equivalent to (new SearchControls())). |
NamingException |
---|
Searches in a single context for objects that contain a
specified set of attributes, and retrieves selected attributes.
See search(Name, Attributes, String[])
for details.
name | the name of the context to search |
---|---|
matchingAttributes | the attributes to search for |
attributesToReturn | the attributes to return |
NamingException |
---|
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[])
.
See search(Name, Attributes, String[])
for a full description.
name | the name of the context to search |
---|---|
matchingAttributes | the attributes to search for |
NamingException |
---|
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.
For an object to be selected, each attribute in
matchingAttributes
must match some attribute of the
object. If matchingAttributes
is empty or
null, all objects in the target context are returned.
An attribute A1 in
matchingAttributes
is considered to match an
attribute A2 of an object if
A1 and A2 have the same
identifier, and each value of A1 is equal
to some value of A2. This implies that the
order of values is not significant, and that
A2 may contain "extra" values not found in
A1 without affecting the comparison. It
also implies that if A1 has no values, then
testing for a match is equivalent to testing for the presence
of an attribute A2 with the same
identifier.
The precise definition of "equality" used in comparing attribute values
is defined by the underlying directory service. It might use the
Object.equals
method, for example, or might use a schema
to specify a different equality operation.
For matching based on operations other than equality (such as
substring comparison) use the version of the search
method that takes a filter argument.
When changes are made to this DirContext, the effect on enumerations returned by prior calls to this method is undefined.
If the object does not have the attribute specified, the directory will ignore the nonexistent attribute and return the requested attributes that the object does have.
A directory might return more attributes than was requested (see Attribute Type Names in the class description), but is not allowed to return arbitrary, unrelated attributes.
See also Operational Attributes in the class description.
name | the name of the context to search |
---|---|
matchingAttributes | the attributes to search for. If empty or null, all objects in the target context are returned. |
attributesToReturn | the attributes to return. null indicates that all attributes are to be returned; an empty array indicates that none are to be returned. |
attributesToReturn
and the name of the corresponding object, named relative
to the context named by name
.NamingException |
---|
Searches in a single context for objects that contain a
specified set of attributes.
See search(Name, Attributes)
for details.
name | the name of the context to search |
---|---|
matchingAttributes | the attributes to search for |
NamingException |
---|
Searches in the named context or object for entries that satisfy the
given search filter. Performs the search as specified by
the search controls.
See search(Name, String, SearchControls)
for details.
name | the name of the context or object to search |
---|---|
filter | the filter expression to use for the search; may not be null |
cons | the search controls that control the search. If null, the default search controls are used (equivalent to (new SearchControls())). |
NamingException |
---|
Gets the context in which to continue the operation. This method is called when this context is asked to process a multicomponent Name in which the first component is a URL. Treat the first component like a junction: resolve it and then use DirectoryManager.getContinuationDirContext() to get the target context in which to operate on the remainder of the name (n.getSuffix(1)). Do this in case intermediate contexts are not DirContext.
NamingException |
---|