KickJava   Java API By Example, From Geeks To Geeks.

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


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.QueueConnection;
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  * A <code>QueueSoapConnectionFactory</code> instance is a factory of
40  * SOAP connections for PTP communication.
41  */

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

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

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

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

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

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

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