1 25 26 27 package org.objectweb.jonas_ejb.container; 28 29 import java.util.Hashtable ; 30 31 import javax.naming.Context ; 32 import javax.naming.Name ; 33 import javax.naming.Reference ; 34 import javax.naming.spi.ObjectFactory ; 35 36 import org.objectweb.util.monolog.api.BasicLevel; 37 38 45 public class HomeFactory implements ObjectFactory { 46 47 59 public Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable env) throws Exception { 60 Reference ref = (Reference ) refObj; 61 String clname = ref.getClassName(); 62 63 if (TraceEjb.isDebugIc()) { 64 TraceEjb.interp.log(BasicLevel.DEBUG, clname); 65 } 66 67 if (clname.equals("org.objectweb.jonas_ejb.container.JLocalHome")) { 68 String beanName = (String ) ref.get("bean.name").getContent(); 70 JLocalHome localhome = JLocalHome.getLocalHome(beanName); 71 if (localhome == null) { 72 TraceEjb.logger.log(BasicLevel.ERROR, "cannot get " + beanName); 73 } 74 return localhome; 75 } else if (clname.equals("org.objectweb.jonas_ejb.container.JServiceEndpointHome")) { 76 String beanName = (String ) ref.get("bean.name").getContent(); 78 JServiceEndpointHome sehome = JServiceEndpointHome.getSEHome(beanName); 79 if (sehome == null) { 80 TraceEjb.logger.log(BasicLevel.ERROR, "cannot get " + beanName); 81 } 82 return sehome; 83 } else { 84 TraceEjb.logger.log(BasicLevel.ERROR, "bad class name: " + clname); 85 } 86 return null; 88 } 89 } 90 | Popular Tags |