Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.util
Class JndiHelper

    java.lang.Object
      com.bea.p13n.util.JndiHelper

    public class JndiHelper

extends Object

Constructor Summary
`JndiHelper()`

Method Summary
`static Context` | `getApplicationContext()`
`static Context` | `getContext()` Returns a reference to an InitialContext object.
`static
`<T> T`
` | `lookup(String lookupname, Class<T> lookupClass)`
`static
`<T> T`
` | `lookupApplicationScope(String lookupname, Class<T> lookupClass)`
`static DataSource` | `lookupDataSource(String lookupname)`
`static
`<T> T`
` | `lookupNarrow(String lookupName, Class<T> lookupClass)` Convenience method for getting a remote JNDI reference to an object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JndiHelper

    public JndiHelper()

Method Detail

### getContext

    public static Context getContext()
                              throws NamingException

  Returns a reference to an InitialContext object. This method is functionally equivalent to: "new InitialContext()", but the use of this method allows for centralized configuration and caching strategies.

  Returns
    ctx The Context reference
  Throws
    `NamingException` - if InitialContext cannot be obtained

### getApplicationContext

    public static Context getApplicationContext()
                                         throws NamingException

  Throws
    `NamingException`

### lookupNarrow

    public static <T> T lookupNarrow(String lookupName,
                                     Class<T> lookupClass)
                          throws NamingException,
                                 ClassCastException

  Convenience method for getting a remote JNDI reference to an object. This will mostly be used to locate a remote EJB's home interface, but is generic to allow location of any JNDI-bound object.

  The code this executes looks like:

          PortableRemoteObject.narrow(
            JndiHelper.getContext().lookup(lookupName),
            lookupClass);

  Parameters
    `lookupName` - The JNDI name of the object to locate
    `lookupClass` - The desired class type
  Returns
    An object which can be cast to the desired type
  Throws
    `NamingException` - If the lookup() call fails
    `ClassCastException` - If lookupName cannot be cast to lookupClass
  See Also
    `PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)`

### lookup

    public static <T> T lookup(String lookupname,
                               Class<T> lookupClass)
                    throws NamingException

  Throws
    `NamingException`

### lookupApplicationScope

    public static <T> T lookupApplicationScope(String lookupname,
                                               Class<T> lookupClass)
                                    throws NamingException

  Throws
    `NamingException`

### lookupDataSource

    public static DataSource lookupDataSource(String lookupname)
                                       throws NamingException

  Throws
    `NamingException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 BEA Systems, Inc. All Rights Reserved