KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exolab > jms > client > JmsXAConnectionFactory


1 /**
2  * Redistribution and use of this software and associated documentation
3  * ("Software"), with or without modification, are permitted provided
4  * that the following conditions are met:
5  *
6  * 1. Redistributions of source code must retain copyright
7  * statements and notices. Redistributions must also contain a
8  * copy of this document.
9  *
10  * 2. Redistributions in binary form must reproduce the
11  * above copyright notice, this list of conditions and the
12  * following disclaimer in the documentation and/or other
13  * materials provided with the distribution.
14  *
15  * 3. The name "Exolab" must not be used to endorse or promote
16  * products derived from this Software without prior written
17  * permission of Exoffice Technologies. For written permission,
18  * please contact info@exolab.org.
19  *
20  * 4. Products derived from this Software may not be called "Exolab"
21  * nor may "Exolab" appear in their names without prior written
22  * permission of Exoffice Technologies. Exolab is a registered
23  * trademark of Exoffice Technologies.
24  *
25  * 5. Due credit should be given to the Exolab Project
26  * (http://www.exolab.org/).
27  *
28  * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39  * OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Copyright 2001-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
42  *
43  * $Id: JmsXAConnectionFactory.java,v 1.1 2005/03/18 03:36:37 tanderson Exp $
44  */

45 package org.exolab.jms.client;
46
47 import java.util.Map JavaDoc;
48 import javax.jms.JMSException JavaDoc;
49 import javax.jms.JMSSecurityException JavaDoc;
50 import javax.jms.XAConnection JavaDoc;
51 import javax.jms.XAConnectionFactory JavaDoc;
52 import javax.jms.XAQueueConnection JavaDoc;
53 import javax.jms.XAQueueConnectionFactory JavaDoc;
54 import javax.jms.XATopicConnection JavaDoc;
55 import javax.jms.XATopicConnectionFactory JavaDoc;
56
57 import org.exolab.jms.common.uuid.UUID;
58
59
60 /**
61  * Client implementation of the <code>javax.jms.XAConnectionFactory</code>
62  * interface.
63  *
64  * @author <a HREF="mailto:jima@comware.com.au">Jim Alateras</a>
65  * @author <a HREF="mailto:tma@netspace.net.au">Tim Anderson</a>
66  * @version $Revision: 1.1 $ $Date: 2005/03/18 03:36:37 $
67  */

68 public class JmsXAConnectionFactory
69         extends JmsConnectionFactory
70         implements XAConnectionFactory JavaDoc, XAQueueConnectionFactory JavaDoc,
71         XATopicConnectionFactory JavaDoc {
72
73     /**
74      * Default constructor required for serialization.
75      */

76     public JmsXAConnectionFactory() {
77     }
78
79     /**
80      * Construct a new <code>JmsXAConnectionFactory</code>.
81      *
82      * @param className the server proxy class name
83      * @param properties properties to initialise the server proxy with proxy.
84      * May be <code>null</code>
85      */

86     public JmsXAConnectionFactory(String JavaDoc className, Map JavaDoc properties) {
87         this(className, properties, null);
88     }
89
90     /**
91      * Construct a new <code>JmsXAConnectionFactory</code>.
92      *
93      * @param className the server proxy class name
94      * @param properties properties to initialise the server proxy with
95      * @param environment the environment used in creating the server proxy. May
96      * be <code>null</code>
97      */

98     public JmsXAConnectionFactory(String JavaDoc className, Map JavaDoc properties,
99                                   Map JavaDoc environment) {
100         super(className, properties, environment);
101     }
102
103     /**
104      * Creates an XA connection with the default user identity. The
105      * connection is created in stopped mode. No messages will be delivered
106      * until the <code>Connection.start</code> method is explicitly called.
107      *
108      * @return a newly created <code>XAConnection</code>
109      * @throws JMSException if the JMS provider fails to create an XA
110      * connection due to some internal error.
111      * @throws JMSSecurityException if client authentication fails due to an
112      * invalid user name or password.
113      */

114     public XAConnection JavaDoc createXAConnection() throws JMSException JavaDoc {
115         return createXAConnection(null, null);
116     }
117
118     /**
119      * Creates an XA connection with the specified user identity.
120      * The connection is created in stopped mode. No messages will be delivered
121      * until the <code>Connection.start</code> method is explicitly called.
122      *
123      * @param userName the caller's user name
124      * @param password the caller's password
125      * @return a newly created XA connection
126      * @throws JMSException if the JMS provider fails to create an XA
127      * connection due to some internal error.
128      * @throws JMSSecurityException if client authentication fails due to an
129      * invalid user name or password.
130      */

131     public XAConnection JavaDoc createXAConnection(String JavaDoc userName, String JavaDoc password)
132             throws JMSException JavaDoc {
133         String JavaDoc id = UUID.next();
134         JmsXAConnection connection = new JmsXAConnection(this, id, userName,
135                                                          password);
136         addConnection(connection);
137         return connection;
138     }
139
140     /**
141      * Creates an XA queue connection with the default user identity. The
142      * connection is created in stopped mode. No messages will be delivered
143      * until the <code>Connection.start</code> method is explicitly called.
144      *
145      * @return a newly created XA queue connection
146      * @throws JMSException if the JMS provider fails to create an XA
147      * queue connection due to some internal
148      * error.
149      * @throws JMSSecurityException if client authentication fails due to an
150      * invalid user name or password.
151      */

152     public XAQueueConnection JavaDoc createXAQueueConnection() throws JMSException JavaDoc {
153         return createXAQueueConnection(null, null);
154     }
155
156     /**
157      * Creates an XA queue connection with the specified user identity. The
158      * connection is created in stopped mode. No messages will be delivered
159      * until the <code>Connection.start</code> method is explicitly called.
160      *
161      * @param userName the caller's user name
162      * @param password the caller's password
163      * @return a newly created XA queue connection
164      * @throws JMSException if the JMS provider fails to create an XA
165      * queue connection due to some internal
166      * error.
167      * @throws JMSSecurityException if client authentication fails due to an
168      * invalid user name or password.
169      */

170
171     public XAQueueConnection JavaDoc createXAQueueConnection(String JavaDoc userName,
172                                                      String JavaDoc password)
173             throws JMSException JavaDoc {
174         String JavaDoc id = UUID.next();
175         JmsXAQueueConnection connection = new JmsXAQueueConnection(this, id,
176                                                                    userName,
177                                                                    password);
178         addConnection(connection);
179         return connection;
180     }
181
182     /**
183      * Creates an XA topic connection with the default user identity. The
184      * connection is created in stopped mode. No messages will be delivered
185      * until the <code>Connection.start</code> method is explicitly called.
186      *
187      * @return a newly created XA topic connection
188      * @throws JMSException if the JMS provider fails to create an XA
189      * topic connection due to some internal
190      * error.
191      * @throws JMSSecurityException if client authentication fails due to an
192      * invalid user name or password.
193      */

194
195     public XATopicConnection JavaDoc createXATopicConnection() throws JMSException JavaDoc {
196         return createXATopicConnection(null, null);
197     }
198
199     /**
200      * Creates an XA topic connection with the specified user identity. The
201      * connection is created in stopped mode. No messages will be delivered
202      * until the <code>Connection.start</code> method is explicitly called.
203      *
204      * @param userName the caller's user name
205      * @param password the caller's password
206      * @return a newly created XA topic connection
207      * @throws JMSException if the JMS provider fails to create an XA
208      * topic connection due to some internal
209      * error.
210      * @throws JMSSecurityException if client authentication fails due to an
211      * invalid user name or password.
212      */

213
214     public XATopicConnection JavaDoc createXATopicConnection(String JavaDoc userName,
215                                                      String JavaDoc password)
216             throws JMSException JavaDoc {
217         String JavaDoc id = UUID.next();
218         JmsXATopicConnection connection = new JmsXATopicConnection(this, id,
219                                                                    userName,
220                                                                    password);
221         addConnection(connection);
222         return connection;
223     }
224
225 }
226
Popular Tags