#include <javax_naming_Context.h>
Inheritance diagram for javax::naming::Context:


Public Types | |
| enum | { xmogDefaultFlags = xmog_base::GLOBAL, xmogMajorVersion = 3, xmogMinorVersion = 2, xmogPatchVersion = 9, xmogBuildNumber = 2047 } |
|
typedef ::xmog_java_array_template< ::javax::naming::Context > | array1D |
|
typedef ::xmog_java_array_template< ::xmog_java_array_template< ::javax::naming::Context > > | array2D |
Public Member Functions | |
| virtual ::java::lang::Object | addToEnvironment (const ::java::lang::String &propName, const ::java::lang::Object &propVal,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Adds a new environment property to the environment of this context. | |
| virtual void | bind (const ::java::lang::String &name, const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a name to an object. | |
| virtual void | bind (const ::javax::naming::Name &name, const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a name to an object. | |
| virtual void | close (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Closes this context. | |
| virtual ::java::lang::String | composeName (const ::java::lang::String &name, const ::java::lang::String &prefix,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Composes the name of this context with a name relative to this context. | |
| virtual ::javax::naming::Name | composeName (const ::javax::naming::Name &name, const ::javax::naming::Name &prefix,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Composes the name of this context with a name relative to this context. | |
| virtual ::javax::naming::Context | createSubcontext (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Creates and binds a new context. | |
| virtual ::javax::naming::Context | createSubcontext (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Creates and binds a new context. | |
| virtual void | destroySubcontext (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Destroys the named context and removes it from the namespace. | |
| virtual void | destroySubcontext (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Destroys the named context and removes it from the namespace. | |
| virtual ::java::util::Hashtable | getEnvironment (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the environment in effect for this context. | |
| virtual ::java::lang::String | getNameInNamespace (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the full name of this context within its own namespace. | |
| virtual ::javax::naming::NameParser | getNameParser (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the parser associated with the named context. | |
| virtual ::javax::naming::NameParser | getNameParser (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the parser associated with the named context. | |
| virtual ::javax::naming::NamingEnumeration | list (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Enumerates the names bound in the named context, along with the class names of objects bound to them. | |
| virtual ::javax::naming::NamingEnumeration | list (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Enumerates the names bound in the named context, along with the class names of objects bound to them. | |
| virtual ::javax::naming::NamingEnumeration | listBindings (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Enumerates the names bound in the named context, along with the objects bound to them. | |
| virtual ::javax::naming::NamingEnumeration | listBindings (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Enumerates the names bound in the named context, along with the objects bound to them. | |
| virtual ::java::lang::Object | lookup (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the named object. | |
| virtual ::java::lang::Object | lookup (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the named object. | |
| virtual ::java::lang::Object | lookupLink (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the named object, following links except for the terminal atomic component of the name. | |
| virtual ::java::lang::Object | lookupLink (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Retrieves the named object, following links except for the terminal atomic component of the name. | |
| virtual void | rebind (const ::java::lang::String &name, const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a name to an object, overwriting any existing binding. | |
| virtual void | rebind (const ::javax::naming::Name &name, const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a name to an object, overwriting any existing binding. | |
| virtual ::java::lang::Object | removeFromEnvironment (const ::java::lang::String &propName,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Removes an environment property from the environment of this context. | |
| virtual void | rename (const ::java::lang::String &oldName, const ::java::lang::String &newName,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a new name to the object bound to an old name, and unbinds the old name. | |
| virtual void | rename (const ::javax::naming::Name &oldName, const ::javax::naming::Name &newName,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Binds a new name to the object bound to an old name, and unbinds the old name. | |
| virtual void | unbind (const ::java::lang::String &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Unbinds the named object. | |
| virtual void | unbind (const ::javax::naming::Name &name,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags) |
| Unbinds the named object. | |
Static Public Attributes | |
| ::java::lang::String | APPLET |
| Constant that holds the name of the environment property for specifying an applet for the initial context constructor to use when searching for other properties. | |
| ::java::lang::String | AUTHORITATIVE |
| Constant that holds the name of the environment property for specifying the authoritativeness of the service requested. | |
| ::java::lang::String | BATCHSIZE |
| Constant that holds the name of the environment property for specifying the batch size to use when returning data via the service's protocol. | |
| ::java::lang::String | DNS_URL |
| Constant that holds the name of the environment property for specifying the DNS host and domain names to use for the JNDI URL context (for example, "dns://somehost/wiz.com"). | |
| ::java::lang::String | INITIAL_CONTEXT_FACTORY |
| Constant that holds the name of the environment property for specifying the initial context factory to use. | |
| ::java::lang::String | LANGUAGE |
| Constant that holds the name of the environment property for specifying the preferred language to use with the service. | |
| ::java::lang::String | OBJECT_FACTORIES |
| Constant that holds the name of the environment property for specifying the list of object factories to use. | |
| ::java::lang::String | PROVIDER_URL |
| Constant that holds the name of the environment property for specifying configuration information for the service provider to use. | |
| ::java::lang::String | REFERRAL |
| Constant that holds the name of the environment property for specifying how referrals encountered by the service provider are to be processed. | |
| ::java::lang::String | SECURITY_AUTHENTICATION |
| Constant that holds the name of the environment property for specifying the security level to use. | |
| ::java::lang::String | SECURITY_CREDENTIALS |
| Constant that holds the name of the environment property for specifying the credentials of the principal for authenticating the caller to the service. | |
| ::java::lang::String | SECURITY_PRINCIPAL |
| Constant that holds the name of the environment property for specifying the identity of the principal for authenticating the caller to the service. | |
| ::java::lang::String | SECURITY_PROTOCOL |
| Constant that holds the name of the environment property for specifying the security protocol to use. | |
| ::java::lang::String | STATE_FACTORIES |
| Constant that holds the name of the environment property for specifying the list of state factories to use. | |
| ::java::lang::String | URL_PKG_PREFIXES |
| Constant that holds the name of the environment property for specifying the list of package prefixes to use when loading in URL context factories. | |
It contains methods for examining and updating these bindings.
Each name passed as an argument to a Context method is relative to that context. The empty name is used to name the context itself. A name parameter may never be null.
Most of the methods have overloaded versions with one taking a Name parameter and one taking a String. These overloaded versions are equivalent in that if the Name and String parameters are just different representations of the same name, then the overloaded versions of the same methods behave the same. In the method descriptions below, only one version is fully documented. The second version instead has a link to the first: the same documentation applies to both.
For systems that support federation, String name arguments to Context methods are composite names. Name arguments that are instances of CompositeName are treated as composite names, while Name arguments that are not instances of CompositeName are treated as compound names (which might be instances of CompoundName or other implementations of compound names). This allows the results of NameParser.parse() to be used as arguments to the Context methods. Prior to JNDI 1.2, all name arguments were treated as composite names.
Furthermore, for systems that support federation, all names returned in a NamingEnumeration from list() and listBindings() are composite names represented as strings. See CompositeName for the string syntax of names.
For systems that do not support federation, the name arguments (in either Name or String forms) and the names returned in NamingEnumeration may be names in their own namespace rather than names in a composite namespace, at the discretion of the service provider.
All the methods in this interface can throw a NamingException or any of its subclasses. See NamingException and their subclasses for details on each exception.
A Context instance is not guaranteed to be synchronized against concurrent access by multiple threads. Threads that need to access a single Context instance concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating a different Context instance need not synchronize. Note that the lookup method, when passed an empty name, will return a new Context instance representing the same naming context.
For purposes of concurrency control, a Context operation that returns a NamingEnumeration is not considered to have completed while the enumeration is still in use, or while any referrals generated by that operation are still being followed.
A Name parameter passed to any method of the Context interface or one of its subinterfaces will not be modified by the service provider. The service provider may keep a reference to it for the duration of the operation, including any enumeration of the method's results and the processing of any referrals generated. The caller should not modify the object during this time. A Name returned by any such method is owned by the caller. The caller may subsequently modify it; the service provider may not.
JNDI applications need a way to communicate various preferences and properties that define the environment in which naming and directory services are accessed. For example, a context might require specification of security credentials in order to access the service. Another context might require that server configuration information be supplied. These are referred to as the environment of a context. The Context interface provides methods for retrieving and updating this environment.
The environment is inherited from the parent context as context methods proceed from one context to the next. Changes to the environment of one context do not directly affect those of other contexts.
It is implementation-dependent when environment properties are used and/or verified for validity. For example, some of the security-related properties are used by service providers to "log in" to the directory. This login process might occur at the time the context is created, or the first time a method is invoked on the context. When, and whether this occurs at all, is implementation-dependent. When environment properties are added or removed from the context, verifying the validity of the changes is again implementation-dependent. For example, verification of some properties might occur at the time the change is made, or at the time the next operation is performed on the context, or not at all.
Any object with a reference to a context may examine that context's environment. Sensitive information such as clear-text passwords should not be stored there unless the implementation is known to protect it.
To simplify the task of setting up the environment required by a JNDI application, application components and service providers may be distributed along with resource files. A JNDI resource file is a file in the properties file format (see java.util.Properties), containing a list of key/value pairs. The key is the name of the property (e.g. "java.naming.factory.object") and the value is a string in the format defined for that property. Here is an example of a JNDI resource file:
<blockquote>
java.naming.factory.object=com.sun.jndi.ldap.AttrsToCorba:com.wiz.from.Person
java.naming.factory.state=com.sun.jndi.ldap.CorbaToAttrs:com.wiz.from.Person
java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
</blockquote>
The JNDI class library reads the resource files and makes the property values freely available. Thus JNDI resource files should be considered to be "world readable", and sensitive information such as clear-text passwords should not be stored there.
There are two kinds of JNDI resource files: provider and application.
Each service provider has an optional resource that lists properties specific to that provider. The name of this resource is: <blockquote> [prefix/]jndiprovider.properties </blockquote> where prefix is the package name of the provider's context implementation(s), with each period (".") converted to a slash ("/").
For example, suppose a service provider defines a context implementation with class name com.sun.jndi.ldap.LdapCtx. The provider resource for this provider is named com/sun/jndi/ldap/jndiprovider.properties. If the class is not in a package, the resource's name is simply jndiprovider.properties.
Certain methods in the JNDI class library make use of the standard JNDI properties that specify lists of JNDI factories:
When an application is deployed, it will generally have several codebase directories and JARs in its classpath. Similarly, when an applet is deployed, it will have a codebase and archives specifying where to find the applet's classes. JNDI locates (using ClassLoader.getResources()) all application resource files named jndi.properties in the classpath. In addition, if the file java.home/lib/jndi.properties exists and is readable, JNDI treats it as an additional application resource file. (java.home indicates the directory named by the java.home system property.) All of the properties contained in these files are placed into the environment of the initial context. This environment is then inherited by other contexts.
For each property found in more than one application resource file, JNDI uses the first value found or, in a few cases where it makes sense to do so, it concatenates all of the values (details are given below). For example, if the "java.naming.factory.object" property is found in three jndi.properties resource files, the list of object factories is a concatenation of the property values from all three files. Using this scheme, each deployable component is responsible for listing the factories that it exports. JNDI automatically collects and uses all of these export lists when searching for factory classes.
Application resource files are available beginning with the Java 2 Platform, except that the file in java.home/lib may be used on earlier Java platforms as well.
When JNDI constructs an initial context, the context's environment is initialized with properties defined in the environment parameter passed to the constructor, the system properties, the applet parameters, and the application resource files. See InitialContext for details. This initial environment is then inherited by other context instances.
When the JNDI class library needs to determine the value of a property, it does so by merging the values from the following two sources, in order:
jndiprovider.properties) for the context being operated on. When a service provider needs to determine the value of a property, it will generally take that value directly from the environment. A service provider may define provider-specific properties to be placed in its own provider resource file. In that case it should merge values as described in the previous paragraph.
In this way, each service provider developer can specify a list of factories to use with that service provider. These can be modified by the application resources specified by the deployer of the application or applet, which in turn can be modified by the user.
Scott Seligman
R. Vasudevan
|
||||||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
Binds a name to an object.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
Composes the name of this context with a name relative to this context.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
Composes the name of this context with a name relative to this context.
Given a name ( For example, if this context is named "wiz.com" relative to the initial context, then
composeName("east", "wiz.com")
might return
composeName("user/jane", "org/research")
might return
composeName("user/jane", "research")
returns
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Creates and binds a new context.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Destroys the named context and removes it from the namespace.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
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
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
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||
|
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
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||
|
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,
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Retrieves the parser associated with the named context.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
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,
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Enumerates the names bound in the named context, along with the class names of objects bound to them.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Enumerates the names bound in the named context, along with the objects bound to them.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Retrieves the named object.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Retrieves the named object.
If
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Retrieves the named object, following links except for the terminal atomic component of the name.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Retrieves the named object, following links except for the terminal atomic component of the name.
If the object bound to
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
Binds a name to an object, overwriting any existing binding.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
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
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Removes an environment property from the environment of this context. See class description for more details on environment properties.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
Binds a new name to the object bound to an old name, and unbinds the old name.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||||||
|
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.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Unbinds the named object.
Reimplemented in javax::naming::InitialContext. |
|
||||||||||||||||
|
Unbinds the named object.
Removes the terminal atomic name in
This method is idempotent. It succeeds even if the terminal atomic name is not bound in the target context, but throws Any attributes associated with the name are removed. Intermediate contexts are not changed.
Reimplemented in javax::naming::InitialContext. |
|
|
Constant that holds the name of the environment property for specifying an applet for the initial context constructor to use when searching for other properties.
The value of this property is the The value of this constant is "java.naming.applet". |
|
|
Constant that holds the name of the environment property for specifying the authoritativeness of the service requested. If the value of the property is the string "true", it means that the access is to the most authoritative source (i.e. bypass any cache or replicas). If the value is anything else, the source need not be (but may be) authoritative. If unspecified, the value defaults to "false". The value of this constant is "java.naming.authoritative". |
|
|
Constant that holds the name of the environment property for specifying the batch size to use when returning data via the service's protocol. This is a hint to the provider to return the results of operations in batches of the specified size, so the provider can optimize its performance and usage of resources. The value of the property is the string representation of an integer. If unspecified, the batch size is determined by the service provider. The value of this constant is "java.naming.batchsize". |
|
|
Constant that holds the name of the environment property for specifying the DNS host and domain names to use for the JNDI URL context (for example, "dns://somehost/wiz.com"). This property may be specified in the environment, an applet parameter, a system property, or a resource file. If it is not specified in any of these sources and |