pt.jcodeutil.core.ejb
Class EJBHomeFactory

java.lang.Object
  |
  +--pt.jcodeutil.core.ejb.EJBHomeFactory

public class EJBHomeFactory
extends java.lang.Object

Title: EJB Home Factory Description: Singleton that performs lookup and caches EJB homes for reuse and performance purposes.

Version:
1.0
Author:
Marco Samuel (samuelbb@sapo.pt)

Method Summary
static EJBHomeFactory getInstance()
          Gets the singleton instance
 javax.ejb.EJBHome lookup(java.lang.Class homeInterfaceClass)
          Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name, getting the JNDI name from the full class name.
 javax.ejb.EJBHome lookup(java.lang.Class homeInterfaceClass, java.util.Hashtable htEnv)
          Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name, getting the JNDI name from the full class name.
 javax.ejb.EJBHome lookup(java.lang.String jndiName, java.lang.Class homeInterfaceClass)
          Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name.
 javax.ejb.EJBHome lookup(java.lang.String jndiName, java.lang.Class homeInterfaceClass, java.util.Hashtable htEnv)
          Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static EJBHomeFactory getInstance()
                                  throws javax.naming.NamingException
Gets the singleton instance
Returns:
the singleton instance
Throws:
javax.naming.NamingException - from InitialContext creation

lookup

public javax.ejb.EJBHome lookup(java.lang.String jndiName,
                                java.lang.Class homeInterfaceClass,
                                java.util.Hashtable htEnv)
                         throws javax.naming.NamingException
Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name.
Parameters:
jndiName - the JNDI / total EJB-REF name where the EJB is binded to.
homeInterfaceClass - the class to look up in cache. Must extend EJBHome interface and cannot be exactly the EJBHome class.
htEnv - Properties or Hashtable for Context creation, null if default.
Returns:
the EJB home interface.
Throws:
javax.naming.NamingException - from JNDI lookup.

lookup

public javax.ejb.EJBHome lookup(java.lang.String jndiName,
                                java.lang.Class homeInterfaceClass)
                         throws javax.naming.NamingException
Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name.
Parameters:
jndiName - the JNDI / total EJB-REF name where the EJB is binded to.
homeInterfaceClass - the class to look up in cache. Can not be EJBHome.class.
htEnv - Properties or Hashtable for Context creation, null if default.
Returns:
the EJB home interface.
Throws:
javax.naming.NamingException - from JNDI lookup.

lookup

public javax.ejb.EJBHome lookup(java.lang.Class homeInterfaceClass,
                                java.util.Hashtable htEnv)
                         throws javax.naming.NamingException
Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name, getting the JNDI name from the full class name.
Parameters:
homeInterfaceClass - the class to look up in cache. Can not be EJBHome.class.
Returns:
the EJB home interface.
Throws:
javax.naming.NamingException - from JNDI lookup.

lookup

public javax.ejb.EJBHome lookup(java.lang.Class homeInterfaceClass)
                         throws javax.naming.NamingException
Looks up the EJB Home class in cache and if doesn't exist, looks up with JNDI name, getting the JNDI name from the full class name.
Parameters:
homeInterfaceClass - the class to look up in cache. Can not be EJBHome.class.
Returns:
the EJB home interface.
Throws:
javax.naming.NamingException - from JNDI lookup.