Package com.sun.enterprise.naming.impl
Class JavaURLContext
- java.lang.Object
-
- com.sun.enterprise.naming.impl.JavaURLContext
-
public final class JavaURLContext extends Object implements Context, Cloneable
This class is a context implementation for the java:comp namespace. The context determines the component id from the invocation manager of the component that is invoking the method and then looks up the object in that component's local namespace.
-
-
Field Summary
-
Fields inherited from interface javax.naming.Context
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES
-
-
Constructor Summary
Constructors Constructor Description JavaURLContext(JavaURLContext ctx, SerialContext sctx)
JavaURLContext(String name, Hashtable env)
Create a context with the specified name+environment.JavaURLContext(Hashtable environment)
Create a context with the specified environment.JavaURLContext(Hashtable env, SerialContext serialContext)
this constructor is called from SerialContext class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
addToEnvironment(String propName, Object propVal)
Add a property to the environment.void
bind(String name, Object obj)
Bind an object in the namespace.void
bind(Name name, Object obj)
Bind an object in the namespace.void
close()
New JNDI 1.2 operation.String
composeName(String name, String prefix)
Name
composeName(Name name, Name prefix)
Context
createSubcontext(String name)
Context
createSubcontext(Name name)
void
destroySubcontext(String name)
The destroySubcontext operation is not supported by this context.void
destroySubcontext(Name name)
The destroySubcontext operation is not supported by this context.Hashtable
getEnvironment()
Get the context's environment.String
getNameInNamespace()
Return the name of this context within the namespace.NameParser
getNameParser(String name)
Return the name parser for the specified name.NameParser
getNameParser(Name name)
Return the name parser for the specified name.NamingEnumeration<NameClassPair>
list(String name)
Lists the contents of a context or subcontext.NamingEnumeration<NameClassPair>
list(Name name)
Lists the contents of a context or subcontext.NamingEnumeration<Binding>
listBindings(String name)
Lists the bindings of a context or subcontext.NamingEnumeration<Binding>
listBindings(Name name)
Lists the bindings of a context or subcontext.Object
lookup(String name)
Lookup an object in the serial context.Object
lookup(Name name)
Lookup a name in either the cosnaming or serial context.Object
lookupLink(String name)
This context does not treat links specially.Object
lookupLink(Name name)
This context does not treat links specially.void
rebind(String name, Object obj)
Rebind an object in the namespace.void
rebind(Name name, Object obj)
Rebind an object in the namespace.Object
removeFromEnvironment(String propName)
Remove a property from the environment.void
rename(String oldname, String newname)
The rename operation is not supported by this context.void
rename(Name oldname, Name newname)
The rename operation is not supported by this context.void
unbind(String name)
Unbind an object from the namespace.void
unbind(Name name)
Unbind an object from the namespace.
-
-
-
Constructor Detail
-
JavaURLContext
public JavaURLContext(Hashtable environment) throws NamingException
Create a context with the specified environment.- Throws:
NamingException
-
JavaURLContext
public JavaURLContext(String name, Hashtable env) throws NamingException
Create a context with the specified name+environment. Called only from GlassfishNamingManager.- Throws:
NamingException
-
JavaURLContext
public JavaURLContext(Hashtable env, SerialContext serialContext) throws NamingException
this constructor is called from SerialContext class- Throws:
NamingException
-
JavaURLContext
public JavaURLContext(JavaURLContext ctx, SerialContext sctx)
-
-
Method Detail
-
lookup
public Object lookup(String name) throws NamingException
Lookup an object in the serial context.- Specified by:
lookup
in interfaceContext
- Returns:
- the object that is being looked up.
- Throws:
NamingException
- if there is a naming exception.
-
lookup
public Object lookup(Name name) throws NamingException
Lookup a name in either the cosnaming or serial context.- Specified by:
lookup
in interfaceContext
- Returns:
- the object that is being looked up.
- Throws:
NamingException
- if there is a naming exception.
-
bind
public void bind(String name, Object obj) throws NamingException
Bind an object in the namespace. Binds the reference to the actual object in either the cosnaming or serial context.- Specified by:
bind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
bind
public void bind(Name name, Object obj) throws NamingException
Bind an object in the namespace. Binds the reference to the actual object in either the cosnaming or serial context.- Specified by:
bind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
rebind
public void rebind(String name, Object obj) throws NamingException
Rebind an object in the namespace. Rebinds the reference to the actual object in either the cosnaming or serial context.- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
rebind
public void rebind(Name name, Object obj) throws NamingException
Rebind an object in the namespace. Rebinds the reference to the actual object in either the cosnaming or serial context.- Specified by:
rebind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
unbind
public void unbind(String name) throws NamingException
Unbind an object from the namespace.- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
unbind
public void unbind(Name name) throws NamingException
Unbind an object from the namespace.- Specified by:
unbind
in interfaceContext
- Throws:
NamingException
- if there is a naming exception.
-
rename
public void rename(String oldname, String newname) throws NamingException
The rename operation is not supported by this context. It throws an OperationNotSupportedException.- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
rename
public void rename(Name oldname, Name newname) throws NamingException
The rename operation is not supported by this context. It throws an OperationNotSupportedException.- Specified by:
rename
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(String name) throws NamingException
The destroySubcontext operation is not supported by this context. It throws an OperationNotSupportedException.- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
destroySubcontext
public void destroySubcontext(Name name) throws NamingException
The destroySubcontext operation is not supported by this context. It throws an OperationNotSupportedException.- Specified by:
destroySubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(String name) throws NamingException
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
createSubcontext
public Context createSubcontext(Name name) throws NamingException
- Specified by:
createSubcontext
in interfaceContext
- Throws:
NamingException
-
list
public NamingEnumeration<NameClassPair> list(String name) throws NamingException
Lists the contents of a context or subcontext. The operation is delegated to the serial context.- Specified by:
list
in interfaceContext
- Returns:
- an enumeration of the contents of the context.
- Throws:
NamingException
- if there is a naming exception.
-
list
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
Lists the contents of a context or subcontext. The operation is delegated to the serial context.- Specified by:
list
in interfaceContext
- Returns:
- an enumeration of the contents of the context.
- Throws:
NamingException
- if there is a naming exception.
-
listBindings
public NamingEnumeration<Binding> listBindings(String name) throws NamingException
Lists the bindings of a context or subcontext. The operation is delegated to the serial context.- Specified by:
listBindings
in interfaceContext
- Returns:
- an enumeration of the bindings of the context.
- Throws:
NamingException
- if there is a naming exception.
-
listBindings
public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
Lists the bindings of a context or subcontext. The operation is delegated to the serial context.- Specified by:
listBindings
in interfaceContext
- Returns:
- an enumeration of the bindings of the context.
- Throws:
NamingException
- if there is a naming exception.
-
lookupLink
public Object lookupLink(String name) throws NamingException
This context does not treat links specially. A lookup operation is performed.- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
lookupLink
public Object lookupLink(Name name) throws NamingException
This context does not treat links specially. A lookup operation is performed.- Specified by:
lookupLink
in interfaceContext
- Throws:
NamingException
-
getNameParser
public NameParser getNameParser(String name) throws NamingException
Return the name parser for the specified name.- Specified by:
getNameParser
in interfaceContext
- Returns:
- the NameParser instance.
- Throws:
NamingException
- if there is an exception.
-
getNameParser
public NameParser getNameParser(Name name) throws NamingException
Return the name parser for the specified name.- Specified by:
getNameParser
in interfaceContext
- Returns:
- the NameParser instance.
- Throws:
NamingException
- if there is an exception.
-
composeName
public String composeName(String name, String prefix) throws NamingException
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
composeName
public Name composeName(Name name, Name prefix) throws NamingException
- Specified by:
composeName
in interfaceContext
- Throws:
NamingException
-
addToEnvironment
public Object addToEnvironment(String propName, Object propVal) throws NamingException
Add a property to the environment.- Specified by:
addToEnvironment
in interfaceContext
- Throws:
NamingException
-
removeFromEnvironment
public Object removeFromEnvironment(String propName) throws NamingException
Remove a property from the environment.- Specified by:
removeFromEnvironment
in interfaceContext
- Throws:
NamingException
-
getEnvironment
public Hashtable getEnvironment() throws NamingException
Get the context's environment.- Specified by:
getEnvironment
in interfaceContext
- Throws:
NamingException
-
close
public void close() throws NamingException
New JNDI 1.2 operation.- Specified by:
close
in interfaceContext
- Throws:
NamingException
-
getNameInNamespace
public String getNameInNamespace() throws NamingException
Return the name of this context within the namespace. The name can be passed as an argument to (new InitialContext()).lookup() to reproduce this context.- Specified by:
getNameInNamespace
in interfaceContext
- Throws:
NamingException
-
-