org.jboss.naming
Class Util

java.lang.Object
  extended byorg.jboss.naming.Util

public class Util
extends java.lang.Object

A static utility class for common JNDI operations.


Constructor Summary
Util()
           
 
Method Summary
protected static void appendClassInfo(java.lang.StringBuffer buffer, java.lang.Class clazz)
          Append Class Info
static void bind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value)
          Bind val to name in ctx, and make sure that all intermediate contexts exist
static void bind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value)
          Bind val to name in ctx, and make sure that all intermediate contexts exist
protected static void checkObject(javax.naming.Context context, java.lang.String name, java.lang.Object object, java.lang.Class clazz)
          Checks an object implements the given class
static javax.naming.Context createSubcontext(javax.naming.Context ctx, javax.naming.Name name)
          Create a subcontext including any intermediate contexts.
static javax.naming.Context createSubcontext(javax.naming.Context ctx, java.lang.String name)
          Create a subcontext including any intermediate contexts.
static java.lang.Object lookup(javax.naming.Context context, javax.naming.Name name, java.lang.Class clazz)
          Lookup an object in the given context
static java.lang.Object lookup(javax.naming.Context context, java.lang.String name, java.lang.Class clazz)
          Lookup an object in the given context
static java.lang.Object lookup(javax.naming.Name name, java.lang.Class clazz)
          Lookup an object in the default initial context
static java.lang.Object lookup(java.lang.String name, java.lang.Class clazz)
          Lookup an object in the default initial context
static void rebind(javax.naming.Context ctx, javax.naming.Name name, java.lang.Object value)
          Rebind val to name in ctx, and make sure that all intermediate contexts exist
static void rebind(javax.naming.Context ctx, java.lang.String name, java.lang.Object value)
          Rebind val to name in ctx, and make sure that all intermediate contexts exist
static void unbind(javax.naming.Context ctx, javax.naming.Name name)
          Unbinds a name from ctx, and removes parents if they are empty
static void unbind(javax.naming.Context ctx, java.lang.String name)
          Unbinds a name from ctx, and removes parents if they are empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

createSubcontext

public static javax.naming.Context createSubcontext(javax.naming.Context ctx,
                                                    java.lang.String name)
                                             throws javax.naming.NamingException
Create a subcontext including any intermediate contexts.

Returns:
The new or existing JNDI subcontext
Throws:
NamingException, - on any JNDI failure
javax.naming.NamingException

createSubcontext

public static javax.naming.Context createSubcontext(javax.naming.Context ctx,
                                                    javax.naming.Name name)
                                             throws javax.naming.NamingException
Create a subcontext including any intermediate contexts.

Returns:
The new or existing JNDI subcontext
Throws:
NamingException, - on any JNDI failure
javax.naming.NamingException

bind

public static void bind(javax.naming.Context ctx,
                        java.lang.String name,
                        java.lang.Object value)
                 throws javax.naming.NamingException
Bind val to name in ctx, and make sure that all intermediate contexts exist

Throws:
javax.naming.NamingException

bind

public static void bind(javax.naming.Context ctx,
                        javax.naming.Name name,
                        java.lang.Object value)
                 throws javax.naming.NamingException
Bind val to name in ctx, and make sure that all intermediate contexts exist

Throws:
javax.naming.NamingException

rebind

public static void rebind(javax.naming.Context ctx,
                          java.lang.String name,
                          java.lang.Object value)
                   throws javax.naming.NamingException
Rebind val to name in ctx, and make sure that all intermediate contexts exist

Throws:
javax.naming.NamingException

rebind

public static void rebind(javax.naming.Context ctx,
                          javax.naming.Name name,
                          java.lang.Object value)
                   throws javax.naming.NamingException
Rebind val to name in ctx, and make sure that all intermediate contexts exist

Throws:
javax.naming.NamingException

unbind

public static void unbind(javax.naming.Context ctx,
                          java.lang.String name)
                   throws javax.naming.NamingException
Unbinds a name from ctx, and removes parents if they are empty

Throws:
javax.naming.NamingException

unbind

public static void unbind(javax.naming.Context ctx,
                          javax.naming.Name name)
                   throws javax.naming.NamingException
Unbinds a name from ctx, and removes parents if they are empty

Throws:
javax.naming.NamingException

lookup

public static java.lang.Object lookup(java.lang.String name,
                                      java.lang.Class clazz)
                               throws java.lang.Exception
Lookup an object in the default initial context

Parameters:
name - the name to lookup
clazz - the expected type
Returns:
the object
Throws:
java.lang.Exception - for any error

lookup

public static java.lang.Object lookup(javax.naming.Name name,
                                      java.lang.Class clazz)
                               throws java.lang.Exception
Lookup an object in the default initial context

Parameters:
name - the name to lookup
clazz - the expected type
Returns:
the object
Throws:
java.lang.Exception - for any error

lookup

public static java.lang.Object lookup(javax.naming.Context context,
                                      java.lang.String name,
                                      java.lang.Class clazz)
                               throws java.lang.Exception
Lookup an object in the given context

Parameters:
context - the context
name - the name to lookup
clazz - the expected type
Returns:
the object
Throws:
java.lang.Exception - for any error

lookup

public static java.lang.Object lookup(javax.naming.Context context,
                                      javax.naming.Name name,
                                      java.lang.Class clazz)
                               throws java.lang.Exception
Lookup an object in the given context

Parameters:
context - the context
name - the name to lookup
clazz - the expected type
Returns:
the object
Throws:
java.lang.Exception - for any error

checkObject

protected static void checkObject(javax.naming.Context context,
                                  java.lang.String name,
                                  java.lang.Object object,
                                  java.lang.Class clazz)
                           throws java.lang.Exception
Checks an object implements the given class

Parameters:
context - the context
name - the name to lookup
object - the object
clazz - the expected type
Throws:
java.lang.Exception

appendClassInfo

protected static void appendClassInfo(java.lang.StringBuffer buffer,
                                      java.lang.Class clazz)
Append Class Info

Parameters:
buffer - the buffer to append to
clazz - the class to describe