All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.naming.InitialContext

java.lang.Object
   |
   +----java.naming.InitialContext

public class InitialContext
extends Object
implements Context
All naming operations are relative to a context. The initial context implements the Context interface and provides the starting point for resolution of names. The initial context implementation is determined at runtime. The default policy uses the system property "jndi.initialContextFactory", which contains the class name of the initial context factory. For methods in the Context interface that accept string names with URL syntax (:), passing a URL string to these methods in the initial context results in the use of the URL's scheme id to locate the context factory for handling that scheme. This default policy of locating the initial context can be overridden by calling java.naming.spi.NamingManager.setInitialContextFactoryBuilder().

See Also:
Context, setInitialContextFactoryBuilder

Variable Index

 o defaultInitCtx
 o gotDefault
 o myProps

Constructor Index

 o InitialContext()
Constructs an initial context.
 o InitialContext(Properties)
Constructs an initial context using information supplied in 'environment'.

Method Index

 o bind(Name, Object)
Binds 'name' to the object 'obj'.
 o bind(String, Object)
Binds 'name' to the object 'obj'.
 o createSubcontext(Name)
Creates a new context with the given name resolved relative to this initial context and bind it in the target context (that named by all but terminal atomic component of the name).
 o createSubcontext(String)
Creates a new context with the given name resolved relative to this initial context and bind it in the target context (that named by all but terminal component of the name).
 o destroySubcontext(Name)
Destory the named context and remove it from the namespace.
 o destroySubcontext(String)
Destory the named context and remove it from the namespace.
 o getEnvironment()
Retrieves the environment properties in effect for the initial context.
 o getNameParser(Name)
Retrieves the parser associated with the named context.
 o getNameParser(String)
Retrieves the parser associated with the named context.
 o getURLScheme(String)
 o list(Name)
Enumerates the atomic names and the class names of their bound objects in the context named relative to this initial context.
 o list(String)
Enumerates the atomic names and the class names of their bound objects in the context named relative to this initial context.
 o listBindings(Name)
Enumerates the atomic names and their bound objects in the context named relative to this initial context.
 o listBindings(String)
Enumerates the atomic names and their bound objects in the context named relative to this initial context.
 o lookup(Name)
Retrieves the object bound to 'name' resolved relative to this initial context.
 o lookup(String)
Retrieves the object bound to 'name' resolved relative to the initial context.
 o lookupLink(Name)
Looks up 'name' relative to this initial context, following links except for the last atomic part of name.
 o lookupLink(String)
Looks up 'name' relative to this initial context, following links except for the last atomic part of name.
 o rebind(Name, Object)
Binds 'name' to the object 'obj'.
 o rebind(String, Object)
Binds 'name' to the object 'obj'.
 o rename(Name, Name)
Binds 'newName' to the object bound to 'oldName'.
 o rename(String, String)
Binds 'newName' to the object bound to 'oldName'.
 o setEnvironment(Properties)
Changes the environment properties of the initial context to be those specified by envProps.
 o unbind(Name)
Unbinds 'name' resolved relative to this initial context.
 o unbind(String)
Unbinds 'name' resolved relative to this initial context.

Variables

 o myProps
 protected Properties myProps
 o defaultInitCtx
 protected Context defaultInitCtx
 o gotDefault
 protected boolean gotDefault

Constructors

 o InitialContext
 public InitialContext()
Constructs an initial context.

 o InitialContext
 public InitialContext(Properties environment)
Constructs an initial context using information supplied in 'environment'.

Parameters:
environment - Environment properties that may be used in the construction of the initial context (such as user name, password, etc.)

Methods

 o getURLScheme
 protected static String getURLScheme(String str)
 o lookup
 public Object lookup(String name) throws NamingException
Retrieves the object bound to 'name' resolved relative to the initial context.

Parameters:
name - The string name to lookup.
Returns:
The object bound to 'name'.
 o lookup
 public Object lookup(Name name) throws NamingException
Retrieves the object bound to 'name' resolved relative to this initial context.

Parameters:
name - The name to lookup.
Returns:
The object bound to 'name'.
 o bind
 public void bind(String name,
                  Object obj) throws NamingException
Binds 'name' to the object 'obj'.

Parameters:
name - The string name to bind. name is resolved relative to this initial context.
Throws: NameAlreadyBoundException
If name is already bound.
 o bind
 public void bind(Name name,
                  Object obj) throws NamingException
Binds 'name' to the object 'obj'.

Parameters:
name - The name to bind. name is resolved relative to this initial context.
Throws: NameAlreadyBoundException
If name is already bound.
 o rebind
 public void rebind(String name,
                    Object obj) throws NamingException
Binds 'name' to the object 'obj'. If name is already bound, overwrite the existing binding.

Parameters:
name - The string name to bind. name is resolved relative to this initial context.
 o rebind
 public void rebind(Name name,
                    Object obj) throws NamingException
Binds 'name' to the object 'obj'. If name is already bound, overwrite the existing binding.

Parameters:
name - The name to bind. name is resolved relative to this initial context.
 o unbind
 public void unbind(String name) throws NamingException
Unbinds 'name' resolved relative to this initial context.

Parameters:
name - The string name to unbind. name is resolved relative to this initial context.
 o unbind
 public void unbind(Name name) throws NamingException
Unbinds 'name' resolved relative to this initial context.

Parameters:
name - The name to unbind. name is resolved relative to this initial context.
 o rename
 public void rename(String oldName,
                    String newName) throws NamingException
Binds 'newName' to the object bound to 'oldName'.

Parameters:
oldName - The string name of the existing binding. oldName is resolved relative to this initial context.
newName - The string name of the new binding. newName is resolved relative to the target context (i.e. the context in which oldName is bound).
 o rename
 public void rename(Name oldName,
                    Name newName) throws NamingException
Binds 'newName' to the object bound to 'oldName'.

Parameters:
oldName - The name of the existing binding. oldName is resolved relative to this initial context.
newName - The name of the new binding. newName is resolved relative to the target context (i.e. the context in which oldName is bound).
 o list
 public NameClassEnumeration list(String name) throws NamingException
Enumerates the atomic names and the class names of their bound objects in the context named relative to this initial context.

Parameters:
name - The string name of the context to list.
Returns:
An enumeration of the atomic names and class names of the bindings in this context.
 o list
 public NameClassEnumeration list(Name name) throws NamingException
Enumerates the atomic names and the class names of their bound objects in the context named relative to this initial context.

Parameters:
name - The name of the context to list.
Returns:
An enumeration of the atomic names and class names of the bindings in this context.
 o listBindings
 public BindingEnumeration listBindings(String name) throws NamingException
Enumerates the atomic names and their bound objects in the context named relative to this initial context.

Parameters:
name - The string name of the context to list.
Returns:
An enumeration of the atomic names and their bound objects.
 o listBindings
 public BindingEnumeration listBindings(Name name) throws NamingException
Enumerates the atomic names and their bound objects in the context named relative to this initial context.

Parameters:
name - The name of the context to list.
Returns:
An enumeration of the atomic names and their bound objects.
 o destroySubcontext
 public void destroySubcontext(String name) throws NamingException
Destory the named context and remove it from the namespace.

Parameters:
name - The string name of the context to be destroyed; it is resolved relative to this initial context.
 o destroySubcontext
 public void destroySubcontext(Name name) throws NamingException
Destory the named context and remove it from the namespace.

Parameters:
name - The name of the context to be destroyed; it is resolved relative to this initial context.
 o createSubcontext
 public Context createSubcontext(String name) throws NamingException
Creates a new context with the given name resolved relative to this initial context and bind it in the target context (that named by all but terminal component of the name).

Parameters:
name - The string name of the context to create.
Returns:
The newly created context.
 o createSubcontext
 public Context createSubcontext(Name name) throws NamingException
Creates a new context with the given name resolved relative to this initial context and bind it in the target context (that named by all but terminal atomic component of the name).

Parameters:
name - The name of the context to create.
Returns:
The newly created context.
 o lookupLink
 public Object lookupLink(String name) throws NamingException
Looks up 'name' relative to this initial context, following links except for the last atomic part of name.

Parameters:
name - The string name to look up.
Returns:
The object bound to the name by not following the terminal link (if any).
 o lookupLink
 public Object lookupLink(Name name) throws NamingException
Looks up 'name' relative to this initial context, following links except for the last atomic part of name.

Parameters:
name - The name to look up.
Returns:
The object bound to the name by not following the terminal link (if any).
 o getNameParser
 public NameParser getNameParser(String name) throws 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 in a particular namespace.

Parameters:
name - The string name of the context from which to get the parser.
Returns:
A name parser that will parse names into their atomic components.
See Also:
CompoundName
 o getNameParser
 public NameParser getNameParser(Name name) throws 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 in a particular namespace.

Parameters:
name - The name of the context from which to get the parser.
Returns:
A name parser that will parse names into their atomic components.
See Also:
CompoundName
 o setEnvironment
 public Properties setEnvironment(Properties envProps) throws NamingException
Changes the environment properties of the initial context to be those specified by envProps. envProps overrides any prior environment properties with the same property names. An environment property that could not be satisfied by this context is silently ignored. setEnvironment() returns the resulting set of environment properties.

Parameters:
envprops - The environment properties to set.
Returns:
The resulting environment properties of this context.
 o getEnvironment
 public Properties getEnvironment() throws NamingException
Retrieves the environment properties in effect for the initial context.

Returns:
The environment properties for the initial context.

All Packages  Class Hierarchy  This Package  Previous  Next  Index