/* */ throws ResourceException
/* */ {
/* 660 */ boolean trace = log.isTraceEnabled();
/* */ try
/* */ {
/* 664 */ JMSProviderAdapter adapter = getProviderAdapter();
/* 665 */ Context context = adapter.getInitialContext();
/* */
/* 667 */ boolean transacted = this.info.isTransacted();
/* 668 */ int ack = 1;
/* */
/* 670 */ if (this.info.getType() == 2)
/* */ {
/* 672 */ String jndi = adapter.getTopicFactoryRef();
/* 673 */ if (jndi == null)
/* 674 */ throw new IllegalStateException("No configured 'TopicFactoryRef' on the jms provider " + this.mcf.getJmsProviderAdapterJNDI());
/* 675 */ Object factory = context.lookup(jndi);
/* 676 */ this.con = ConnectionFactoryHelper.createTopicConnection(factory, this.user, this.pwd);
/* 677 */ if (this.info.getClientID() != null)
/* 678 */ this.con.setClientID(this.info.getClientID());
/* 679 */ this.con.setExceptionListener(this);
/* 680 */ if (trace) {
/* 681 */ log.trace("created connection: " + this.con);
/* */ }
/* 683 */ if ((this.con instanceof XATopicConnection))
/* */ {
/* 685 */ this.xaTopicSession = ((XATopicConnection)this.con).createXATopicSession();
/* 686 */ this.topicSession = this.xaTopicSession.getTopicSession();
/* 687 */ this.xaTransacted = true;
/* */ }
/* 689 */ else if ((this.con instanceof TopicConnection))
/* */ {
/* 691 */ this.topicSession = ((TopicConnection)this.con).createTopicSession(transacted, ack);
/* */
/* 693 */ if (trace)
/* 694 */ log.trace("Using a non-XA TopicConnection. It will not be able to participate in a Global UOW");
/* */ }
/* */ else
/* */ {
/* 698 */ throw new JBossResourceException("Connection was not recognizable: " + this.con);
/* */ }
/* 700 */ if (trace)
/* 701 */ log.trace("xaTopicSession=" + this.xaTopicSession + ", topicSession=" + this.topicSession);
/* */ }
/* 703 */ else if (this.info.getType() == 1)
/* */ {
/* 705 */ String jndi = adapter.getQueueFactoryRef();
/* 706 */ if (jndi == null)
/* 707 */ throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + this.mcf.getJmsProviderAdapterJNDI());
/* 708 */ Object factory = context.lookup(jndi);
/* 709 */ this.con = ConnectionFactoryHelper.createQueueConnection(factory, this.user, this.pwd);
/* 710 */ if (this.info.getClientID() != null)
/* 711 */ this.con.setClientID(this.info.getClientID());
/* 712 */ this.con.setExceptionListener(this);
/* 713 */ if (trace) {
/* 714 */ log.debug("created connection: " + this.con);
/* */ }
/* 716 */ if ((this.con instanceof XAQueueConnection))
/* */ {
/* 718 */ this.xaQueueSession = ((XAQueueConnection)this.con).createXAQueueSession();
/* */
/* 720 */ this.queueSession = this.xaQueueSession.getQueueSession();
/* 721 */ this.xaTransacted = true;
/* */ }
/* 723 */ else if ((this.con instanceof QueueConnection))
/* */ {
/* 725 */ this.queueSession = ((QueueConnection)this.con).createQueueSession(transacted, ack);
/* */
/* 727 */ if (trace)
/* 728 */ log.trace("Using a non-XA QueueConnection. It will not be able to participate in a Global UOW");
/* */ }
/* */ else
/* */ {
/* 732 */ throw new JBossResourceException("Connection was not reconizable: " + this.con);
/* */ }
/* 734 */ if (trace)
/* 735 */ log.trace("xaQueueSession=" + this.xaQueueSession + ", queueSession=" + this.queueSession);
/* */ }
/* */ else
/* */ {
/* 739 */ String jndi = adapter.getFactoryRef();
/* 740 */ if (jndi == null)
/* 741 */ throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + this.mcf.getJmsProviderAdapterJNDI());
/* 742 */ Object factory = context.lookup(jndi);
/* 743 */ this.con = ConnectionFactoryHelper.createConnection(factory, this.user, this.pwd);
/* 744 */ if (this.info.getClientID() != null)