javax.naming
Interface Context

All Known Subinterfaces:
DirContext sample code for javax.naming.directory.DirContext definition code for javax.naming.directory.DirContext , EventContext sample code for javax.naming.event.EventContext definition code for javax.naming.event.EventContext , EventDirContext sample code for javax.naming.event.EventDirContext definition code for javax.naming.event.EventDirContext , LdapContext sample code for javax.naming.ldap.LdapContext definition code for javax.naming.ldap.LdapContext
All Known Implementing Classes:
InitialContext sample code for javax.naming.InitialContext definition code for javax.naming.InitialContext , InitialDirContext sample code for javax.naming.directory.InitialDirContext definition code for javax.naming.directory.InitialDirContext , InitialLdapContext sample code for javax.naming.ldap.InitialLdapContext definition code for javax.naming.ldap.InitialLdapContext

public interface Context

This interface represents a naming context, which consists of a set of name-to-object bindings. It contains methods for examining and updating these bindings.

Names

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.

Exceptions

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.

Concurrent Access

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 sample code for javax.naming.Context.lookup(javax.naming.Name) definition code for javax.naming.Context.lookup(javax.naming.Name) 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.

Parameters

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.

Environment Properties

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.

Resource Files

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 sample code for java.util.Properties.load(java.io.InputStream) definition code for java.util.Properties.load(java.io.InputStream) ), 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:

 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
 
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.

Provider Resource Files
Each service provider has an optional resource that lists properties specific to that provider. The name of this resource is:
[prefix/]jndiprovider.properties
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:

The JNDI library will consult the provider resource file when determining the values of these properties. Properties other than these may be set in the provider resource file at the discretion of the service provider. The service provider's documentation should clearly state which properties are allowed; other properties in the file will be ignored.
Application Resource Files
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() sample code for java.lang.ClassLoader.getResources(java.lang.String) definition code for java.lang.ClassLoader.getResources(java.lang.String) ) 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.

Search Algorithm for Properties
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:

  1. The environment of the context being operated on.
  2. The provider resource file (jndiprovider.properties) for the context being operated on.
For each property found in both of these two sources, JNDI determines the property's value as follows. If the property is one of the standard JNDI properties that specify a list of JNDI factories (listed above), the values are concatenated into a single colon-separated list. For other properties, only the first value found is used.

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.

Since:
1.3

Field Summary
static String sample code for java.lang.String definition code for java.lang.String APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.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.
static String sample code for java.lang.String definition code for java.lang.String AUTHORITATIVE sample code for javax.naming.Context.AUTHORITATIVE definition code for javax.naming.Context.AUTHORITATIVE
          Constant that holds the name of the environment property for specifying the authoritativeness of the service requested.
static String sample code for java.lang.String definition code for java.lang.String BATCHSIZE sample code for javax.naming.Context.BATCHSIZE definition code for javax.naming.Context.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.
static String sample code for java.lang.String definition code for java.lang.String DNS_URL sample code for javax.naming.Context.DNS_URL definition code for javax.naming.Context.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").
static String sample code for java.lang.String definition code for java.lang.String INITIAL_CONTEXT_FACTORY sample code for javax.naming.Context.INITIAL_CONTEXT_FACTORY definition code for javax.naming.Context.INITIAL_CONTEXT_FACTORY
          Constant that holds the name of the environment property for specifying the initial context factory to use.
static String sample code for java.lang.String definition code for java.lang.String LANGUAGE sample code for javax.naming.Context.LANGUAGE definition code for javax.naming.Context.LANGUAGE
          Constant that holds the name of the environment property for specifying the preferred language to use with the service.
static String sample code for java.lang.String definition code for java.lang.String OBJECT_FACTORIES sample code for javax.naming.Context.OBJECT_FACTORIES definition code for javax.naming.Context.OBJECT_FACTORIES
          Constant that holds the name of the environment property for specifying the list of object factories to use.
static String sample code for java.lang.String definition code for java.lang.String PROVIDER_URL sample code for javax.naming.Context.PROVIDER_URL definition code for javax.naming.Context.PROVIDER_URL
          Constant that holds the name of the environment property for specifying configuration information for the service provider to use.
static String sample code for java.lang.String definition code for java.lang.String REFERRAL sample code for javax.naming.Context.REFERRAL definition code for javax.naming.Context.REFERRAL
          Constant that holds the name of the environment property for specifying how referrals encountered by the service provider are to be processed.
static String sample code for java.lang.String definition code for java.lang.String SECURITY_AUTHENTICATION sample code for javax.naming.Context.SECURITY_AUTHENTICATION definition code for javax.naming.Context.SECURITY_AUTHENTICATION
          Constant that holds the name of the environment property for specifying the security level to use.
static String sample code for java.lang.String definition code for java.lang.String SECURITY_CREDENTIALS sample code for javax.naming.Context.SECURITY_CREDENTIALS definition code for javax.naming.Context.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.
static String sample code for java.lang.String definition code for java.lang.String SECURITY_PRINCIPAL sample code for javax.naming.Context.SECURITY_PRINCIPAL definition code for javax.naming.Context.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.
static String sample code for java.lang.String definition code for java.lang.String SECURITY_PROTOCOL sample code for javax.naming.Context.SECURITY_PROTOCOL definition code for javax.naming.Context.SECURITY_PROTOCOL
          Constant that holds the name of the environment property for specifying the security protocol to use.
static String sample code for java.lang.String definition code for java.lang.String STATE_FACTORIES sample code for javax.naming.Context.STATE_FACTORIES definition code for javax.naming.Context.STATE_FACTORIES
          Constant that holds the name of the environment property for specifying the list of state factories to use.
static String sample code for java.lang.String definition code for java.lang.String URL_PKG_PREFIXES sample code for javax.naming.Context.URL_PKG_PREFIXES definition code for javax.naming.Context.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.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object addToEnvironment sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) (String sample code for java.lang.String definition code for java.lang.String  propName, Object sample code for java.lang.Object definition code for java.lang.Object  propVal)
          Adds a new environment property to the environment of this context.
 void bind sample code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name, Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Binds a name to an object.
 void bind sample code for javax.naming.Context.bind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.bind(java.lang.String, java.lang.Object) (String sample code for java.lang.String definition code for java.lang.String  name, Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Binds a name to an object.
 void close sample code for javax.naming.Context.close() definition code for javax.naming.Context.close() ()
          Closes this context.
 Name sample code for javax.naming.Name definition code for javax.naming.Name composeName sample code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name, Name sample code for javax.naming.Name definition code for javax.naming.Name  prefix)
          Composes the name of this context with a name relative to this context.
 String sample code for java.lang.String definition code for java.lang.String composeName sample code for javax.naming.Context.composeName(java.lang.String, java.lang.String) definition code for javax.naming.Context.composeName(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  prefix)
          Composes the name of this context with a name relative to this context.
 Context sample code for javax.naming.Context definition code for javax.naming.Context createSubcontext sample code for javax.naming.Context.createSubcontext(javax.naming.Name) definition code for javax.naming.Context.createSubcontext(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Creates and binds a new context.
 Context sample code for javax.naming.Context definition code for javax.naming.Context createSubcontext sample code for javax.naming.Context.createSubcontext(java.lang.String) definition code for javax.naming.Context.createSubcontext(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Creates and binds a new context.
 void destroySubcontext sample code for javax.naming.Context.destroySubcontext(javax.naming.Name) definition code for javax.naming.Context.destroySubcontext(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Destroys the named context and removes it from the namespace.
 void destroySubcontext sample code for javax.naming.Context.destroySubcontext(java.lang.String) definition code for javax.naming.Context.destroySubcontext(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Destroys the named context and removes it from the namespace.
 Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable <?,?> getEnvironment sample code for javax.naming.Context.getEnvironment() definition code for javax.naming.Context.getEnvironment() ()
          Retrieves the environment in effect for this context.
 String sample code for java.lang.String definition code for java.lang.String getNameInNamespace sample code for javax.naming.Context.getNameInNamespace() definition code for javax.naming.Context.getNameInNamespace() ()
          Retrieves the full name of this context within its own namespace.
 NameParser sample code for javax.naming.NameParser definition code for javax.naming.NameParser getNameParser sample code for javax.naming.Context.getNameParser(javax.naming.Name) definition code for javax.naming.Context.getNameParser(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Retrieves the parser associated with the named context.
 NameParser sample code for javax.naming.NameParser definition code for javax.naming.NameParser getNameParser sample code for javax.naming.Context.getNameParser(java.lang.String) definition code for javax.naming.Context.getNameParser(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Retrieves the parser associated with the named context.
 NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <NameClassPair sample code for javax.naming.NameClassPair definition code for javax.naming.NameClassPair > list sample code for javax.naming.Context.list(javax.naming.Name) definition code for javax.naming.Context.list(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Enumerates the names bound in the named context, along with the class names of objects bound to them.
 NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <NameClassPair sample code for javax.naming.NameClassPair definition code for javax.naming.NameClassPair > list sample code for javax.naming.Context.list(java.lang.String) definition code for javax.naming.Context.list(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Enumerates the names bound in the named context, along with the class names of objects bound to them.
 NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <Binding sample code for javax.naming.Binding definition code for javax.naming.Binding > listBindings sample code for javax.naming.Context.listBindings(javax.naming.Name) definition code for javax.naming.Context.listBindings(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Enumerates the names bound in the named context, along with the objects bound to them.
 NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <Binding sample code for javax.naming.Binding definition code for javax.naming.Binding > listBindings sample code for javax.naming.Context.listBindings(java.lang.String) definition code for javax.naming.Context.listBindings(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Enumerates the names bound in the named context, along with the objects bound to them.
 Object sample code for java.lang.Object definition code for java.lang.Object lookup sample code for javax.naming.Context.lookup(javax.naming.Name) definition code for javax.naming.Context.lookup(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Retrieves the named object.
 Object sample code for java.lang.Object definition code for java.lang.Object lookup sample code for javax.naming.Context.lookup(java.lang.String) definition code for javax.naming.Context.lookup(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Retrieves the named object.
 Object sample code for java.lang.Object definition code for java.lang.Object lookupLink sample code for javax.naming.Context.lookupLink(javax.naming.Name) definition code for javax.naming.Context.lookupLink(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Retrieves the named object, following links except for the terminal atomic component of the name.
 Object sample code for java.lang.Object definition code for java.lang.Object lookupLink sample code for javax.naming.Context.lookupLink(java.lang.String) definition code for javax.naming.Context.lookupLink(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Retrieves the named object, following links except for the terminal atomic component of the name.
 void rebind sample code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name, Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Binds a name to an object, overwriting any existing binding.
 void rebind sample code for javax.naming.Context.rebind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.rebind(java.lang.String, java.lang.Object) (String sample code for java.lang.String definition code for java.lang.String  name, Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Binds a name to an object, overwriting any existing binding.
 Object sample code for java.lang.Object definition code for java.lang.Object removeFromEnvironment sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  propName)
          Removes an environment property from the environment of this context.
 void rename sample code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  oldName, Name sample code for javax.naming.Name definition code for javax.naming.Name  newName)
          Binds a new name to the object bound to an old name, and unbinds the old name.
 void rename sample code for javax.naming.Context.rename(java.lang.String, java.lang.String) definition code for javax.naming.Context.rename(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  oldName, String sample code for java.lang.String definition code for java.lang.String  newName)
          Binds a new name to the object bound to an old name, and unbinds the old name.
 void unbind sample code for javax.naming.Context.unbind(javax.naming.Name) definition code for javax.naming.Context.unbind(javax.naming.Name) (Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
          Unbinds the named object.
 void unbind sample code for javax.naming.Context.unbind(java.lang.String) definition code for javax.naming.Context.unbind(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Unbinds the named object.
 

Field Detail

INITIAL_CONTEXT_FACTORY sample code for javax.naming.Context.INITIAL_CONTEXT_FACTORY

static final String sample code for java.lang.String definition code for java.lang.String  INITIAL_CONTEXT_FACTORY
Constant that holds the name of the environment property for specifying the initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context. This property may be specified in the environment parameter passed to the initial context constructor, an applet parameter, a system property, or an application resource file. If it is not specified in any of these sources, NoInitialContextException is thrown when an initial context is required to complete an operation.

The value of this constant is "java.naming.factory.initial".

See Also:
InitialContext sample code for javax.naming.InitialContext definition code for javax.naming.InitialContext , InitialDirContext sample code for javax.naming.directory.InitialDirContext definition code for javax.naming.directory.InitialDirContext , NamingManager.getInitialContext(java.util.Hashtable) sample code for javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable) definition code for javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable) , InitialContextFactory sample code for javax.naming.spi.InitialContextFactory definition code for javax.naming.spi.InitialContextFactory , NoInitialContextException sample code for javax.naming.NoInitialContextException definition code for javax.naming.NoInitialContextException , addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.APPLET , Constant Field Values

OBJECT_FACTORIES sample code for javax.naming.Context.OBJECT_FACTORIES

static final String sample code for java.lang.String definition code for java.lang.String  OBJECT_FACTORIES
Constant that holds the name of the environment property for specifying the list of object factories to use. The value of the property should be a colon-separated list of the fully qualified class names of factory classes that will create an object given information about the object. This property may be specified in the environment, an applet parameter, a system property, or one or more resource files.

The value of this constant is "java.naming.factory.object".

See Also:
NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) sample code for javax.naming.spi.NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) definition code for javax.naming.spi.NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) , ObjectFactory sample code for javax.naming.spi.ObjectFactory definition code for javax.naming.spi.ObjectFactory , addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.APPLET , Constant Field Values

STATE_FACTORIES sample code for javax.naming.Context.STATE_FACTORIES

static final String sample code for java.lang.String definition code for java.lang.String  STATE_FACTORIES
Constant that holds the name of the environment property for specifying the list of state factories to use. The value of the property should be a colon-separated list of the fully qualified class names of state factory classes that will be used to get an object's state given the object itself. This property may be specified in the environment, an applet parameter, a system property, or one or more resource files.

The value of this constant is "java.naming.factory.state".

Since:
1.3
See Also:
NamingManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) sample code for javax.naming.spi.NamingManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) definition code for javax.naming.spi.NamingManager.getStateToBind(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) , StateFactory sample code for javax.naming.spi.StateFactory definition code for javax.naming.spi.StateFactory , addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.APPLET , Constant Field Values

URL_PKG_PREFIXES sample code for javax.naming.Context.URL_PKG_PREFIXES

static final String sample code for java.lang.String definition code for 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. The value of the property should be a colon-separated list of package prefixes for the class name of the factory class that will create a URL context factory. This property may be specified in the environment, an applet parameter, a system property, or one or more resource files. The prefix com.sun.jndi.url is always appended to the possibly empty list of package prefixes.

The value of this constant is "java.naming.factory.url.pkgs".

See Also:
NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) sample code for javax.naming.spi.NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) definition code for javax.naming.spi.NamingManager.getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable) , NamingManager.getURLContext(java.lang.String, java.util.Hashtable) sample code for javax.naming.spi.NamingManager.getURLContext(java.lang.String, java.util.Hashtable) definition code for javax.naming.spi.NamingManager.getURLContext(java.lang.String, java.util.Hashtable) , ObjectFactory sample code for javax.naming.spi.ObjectFactory definition code for javax.naming.spi.ObjectFactory , addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.APPLET , Constant Field Values

PROVIDER_URL sample code for javax.naming.Context.PROVIDER_URL

static final String sample code for java.lang.String definition code for java.lang.String  PROVIDER_URL
Constant that holds the name of the environment property for specifying configuration information for the service provider to use. The value of the property should contain a URL string (e.g. "ldap://somehost:389"). 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, the default configuration is determined by the service provider.

The value of this constant is "java.naming.provider.url".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , APPLET sample code for javax.naming.Context.APPLET definition code for javax.naming.Context.APPLET , Constant Field Values

DNS_URL sample code for javax.naming.Context.DNS_URL

static final String sample code for java.lang.String definition code for 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"). 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 the program attempts to use a JNDI URL containing a DNS name, a ConfigurationException will be thrown.

The value of this constant is "java.naming.dns.url".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

AUTHORITATIVE sample code for javax.naming.Context.AUTHORITATIVE

static final String sample code for java.lang.String definition code for java.lang.String  AUTHORITATIVE
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".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

BATCHSIZE sample code for javax.naming.Context.BATCHSIZE

static final String sample code for java.lang.String definition code for 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. 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".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

REFERRAL sample code for javax.naming.Context.REFERRAL

static final String sample code for java.lang.String definition code for 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. The value of the property is one of the following strings:
"follow"
follow referrals automatically
"ignore"
ignore referrals
"throw"
throw ReferralException when a referral is encountered.
If this property is not specified, the default is determined by the provider.

The value of this constant is "java.naming.referral".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

SECURITY_PROTOCOL sample code for javax.naming.Context.SECURITY_PROTOCOL

static final String sample code for java.lang.String definition code for java.lang.String  SECURITY_PROTOCOL
Constant that holds the name of the environment property for specifying the security protocol to use. Its value is a string determined by the service provider (e.g. "ssl"). If this property is unspecified, the behaviour is determined by the service provider.

The value of this constant is "java.naming.security.protocol".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

SECURITY_AUTHENTICATION sample code for javax.naming.Context.SECURITY_AUTHENTICATION

static final String sample code for java.lang.String definition code for java.lang.String  SECURITY_AUTHENTICATION
Constant that holds the name of the environment property for specifying the security level to use. Its value is one of the following strings: "none", "simple", "strong". If this property is unspecified, the behaviour is determined by the service provider.

The value of this constant is "java.naming.security.authentication".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

SECURITY_PRINCIPAL sample code for javax.naming.Context.SECURITY_PRINCIPAL

static final String sample code for java.lang.String definition code for 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. The format of the principal depends on the authentication scheme. If this property is unspecified, the behaviour is determined by the service provider.

The value of this constant is "java.naming.security.principal".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

SECURITY_CREDENTIALS sample code for javax.naming.Context.SECURITY_CREDENTIALS

static final String sample code for java.lang.String definition code for 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. The value of the property depends on the authentication scheme. For example, it could be a hashed password, clear-text password, key, certificate, and so on. If this property is unspecified, the behaviour is determined by the service provider.

The value of this constant is "java.naming.security.credentials".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

LANGUAGE sample code for javax.naming.Context.LANGUAGE

static final String sample code for java.lang.String definition code for java.lang.String  LANGUAGE
Constant that holds the name of the environment property for specifying the preferred language to use with the service. The value of the property is a colon-separated list of language tags as defined in RFC 1766. If this property is unspecified, the language preference is determined by the service provider.

The value of this constant is "java.naming.language".

See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , Constant Field Values

APPLET sample code for javax.naming.Context.APPLET

static final String sample code for java.lang.String definition code for 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. The value of this property is the java.applet.Applet instance that is being executed. This property may be specified in the environment parameter passed to the initial context constructor. When this property is set, each property that the initial context constructor looks for in the system properties is first looked for in the applet's parameter list. If this property is unspecified, the initial context constructor will search for properties only in the environment parameter passed to it, the system properties, and application resource files.

The value of this constant is "java.naming.applet".

Since:
1.3
See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String) , InitialContext sample code for javax.naming.InitialContext definition code for javax.naming.InitialContext , Constant Field Values
Method Detail

lookup sample code for javax.naming.Context.lookup(javax.naming.Name) definition code for javax.naming.Context.lookup(javax.naming.Name)

Object sample code for java.lang.Object definition code for java.lang.Object  lookup(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
              throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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).

Parameters:
name - the name of the object to look up
Returns:
the object bound to name
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
lookup(String) sample code for javax.naming.Context.lookup(java.lang.String) definition code for javax.naming.Context.lookup(java.lang.String) , lookupLink(Name) sample code for javax.naming.Context.lookupLink(javax.naming.Name) definition code for javax.naming.Context.lookupLink(javax.naming.Name)

lookup sample code for javax.naming.Context.lookup(java.lang.String) definition code for javax.naming.Context.lookup(java.lang.String)

Object sample code for java.lang.Object definition code for java.lang.Object  lookup(String sample code for java.lang.String definition code for java.lang.String  name)
              throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Retrieves the named object. See lookup(Name) sample code for javax.naming.Context.lookup(javax.naming.Name) definition code for javax.naming.Context.lookup(javax.naming.Name) for details.

Parameters:
name - the name of the object to look up
Returns:
the object bound to name
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

bind sample code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object)

void bind(Name sample code for javax.naming.Name definition code for javax.naming.Name  name,
          Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if name is already bound
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if object did not supply all mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
bind(String, Object) sample code for javax.naming.Context.bind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.bind(java.lang.String, java.lang.Object) , rebind(Name, Object) sample code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) , DirContext.bind(Name, Object, javax.naming.directory.Attributes) sample code for javax.naming.directory.DirContext.bind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes) definition code for javax.naming.directory.DirContext.bind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes)

bind sample code for javax.naming.Context.bind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.bind(java.lang.String, java.lang.Object)

void bind(String sample code for java.lang.String definition code for java.lang.String  name,
          Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Binds a name to an object. See bind(Name, Object) sample code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) for details.

Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if name is already bound
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if object did not supply all mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

rebind sample code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object)

void rebind(Name sample code for javax.naming.Name definition code for javax.naming.Name  name,
            Object sample code for java.lang.Object definition code for java.lang.Object  obj)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if object did not supply all mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
rebind(String, Object) sample code for javax.naming.Context.rebind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.rebind(java.lang.String, java.lang.Object) , bind(Name, Object) sample code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) , DirContext.rebind(Name, Object, javax.naming.directory.Attributes) sample code for javax.naming.directory.DirContext.rebind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes) definition code for javax.naming.directory.DirContext.rebind(javax.naming.Name, java.lang.Object, javax.naming.directory.Attributes) , DirContext sample code for javax.naming.directory.DirContext definition code for javax.naming.directory.DirContext

rebind sample code for javax.naming.Context.rebind(java.lang.String, java.lang.Object) definition code for javax.naming.Context.rebind(java.lang.String, java.lang.Object)

void rebind(String sample code for java.lang.String definition code for java.lang.String  name,
            Object sample code for java.lang.Object definition code for java.lang.Object  obj)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Binds a name to an object, overwriting any existing binding. See rebind(Name, Object) sample code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) for details.

Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if object did not supply all mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

unbind sample code for javax.naming.Context.unbind(javax.naming.Name) definition code for javax.naming.Context.unbind(javax.naming.Name)

void unbind(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name to unbind; may not be empty
Throws:
NameNotFoundException sample code for javax.naming.NameNotFoundException definition code for javax.naming.NameNotFoundException - if an intermediate context does not exist
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
unbind(String) sample code for javax.naming.Context.unbind(java.lang.String) definition code for javax.naming.Context.unbind(java.lang.String)

unbind sample code for javax.naming.Context.unbind(java.lang.String) definition code for javax.naming.Context.unbind(java.lang.String)

void unbind(String sample code for java.lang.String definition code for java.lang.String  name)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Unbinds the named object. See unbind(Name) sample code for javax.naming.Context.unbind(javax.naming.Name) definition code for javax.naming.Context.unbind(javax.naming.Name) for details.

Parameters:
name - the name to unbind; may not be empty
Throws:
NameNotFoundException sample code for javax.naming.NameNotFoundException definition code for javax.naming.NameNotFoundException - if an intermediate context does not exist
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

rename sample code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name)

void rename(Name sample code for javax.naming.Name definition code for javax.naming.Name  oldName,
            Name sample code for javax.naming.Name definition code for javax.naming.Name  newName)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
oldName - the name of the existing binding; may not be empty
newName - the name of the new binding; may not be empty
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if newName is already bound
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
rename(String, String) sample code for javax.naming.Context.rename(java.lang.String, java.lang.String) definition code for javax.naming.Context.rename(java.lang.String, java.lang.String) , bind(Name, Object) sample code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.bind(javax.naming.Name, java.lang.Object) , rebind(Name, Object) sample code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object) definition code for javax.naming.Context.rebind(javax.naming.Name, java.lang.Object)

rename sample code for javax.naming.Context.rename(java.lang.String, java.lang.String) definition code for javax.naming.Context.rename(java.lang.String, java.lang.String)

void rename(String sample code for java.lang.String definition code for java.lang.String  oldName,
            String sample code for java.lang.String definition code for java.lang.String  newName)
            throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Binds a new name to the object bound to an old name, and unbinds the old name. See rename(Name, Name) sample code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.rename(javax.naming.Name, javax.naming.Name) for details.

Parameters:
oldName - the name of the existing binding; may not be empty
newName - the name of the new binding; may not be empty
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if newName is already bound
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

list sample code for javax.naming.Context.list(javax.naming.Name) definition code for javax.naming.Context.list(javax.naming.Name)

NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <NameClassPair sample code for javax.naming.NameClassPair definition code for javax.naming.NameClassPair > list(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                                      throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name of the context to list
Returns:
an enumeration of the names and class names of the bindings in this context. Each element of the enumeration is of type NameClassPair.
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
list(String) sample code for javax.naming.Context.list(java.lang.String) definition code for javax.naming.Context.list(java.lang.String) , listBindings(Name) sample code for javax.naming.Context.listBindings(javax.naming.Name) definition code for javax.naming.Context.listBindings(javax.naming.Name) , NameClassPair sample code for javax.naming.NameClassPair definition code for javax.naming.NameClassPair

list sample code for javax.naming.Context.list(java.lang.String) definition code for javax.naming.Context.list(java.lang.String)

NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <NameClassPair sample code for javax.naming.NameClassPair definition code for javax.naming.NameClassPair > list(String sample code for java.lang.String definition code for java.lang.String  name)
                                      throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Enumerates the names bound in the named context, along with the class names of objects bound to them. See list(Name) sample code for javax.naming.Context.list(javax.naming.Name) definition code for javax.naming.Context.list(javax.naming.Name) for details.

Parameters:
name - the name of the context to list
Returns:
an enumeration of the names and class names of the bindings in this context. Each element of the enumeration is of type NameClassPair.
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

listBindings sample code for javax.naming.Context.listBindings(javax.naming.Name) definition code for javax.naming.Context.listBindings(javax.naming.Name)

NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <Binding sample code for javax.naming.Binding definition code for javax.naming.Binding > listBindings(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                                        throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name of the context to list
Returns:
an enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
listBindings(String) sample code for javax.naming.Context.listBindings(java.lang.String) definition code for javax.naming.Context.listBindings(java.lang.String) , list(Name) sample code for javax.naming.Context.list(javax.naming.Name) definition code for javax.naming.Context.list(javax.naming.Name) , Binding sample code for javax.naming.Binding definition code for javax.naming.Binding

listBindings sample code for javax.naming.Context.listBindings(java.lang.String) definition code for javax.naming.Context.listBindings(java.lang.String)

NamingEnumeration sample code for javax.naming.NamingEnumeration definition code for javax.naming.NamingEnumeration <Binding sample code for javax.naming.Binding definition code for javax.naming.Binding > listBindings(String sample code for java.lang.String definition code for java.lang.String  name)
                                        throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Enumerates the names bound in the named context, along with the objects bound to them. See listBindings(Name) sample code for javax.naming.Context.listBindings(javax.naming.Name) definition code for javax.naming.Context.listBindings(javax.naming.Name) for details.

Parameters:
name - the name of the context to list
Returns:
an enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

destroySubcontext sample code for javax.naming.Context.destroySubcontext(javax.naming.Name) definition code for javax.naming.Context.destroySubcontext(javax.naming.Name)

void destroySubcontext(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                       throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name of the context to be destroyed; may not be empty
Throws:
NameNotFoundException sample code for javax.naming.NameNotFoundException definition code for javax.naming.NameNotFoundException - if an intermediate context does not exist
NotContextException sample code for javax.naming.NotContextException definition code for javax.naming.NotContextException - if the name is bound but does not name a context, or does not name a context of the appropriate type
ContextNotEmptyException sample code for javax.naming.ContextNotEmptyException definition code for javax.naming.ContextNotEmptyException - if the named context is not empty
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
destroySubcontext(String) sample code for javax.naming.Context.destroySubcontext(java.lang.String) definition code for javax.naming.Context.destroySubcontext(java.lang.String)

destroySubcontext sample code for javax.naming.Context.destroySubcontext(java.lang.String) definition code for javax.naming.Context.destroySubcontext(java.lang.String)

void destroySubcontext(String sample code for java.lang.String definition code for java.lang.String  name)
                       throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Destroys the named context and removes it from the namespace. See destroySubcontext(Name) sample code for javax.naming.Context.destroySubcontext(javax.naming.Name) definition code for javax.naming.Context.destroySubcontext(javax.naming.Name) for details.

Parameters:
name - the name of the context to be destroyed; may not be empty
Throws:
NameNotFoundException sample code for javax.naming.NameNotFoundException definition code for javax.naming.NameNotFoundException - if an intermediate context does not exist
NotContextException sample code for javax.naming.NotContextException definition code for javax.naming.NotContextException - if the name is bound but does not name a context, or does not name a context of the appropriate type
ContextNotEmptyException sample code for javax.naming.ContextNotEmptyException definition code for javax.naming.ContextNotEmptyException - if the named context is not empty
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

createSubcontext sample code for javax.naming.Context.createSubcontext(javax.naming.Name) definition code for javax.naming.Context.createSubcontext(javax.naming.Name)

Context sample code for javax.naming.Context definition code for javax.naming.Context  createSubcontext(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                         throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name of the context to create; may not be empty
Returns:
the newly created context
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if name is already bound
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if creation of the subcontext requires specification of mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
createSubcontext(String) sample code for javax.naming.Context.createSubcontext(java.lang.String) definition code for javax.naming.Context.createSubcontext(java.lang.String) , DirContext.createSubcontext(javax.naming.Name, javax.naming.directory.Attributes) sample code for javax.naming.directory.DirContext.createSubcontext(javax.naming.Name, javax.naming.directory.Attributes) definition code for javax.naming.directory.DirContext.createSubcontext(javax.naming.Name, javax.naming.directory.Attributes)

createSubcontext sample code for javax.naming.Context.createSubcontext(java.lang.String) definition code for javax.naming.Context.createSubcontext(java.lang.String)

Context sample code for javax.naming.Context definition code for javax.naming.Context  createSubcontext(String sample code for java.lang.String definition code for java.lang.String  name)
                         throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Creates and binds a new context. See createSubcontext(Name) sample code for javax.naming.Context.createSubcontext(javax.naming.Name) definition code for javax.naming.Context.createSubcontext(javax.naming.Name) for details.

Parameters:
name - the name of the context to create; may not be empty
Returns:
the newly created context
Throws:
NameAlreadyBoundException sample code for javax.naming.NameAlreadyBoundException definition code for javax.naming.NameAlreadyBoundException - if name is already bound
InvalidAttributesException sample code for javax.naming.directory.InvalidAttributesException definition code for javax.naming.directory.InvalidAttributesException - if creation of the subcontext requires specification of mandatory attributes
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

lookupLink sample code for javax.naming.Context.lookupLink(javax.naming.Name) definition code for javax.naming.Context.lookupLink(javax.naming.Name)

Object sample code for java.lang.Object definition code for java.lang.Object  lookupLink(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                  throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Parameters:
name - the name of the object to look up
Returns:
the object bound to name, not following the terminal link (if any).
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
lookupLink(String) sample code for javax.naming.Context.lookupLink(java.lang.String) definition code for javax.naming.Context.lookupLink(java.lang.String)

lookupLink sample code for javax.naming.Context.lookupLink(java.lang.String) definition code for javax.naming.Context.lookupLink(java.lang.String)

Object sample code for java.lang.Object definition code for java.lang.Object  lookupLink(String sample code for java.lang.String definition code for java.lang.String  name)
                  throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Retrieves the named object, following links except for the terminal atomic component of the name. See lookupLink(Name) sample code for javax.naming.Context.lookupLink(javax.naming.Name) definition code for javax.naming.Context.lookupLink(javax.naming.Name) for details.

Parameters:
name - the name of the object to look up
Returns:
the object bound to name, not following the terminal link (if any)
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

getNameParser sample code for javax.naming.Context.getNameParser(javax.naming.Name) definition code for javax.naming.Context.getNameParser(javax.naming.Name)

NameParser sample code for javax.naming.NameParser definition code for javax.naming.NameParser  getNameParser(Name sample code for javax.naming.Name definition code for javax.naming.Name  name)
                         throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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).

Parameters:
name - the name of the context from which to get the parser
Returns:
a name parser that can parse compound names into their atomic components
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
getNameParser(String) sample code for javax.naming.Context.getNameParser(java.lang.String) definition code for javax.naming.Context.getNameParser(java.lang.String) , CompoundName sample code for javax.naming.CompoundName definition code for javax.naming.CompoundName

getNameParser sample code for javax.naming.Context.getNameParser(java.lang.String) definition code for javax.naming.Context.getNameParser(java.lang.String)

NameParser sample code for javax.naming.NameParser definition code for javax.naming.NameParser  getNameParser(String sample code for java.lang.String definition code for java.lang.String  name)
                         throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Retrieves the parser associated with the named context. See getNameParser(Name) sample code for javax.naming.Context.getNameParser(javax.naming.Name) definition code for javax.naming.Context.getNameParser(javax.naming.Name) for details.

Parameters:
name - the name of the context from which to get the parser
Returns:
a name parser that can parse compound names into their atomic components
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

composeName sample code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name)

Name sample code for javax.naming.Name definition code for javax.naming.Name  composeName(Name sample code for javax.naming.Name definition code for javax.naming.Name  name,
                 Name sample code for javax.naming.Name definition code for javax.naming.Name  prefix)
                 throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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".

Parameters:
name - a name relative to this context
prefix - the name of this context relative to one of its ancestors
Returns:
the composition of prefix and name
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
composeName(String, String) sample code for javax.naming.Context.composeName(java.lang.String, java.lang.String) definition code for javax.naming.Context.composeName(java.lang.String, java.lang.String)

composeName sample code for javax.naming.Context.composeName(java.lang.String, java.lang.String) definition code for javax.naming.Context.composeName(java.lang.String, java.lang.String)

String sample code for java.lang.String definition code for java.lang.String  composeName(String sample code for java.lang.String definition code for java.lang.String  name,
                   String sample code for java.lang.String definition code for java.lang.String  prefix)
                   throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Composes the name of this context with a name relative to this context. See composeName(Name, Name) sample code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name) definition code for javax.naming.Context.composeName(javax.naming.Name, javax.naming.Name) for details.

Parameters:
name - a name relative to this context
prefix - the name of this context relative to one of its ancestors
Returns:
the composition of prefix and name
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

addToEnvironment sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object)

Object sample code for java.lang.Object definition code for java.lang.Object  addToEnvironment(String sample code for java.lang.String definition code for java.lang.String  propName,
                        Object sample code for java.lang.Object definition code for java.lang.Object  propVal)
                        throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
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.

Parameters:
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
Returns:
the previous value of the property, or null if the property was not in the environment before
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
getEnvironment() sample code for javax.naming.Context.getEnvironment() definition code for javax.naming.Context.getEnvironment() , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String)

removeFromEnvironment sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String)

Object sample code for java.lang.Object definition code for java.lang.Object  removeFromEnvironment(String sample code for java.lang.String definition code for java.lang.String  propName)
                             throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException 
Removes an environment property from the environment of this context. See class description for more details on environment properties.

Parameters:
propName - the name of the environment property to remove; may not be null
Returns:
the previous value of the property, or null if the property was not in the environment
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
getEnvironment() sample code for javax.naming.Context.getEnvironment() definition code for javax.naming.Context.getEnvironment() , addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object)

getEnvironment sample code for javax.naming.Context.getEnvironment() definition code for javax.naming.Context.getEnvironment()

Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable <?,?> getEnvironment()
                              throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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().

Returns:
the environment of this context; never null
Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
See Also:
addToEnvironment(String, Object) sample code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) definition code for javax.naming.Context.addToEnvironment(java.lang.String, java.lang.Object) , removeFromEnvironment(String) sample code for javax.naming.Context.removeFromEnvironment(java.lang.String) definition code for javax.naming.Context.removeFromEnvironment(java.lang.String)

close sample code for javax.naming.Context.close() definition code for javax.naming.Context.close()

void close()
           throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Throws:
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered

getNameInNamespace sample code for javax.naming.Context.getNameInNamespace() definition code for javax.naming.Context.getNameInNamespace()

String sample code for java.lang.String definition code for java.lang.String  getNameInNamespace()
                          throws NamingException sample code for javax.naming.NamingException definition code for javax.naming.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.

Returns:
this context's name in its own namespace; never null
Throws:
OperationNotSupportedException sample code for javax.naming.OperationNotSupportedException definition code for javax.naming.OperationNotSupportedException - if the naming system does not have the notion of a full name
NamingException sample code for javax.naming.NamingException definition code for javax.naming.NamingException - if a naming exception is encountered
Since:
1.3