KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > soap > TopicSoapConnectionFactory


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - Bull SA
4  * Copyright (C) 2004 - ScalAgent Distributed Technologies
5  * Copyright (C) 1996 - Dyade
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or any later version.
11  *
12  * This library 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 library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA.
21  *
22  * Initial developer(s): Frederic Maistre (INRIA)
23  * Contributor(s): Nicolas Tachker (ScalAgent)
24  */

25 package org.objectweb.joram.client.jms.soap;
26
27 import org.objectweb.joram.client.jms.Connection;
28 import org.objectweb.joram.client.jms.FactoryParameters;
29 import org.objectweb.joram.client.jms.TopicConnection;
30 import org.objectweb.joram.client.jms.admin.AdminModule;
31
32 import java.util.Vector JavaDoc;
33
34 import javax.naming.NamingException JavaDoc;
35 import javax.naming.Reference JavaDoc;
36 import javax.naming.StringRefAddr JavaDoc;
37
38
39 /**
40  * A <code>TopicSoapConnectionFactory</code> instance is a factory of
41  * SOAP connections for Pub/Sub communication.
42  */

43 public class TopicSoapConnectionFactory
44              extends org.objectweb.joram.client.jms.TopicConnectionFactory
45 {
46   /**
47    * Constructs a <code>TopicSoapConnectionFactory</code> instance.
48    *
49    * @param host Name or IP address of the server's host.
50    * @param port Server's listening port.
51    * @param timeout Duration in seconds during which a SOAP connection might
52    * be inactive before being considered as dead (0 for never).
53    */

54   public TopicSoapConnectionFactory(String JavaDoc host, int port, int timeout)
55   {
56     super(host, port);
57     params.cnxPendingTimer = timeout * 1000;
58   }
59
60   /**
61    * Constructs an empty <code>TopicSoapConnectionFactory</code> instance.
62    */

63   public TopicSoapConnectionFactory()
64   {}
65
66
67   /**
68    * Method inherited from the <code>TopicConnectionFactory</code> class.
69    *
70    * @exception JMSSecurityException If the user identification is incorrect.
71    * @exception IllegalStateException If the server is not listening.
72    */

73   public javax.jms.TopicConnection JavaDoc
74          createTopicConnection(String JavaDoc name, String JavaDoc password)
75          throws javax.jms.JMSException JavaDoc
76   {
77     return new TopicConnection(params,
78                                new SoapConnection(params, name, password));
79   }
80
81   /**
82    * Method inherited from the <code>ConnectionFactory</code> class.
83    *
84    * @exception JMSSecurityException If the user identification is incorrect.
85    * @exception IllegalStateException If the server is not listening.
86    */

87   public javax.jms.Connection JavaDoc createConnection(String JavaDoc name, String JavaDoc password)
88                               throws javax.jms.JMSException JavaDoc
89   {
90     return new Connection(params, new SoapConnection(params, name, password));
91   }
92
93   /**
94    * Admin method creating a <code>javax.jms.TopicConnectionFactory</code>
95    * instance for creating SOAP connections with a given server.
96    *
97    * @param host Name or IP address of the server's host.
98    * @param port Server's listening port.
99    * @param timeout Duration in seconds during which a SOAP connection might
100    * be inactive before being considered as dead (0 for never).
101    */

102   public static javax.jms.TopicConnectionFactory JavaDoc
103                 create(String JavaDoc host, int port, int timeout)
104   {
105     return new TopicSoapConnectionFactory(host, port, timeout);
106   }
107
108   /**
109    * Admin method creating a <code>javax.jms.TopicConnectionFactory</code>
110    * instance for creating SOAP connections with the local server.
111    *
112    * @param timeout Duration in seconds during which a SOAP connection might
113    * be inactive before being considered as dead (0 for never).
114    *
115    * @exception ConnectException If the admin connection is closed or broken.
116    */

117   public static javax.jms.TopicConnectionFactory JavaDoc create(int timeout)
118                 throws java.net.ConnectException JavaDoc
119   {
120     return create(AdminModule.getLocalHost(),
121                   AdminModule.getLocalPort(),
122                   timeout);
123   }
124 }
125
Popular Tags