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.
Field Summary
protected ContextdefaultInitCtx
Contains the default initial context.
protected booleangotDefault
Indicates if the initial context was obtained by calling {@link NamingManager#getInitialContext}.
protected Hashtable<Object,Object>myProps
The environment, associated with this initial context.
Constructor Summary
InitialContext(Hashtable<?,?> environment)
Creates the new initial context with the given properties.
protected InitialContext(boolean lazy)
Creates the initial context with the possibility to delay its initialisation.
InitialContext()
Creates teh new initial context with no properties.
Method Summary
ObjectaddToEnvironment(String propName, Object propVal)
voidbind(Name name, Object obj)
voidbind(String name, Object obj)
voidclose()
NamecomposeName(Name name, Name prefix)
StringcomposeName(String name, String prefix)
ContextcreateSubcontext(Name name)
ContextcreateSubcontext(String name)
voiddestroySubcontext(Name name)
voiddestroySubcontext(String name)
protected ContextgetDefaultInitCtx()
Get the default initial context.
Hashtable<?,?>getEnvironment()
StringgetNameInNamespace()
This operation is not supported for the initial naming context.
NameParsergetNameParser(Name name)
NameParsergetNameParser(String name)
protected ContextgetURLOrDefaultInitCtx(Name name)
Obtains the context for resolving the given name.
protected ContextgetURLOrDefaultInitCtx(String name)
Obtains the context for resolving the given name.
protected voidinit(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)
Objectlookup(Name name)
Objectlookup(String name)
ObjectlookupLink(Name name)
ObjectlookupLink(String name)
voidrebind(Name name, Object obj)
voidrebind(String name, Object obj)
ObjectremoveFromEnvironment(String propName)
voidrename(Name oldName, Name newName)
voidrename(String oldName, String newName)
voidunbind(Name name)
voidunbind(String name)

Field Detail

defaultInitCtx

protected Context defaultInitCtx
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.

gotDefault

protected boolean gotDefault
Indicates if the initial context was obtained by calling {@link NamingManager#getInitialContext}.

myProps

protected Hashtable<Object,Object> myProps
The environment, associated with this initial context.

Constructor Detail

InitialContext

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

InitialContext

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

InitialContext

public InitialContext()
Creates teh new initial context with no properties. Same as InitialContext(null).

Throws: NamingException

Method Detail

addToEnvironment

public Object addToEnvironment(String propName, Object propVal)

UNKNOWN:

bind

public void bind(Name name, Object obj)

UNKNOWN:

bind

public void bind(String name, Object obj)

UNKNOWN:

close

public void close()

UNKNOWN:

composeName

public Name composeName(Name name, Name prefix)

UNKNOWN:

composeName

public String composeName(String name, String prefix)

UNKNOWN:

createSubcontext

public Context createSubcontext(Name name)

UNKNOWN:

createSubcontext

public Context createSubcontext(String name)

UNKNOWN:

destroySubcontext

public void destroySubcontext(Name name)

UNKNOWN:

destroySubcontext

public void destroySubcontext(String name)

UNKNOWN:

getDefaultInitCtx

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

getEnvironment

public Hashtable<?,?> getEnvironment()

UNKNOWN:

getNameInNamespace

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.

getNameParser

public NameParser getNameParser(Name name)

UNKNOWN:

getNameParser

public NameParser getNameParser(String name)

UNKNOWN:

getURLOrDefaultInitCtx

protected Context getURLOrDefaultInitCtx(Name name)
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

getURLOrDefaultInitCtx

protected Context getURLOrDefaultInitCtx(String name)
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

init

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:

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

list

public NamingEnumeration<NameClassPair> list(Name name)

UNKNOWN:

list

public NamingEnumeration<NameClassPair> list(String name)

UNKNOWN:

listBindings

public NamingEnumeration<Binding> listBindings(Name name)

UNKNOWN:

listBindings

public NamingEnumeration<Binding> listBindings(String name)

UNKNOWN:

lookup

public Object lookup(Name name)

UNKNOWN:

lookup

public Object lookup(String name)

UNKNOWN:

lookupLink

public Object lookupLink(Name name)

UNKNOWN:

lookupLink

public Object lookupLink(String name)

UNKNOWN:

rebind

public void rebind(Name name, Object obj)

UNKNOWN:

rebind

public void rebind(String name, Object obj)

UNKNOWN:

removeFromEnvironment

public Object removeFromEnvironment(String propName)

UNKNOWN:

rename

public void rename(Name oldName, Name newName)

UNKNOWN:

rename

public void rename(String oldName, String newName)

UNKNOWN:

unbind

public void unbind(Name name)

UNKNOWN:

unbind

public void unbind(String name)

UNKNOWN: