1 7 package org.jboss.jms.client.standard; 8 9 import java.util.Hashtable ; 10 11 import javax.naming.Context ; 12 import javax.naming.Name ; 13 import javax.naming.Reference ; 14 import javax.naming.spi.ObjectFactory ; 15 16 import org.jboss.jms.client.JBossConnectionFactory; 17 import org.jboss.remoting.Client; 18 import org.jboss.remoting.InvokerLocator; 19 20 26 public class StandardImplementationFactory 27 implements ObjectFactory 28 { 29 31 33 35 37 39 41 public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception 42 { 43 try 44 { 45 Reference reference = (Reference ) obj; 46 String className = reference.getClassName(); 47 if (className.equals(JBossConnectionFactory.class.getName())) 48 return new JBossConnectionFactory(getImplementation(reference)); 49 } 50 catch (Exception ignored) 51 { 52 } 53 return null; 54 } 55 56 58 64 protected StandardImplementation getImplementation(Reference reference) 65 throws Exception 66 { 67 String locatorURI = (String ) reference.get("locatorURI").getContent(); 68 InvokerLocator locator = new InvokerLocator(locatorURI); 69 Client client = new Client(locator, "JMS"); 70 return new StandardImplementation(client); 71 } 72 73 75 77 79 } 80 | Popular Tags |