org.globus.wsrf.jndi
Class JNDIUtils

java.lang.Object
  extended byorg.globus.wsrf.jndi.JNDIUtils

public class JNDIUtils
extends java.lang.Object

A utility class containing methods for setting up the JNDI environment and performing JNDI lookups


Nested Class Summary
private static class JNDIUtils.DirFilter
           
 
Field Summary
private static org.globus.util.I18n i18n
           
private static javax.naming.Context initialContext
           
static java.lang.String JNDI_CONFIG
           
private static org.apache.commons.logging.Log logger
           
 
Constructor Summary
JNDIUtils()
           
 
Method Summary
static javax.naming.Context createSubcontexts(javax.naming.Context currentContext, java.lang.String name)
          Create all intermediate subcontexts.
static java.lang.String getJNDIConfigFileName(org.apache.axis.MessageContext messageContext)
          Get the location of the JNDI configuration file from the deployment descriptor
static javax.naming.Context initializeDir(org.apache.axis.MessageContext msgCtx)
           
static javax.naming.Context initializeFile(org.apache.axis.MessageContext msgCtx)
           
static javax.naming.Context initJNDI()
          Configure JNDI with the Apache Tomcat naming service classes and create the comp and env contexts
static java.lang.Object lookup(javax.naming.Context context, java.lang.String name, java.lang.Class type)
          Retrieves the named object on the specified context.
static void parseJNDIConfig(javax.naming.Context initContext, java.io.InputStream configInput, org.apache.axis.AxisEngine engine)
          Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
static void parseJNDIConfig(java.io.InputStream configInput)
          Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration
private static void processJNDIFile(javax.naming.Context context, java.io.File dir, org.apache.axis.AxisEngine engine, java.lang.String configFile)
           
static java.lang.String toString(javax.naming.Context ctx, java.lang.String name)
           
private static void toString(java.lang.StringBuffer buf, javax.naming.Context ctx, java.lang.String name, java.lang.String tab)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.commons.logging.Log logger

i18n

private static org.globus.util.I18n i18n

JNDI_CONFIG

public static final java.lang.String JNDI_CONFIG
See Also:
Constant Field Values

initialContext

private static javax.naming.Context initialContext
Constructor Detail

JNDIUtils

public JNDIUtils()
Method Detail

initJNDI

public static javax.naming.Context initJNDI()
                                     throws java.lang.Exception
Configure JNDI with the Apache Tomcat naming service classes and create the comp and env contexts

Returns:
The initial context
Throws:
java.lang.Exception

getJNDIConfigFileName

public static java.lang.String getJNDIConfigFileName(org.apache.axis.MessageContext messageContext)
Get the location of the JNDI configuration file from the deployment descriptor

Parameters:
messageContext - The message context to use for discovering deployment information
Returns:
Location of JNDI configuration file relative to the root of the installation

parseJNDIConfig

public static void parseJNDIConfig(java.io.InputStream configInput)
                            throws java.lang.Exception
Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration

Parameters:
configInput - The configuration stream to parse
Throws:
java.lang.Exception

parseJNDIConfig

public static void parseJNDIConfig(javax.naming.Context initContext,
                                   java.io.InputStream configInput,
                                   org.apache.axis.AxisEngine engine)
                            throws javax.naming.NamingException,
                                   java.io.IOException,
                                   org.xml.sax.SAXException
Parse the given JNDI configuration and populate the JNDI registry using the parsed configuration

Parameters:
configInput - The configuration stream to parse
Throws:
javax.naming.NamingException
java.io.IOException
org.xml.sax.SAXException

lookup

public static java.lang.Object lookup(javax.naming.Context context,
                                      java.lang.String name,
                                      java.lang.Class type)
                               throws javax.naming.NamingException
Retrieves the named object on the specified context. The object returned must be of assignable from the type specified.

Parameters:
context - the context to perform lookup on
name - the name of the object to lookup
type - the expected type of the object returned
Throws:
javax.naming.NamingException

initializeDir

public static javax.naming.Context initializeDir(org.apache.axis.MessageContext msgCtx)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

processJNDIFile

private static void processJNDIFile(javax.naming.Context context,
                                    java.io.File dir,
                                    org.apache.axis.AxisEngine engine,
                                    java.lang.String configFile)
                             throws java.lang.Exception
Throws:
java.lang.Exception

initializeFile

public static javax.naming.Context initializeFile(org.apache.axis.MessageContext msgCtx)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

toString

public static java.lang.String toString(javax.naming.Context ctx,
                                        java.lang.String name)
                                 throws javax.naming.NamingException
Throws:
javax.naming.NamingException

toString

private static void toString(java.lang.StringBuffer buf,
                             javax.naming.Context ctx,
                             java.lang.String name,
                             java.lang.String tab)
                      throws javax.naming.NamingException
Throws:
javax.naming.NamingException

createSubcontexts

public static javax.naming.Context createSubcontexts(javax.naming.Context currentContext,
                                                     java.lang.String name)
                                              throws javax.naming.NamingException
Create all intermediate subcontexts.

Throws:
javax.naming.NamingException