Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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 java.lang.Object

Constructor Summary
`JndiHelper()`

Method Summary
`static javax.naming.Context` | `getContext()` Returns a reference to an InitialContext object.
`static java.lang.Object` | `lookupNarrow(java.lang.String lookupName, java.lang.Class 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 javax.naming.Context getContext()
                                           throws javax.naming.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:
    javax.naming.NamingException - if InitialContext cannot be obtained

### lookupNarrow

    public static java.lang.Object lookupNarrow(java.lang.String lookupName,
                                                java.lang.Class lookupClass)
                                         throws javax.naming.NamingException,
                                                java.lang.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:
    javax.naming.NamingException - If the lookup() call fails
    java.lang.ClassCastException - If lookupName cannot be cast to lookupClass
  See Also:
    `PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved