1 22 package org.jboss.mq.il.uil2; 23 24 import java.util.Properties ; 25 26 import org.jboss.mq.il.ServerIL; 27 import org.jboss.mq.il.ServerILFactory; 28 import java.net.InetAddress ; 29 30 36 public class UILServerILFactory implements ServerILFactory { 37 38 final public static String SERVER_IL_FACTORY = UILServerILFactory.class.getName(); 39 final public static String CLIENT_IL_SERVICE = UILClientILService.class.getName(); 40 final public static String UIL_ADDRESS_KEY = "UIL_ADDRESS_KEY"; 41 final public static String UIL_PORT_KEY = "UIL_PORT_KEY"; 42 final public static String UIL_TCPNODELAY_KEY = "UIL_TCPNODELAY_KEY"; 43 final public static String UIL_BUFFERSIZE_KEY = "UIL_BUFFERSIZE_KEY"; 44 final public static String UIL_CHUNKSIZE_KEY = "UIL_CHUNKSIZE_KEY"; 45 final public static String UIL_RECEIVE_REPLIES_KEY = "UIL_RECEIVE_REPLIES_KEY"; 46 final public static String UIL_SOTIMEOUT_KEY = "UIL_SOTIMEOUT_KEY"; 47 final public static String UIL_CONNECTADDRESS_KEY = "UIL_CONNECTADDRESS_KEY"; 48 final public static String UIL_CONNECTPORT_KEY = "UIL_CONNECTPORT_KEY"; 49 50 private ServerIL serverIL; 51 52 55 public void init(Properties props) throws Exception { 56 57 String t = props.getProperty(UIL_ADDRESS_KEY); 58 if (t == null) 59 throw new javax.jms.JMSException ("A required connection property was not set: " + UIL_ADDRESS_KEY); 60 InetAddress address = InetAddress.getByName(t); 61 62 t = props.getProperty(UIL_PORT_KEY); 63 if (t == null) 64 throw new javax.jms.JMSException ("A required connection property was not set: " + UIL_PORT_KEY); 65 int port = Integer.parseInt(t); 66 67 boolean enableTcpNoDelay=false; 68 t = props.getProperty(UIL_TCPNODELAY_KEY); 69 if (t != null) 70 enableTcpNoDelay = t.equals("yes"); 71 72 int bufferSize = 1; t = props.getProperty(UIL_BUFFERSIZE_KEY); 74 if (t != null) 75 bufferSize = Integer.parseInt(t); 76 77 int chunkSize = 0x40000000; t = props.getProperty(UIL_CHUNKSIZE_KEY); 79 if (t != null) 80 chunkSize = Integer.parseInt(t); 81 82 int soTimeout = 0; 83 t = props.getProperty(UIL_SOTIMEOUT_KEY); 84 if (t != null) 85 soTimeout = Integer.parseInt(t); 86 87 String connectAddress = props.getProperty(UIL_CONNECTADDRESS_KEY); 88 89 int connectPort = 0; 90 t = props.getProperty(UIL_CONNECTPORT_KEY); 91 if (t != null) 92 connectPort = Integer.parseInt(t); 93 94 String clientSocketFactoryName = null; 95 96 serverIL = new UILServerIL(address, port, clientSocketFactoryName, enableTcpNoDelay, bufferSize, chunkSize, soTimeout, connectAddress, connectPort); 97 98 } 99 100 103 public ServerIL getServerIL() throws Exception { 104 return serverIL; 105 } 106 107 } | Popular Tags |