1 7 package org.jboss.test.hibernate.ejb.interfaces; 8 9 12 public class AggregateProfileServiceUtil 13 { 14 15 private static Object lookupHome(java.util.Hashtable environment, String jndiName, Class narrowTo) throws javax.naming.NamingException { 16 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (environment); 18 try { 19 Object objRef = initialContext.lookup(jndiName); 20 if (narrowTo.isInstance(java.rmi.Remote .class)) 22 return javax.rmi.PortableRemoteObject.narrow(objRef, narrowTo); 23 else 24 return objRef; 25 } finally { 26 initialContext.close(); 27 } 28 } 29 30 32 36 public static AggregateProfileServiceHome getHome() throws javax.naming.NamingException 37 { 38 return (AggregateProfileServiceHome) lookupHome(null, AggregateProfileServiceHome.JNDI_NAME, AggregateProfileServiceHome.class); 39 } 40 41 46 public static AggregateProfileServiceHome getHome( java.util.Hashtable environment ) throws javax.naming.NamingException 47 { 48 return (AggregateProfileServiceHome) lookupHome(environment, AggregateProfileServiceHome.JNDI_NAME, AggregateProfileServiceHome.class); 49 } 50 51 } | Popular Tags |