1 package net.walend.somnifugi.juc; 2 3 import java.util.Hashtable ; 4 5 import javax.jms.Message ; 6 7 import javax.naming.Context ; 8 import javax.naming.NamingException ; 9 10 import net.walend.somnifugi.SomniProperties; 11 import net.walend.somnifugi.SomniDestination; 12 import net.walend.somnifugi.SomniNamingException; 13 14 import net.walend.somnifugi.channel.ChannelFactory; 15 import net.walend.somnifugi.channel.FanOutFactory; 16 import net.walend.somnifugi.channel.FanOut; 17 18 30 31 public class SimpleFanOutFactory 32 implements FanOutFactory<Message > 33 { 34 public SimpleFanOutFactory() 35 { 36 JUCLogger.IT.finer("Creating new SimpleFanOutFactory."); 37 } 38 39 public FanOut<Message > createFanOut(String destinationName,Context context,ChannelFactory<Message > factory) 40 throws SomniNamingException 41 { 42 try 43 { 44 Hashtable env = context.getEnvironment(); 45 46 JUCLogger.IT.finest("Creating SimpleFanOut for "+destinationName); 47 48 String copyMode = SomniProperties.DEEPCOPY; 49 50 String copyModeKey = SomniProperties.DEFAULT+"."+SomniProperties.COPYMODE; 51 if(env.containsKey(copyModeKey)) 52 { 53 copyMode = (String )env.get(copyModeKey); 54 } 55 56 copyModeKey = destinationName+"."+SomniProperties.COPYMODE; 57 if(env.containsKey(copyModeKey)) 58 { 59 copyMode = (String )env.get(copyModeKey); 60 } 61 62 return new SimpleFanOut(copyMode,factory,destinationName,context); 63 } 64 catch(NamingException ne) 65 { 66 throw new SomniNamingException(ne); 67 } 68 } 69 70 } 71 72 92 | Popular Tags |