javax.naming

Interface Context

public interface Context

Field Summary
StringAPPLET
Property for the initial context constructor to use when searching for other properties.
StringAUTHORITATIVE
Property with the authoritativeness of the service requested.
StringBATCHSIZE
Property with the batch size to use when returning data via the service's protocol.
StringDNS_URL
Property with the DNS host and domain names to use.
StringINITIAL_CONTEXT_FACTORY
Property with name of the inital context factory to use
StringLANGUAGE
Property for specifying the preferred language to use with the service.
StringOBJECT_FACTORIES
Property with colon-separated list of object factories to use.
StringPROVIDER_URL
Property with URL specifying configuration for the service provider to use.
StringREFERRAL
Property defining how referrals encountered by the service provider are to be processed.
StringSECURITY_AUTHENTICATION
Property specifying the security level to use.
StringSECURITY_CREDENTIALS
Property specifying the credentials of the principal for authenticating the caller to the service.
StringSECURITY_PRINCIPAL
Property for the identity of the principal for authenticating the caller to the service.
StringSECURITY_PROTOCOL
Property specifying the security protocol to use.
StringSTATE_FACTORIES
Property with colon-separated list of state factories to use.
StringURL_PKG_PREFIXES
Property with colon-separated list of package prefixes to use.
Method Summary
ObjectaddToEnvironment(String propName, Object propVal)
Add new environment property to the environment of this context.
voidbind(Name name, Object obj)
Give the specified name for the specified object.
voidbind(String name, Object obj)
Give the specified name for the specified object.
voidclose()
Releases all resources, associated with this context.
NamecomposeName(Name name, Name prefix)
Composes the name of this context together with another name, related to this context.
StringcomposeName(String name, String prefix)
Composes the name of this context together with another name, related to this context.
ContextcreateSubcontext(Name name)
Creates the new naming subcontext and binds it to the current (this) context.
ContextcreateSubcontext(String name)
Creates the new naming subcontext and binds it to the current (this) context.
voiddestroySubcontext(Name name)
Removes the naming subcontext from this naming context.
voiddestroySubcontext(String name)
Removes the naming subcontext from this naming context.
Hashtable<?,?>getEnvironment()
Returns the environment, associated with this naming context.
StringgetNameInNamespace()
Returs the full name of this naming context.
NameParsergetNameParser(Name name)
Obtains the name parser for parsing the names of the given naming subcontext.
NameParsergetNameParser(String name)
Obtains the name parser for parsing the names of the given naming subcontext.
NamingEnumeration<NameClassPair>list(Name name)
Creates and returns the enumeration over the name bindings that are present the given subcontext.
NamingEnumeration<NameClassPair>list(String name)
Creates and returns the enumeration over the name bindings that are present the given subcontext.
NamingEnumeration<Binding>listBindings(Name name)
Creates and returns the enumeration over the name - object bindings that are present the given subcontext.
NamingEnumeration<Binding>listBindings(String name)
Creates and returns the enumeration over the name - object bindings that are present the given subcontext.
Objectlookup(Name name)
Gets the previously named object by name.
Objectlookup(String name)
Gets the previously named object by name.
ObjectlookupLink(Name name)
Retrieves the named object, not following the link of the terminal atomic component of the name.
ObjectlookupLink(String name)
Retrieves the named object, not following the link of the terminal atomic component of the name.
voidrebind(Name name, Object obj)
Give the specified name for the specified object.
voidrebind(String name, Object obj)
Give the specified name for the specified object.
ObjectremoveFromEnvironment(String propName)
Removes the property with the given name from the environment.
voidrename(Name oldName, Name newName)
Renames the existing binding, removing the existing and giving the new name for the same object.
voidrename(String oldName, String newName)
Renames the existing binding, removing the existing and giving the new name for the same object.
voidunbind(Name name)
Removes the name - object mapping from the current context.
voidunbind(String name)
Removes the name - object mapping from the current context.

Field Detail

APPLET

public String APPLET
Property for the initial context constructor to use when searching for other properties.

AUTHORITATIVE

public String AUTHORITATIVE
Property with the authoritativeness of the service requested.

BATCHSIZE

public String BATCHSIZE
Property with the batch size to use when returning data via the service's protocol.

DNS_URL

public String DNS_URL
Property with the DNS host and domain names to use.

INITIAL_CONTEXT_FACTORY

public String INITIAL_CONTEXT_FACTORY
Property with name of the inital context factory to use

LANGUAGE

public String LANGUAGE
Property for specifying the preferred language to use with the service.

OBJECT_FACTORIES

public String OBJECT_FACTORIES
Property with colon-separated list of object factories to use.

PROVIDER_URL

public String PROVIDER_URL
Property with URL specifying configuration for the service provider to use.

REFERRAL

public String REFERRAL
Property defining how referrals encountered by the service provider are to be processed.

SECURITY_AUTHENTICATION

public String SECURITY_AUTHENTICATION
Property specifying the security level to use.

SECURITY_CREDENTIALS

public String SECURITY_CREDENTIALS
Property specifying the credentials of the principal for authenticating the caller to the service.

SECURITY_PRINCIPAL

public String SECURITY_PRINCIPAL
Property for the identity of the principal for authenticating the caller to the service.

SECURITY_PROTOCOL

public String SECURITY_PROTOCOL
Property specifying the security protocol to use.

STATE_FACTORIES

public String STATE_FACTORIES
Property with colon-separated list of state factories to use.

URL_PKG_PREFIXES

public String URL_PKG_PREFIXES
Property with colon-separated list of package prefixes to use.

Method Detail

addToEnvironment

public Object addToEnvironment(String propName, Object propVal)
Add new environment property to the environment of this context. Both name and value of the new property must not be null. If the property is already defined, is current value is replaced by the propVal.

Parameters: propName the name of the new property propVal the value of the new property

Returns: the previous value of this property or null if the property has not been previously defined

Throws: NamingException

bind

public void bind(Name name, Object obj)
Give the specified name for the specified object. The passed name must not be already bound to some other object.

Parameters: name the name that will be given to the object (in the scope of this context). obj the object being named.

Throws: NameAlreadyBoundException if this name is already used to name some object. InvalidAttributesException if the object does not supply all required attributes. NamingException if the naming operation has failed due other reasons.

bind

public void bind(String name, Object obj)
Give the specified name for the specified object. The passed name must not be already bound to some other object.

Parameters: name the name that will be given to the object (in the scope of this context). obj the object being named.

Throws: NameAlreadyBoundException if this name is already used to name some object. InvalidAttributesException if the object does not supply all required attributes. NamingException if the naming operation has failed due other reasons.

close

public void close()
Releases all resources, associated with this context. The close() method can be called several times, but after it has been once invoked, it is not allowed to call any other method of this context,

Throws: NamingException

composeName

public Name composeName(Name name, Name prefix)
Composes the name of this context together with another name, related to this context.

Parameters: name a name, defined in the scope of this context prefix a name of this context itself, defined in the scope of some ancestor

Returns: the name of the same object as named by the first parameter, but related to the context of the specified ancestor.

Throws: NamingException

composeName

public String composeName(String name, String prefix)
Composes the name of this context together with another name, related to this context.

Parameters: name a name, defined in the scope of this context prefix a name of this context itself, defined in the scope of some ancestor

Returns: the name of the same object as named by the first parameter, but related to the context of the specified ancestor.

Throws: NamingException

createSubcontext

public Context createSubcontext(Name name)
Creates the new naming subcontext and binds it to the current (this) context.

Parameters: name the name of the new context being created

Returns: the newly created context, bound to the instance of the context on that the method has been called

Throws: NameAlreadyBoundException if this name is already bound InvalidAttributesException if the creation of the new context requires the missing mandatory attributes NamingException

createSubcontext

public Context createSubcontext(String name)
Creates the new naming subcontext and binds it to the current (this) context.

Parameters: name the name of the new context being created

Returns: the newly created context, bound to the instance of the context on that the method has been called

Throws: NameAlreadyBoundException if this name is already bound InvalidAttributesException if the creation of the new context requires the missing mandatory attributes NamingException

destroySubcontext

public void destroySubcontext(Name name)
Removes the naming subcontext from this naming context. Returns without action if such subcontext does not exist. The context being destroyed must be empty.

Parameters: name the name of the subcontext beig removed.

Throws: ContextNotEmptyException if the named context is not empty. NamingException

destroySubcontext

public void destroySubcontext(String name)
Removes the naming subcontext from this naming context. Returns without action if such subcontext does not exist. The context being destroyed must be empty.

Parameters: name the name of the subcontext beig removed.

Throws: ContextNotEmptyException if the named context is not empty. NamingException

getEnvironment

public Hashtable<?,?> getEnvironment()
Returns the environment, associated with this naming context. The returned table should never be modified by the caller. Use {@link #addToEnvironment} and {@link #removeFromEnvironment} to modify the environement, if needed.

Returns: the table, representing the environment of this context

Throws: NamingException

getNameInNamespace

public String getNameInNamespace()
Returs the full name of this naming context. The returned string is not a JNDI composite name and should not be passed directly to the methods of the naming context.

Returns: the full name of this naming context, in its own namespace.

Throws: OperationNotSupportedException if the naming system, represented by this context, does not support the notation of the full name. NamingException

getNameParser

public NameParser getNameParser(Name name)
Obtains the name parser for parsing the names of the given naming subcontext.

Parameters: name the name of the subcontext for that the parser must be obtained

Returns: the parser to parse the names of that context

Throws: NamingException

getNameParser

public NameParser getNameParser(String name)
Obtains the name parser for parsing the names of the given naming subcontext.

Parameters: name the name of the subcontext for that the parser must be obtained

Returns: the parser to parse the names of that context

Throws: NamingException

list

public NamingEnumeration<NameClassPair> list(Name name)
Creates and returns the enumeration over the name bindings that are present the given subcontext. The enumeration elements have the type of {@link NameClassPair}, providing also information about the class of the bound object. The behaviour in the case if the bindings are added or removed later is not defined. The contents of the subcontexts are not included.

Parameters: name the name of the subcontext

Returns: the enumeration over the names, known for the given subcontext.

Throws: NamingException

list

public NamingEnumeration<NameClassPair> list(String name)
Creates and returns the enumeration over the name bindings that are present the given subcontext. The enumeration elements have the type of {@link NameClassPair}, providing also information about the class of the bound object. The behaviour in the case if the bindings are added or removed later is not defined. The contents of the subcontexts are not included.

Parameters: name the name of the subcontext

Returns: the enumeration over the names, known for the given subcontext.

Throws: NamingException

listBindings

public NamingEnumeration<Binding> listBindings(Name name)
Creates and returns the enumeration over the name - object bindings that are present the given subcontext. The enumeration elements have the type of {@link Binding}, providing also information about the class of the bound object. The behaviour in the case if the bindings are added or removed later is not defined. The contents of the subcontexts are not included.

Parameters: name the name of the subcontext

Returns: the enumeration over the names, known for the given subcontext.

Throws: NamingException

listBindings

public NamingEnumeration<Binding> listBindings(String name)
Creates and returns the enumeration over the name - object bindings that are present the given subcontext. The enumeration elements have the type of {@link Binding}, providing also information about the class of the bound object. The behaviour in the case if the bindings are added or removed later is not defined. The contents of the subcontexts are not included.

Parameters: name the name of the subcontext

Returns: the enumeration over the names, known for the given subcontext.

Throws: NamingException

lookup

public Object lookup(Name name)
Gets the previously named object by name. If the passed name is empty, the method should return a cloned instance of this naming context.

Parameters: name the name of the object being searched in this context

Returns: the named object

Throws: NamingException if the naming fails.

lookup

public Object lookup(String name)
Gets the previously named object by name. If the passed name is empty, the method should return a cloned instance of this naming context.

Parameters: name the name of the object being searched in this context

Returns: the named object

Throws: NamingException if the naming fails.

lookupLink

public Object lookupLink(Name name)
Retrieves the named object, not following the link of the terminal atomic component of the name. If the object, named by the passed name, is not a link, returns that object itself. The intermediate links, if present, are followed.

Parameters: name the name of the object that may be a link, leading to another object.

Returns: the named object, not following the terminal link (if present).

Throws: NamingException

lookupLink

public Object lookupLink(String name)
Retrieves the named object, not following the link of the terminal atomic component of the name. If the object, named by the passed name, is not a link, returns that object itself. The intermediate links, if present, are followed.

Parameters: name the name of the object that may be a link, leading to another object.

Returns: the named object, not following the terminal link (if present).

Throws: NamingException

rebind

public void rebind(Name name, Object obj)
Give the specified name for the specified object. Unlike bind, this method silently replaces the existing binding for this name, if one exists.

Parameters: name the name that will be given to the object (in the scope of this context). obj the object being named.

Throws: InvalidAttributesException if the object does not supply all required attributes. NamingException if the naming operation has failed due other reasons.

rebind

public void rebind(String name, Object obj)
Give the specified name for the specified object. Unlike bind, this method silently replaces the existing binding for this name, if one exists.

Parameters: name the name that will be given to the object (in the scope of this context). obj the object being named.

Throws: InvalidAttributesException if the object does not supply all required attributes. NamingException if the naming operation has failed due other reasons.

removeFromEnvironment

public Object removeFromEnvironment(String propName)
Removes the property with the given name from the environment. Returns without action if this property is not defined.

Parameters: propName the name of the property being removed.

Returns: the value of the property that has been removed or null if the property was not defined.

Throws: NamingException

rename

public void rename(Name oldName, Name newName)
Renames the existing binding, removing the existing and giving the new name for the same object.

Parameters: oldName the existing name of the known object newName the new name of the same object

Throws: NameNotFoundException if the oldName is unknown for this context NamingException if the naming operation has failed due other reasons.

rename

public void rename(String oldName, String newName)
Renames the existing binding, removing the existing and giving the new name for the same object.

Parameters: oldName the existing name of the known object newName the new name of the same object

Throws: NameNotFoundException if the oldName is unknown for this context NamingException if the naming operation has failed due other reasons.

unbind

public void unbind(Name name)
Removes the name - object mapping from the current context. This method returns without action if the name is not bound to an object in the terminal context, but throws {@link NameNotFoundException} if one of the intermadiate contexts does not exist.

Parameters: name the name to be removed

Throws: NameNotFoundException if one of the intermediate naming contexts does not exist. Will not be thrown if just the terminal binding is missing. NamingException if the naming operation has failed due other reasons.

unbind

public void unbind(String name)
Removes the name - object mapping from the current context. This method returns without action if the name is not bound to an object in the terminal context, but throws {@link NameNotFoundException} if one of the intermadiate contexts does not exist.

Parameters: name the name to be removed

Throws: NameNotFoundException if one of the intermediate naming contexts does not exist. Will not be thrown if just the terminal binding is missing. NamingException if the naming operation has failed due other reasons.