1 7 package org.jboss.jms.serverless; 8 9 import org.jboss.logging.Logger; 10 import javax.jms.ConnectionFactory ; 11 import javax.jms.Connection ; 12 import javax.jms.JMSException ; 13 import java.net.URL ; 14 15 21 public class GroupConnectionFactory implements ConnectionFactory { 22 23 private static final Logger log = Logger.getLogger(GroupConnectionFactory.class); 24 25 private String stackConfigFileName; 26 27 public GroupConnectionFactory(String stackConfigFileName) { 28 this.stackConfigFileName = stackConfigFileName; 29 } 30 31 39 public Connection createConnection() throws JMSException { 40 41 URL url = getClass().getClassLoader().getResource(stackConfigFileName); 42 if (url == null) { 43 String msg = 44 "The channel configuration file (" + stackConfigFileName + ") not found! "+ 45 "Make sure it is in classpath."; 46 throw new JMSException (msg); 47 } 48 49 GroupConnection c = new GroupConnection(url); 50 c.connect(); 51 return c; 52 53 } 54 55 public String toString() { 56 return 57 getClass().getName().toString()+"@"+Integer.toHexString(hashCode())+"["+ 58 stackConfigFileName+"]"; 59 } 60 61 68 public Connection createConnection(String userName, String password) throws JMSException { 69 throw new NotImplementedException(); 70 } 71 72 } 73 | Popular Tags |