1 29 30 package org.objectweb.jonas_jms; 31 32 import java.util.Hashtable ; 33 import javax.naming.Context ; 34 import javax.naming.Name ; 35 import javax.naming.Reference ; 36 import javax.naming.spi.ObjectFactory ; 37 import org.objectweb.jonas_jms.api.JmsManager; 38 39 import org.objectweb.util.monolog.api.BasicLevel; 40 41 50 public class JObjectFactory implements ObjectFactory { 51 52 55 public Object getObjectInstance(Object refObj, Name name, Context nameCtx, Hashtable env) throws Exception { 56 57 Reference ref = (Reference ) refObj; 58 JmsManager jms = JmsManagerImpl.getJmsManager(); 59 String clname = ref.getClassName(); 60 61 TraceJms.logger.log(BasicLevel.DEBUG, "instance " + clname); 62 63 if (clname.equals("org.objectweb.jonas_jms.JConnectionFactory")) { 64 return jms.getConnectionFactory(); 66 } else if (clname.equals("org.objectweb.jonas_jms.JQueueConnectionFactory")) { 67 return jms.getQueueConnectionFactory(); 69 } else if (clname.equals("org.objectweb.jonas_jms.JTopicConnectionFactory")) { 70 return jms.getTopicConnectionFactory(); 72 } else { 73 TraceJms.logger.log(BasicLevel.ERROR, "bad class name: " + clname); 74 return null; 75 } 76 } 77 } 78 | Popular Tags |