JNDIHelper Class

DEPRECATED Use com.bea.p13n.util.JndiHelper

com.beasys.commerce.axiom.util.helper
JNDIHelper Class

public class JNDIHelper

    extends Object
    implements com.beasys.commerce.axiom.util.ToolkitConstants

Single point of access to the application server. This should make it easy to swap out servers, and processes.


Hierarchy
Object
  JNDIHelper
All Implemented Interfaces

com.beasys.commerce.axiom.util.ToolkitConstants

Constructor Summary

JNDIHelper()

 

Method Summary

public static void
bind(String name, Object obj)
Bind an object into the local naming context.
public static void
bind(Context ctx, String name, Object obj)
Bind an object to name in the given context.
public static Context
create(Hashtable props)
Create a new context based on the properties file.
public static Hashtable
createDefault()
Create the default context hashtable for creating the InitialContext.
protected static Context
createSubcontext(Context initial, String name)
Create a subcontext for the given name.
public static Context
getDefaultContext()
The default context.
public static Object
getHome(String homeName)
Safely retrieve an EJBHome by passing it through the PortableRemoteObject.narrow method, using the EJBMetaData.
public static Object
getHome(Context ctx, String homeName)
Get home.
public static Object
getService(String aLookupName)
Connect to a reference in JNDI referred to by the lookup name.
public static Object
lookup(String aLookupName)
Connect to a reference in JNDI referred to by the lookup name.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Constructor Detail

JNDIHelper

public JNDIHelper()
 

Method Detail

bind(String, Object) Method

public static void bind(String name, 
                        Object obj)
throws NamingException
Bind an object into the local naming context.

Parameters

name
the name (can be multi-part).
obj
the object.

Exceptions

NamingException
thrown on a naming error.

Related Topics

JNDIHelper.bind(Context, String, Object)
JNDIHelper.getDefaultContext()


bind(Context, String, Object) Method

public static void bind(Context ctx, 
                        String name, 
                        Object obj)
throws NamingException
Bind an object to name in the given context.

This supports binding multi-part names by creating the required sub Contexts as needed. If an object is already bound there, this will do a rebind.

Parameters

ctx
the naming Context.
name
the name (can be multi-part).
obj
the object.

Exceptions

NamingException
thrown on a naming error.

Related Topics

JNDIHelper.createSubcontext(Context, String)


create(Hashtable) Method

public static Context create(Hashtable props)
throws NamingException
Create a new context based on the properties file.

Parameters

props
the properties for the JNDI implementation.

Returns

Context

Exceptions

NamingException

createDefault() Method

public static Hashtable createDefault()
Create the default context hashtable for creating the InitialContext.

Returns

Hashtable

createSubcontext(Context, String) Method

protected static Context createSubcontext(Context initial, 
                                          String name)
throws NamingException
Create a subcontext for the given name.

This will not create the last portion of the name.

Parameters

initial
the initial context to start at.
name
the name (can be multi-part).

Returns

the subcontext.

Exceptions

NamingException
thrown is the name cannot be created.

getDefaultContext() Method

public static Context getDefaultContext()
The default context. This will look to see if a default context has been created


getHome(String) Method

public static Object getHome(String homeName)
throws ToolkitException
Safely retrieve an EJBHome by passing it through the PortableRemoteObject.narrow method, using the EJBMetaData.

If rmi-iiop is not being used, this will just do a lookup.

Parameters

homeName
the JNDI name of the home.

Returns

the home, safely narrowed to the home interface class.

Exceptions

ToolkitException
thrown on a lookup error.

getHome(Context, String) Method

public static Object getHome(Context ctx, 
                             String homeName)
throws NamingException
Get home.

Returns

Object

Exceptions

NamingException

getService(String) Method

DEPRECATED See lookup

public static Object getService(String aLookupName)
throws ToolkitException
Connect to a reference in JNDI referred to by the lookup name.

Parameters

aLookupName
the lookup name.

Returns

Object the object referenced by the name. Use this to get handles to Home interfaces, RMI objects, etc.

Exceptions

ToolkitException
holder for any exception

lookup(String) Method

public static Object lookup(String aLookupName)
throws ToolkitException
Connect to a reference in JNDI referred to by the lookup name.

Parameters

aLookupName
the lookup name.

Returns

Object the object referenced by the name. Use this to get handles to Home interfaces, RMI objects, etc.

Exceptions

ToolkitException
holder for any exception