package org.jboss.jms.client;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.XAConnection;
import javax.jms.XAConnectionFactory;
import javax.jms.XAQueueConnection;
import javax.jms.XAQueueConnectionFactory;
import javax.jms.XATopicConnection;
import javax.jms.XATopicConnectionFactory;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.Referenceable;
public class JBossConnectionFactory
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory,
Referenceable
{
ImplementationDelegate delegate;
public JBossConnectionFactory(ImplementationDelegate delegate)
throws JMSException
{
this.delegate = delegate;
}
public Connection createConnection()
throws JMSException
{
return createConnection(null, null);
}
public Connection createConnection(String userName, String password)
throws JMSException
{
ConnectionDelegate connection = delegate.createConnection(userName, password);
return new JBossConnection(connection, false);
}
public QueueConnection createQueueConnection()
throws JMSException
{
return (QueueConnection) createConnection(null, null);
}
public QueueConnection createQueueConnection(String userName, String password)
throws JMSException
{
return (QueueConnection) createConnection(userName, password);
}
public TopicConnection createTopicConnection()
throws JMSException
{
return (TopicConnection) createConnection(null, null);
}
public TopicConnection createTopicConnection(String userName, String password)
throws JMSException
{
return (TopicConnection) createConnection(userName, password);
}
public XAConnection createXAConnection() throws JMSException
{
return createXAConnection(null, null);
}
public XAConnection createXAConnection(String userName, String password) throws JMSException
{
ConnectionDelegate connection = delegate.createConnection(userName, password);
return new JBossConnection(connection, true);
}
public XAQueueConnection createXAQueueConnection() throws JMSException
{
return (XAQueueConnection) createXAConnection(null, null);
}
public XAQueueConnection createXAQueueConnection(String userName, String password) throws JMSException
{
return (XAQueueConnection) createXAConnection(userName, password);
}
public XATopicConnection createXATopicConnection() throws JMSException
{
return (XATopicConnection) createXAConnection(null, null);
}
public XATopicConnection createXATopicConnection(String userName, String password) throws JMSException
{
return (XATopicConnection) createXAConnection(userName, password);
}
public Reference getReference() throws NamingException
{
return delegate.getReference();
}
}