1 package net.walend.somnifugi; 2 3 import java.io.Serializable ; 4 5 import java.util.Hashtable ; 6 7 import net.walend.somnifugi.channel.Channel; 8 import net.walend.somnifugi.channel.Puttable; 9 import net.walend.somnifugi.channel.ChannelFactory; 10 11 import javax.naming.Context ; 12 import javax.naming.NamingException ; 13 14 import javax.jms.Destination ; 15 import javax.jms.JMSException ; 16 import javax.jms.Message ; 17 18 23 24 public abstract class SomniDestination 25 implements Destination , Serializable 26 { 27 private ChannelFactory<Message > factory; 28 29 private String name; 30 31 private String copyMode = SomniProperties.DEEPCOPY; 32 33 private Context context; 34 35 protected SomniDestination(String name,ChannelFactory<Message > factory,Context context) 36 throws SomniNamingException 37 { 38 try 39 { 40 this.factory = factory; 41 this.name = name; 42 43 this.context = context; 44 45 Hashtable props = context.getEnvironment(); 46 47 String copyModeKey = SomniProperties.DEFAULT+"."+SomniProperties.COPYMODE; 48 if(props.containsKey(copyModeKey)) 49 { 50 copyMode = (String )props.get(copyModeKey); 51 SomniLogger.IT.config("Set "+name+" copy mode to "+copyMode); 52 } 53 54 copyModeKey = name+"."+SomniProperties.COPYMODE; 55 if(props.containsKey(copyModeKey)) 56 { 57 copyMode = (String )props.get(copyModeKey); 58 SomniLogger.IT.config("Set "+name+" copy mode to "+copyMode); 59 } 60 } 61 catch(NamingException ne) 62 { 63 throw new SomniNamingException(ne); 64 } 65 } 66 67 ChannelFactory<Message > getChannelFactory() 68 { 69 return factory; 70 } 71 72 Context getContext() 73 { 74 return context; 75 } 76 77 public String getName() 78 { 79 return name; 80 } 81 82 final String getCopyMode() 83 { 84 return copyMode; 85 } 86 } 87 88 108 | Popular Tags |