com.sun.enterprise.naming.impl
Class SerialContext

java.lang.Object
  extended by com.sun.enterprise.naming.impl.SerialContext
All Implemented Interfaces:
Context

public class SerialContext
extends Object
implements Context

This context provides access to the app server naming service. This is the default Context for GlassFish. Lookups of unqualified names (i.e. names not starting with "java:", "corbaname:" etc) are serviced by SerialContext. The namespace is implemented in the SerialContextProviderImpl object, which is accessed directly in the case that the client is collocated with the naming service impl or remotely via RMI-IIOP if not collocated.

NOT THREAD SAFE: mutable instance variables


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
SerialContext(Hashtable env, org.glassfish.hk2.Services services)
          This constructor takes the component id as an argument.
SerialContext(String name, Hashtable environment, org.glassfish.hk2.Services h)
          Constructor for the context.
 
Method Summary
 Object addToEnvironment(String propName, Object propVal)
          Add to the environment for the current context.
 void bind(Name name, Object obj)
          Bind the object to the specified name.
 void bind(String name, Object obj)
          Bind the object to the specified name.
 void close()
          Set the environment for the current context to null when close is called.
 Name composeName(Name name, Name prefix)
           
 String composeName(String name, String prefix)
           
 Context createSubcontext(Name name)
          Create the specified subcontext.
 Context createSubcontext(String name)
          Create the specified subcontext.
 void destroySubcontext(Name name)
          Destroy the specified subcontext.
 void destroySubcontext(String name)
          Destroy the specified subcontext.
 Hashtable getEnvironment()
          Return the environment for the current context.
 String getNameInNamespace()
          The getNameInNamespace API is not supported in this context.
 NameParser getNameParser(Name name)
          Allow access to the name parser object.
 NameParser getNameParser(String name)
          Allow access to the name parser object.
 NamingEnumeration<NameClassPair> list(Name name)
          List the contents of the specified context.
 NamingEnumeration<NameClassPair> list(String name)
          List the contents of the specified context.
 NamingEnumeration<Binding> listBindings(Name name)
          List the bindings in the specified context.
 NamingEnumeration<Binding> listBindings(String name)
          List the bindings in the specified context.
 Object lookup(Name name)
          Lookup the specifed name in the context.
 Object lookup(String name)
          Lookup the specified name in the context.
 Object lookupLink(Name name)
          Links are not treated specially.
 Object lookupLink(String name)
          Links are not treated specially.
 void rebind(Name name, Object obj)
          Rebind the object to the specified name.
 void rebind(String name, Object obj)
          Rebind the object to the specified name.
 Object removeFromEnvironment(String propName)
          Remove from the environment for the current context.
 void rename(Name oldname, Name newname)
          Rename the bound object.
 void rename(String oldname, String newname)
          Rename the bound object.
 String toString()
           
 void unbind(Name name)
          Unbind the object with the specified name.
 void unbind(String name)
          Unbind the object with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerialContext

public SerialContext(String name,
                     Hashtable environment,
                     org.glassfish.hk2.Services h)
              throws NamingException
Constructor for the context. Initializes the object reference to the remote provider object.

Throws:
NamingException

SerialContext

public SerialContext(Hashtable env,
                     org.glassfish.hk2.Services services)
              throws NamingException
This constructor takes the component id as an argument. All name arguments to operations are prepended by the component id.

Throws:
NamingException
Method Detail

getNameInNamespace

public String getNameInNamespace()
                          throws NamingException
The getNameInNamespace API is not supported in this context.

Specified by:
getNameInNamespace in interface Context
Throws:
NamingException - if there is a naming exception.

lookup

public Object lookup(String name)
              throws NamingException
Lookup the specified name in the context. Returns the resolved object.

Specified by:
lookup in interface Context
Returns:
the resolved object.
Throws:
NamingException - if there is a naming exception.

lookup

public Object lookup(Name name)
              throws NamingException
Lookup the specifed name in the context. Returns the resolved object.

Specified by:
lookup in interface Context
Returns:
the resolved object.
Throws:
NamingException - if there is a naming exception.

bind

public void bind(String name,
                 Object obj)
          throws NamingException
Bind the object to the specified name.

Specified by:
bind in interface Context
Parameters:
name - name that the object is being bound to.
obj - object that is being bound.
Throws:
NamingException - if there is a naming exception.

bind

public void bind(Name name,
                 Object obj)
          throws NamingException
Bind the object to the specified name.

Specified by:
bind in interface Context
Parameters:
name - name that the object is being bound to.
obj - object that is being bound.
Throws:
NamingException - if there is a naming exception.

rebind

public void rebind(String name,
                   Object obj)
            throws NamingException
Rebind the object to the specified name.

Specified by:
rebind in interface Context
Parameters:
name - name that the object is being bound to.
obj - object that is being bound.
Throws:
NamingException - if there is a naming exception.

rebind

public void rebind(Name name,
                   Object obj)
            throws NamingException
Rebind the object to the specified name.

Specified by:
rebind in interface Context
Parameters:
name - name that the object is being bound to.
obj - object that is being bound.
Throws:
NamingException - if there is a naming exception.

unbind

public void unbind(String name)
            throws NamingException
Unbind the object with the specified name.

Specified by:
unbind in interface Context
Parameters:
name - that is being unbound.
Throws:
NamingException - if there is a naming exception.

unbind

public void unbind(Name name)
            throws NamingException
Unbind the object with the specified name.

Specified by:
unbind in interface Context
Parameters:
name - name that is being unbound.
Throws:
NamingException - if there is a naming exception.

rename

public void rename(String oldname,
                   String newname)
            throws NamingException
Rename the bound object.

Specified by:
rename in interface Context
Parameters:
oldname - old name that the object is bound as.
newname - new name that the object will be bound as.
Throws:
NamingException - if there is a naming exception.

rename

public void rename(Name oldname,
                   Name newname)
            throws NamingException
Rename the bound object.

Specified by:
rename in interface Context
Parameters:
oldname - old name that the object is bound as.
newname - new name that the object will be bound as.
Throws:
NamingException - if there is a naming exception.

list

public NamingEnumeration<NameClassPair> list(String name)
                                      throws NamingException
List the contents of the specified context.

Specified by:
list in interface Context
Parameters:
name - context name.
Returns:
an enumeration of the contents.
Throws:
NamingException - if there is a naming exception.

list

public NamingEnumeration<NameClassPair> list(Name name)
                                      throws NamingException
List the contents of the specified context.

Specified by:
list in interface Context
Parameters:
name - context name.
Returns:
an enumeration of the contents.
Throws:
NamingException - if there is a naming exception.

listBindings

public NamingEnumeration<Binding> listBindings(String name)
                                        throws NamingException
List the bindings in the specified context.

Specified by:
listBindings in interface Context
Parameters:
name - context name.
Returns:
an enumeration of the bindings.
Throws:
NamingException - if there is a naming exception.

listBindings

public NamingEnumeration<Binding> listBindings(Name name)
                                        throws NamingException
List the bindings in the specified context.

Specified by:
listBindings in interface Context
Parameters:
name - context name.
Returns:
an enumeration of the bindings.
Throws:
NamingException - if there is a naming exception.

destroySubcontext

public void destroySubcontext(String name)
                       throws NamingException
Destroy the specified subcontext.

Specified by:
destroySubcontext in interface Context
Parameters:
name - name of the subcontext.
Throws:
NamingException - if there is a naming exception.

destroySubcontext

public void destroySubcontext(Name name)
                       throws NamingException
Destroy the specified subcontext.

Specified by:
destroySubcontext in interface Context
Parameters:
name - name of the subcontext.
Throws:
NamingException - if there is a naming exception.

createSubcontext

public Context createSubcontext(String name)
                         throws NamingException
Create the specified subcontext.

Specified by:
createSubcontext in interface Context
Parameters:
name - name of the subcontext.
Returns:
the created subcontext.
Throws:
NamingException - if there is a naming exception.

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException
Create the specified subcontext.

Specified by:
createSubcontext in interface Context
Parameters:
name - name of the subcontext.
Returns:
the created subcontext.
Throws:
NamingException - if there is a naming exception.

lookupLink

public Object lookupLink(String name)
                  throws NamingException
Links are not treated specially.

Specified by:
lookupLink in interface Context
Parameters:
name - name of the link.
Returns:
the resolved object.
Throws:
NamingException - if there is a naming exception.

lookupLink

public Object lookupLink(Name name)
                  throws NamingException
Links are not treated specially.

Specified by:
lookupLink in interface Context
Parameters:
name - name of the link.
Returns:
the resolved object.
Throws:
NamingException - if there is a naming exception.

getNameParser

public NameParser getNameParser(String name)
                         throws NamingException
Allow access to the name parser object.

Specified by:
getNameParser in interface Context
Parameters:
name - JNDI name, is ignored since there is only one Name Parser object.
Returns:
NameParser object
Throws:
NamingException

getNameParser

public NameParser getNameParser(Name name)
                         throws NamingException
Allow access to the name parser object.

Specified by:
getNameParser in interface Context
Parameters:
name - JNDI name, is ignored since there is only one Name Parser object.
Returns:
NameParser object
Throws:
NamingException

composeName

public String composeName(String name,
                          String prefix)
                   throws NamingException
Specified by:
composeName in interface Context
Throws:
NamingException

composeName

public Name composeName(Name name,
                        Name prefix)
                 throws NamingException
Specified by:
composeName in interface Context
Throws:
NamingException

addToEnvironment

public Object addToEnvironment(String propName,
                               Object propVal)
                        throws NamingException
Add to the environment for the current context.

Specified by:
addToEnvironment in interface Context
Throws:
NamingException - if there is a naming exception.

removeFromEnvironment

public Object removeFromEnvironment(String propName)
                             throws NamingException
Remove from the environment for the current context.

Specified by:
removeFromEnvironment in interface Context
Throws:
NamingException - if there is a naming exception.

getEnvironment

public Hashtable getEnvironment()
                         throws NamingException
Return the environment for the current context.

Specified by:
getEnvironment in interface Context
Throws:
NamingException - if there is a naming exception.

close

public void close()
           throws NamingException
Set the environment for the current context to null when close is called.

Specified by:
close in interface Context
Throws:
NamingException - if there is a naming exception.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.