1 7 package org.jboss.jms.client; 8 9 import javax.jms.Connection ; 10 import javax.jms.ConnectionFactory ; 11 import javax.jms.JMSException ; 12 import javax.jms.QueueConnection ; 13 import javax.jms.QueueConnectionFactory ; 14 import javax.jms.TopicConnection ; 15 import javax.jms.TopicConnectionFactory ; 16 import javax.jms.XAConnection ; 17 import javax.jms.XAConnectionFactory ; 18 import javax.jms.XAQueueConnection ; 19 import javax.jms.XAQueueConnectionFactory ; 20 import javax.jms.XATopicConnection ; 21 import javax.jms.XATopicConnectionFactory ; 22 import javax.naming.NamingException ; 23 import javax.naming.Reference ; 24 import javax.naming.Referenceable ; 25 26 32 public class JBossConnectionFactory 33 implements ConnectionFactory , QueueConnectionFactory , TopicConnectionFactory , 34 XAConnectionFactory , XAQueueConnectionFactory , XATopicConnectionFactory , 35 Referenceable 36 { 37 39 41 42 ImplementationDelegate delegate; 43 44 46 48 50 55 public JBossConnectionFactory(ImplementationDelegate delegate) 56 throws JMSException 57 { 58 this.delegate = delegate; 59 } 60 61 63 public Connection createConnection() 64 throws JMSException 65 { 66 return createConnection(null, null); 67 } 68 69 public Connection createConnection(String userName, String password) 70 throws JMSException 71 { 72 ConnectionDelegate connection = delegate.createConnection(userName, password); 73 return new JBossConnection(connection, false); 74 } 75 76 78 public QueueConnection createQueueConnection() 79 throws JMSException 80 { 81 return (QueueConnection ) createConnection(null, null); 82 } 83 84 public QueueConnection createQueueConnection(String userName, String password) 85 throws JMSException 86 { 87 return (QueueConnection ) createConnection(userName, password); 88 } 89 90 92 public TopicConnection createTopicConnection() 93 throws JMSException 94 { 95 return (TopicConnection ) createConnection(null, null); 96 } 97 98 public TopicConnection createTopicConnection(String userName, String password) 99 throws JMSException 100 { 101 return (TopicConnection ) createConnection(userName, password); 102 } 103 104 106 public XAConnection createXAConnection() throws JMSException 107 { 108 return createXAConnection(null, null); 109 } 110 111 public XAConnection createXAConnection(String userName, String password) throws JMSException 112 { 113 ConnectionDelegate connection = delegate.createConnection(userName, password); 114 return new JBossConnection(connection, true); 115 } 116 117 119 public XAQueueConnection createXAQueueConnection() throws JMSException 120 { 121 return (XAQueueConnection ) createXAConnection(null, null); 122 } 123 124 public XAQueueConnection createXAQueueConnection(String userName, String password) throws JMSException 125 { 126 return (XAQueueConnection ) createXAConnection(userName, password); 127 } 128 129 131 public XATopicConnection createXATopicConnection() throws JMSException 132 { 133 return (XATopicConnection ) createXAConnection(null, null); 134 } 135 136 public XATopicConnection createXATopicConnection(String userName, String password) throws JMSException 137 { 138 return (XATopicConnection ) createXAConnection(userName, password); 139 } 140 141 143 public Reference getReference() throws NamingException 144 { 145 return delegate.getReference(); 146 } 147 148 150 152 154 156 } 157 | Popular Tags |