1 22 package org.jboss.mq.il.http; 23 24 import java.util.Properties ; 25 26 import javax.jms.JMSException ; 27 28 import org.jboss.logging.Logger; 29 30 import org.jboss.mq.il.ServerIL; 31 import org.jboss.mq.il.ServerILFactory; 32 33 40 public class HTTPServerILFactory implements ServerILFactory 41 { 42 43 public static final String SERVER_IL_FACTORY = HTTPServerILFactory.class.getName(); 44 public static final String CLIENT_IL_SERVICE = HTTPClientILService.class.getName(); 45 public static final String SERVER_URL_KEY = "org.jboss.mq.il.http.url"; 46 public static final String TIMEOUT_KEY = "org.jboss.mq.il.http.timeout"; 47 public static final String REST_INTERVAL_KEY = "org.jboss.mq.il.http.restinterval"; 48 49 private static Logger log = Logger.getLogger(HTTPServerILFactory.class); 50 51 private HTTPServerIL serverIL; 52 53 public HTTPServerILFactory() 54 { 55 if(log.isTraceEnabled()) 56 { 57 log.trace("created"); 58 } 59 } 60 61 public ServerIL getServerIL() throws Exception 62 { 63 if (log.isTraceEnabled()) 64 { 65 log.trace("getServerIL()"); 66 } 67 return this.serverIL; 68 } 69 70 public void init(Properties props) throws Exception 71 { 72 if (log.isTraceEnabled()) 73 { 74 log.trace("init(Properties " + props.toString() + ")"); 75 } 76 if (!props.containsKey(SERVER_URL_KEY)) 77 { 78 if (log.isDebugEnabled()) 79 { 80 log.debug("The supplied properties don't include a server URL entry. Now checking to see if it is specified in the system properties."); 81 } 82 if (System.getProperties().containsKey(SERVER_URL_KEY)) 83 { 84 if (log.isDebugEnabled()) 85 { 86 log.debug("The server URL property was found in the system properties. Will use it."); 87 } 88 props.setProperty(SERVER_URL_KEY, System.getProperty(SERVER_URL_KEY)); 89 } 90 else 91 { 92 throw new JMSException ("A required connection property was not set: " + SERVER_URL_KEY); 93 } 94 } 95 this.serverIL = new HTTPServerIL(props.getProperty(SERVER_URL_KEY)); 96 97 } 98 99 } | Popular Tags |