java.lang.Object | |
↳ | com.sun.jndi.toolkit.url.GenericURLContext |
Known Direct Subclasses |
Known Indirect Subclasses |
This abstract class is a generic URL context 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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
javax.naming.Context
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
myEnv |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a new environment property to the environment of this
context.
| |||||||||||
Binds a name to an object.
| |||||||||||
Binds a name to an object.
| |||||||||||
Closes this context.
| |||||||||||
Composes the name of this context with a name relative to
this context.
| |||||||||||
Composes the name of this context with a name relative to
this context.
| |||||||||||
Creates and binds a new context.
| |||||||||||
Creates and binds a new context.
| |||||||||||
Destroys the named context and removes it from the namespace.
| |||||||||||
Destroys the named context and removes it from the namespace.
| |||||||||||
Retrieves the environment in effect for this context.
| |||||||||||
Retrieves the full name of this context within its own namespace.
| |||||||||||
Retrieves the parser associated with the named context.
| |||||||||||
Retrieves the parser associated with the named context.
| |||||||||||
Enumerates the names bound in the named context, along with the
class names of objects bound to them.
| |||||||||||
Enumerates the names bound in the named context, along with the
class names of objects bound to them.
| |||||||||||
Enumerates the names bound in the named context, along with the
objects bound to them.
| |||||||||||
Enumerates the names bound in the named context, along with the
objects bound to them.
| |||||||||||
Retrieves the named object.
| |||||||||||
Retrieves the named object.
| |||||||||||
Retrieves the named object, following links except
for the terminal atomic component of the name.
| |||||||||||
Retrieves the named object, following links except
for the terminal atomic component of the name.
| |||||||||||
Binds a name to an object, overwriting any existing binding.
| |||||||||||
Binds a name to an object, overwriting any existing binding.
| |||||||||||
Removes an environment property from the environment of this
context.
| |||||||||||
Binds a new name to the object bound to an old name, and unbinds
the old name.
| |||||||||||
Binds a new name to the object bound to an old name, and unbinds
the old name.
| |||||||||||
Unbinds the named object.
| |||||||||||
Unbinds the named object.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the context in which to continue the operation.
| |||||||||||
Resolves 'name' into a target context with remaining name.
| |||||||||||
Finds the prefix of a URL.
| |||||||||||
Returns the suffix of the url.
| |||||||||||
Determines whether two URLs are the same.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
javax.naming.Context
|
Adds a new environment property to the environment of this context. If the property already exists, its value is overwritten. See class description for more details on environment properties.
propName | the name of the environment property to add; may not be null |
---|---|
propVal | the value of the property to add; may not be null |
NamingException |
---|
Binds a name to an object. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
NamingException |
---|
Binds a name to an object.
See bind(Name, Object)
for details.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
NamingException |
---|
Closes this context. This method releases this context's resources immediately, instead of waiting for them to be released automatically by the garbage collector.
This method is idempotent: invoking it on a context that has already been closed has no effect. Invoking any other method on a closed context is not allowed, and results in undefined behaviour.
NamingException |
---|
Composes the name of this context with a name relative to
this context.
See composeName(Name, Name)
for details.
name | a name relative to this context |
---|---|
prefix | the name of this context relative to one of its ancestors |
prefix
and name
NamingException |
---|
Composes the name of this context with a name relative to
this context.
Given a name (name
) relative to this context, and
the name (prefix
) of this context relative to one
of its ancestors, this method returns the composition of the
two names using the syntax appropriate for the naming
system(s) involved. That is, if name
names an
object relative to this context, the result is the name of the
same object, but relative to the ancestor context. None of the
names may be null.
For example, if this context is named "wiz.com" relative to the initial context, then
composeName("east", "wiz.com")might return
"east.wiz.com"
.
If instead this context is named "org/research", then
composeName("user/jane", "org/research")might return
"org/research/user/jane"
while
composeName("user/jane", "research")returns
"research/user/jane"
.name | a name relative to this context |
---|---|
prefix | the name of this context relative to one of its ancestors |
prefix
and name
NamingException |
---|
Creates and binds a new context. Creates a new context with the given name and binds it in the target context (that named by all but terminal atomic component of the name). All intermediate contexts and the target context must already exist.
name | the name of the context to create; may not be empty |
---|
NamingException |
---|
Creates and binds a new context.
See createSubcontext(Name)
for details.
name | the name of the context to create; may not be empty |
---|
NamingException |
---|
Destroys the named context and removes it from the namespace. Any attributes associated with the name are also removed. Intermediate contexts are not destroyed.
This method is idempotent. It succeeds even if the terminal atomic name is not bound in the target context, but throws NameNotFoundException if any of the intermediate contexts do not exist.
In a federated naming system, a context from one naming system may be bound to a name in another. One can subsequently look up and perform operations on the foreign context using a composite name. However, an attempt destroy the context using this composite name will fail with NotContextException, because the foreign context is not a "subcontext" of the context in which it is bound. Instead, use unbind() to remove the binding of the foreign context. Destroying the foreign context requires that the destroySubcontext() be performed on a context from the foreign context's "native" naming system.
name | the name of the context to be destroyed; may not be empty |
---|
NamingException |
---|
Destroys the named context and removes it from the namespace.
See destroySubcontext(Name)
for details.
name | the name of the context to be destroyed; may not be empty |
---|
NamingException |
---|
Retrieves the environment in effect for this context. See class description for more details on environment properties.
The caller should not make any changes to the object returned: their effect on the context is undefined. The environment of this context may be changed using addToEnvironment() and removeFromEnvironment().
NamingException |
---|
Retrieves the full name of this context within its own namespace.
Many naming services have a notion of a "full name" for objects in their respective namespaces. For example, an LDAP entry has a distinguished name, and a DNS record has a fully qualified name. This method allows the client application to retrieve this name. The string returned by this method is not a JNDI composite name and should not be passed directly to context methods. In naming systems for which the notion of full name does not make sense, OperationNotSupportedException is thrown.
NamingException |
---|
Retrieves the parser associated with the named context. In a federation of namespaces, different naming systems will parse names differently. This method allows an application to get a parser for parsing names into their atomic components using the naming convention of a particular naming system. Within any single naming system, NameParser objects returned by this method must be equal (using the equals() test).
name | the name of the context from which to get the parser |
---|
NamingException |
---|
Retrieves the parser associated with the named context.
See getNameParser(Name)
for details.
name | the name of the context from which to get the parser |
---|
NamingException |
---|
Enumerates the names bound in the named context, along with the
class names of objects bound to them.
See list(Name)
for details.
name | the name of the context to list |
---|
NamingException |
---|
Enumerates the names bound in the named context, along with the class names of objects bound to them. The contents of any subcontexts are not included.
If a binding is added to or removed from this context, its effect on an enumeration previously returned is undefined.
name | the name of the context to list |
---|
NamingException |
---|
Enumerates the names bound in the named context, along with the objects bound to them. The contents of any subcontexts are not included.
If a binding is added to or removed from this context, its effect on an enumeration previously returned is undefined.
name | the name of the context to list |
---|
NamingException |
---|
Enumerates the names bound in the named context, along with the
objects bound to them.
See listBindings(Name)
for details.
name | the name of the context to list |
---|
NamingException |
---|
Retrieves the named object.
See lookup(Name)
for details.
name | the name of the object to look up |
---|
NamingException |
---|
Retrieves the named object. If name is empty, returns a new instance of this context (which represents the same naming context as this context, but its environment may be modified independently and it may be accessed concurrently).
name | the name of the object to look up |
---|
NamingException |
---|
Retrieves the named object, following links except
for the terminal atomic component of the name.
See lookupLink(Name)
for details.
name | the name of the object to look up |
---|
NamingException |
---|
Retrieves the named object, following links except for the terminal atomic component of the name. If the object bound to name is not a link, returns the object itself.
name | the name of the object to look up |
---|
NamingException |
---|
Binds a name to an object, overwriting any existing binding.
See rebind(Name, Object)
for details.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
NamingException |
---|
Binds a name to an object, overwriting any existing binding. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist.
If the object is a DirContext, any existing attributes associated with the name are replaced with those of the object. Otherwise, any existing attributes associated with the name remain unchanged.
name | the name to bind; may not be empty |
---|---|
obj | the object to bind; possibly null |
NamingException |
---|
Removes an environment property from the environment of this context. See class description for more details on environment properties.
propName | the name of the environment property to remove; may not be null |
---|
NamingException |
---|
Binds a new name to the object bound to an old name, and unbinds
the old name.
See rename(Name, Name)
for details.
oldName | the name of the existing binding; may not be empty |
---|---|
newName | the name of the new binding; may not be empty |
NamingException |
---|
Binds a new name to the object bound to an old name, and unbinds the old name. Both names are relative to this context. Any attributes associated with the old name become associated with the new name. Intermediate contexts of the old name are not changed.
name | the name of the existing binding; may not be empty |
---|---|
newName | the name of the new binding; may not be empty |
NamingException |
---|
Unbinds the named object.
Removes the terminal atomic name in name
from the target context--that named by all but the terminal
atomic part of name
.
This method is idempotent. It succeeds even if the terminal atomic name is not bound in the target context, but throws NameNotFoundException if any of the intermediate contexts do not exist.
Any attributes associated with the name are removed. Intermediate contexts are not changed.
name | the name to unbind; may not be empty |
---|
NamingException |
---|
Unbinds the named object.
See unbind(Name)
for details.
name | the name to unbind; may not be empty |
---|
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 NamingManager.getContinuationContext() to get the target context in which to operate on the remainder of the name (n.getSuffix(1)).
NamingException |
---|
Resolves 'name' into a target context with remaining name. For example, with a JNDI URL "jndi://dnsname/rest_name", this method resolves "jndi://dnsname/" to a target context, and returns the target context with "rest_name". The definition of "root URL" and how much of the URL to consume is implementation specific. If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.
NamingException |
---|
Finds the prefix of a URL. Default implementation looks for slashes and then extracts prefixes using String.substring(). Subclass should override if this is not appropriate. This method is used only by rename(). If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.
URL Prefix foo://host:port foo://host:port foo://host:port/rest/of/name foo://host:port foo:///rest/of/name foo:// foo:/rest/of/name foo: foo:rest/of/name foo:
NamingException |
---|
Returns the suffix of the url. The result should be identical to that of calling getRootURLContext().getRemainingName(), but without the overhead of doing anything with the prefix like creating a context.
This method returns a Name instead of a String because to give the provider an opportunity to return a Name (for example, for weakly separated naming systems like COS naming).
The default implementation uses skips 'prefix', calls UrlUtil.decode() on it, and returns the result as a single component CompositeName. Subclass should override if this is not appropriate. This method is used only by rename(). If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.
For many URL schemes, this method is very similar to URL.getFile(),
except getFile() will return a leading slash in the
2nd, 3rd, and 4th cases. For schemes like "ldap" and "iiop",
the leading slash must be skipped before the name is an acceptable
format for operation by the Context methods. For schemes that treat the
leading slash as significant (such as "file"),
the subclass must override getURLSuffix() to get the correct behavior.
Remember, the behavior must match getRootURLContext().
URL Suffix
foo://host:port
NamingException |
---|
Determines whether two URLs are the same. Default implementation uses String.equals(). Subclass should override if this is not appropriate. This method is used by rename().