javax.naming
Class InitialContext
public
class
InitialContext
extends Object
implements Context
The starting context for performing naming operations. All naming operations
are performed in the scope of some context. The initial context is the
starting point for the name resolution.
Method Summary |
Object | addToEnvironment(String propName, Object propVal) |
void | bind(Name name, Object obj) |
void | bind(String name, Object obj) |
void | close() |
Name | composeName(Name name, Name prefix) |
String | composeName(String name, String prefix) |
Context | createSubcontext(Name name) |
Context | createSubcontext(String name) |
void | destroySubcontext(Name name) |
void | destroySubcontext(String name) |
protected Context | getDefaultInitCtx()
Get the default initial context. |
Hashtable<?,?> | getEnvironment() |
String | getNameInNamespace()
This operation is not supported for the initial naming context.
|
NameParser | getNameParser(Name name) |
NameParser | getNameParser(String name) |
protected Context | getURLOrDefaultInitCtx(Name name)
Obtains the context for resolving the given name. |
protected Context | getURLOrDefaultInitCtx(String name)
Obtains the context for resolving the given name. |
protected void | init(Hashtable<?,?> environment)
Initialises the context, using the properties, specified in the passed
table.
|
NamingEnumeration<NameClassPair> | list(Name name) |
NamingEnumeration<NameClassPair> | list(String name) |
NamingEnumeration<Binding> | listBindings(Name name) |
NamingEnumeration<Binding> | listBindings(String name) |
Object | lookup(Name name) |
Object | lookup(String name) |
Object | lookupLink(Name name) |
Object | lookupLink(String name) |
void | rebind(Name name, Object obj) |
void | rebind(String name, Object obj) |
Object | removeFromEnvironment(String propName) |
void | rename(Name oldName, Name newName) |
void | rename(String oldName, String newName) |
void | unbind(Name name) |
void | unbind(String name) |
Contains the default initial context. This value is returned by
{@link NamingManager#getInitialContext}. It is set by this method
when calling it first time. The subsequent calls return the value of
this field.
protected boolean gotDefault
Indicates if the initial context was obtained by calling
{@link NamingManager#getInitialContext}.
The environment, associated with this initial context.
public InitialContext(
Hashtable<?,?> environment)
Creates the new initial context with the given properties.
Parameters: environment the properties, used by the initial context being
created.
Throws: NamingException
protected InitialContext(boolean lazy)
Creates the initial context with the possibility to delay its
initialisation.
Parameters: lazy specified if the initialization should not be performed by this
constructor (true). If the valueis false, it works the same way as
the parameterless constructor.
Throws: NamingException
public InitialContext()
Creates teh new initial context with no properties. Same as
InitialContext(null).
Throws: NamingException
public void close()
public void destroySubcontext(
Name name)
public void destroySubcontext(
String name)
protected
Context getDefaultInitCtx()
Get the default initial context. If {@link #gotDefault} == false, this
method obtains the initial context from the naming manager and sets
gotDefault to true. Otherwise the cached value ({@link #defaultInitCtx} is
returned.
Returns: the default initial context
Throws: NamingException
public
String getNameInNamespace()
This operation is not supported for the initial naming context.
Throws: OperationNotSupportedException always, unless the method is
overridden in the derived class.
Obtains the context for resolving the given name. If the first component of
the name is the URL string, this method tries to find the corressponding
URL naming context. If it is not an URL string, or the URL context is not
found, the default initial context is returned.
Parameters: name the name, for that it is required to obtain the context.
Returns: the context for resolving the name.
Throws: NamingException
Obtains the context for resolving the given name. If the first component of
the name is the URL string, this method tries to find the corressponding
URL naming context. If it is not an URL string, or the URL context is not
found, the default initial context is returned.
Parameters: name the name, for that it is required to obtain the context.
Returns: the context for resolving the name.
Throws: NamingException
protected void init(
Hashtable<?,?> environment)
Initialises the context, using the properties, specified in the passed
table.
The missing properties are additionally obtained (in order) from the
following locations:
- If the passed parameter contains the key Context.APPLET, its value
must be the instance of the {@link Applet}. Then the properties are
requested via {@link Applet#getParameter(String)}.
- The value of the system property is used.
- The resource "jndi.properties" is requested from the context class
loader of the current thread
- The property file "jndi.properties" is read from the location,
specified by the system property "gnu.classpath.home.url".
Parameters: environment the table of the properties, may be null. The method
modifies the table and stores the reference to it. The caller must
not later reuse this structure for other purposes.
Since: 1.3
public void rename(
Name oldName,
Name newName)
public void unbind(
Name name)
public void unbind(
String name)