KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > SpyXAConnection


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mq;
23
24 import java.io.Serializable JavaDoc;
25
26 import javax.jms.JMSException JavaDoc;
27 import javax.jms.QueueSession JavaDoc;
28 import javax.jms.Session JavaDoc;
29 import javax.jms.TopicSession JavaDoc;
30 import javax.jms.XAConnection JavaDoc;
31 import javax.jms.XAQueueConnection JavaDoc;
32 import javax.jms.XAQueueSession JavaDoc;
33 import javax.jms.XASession JavaDoc;
34 import javax.jms.XATopicConnection JavaDoc;
35 import javax.jms.XATopicSession JavaDoc;
36
37 /**
38  * This class implements javax.jms.XAQueueConnection
39  *
40  * @author Hiram Chirino (Cojonudo14@hotmail.com)
41  * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a>
42  * @version $Revision: 57013 $
43  */

44 public class SpyXAConnection extends SpyConnection implements Serializable JavaDoc, XAConnection JavaDoc, XATopicConnection JavaDoc, XAQueueConnection JavaDoc
45 {
46    /** The serialVersionUID */
47    static final long serialVersionUID = 1258716704996031025L;
48
49    /**
50     * Create a new SpyXAConnection
51     *
52     * @param userid the user
53     * @param password the password
54     * @param gcf the constructing class
55     * @throws JMSException for any error
56     */

57    public SpyXAConnection(String JavaDoc userid, String JavaDoc password, GenericConnectionFactory gcf) throws JMSException JavaDoc
58    {
59       super(userid, password, gcf);
60    }
61
62    /**
63     * Create a new SpyXAConnection
64     *
65     * @param gcf the constructing class
66     * @throws JMSException for any error
67     */

68    public SpyXAConnection(GenericConnectionFactory gcf) throws JMSException JavaDoc
69    {
70       super(gcf);
71    }
72    
73    public Session JavaDoc createSession(boolean transacted, int acknowledgeMode) throws JMSException JavaDoc
74    {
75       return createXASession();
76    }
77    
78    public QueueSession JavaDoc createQueueSession(boolean transacted, int acknowledgeMode) throws JMSException JavaDoc
79    {
80       return (QueueSession JavaDoc) createXAQueueSession();
81    }
82
83    public TopicSession JavaDoc createTopicSession(boolean transacted, int acknowledgeMode) throws JMSException JavaDoc
84    {
85       return (TopicSession JavaDoc) createXATopicSession();
86    }
87
88    public XASession JavaDoc createXASession() throws JMSException JavaDoc
89    {
90       checkClosed();
91       checkClientID();
92
93       XASession JavaDoc session = new SpySession(this, true, 0, true);
94       //add the new session to the createdSessions list
95
synchronized (createdSessions)
96       {
97          createdSessions.add(session);
98       }
99       return session;
100    }
101
102    public XAQueueSession JavaDoc createXAQueueSession() throws JMSException JavaDoc
103    {
104       checkClosed();
105       checkClientID();
106
107       XAQueueSession JavaDoc session = new SpyQueueSession(this, true, 0, true);
108
109       //add the new session to the createdSessions list
110
synchronized (createdSessions)
111       {
112          createdSessions.add(session);
113       }
114
115       return session;
116    }
117
118    public XATopicSession JavaDoc createXATopicSession() throws javax.jms.JMSException JavaDoc
119    {
120       checkClosed();
121       checkClientID();
122
123       XATopicSession JavaDoc session = new SpyTopicSession(this, true, 0, true);
124       //add the new session to the createdSessions list
125
synchronized (createdSessions)
126       {
127          createdSessions.add(session);
128       }
129       return session;
130    }
131 }
Popular Tags