jrun.naming
Class JRunNamingContext

java.lang.Object
  |
  +--jrun.naming.JRunNamingContext
All Implemented Interfaces:
javax.naming.Context, NamingConstants, java.io.Serializable

public class JRunNamingContext
extends java.lang.Object
implements javax.naming.Context, NamingConstants, java.io.Serializable

This class performs the brunt of the logic required by JNDI-related tasks. It is the JRun-specific implementation of a JNDI Context.

The Context relies on a set of ContextManagers, one for each Context (that is, it includes subcontexts), to perform the specific object manipulations. The delegate ContextManager may be local (set by the NamingService upon service creation) or it may be remote (accessible via an rmi stub). The environment property NamingConstants.JRUN_JNDI_LOCAL determines whether local or remote access is desired. It is explicit in this way in order to avoid confusion regarding references and copies. The access will be remote by default.

When an operation is invoked on the Context, it attempts to locate a ContextProxy to do the work for the request. If it has none, and access is remote, then it will open a connection to the Context.PROVIDER_URL, which in JRun's case means it connects directly via socket to the NamingService listening at that Context.PROVIDER_URL value.

The JRunNamingContext then sends security info (if the Context contains Context.SECURITY_PRINCIPAL and Context.SECURITY_CREDENTIALS) to the server and is authenticated. If authentication succeeds (or if none was necessary), then the JRunNamingContext receives a stub from the remote NamingService. That stub is a proxy to a remote ContextManager.

The JRunNamingContext caches its stubs, and a direct reference to a local ContextManager (if available), so that it needs to perform this network authentication and lookup of a stub only once.

Author:
PS Neville
See Also:
Serialized Form

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
 
Fields inherited from interface jrun.naming.NamingConstants
AUTH_ONLY, AUTHENTICATION_ERROR, BIND, CLUSTER_ALGORITHM, CREATE_CTX, DEFAULT_CLUSTER_ALGORITHM, DEFAULT_HOST, DEFAULT_ORB_HOST, DEFAULT_ORB_PORT, DEFAULT_PERMIT_CLIENT_BINDS, DEFAULT_PERMIT_CLIENT_REBINDS, DEFAULT_PORT, DEFAULT_RMI_PORT, DEFAULT_SECURITY_ID, DEFAULT_USE_CORBA, DEFAULT_USE_FILE_FEDERATION, JNDI_ORB_ENV_NAME, JRUN_LOCAL_JNDI, ORB_HOST, ORB_PORT, ORB_STARTUP_COMMAND, PERMIT_CLIENT_BINDS, PERMIT_CLIENT_REBINDS, PIN_TO_SERVER, PINED_SERVER_NAME, REBIND, RENAME, RMI_PORT, STUBS_ONLY, UNBIND, USE_CORBA, USE_FILE_FEDERATION
 
Constructor Summary
JRunNamingContext(java.util.Hashtable env)
           
JRunNamingContext(java.util.Hashtable env, javax.naming.Name baseName, ContextProxy proxy)
           
JRunNamingContext(java.util.Hashtable env, javax.naming.Name baseName, ContextProxy proxy, JRunNamingContext ctx)
           
 
Method Summary
 java.lang.Object addToEnvironment(java.lang.String propName, java.lang.Object propVal)
           
 void bind(javax.naming.Name name, java.lang.Object obj)
           
 void bind(java.lang.String name, java.lang.Object obj)
           
 void close()
           
 javax.naming.Name composeName(javax.naming.Name name, javax.naming.Name prefix)
           
 java.lang.String composeName(java.lang.String name, java.lang.String prefix)
           
 javax.naming.Context createSubcontext(javax.naming.Name name)
           
 javax.naming.Context createSubcontext(java.lang.String name)
           
 void destroySubcontext(javax.naming.Name name)
           
 void destroySubcontext(java.lang.String name)
           
 java.util.Hashtable getEnvironment()
           
 java.lang.String getNameInNamespace()
           
 javax.naming.NameParser getNameParser(javax.naming.Name name)
           
 javax.naming.NameParser getNameParser(java.lang.String name)
           
 javax.naming.NamingEnumeration list(javax.naming.Name name)
           
 javax.naming.NamingEnumeration list(java.lang.String name)
           
 javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
           
 javax.naming.NamingEnumeration listBindings(java.lang.String name)
           
 java.lang.Object lookup(javax.naming.Name name)
           
 java.lang.Object lookup(java.lang.String name)
           
 java.lang.Object lookupLink(javax.naming.Name name)
           
 java.lang.Object lookupLink(java.lang.String name)
           
static void printTree(javax.naming.Context ctx)
          Prints the contents of this context and its subcontexts to System.out.
 java.util.ArrayList rawNamingOperation(int op, boolean singleServer)
           
 java.util.ArrayList rawNamingOperation(int op, boolean singleServer, java.lang.String serverName)
           
 void rebind(javax.naming.Name name, java.lang.Object obj)
           
 void rebind(java.lang.String name, java.lang.Object obj)
           
 java.lang.Object removeFromEnvironment(java.lang.String propName)
           
 void rename(javax.naming.Name oldName, javax.naming.Name newName)
           
 void rename(java.lang.String oldname, java.lang.String newname)
           
static void setLocalContextManager(ContextProxy proxy)
          Set the local ContextProxy for optimized local access, invoked by the NamingService.
static java.lang.String treeToString(javax.naming.Context ctx)
          Return a String repesenting all the bindings in the Context (passed as a parameter) and its subcontexts.
 void unbind(javax.naming.Name name)
           
 void unbind(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRunNamingContext

public JRunNamingContext(java.util.Hashtable env)
                  throws javax.naming.NamingException

JRunNamingContext

public JRunNamingContext(java.util.Hashtable env,
                         javax.naming.Name baseName,
                         ContextProxy proxy)
                  throws javax.naming.NamingException

JRunNamingContext

public JRunNamingContext(java.util.Hashtable env,
                         javax.naming.Name baseName,
                         ContextProxy proxy,
                         JRunNamingContext ctx)
                  throws javax.naming.NamingException
Method Detail

rebind

public void rebind(java.lang.String name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Specified by:
rebind in interface javax.naming.Context

rebind

public void rebind(javax.naming.Name name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Specified by:
rebind in interface javax.naming.Context

bind

public void bind(java.lang.String name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Specified by:
bind in interface javax.naming.Context

bind

public void bind(javax.naming.Name name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Specified by:
bind in interface javax.naming.Context

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws javax.naming.NamingException
Specified by:
lookup in interface javax.naming.Context

lookup

public java.lang.Object lookup(javax.naming.Name name)
                        throws javax.naming.NamingException
Specified by:
lookup in interface javax.naming.Context

unbind

public void unbind(java.lang.String name)
            throws javax.naming.NamingException
Specified by:
unbind in interface javax.naming.Context

unbind

public void unbind(javax.naming.Name name)
            throws javax.naming.NamingException
Specified by:
unbind in interface javax.naming.Context

rename

public void rename(java.lang.String oldname,
                   java.lang.String newname)
            throws javax.naming.NamingException
Specified by:
rename in interface javax.naming.Context

rename

public void rename(javax.naming.Name oldName,
                   javax.naming.Name newName)
            throws javax.naming.NamingException
Specified by:
rename in interface javax.naming.Context

list

public javax.naming.NamingEnumeration list(java.lang.String name)
                                    throws javax.naming.NamingException
Specified by:
list in interface javax.naming.Context

list

public javax.naming.NamingEnumeration list(javax.naming.Name name)
                                    throws javax.naming.NamingException
Specified by:
list in interface javax.naming.Context

listBindings

public javax.naming.NamingEnumeration listBindings(java.lang.String name)
                                            throws javax.naming.NamingException
Specified by:
listBindings in interface javax.naming.Context

listBindings

public javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
                                            throws javax.naming.NamingException
Specified by:
listBindings in interface javax.naming.Context

composeName

public java.lang.String composeName(java.lang.String name,
                                    java.lang.String prefix)
                             throws javax.naming.NamingException
Specified by:
composeName in interface javax.naming.Context

composeName

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

getNameParser

public javax.naming.NameParser getNameParser(java.lang.String name)
                                      throws javax.naming.NamingException
Specified by:
getNameParser in interface javax.naming.Context

getNameParser

public javax.naming.NameParser getNameParser(javax.naming.Name name)
                                      throws javax.naming.NamingException
Specified by:
getNameParser in interface javax.naming.Context

createSubcontext

public javax.naming.Context createSubcontext(java.lang.String name)
                                      throws javax.naming.NamingException
Specified by:
createSubcontext in interface javax.naming.Context

createSubcontext

public javax.naming.Context createSubcontext(javax.naming.Name name)
                                      throws javax.naming.NamingException
Specified by:
createSubcontext in interface javax.naming.Context

addToEnvironment

public java.lang.Object addToEnvironment(java.lang.String propName,
                                         java.lang.Object propVal)
                                  throws javax.naming.NamingException
Specified by:
addToEnvironment in interface javax.naming.Context

removeFromEnvironment

public java.lang.Object removeFromEnvironment(java.lang.String propName)
                                       throws javax.naming.NamingException
Specified by:
removeFromEnvironment in interface javax.naming.Context

getEnvironment

public java.util.Hashtable getEnvironment()
                                   throws javax.naming.NamingException
Specified by:
getEnvironment in interface javax.naming.Context

close

public void close()
           throws javax.naming.NamingException
Specified by:
close in interface javax.naming.Context

getNameInNamespace

public java.lang.String getNameInNamespace()
                                    throws javax.naming.NamingException
Specified by:
getNameInNamespace in interface javax.naming.Context

destroySubcontext

public void destroySubcontext(java.lang.String name)
                       throws javax.naming.NamingException
Specified by:
destroySubcontext in interface javax.naming.Context

destroySubcontext

public void destroySubcontext(javax.naming.Name name)
                       throws javax.naming.NamingException
Specified by:
destroySubcontext in interface javax.naming.Context

lookupLink

public java.lang.Object lookupLink(java.lang.String name)
                            throws javax.naming.NamingException
Specified by:
lookupLink in interface javax.naming.Context

lookupLink

public java.lang.Object lookupLink(javax.naming.Name name)
                            throws javax.naming.NamingException
Specified by:
lookupLink in interface javax.naming.Context

rawNamingOperation

public java.util.ArrayList rawNamingOperation(int op,
                                              boolean singleServer,
                                              java.lang.String serverName)
                                       throws java.lang.Exception

rawNamingOperation

public java.util.ArrayList rawNamingOperation(int op,
                                              boolean singleServer)
                                       throws java.lang.Exception

setLocalContextManager

public static void setLocalContextManager(ContextProxy proxy)
Set the local ContextProxy for optimized local access, invoked by the NamingService.

printTree

public static void printTree(javax.naming.Context ctx)
Prints the contents of this context and its subcontexts to System.out.

treeToString

public static java.lang.String treeToString(javax.naming.Context ctx)
Return a String repesenting all the bindings in the Context (passed as a parameter) and its subcontexts.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.