if (info.getType() == JmsConnectionFactory.TOPIC)
{
String jndi = adapter.getTopicFactoryRef();
if (jndi == null)
throw new IllegalStateException("No configured 'TopicFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
factory = context.lookup(jndi);
con = ConnectionFactoryHelper.createTopicConnection(factory, user, pwd);
if (info.getClientID() != null)
con.setClientID(info.getClientID());
con.setExceptionListener(this);
if (trace)
log.trace("created connection: " + con);
if (con instanceof XATopicConnection)
{
xaTopicSession = ((XATopicConnection)con).createXATopicSession();
topicSession = xaTopicSession.getTopicSession();
xaTransacted = true;
}
else if (con instanceof TopicConnection)
{
topicSession =
((TopicConnection)con).createTopicSession(transacted, ack);
if (trace)
log.trace("Using a non-XA TopicConnection. " +
"It will not be able to participate in a Global UOW");
}
else
throw new JBossResourceException("Connection was not recognizable: " + con);
if (trace)
log.trace("xaTopicSession=" + xaTopicSession + ", topicSession=" + topicSession);
}
else if (info.getType() == JmsConnectionFactory.QUEUE)
{
String jndi = adapter.getQueueFactoryRef();
if (jndi == null)
throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
factory = context.lookup(jndi);
con = ConnectionFactoryHelper.createQueueConnection(factory, user, pwd);
if (info.getClientID() != null)
con.setClientID(info.getClientID());
con.setExceptionListener(this);
if (trace)
log.debug("created connection: " + con);
if (con instanceof XAQueueConnection)
{
xaQueueSession =
((XAQueueConnection)con).createXAQueueSession();
queueSession = xaQueueSession.getQueueSession();
xaTransacted = true;
}
else if (con instanceof QueueConnection)
{
queueSession =
((QueueConnection)con).createQueueSession(transacted, ack);
if (trace)
log.trace("Using a non-XA QueueConnection. " +
"It will not be able to participate in a Global UOW");
}
else
throw new JBossResourceException("Connection was not reconizable: " + con);
if (trace)
log.trace("xaQueueSession=" + xaQueueSession + ", queueSession=" + queueSession);
}
else
{
String jndi = adapter.getFactoryRef();
if (jndi == null)
throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
factory = context.lookup(jndi);
con = ConnectionFactoryHelper.createConnection(factory, user, pwd);
if (info.getClientID() != null)
con.setClientID(info.getClientID());
con.setExceptionListener(this);