1 7 package org.jboss.jms.destination; 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 22 public class JBossDestinationFactory 23 implements ObjectFactory 24 { 25 27 29 31 33 35 37 public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception 38 { 39 try 40 { 41 Reference reference = (Reference ) obj; 42 String className = reference.getClassName(); 43 if (className.equals(JBossQueue.class.getName())) 44 return new JBossQueue(getName(reference)); 45 if (className.equals(JBossTopic.class.getName())) 46 return new JBossTopic(getName(reference)); 47 } 48 catch (Exception ignored) 49 { 50 } 51 return null; 52 } 53 54 56 62 protected String getName(Reference reference) 63 { 64 return (String ) reference.get("Name").getContent(); 65 } 66 67 69 71 73 } 74 | Popular Tags |