1 22 package org.jboss.ejb3; 23 24 import java.util.Hashtable ; 25 26 import javax.ejb.EJBException ; 27 import javax.naming.Context ; 28 import javax.naming.Name ; 29 import javax.naming.Reference ; 30 import javax.naming.spi.ObjectFactory ; 31 import org.jboss.logging.Logger; 32 33 38 public class JndiProxyFactory implements ObjectFactory 39 { 40 private static final Logger log = Logger.getLogger(JndiProxyFactory.class); 41 42 public static final String FACTORY = "FACTORY"; 43 44 public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception 45 { 46 Reference ref = (Reference ) obj; 47 String factoryName = (String ) ref.get(FACTORY).getContent(); 48 49 try 50 { 51 ProxyFactory factory = (ProxyFactory) nameCtx.lookup(factoryName); 52 return factory.createProxy(); 53 } 54 catch (EJBException e) 55 { 56 throw e; 57 } 58 catch (ClassCastException e) 59 { 60 throw new EJBException ("Invalid invocation of local interface", e); 61 } 62 } 63 } 64 | Popular Tags |