KickJava   Java API By Example, From Geeks To Geeks.

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


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.*;
27
28 public class TopicHATcpConnectionFactory
29   extends org.objectweb.joram.client.jms.TopicConnectionFactory {
30
31   private String JavaDoc url;
32
33   public TopicHATcpConnectionFactory(String JavaDoc url) {
34     super(url);
35     this.url = url;
36   }
37
38   /**
39    * Method inherited from the <code>TopicConnectionFactory</code> class.
40    *
41    * @exception JMSSecurityException If the user identification is incorrect.
42    */

43   public javax.jms.TopicConnection JavaDoc
44       createTopicConnection(String JavaDoc name, String JavaDoc password)
45     throws javax.jms.JMSException JavaDoc
46     {
47       HATcpConnection lc = new HATcpConnection(
48         url, params, name, password, reliableClass);
49       return new TopicConnection(params, lc);
50     }
51
52   /**
53    * Method inherited from the <code>ConnectionFactory</code> class.
54    *
55    * @exception JMSSecurityException If the user identification is incorrect.
56    * @exception IllegalStateException If the server is not listening.
57    */

58   public javax.jms.Connection JavaDoc
59       createConnection(String JavaDoc name, String JavaDoc password)
60     throws javax.jms.JMSException JavaDoc
61     {
62       HATcpConnection lc = new HATcpConnection(
63         url, params, name, password, reliableClass);
64       return new Connection(params, lc);
65     }
66
67   /**
68    * Admin method creating a <code>javax.jms.ConnectionFactory</code>
69    * instance for creating HA tcp connections with a given server.
70    */

71   public static javax.jms.TopicConnectionFactory JavaDoc create(String JavaDoc url) {
72     return create(url,
73                   "org.objectweb.joram.client.jms.tcp.ReliableTcpClient");
74   }
75
76   /**
77    * Admin method creating a <code>javax.jms.ConnectionFactory</code>
78    * instance for creating HA tcp connections with a given server.
79    */

80   public static javax.jms.TopicConnectionFactory JavaDoc
81       create(String JavaDoc url, String JavaDoc reliableClass) {
82     TopicHATcpConnectionFactory cf = new TopicHATcpConnectionFactory(url);
83     cf.setReliableClass(reliableClass);
84     return cf;
85   }
86 }
87
Popular Tags