KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - 2007 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.*;
27
28 /**
29  * An <code>XATcpConnectionFactory</code> instance is a factory of
30  * tcp connections dedicated to HA communication.
31  */

32 public class HATcpConnectionFactory
33   extends org.objectweb.joram.client.jms.ConnectionFactory {
34
35   /**
36    * Constructs an <code>HATcpConnectionFactory</code> instance.
37    */

38   public HATcpConnectionFactory(String JavaDoc url) {
39     super(url);
40   }
41
42   /**
43    * Method inherited from the <code>ConnectionFactory</code> class.
44    *
45    * @exception JMSSecurityException If the user identification is incorrect.
46    * @exception IllegalStateException If the server is not listening.
47    */

48   public javax.jms.Connection JavaDoc
49       createConnection(String JavaDoc name, String JavaDoc password)
50     throws javax.jms.JMSException JavaDoc {
51       HATcpConnection lc = new HATcpConnection(
52         params.getUrl(), params, name, password, reliableClass);
53       return new Connection(params, lc);
54     }
55
56   /**
57    * Admin method creating a <code>javax.jms.ConnectionFactory</code>
58    * instance for creating HA TCP connections with a given list of servers.
59    *
60    * @param url URL of the HA Joram server
61    */

62   public static javax.jms.ConnectionFactory JavaDoc create(String JavaDoc url) {
63     return create(url, "org.objectweb.joram.client.jms.tcp.ReliableTcpClient");
64   }
65   /**
66    * Admin method creating a <code>javax.jms.ConnectionFactory</code>
67    * instance for creating HA TCP connections with a given list of servers.
68    *
69    * @param url URL of the HA Joram server
70    * @param reliableClass Reliable class name.
71    */

72   public static javax.jms.ConnectionFactory JavaDoc
73       create(String JavaDoc url, String JavaDoc reliableClass) {
74     HATcpConnectionFactory cf = new HATcpConnectionFactory(url);
75     cf.setReliableClass(reliableClass);
76     return cf;
77   }
78 }
79
Popular Tags