org.slim3.commons.jndi
Class Jndi

java.lang.Object
  extended by org.slim3.commons.jndi.Jndi

public final class Jndi
extends Object

A class to access naming context conveniently.

Version:
3.0
Author:
higa

Field Summary
static String FRONT_NAMING_FACTORY_KEY
          The key for front initial context factory.
 
Method Summary
static Context getContext()
          Returns the naming context.
static void initialize()
          Initializes this class.
static
<T> T
lookup(String name)
          Looks up a object by the name.
static
<T> T
lookupWithoutNameNotFoundException(String name)
          Looks up a object by the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRONT_NAMING_FACTORY_KEY

public static final String FRONT_NAMING_FACTORY_KEY
The key for front initial context factory.

See Also:
Constant Field Values
Method Detail

initialize

public static void initialize()
Initializes this class.


getContext

public static final Context getContext()
Returns the naming context.

Returns:
the naming context.

lookup

public static <T> T lookup(String name)
                throws NameNotFoundRuntimeException,
                       NamingRuntimeException
Looks up a object by the name.

Type Parameters:
T - the type
Parameters:
name - the name
Returns:
a object
Throws:
NameNotFoundRuntimeException - if the name is not bound to any objects.
NamingRuntimeException - if NamingException is encountered.

lookupWithoutNameNotFoundException

public static <T> T lookupWithoutNameNotFoundException(String name)
                                            throws NamingRuntimeException
Looks up a object by the name. Returns null if the name is not bound to any objects.

Type Parameters:
T - the type
Parameters:
name - the name
Returns:
a object
Throws:
NamingRuntimeException - if NamingException is encountered.


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.