package org.jboss.jms.serverless;
import org.jboss.logging.Logger;
import javax.jms.ConnectionFactory;
import javax.jms.Connection;
import javax.jms.JMSException;
import java.net.URL;
public class GroupConnectionFactory implements ConnectionFactory {
private static final Logger log = Logger.getLogger(GroupConnectionFactory.class);
private String stackConfigFileName;
public GroupConnectionFactory(String stackConfigFileName) {
this.stackConfigFileName = stackConfigFileName;
}
public Connection createConnection() throws JMSException {
URL url = getClass().getClassLoader().getResource(stackConfigFileName);
if (url == null) {
String msg =
"The channel configuration file (" + stackConfigFileName + ") not found! "+
"Make sure it is in classpath.";
throw new JMSException(msg);
}
GroupConnection c = new GroupConnection(url);
c.connect();
return c;
}
public String toString() {
return
getClass().getName().toString()+"@"+Integer.toHexString(hashCode())+"["+
stackConfigFileName+"]";
}
public Connection createConnection(String userName, String password) throws JMSException {
throw new NotImplementedException();
}
}