KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > ha > tcp > XAQueueHATcpConnectionFactory


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - 2006 ScalAgent Distributed Technologies
4  * Copyright (C) 2004 Bull SA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  *
21  * Initial developer(s): ScalAgent Distributed Technologies
22  * Contributor(s): Benoit Pelletier (Bull SA)
23  */

24 package org.objectweb.joram.client.jms.ha.tcp;
25
26 import org.objectweb.joram.client.jms.XAConnection;
27 import org.objectweb.joram.client.jms.XAQueueConnection;
28 import org.objectweb.joram.client.jms.Connection;
29 import org.objectweb.joram.client.jms.QueueConnection;
30
31 import javax.naming.NamingException JavaDoc;
32
33 /**
34  * An <code>XAQueueHATcpConnectionFactory</code> instance is a factory of
35  * tcp connections for XA PTP HA communication.
36  */

37 public class XAQueueHATcpConnectionFactory
38     extends org.objectweb.joram.client.jms.XAQueueConnectionFactory
39 {
40
41   private String JavaDoc url;
42
43   /**
44    * Constructs an <code>XAQueueHATcpConnectionFactory</code> instance.
45    */

46   public XAQueueHATcpConnectionFactory(String JavaDoc url)
47     {
48       super(url);
49       this.url = url;
50     }
51
52   /**
53    * Method inherited from the <code>XAQueueConnectionFactory</code> class.
54    *
55    * @exception JMSSecurityException If the user identification is incorrect.
56    */

57   public javax.jms.XAQueueConnection JavaDoc
58       createXAQueueConnection(String JavaDoc name, String JavaDoc password)
59     throws javax.jms.JMSException JavaDoc
60     {
61       HATcpConnection lc = new HATcpConnection(
62         url, params, name, password, reliableClass);
63       return new XAQueueConnection(params, lc);
64     }
65
66   /**
67    * Method inherited from the <code>XAConnectionFactory</code> class.
68    *
69    * @exception JMSSecurityException If the user identification is incorrect.
70    */

71   public javax.jms.XAConnection JavaDoc
72       createXAConnection(String JavaDoc name, String JavaDoc password)
73     throws javax.jms.JMSException JavaDoc
74     {
75       HATcpConnection lc = new HATcpConnection(
76         url, params, name, password, reliableClass);
77       return new XAConnection(params, lc);
78     }
79
80   /**
81    * Method inherited from the <code>QueueConnectionFactory</code> class.
82    *
83    * @exception JMSSecurityException If the user identification is incorrect.
84    */

85   public javax.jms.QueueConnection JavaDoc
86       createQueueConnection(String JavaDoc name, String JavaDoc password)
87     throws javax.jms.JMSException JavaDoc
88     {
89       HATcpConnection lc = new HATcpConnection(
90         url, params, name, password, reliableClass);
91       return new QueueConnection(params, lc);
92     }
93
94   /**
95    * Method inherited from the <code>ConnectionFactory</code> class.
96    *
97    * @exception JMSSecurityException If the user identification is incorrect.
98    */

99   public javax.jms.Connection JavaDoc createConnection(String JavaDoc name, String JavaDoc password)
100     throws javax.jms.JMSException JavaDoc
101     {
102       HATcpConnection lc = new HATcpConnection(
103         url, params, name, password, reliableClass);
104       return new Connection(params, lc);
105     }
106
107
108   /**
109    * Admin method creating a <code>javax.jms.XAQueueConnectionFactory</code>
110    * instance for creating tcp connections.
111    */

112   public static javax.jms.XAQueueConnectionFactory JavaDoc create(String JavaDoc url) {
113     return create(url,
114                   "org.objectweb.joram.client.jms.tcp.ReliableTcpClient");
115   }
116
117   /**
118    * Admin method creating a <code>javax.jms.XAQueueConnectionFactory</code>
119    * instance for creating tcp connections.
120    */

121   public static javax.jms.XAQueueConnectionFactory JavaDoc
122       create(String JavaDoc url, String JavaDoc reliableClass) {
123     XAQueueHATcpConnectionFactory cf = new XAQueueHATcpConnectionFactory(url);
124     cf.setReliableClass(reliableClass);
125     return cf;
126   }
127 }
128
Popular Tags