KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - 2007 ScalAgent Distributed Technologies
4  * Copyright (C) 2004 Bull SA
5  * Copyright (C) 1996 - 2000 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): ScalAgent Distributed Technologies
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.admin.AdminModule;
30
31 import java.util.Hashtable JavaDoc;
32
33 import javax.naming.NamingException JavaDoc;
34 import javax.naming.Reference JavaDoc;
35 import javax.naming.StringRefAddr JavaDoc;
36
37
38 /**
39  * A <code>SoapConnectionFactory</code> instance is a factory of SOAP
40  * connections.
41  */

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

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

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

69   public javax.jms.Connection JavaDoc createConnection(String JavaDoc name, String JavaDoc password)
70          throws javax.jms.JMSException JavaDoc {
71     return new Connection(params, new SoapConnection(params, name, password));
72   }
73
74   /**
75    * Admin method creating a <code>javax.jms.ConnectionFactory</code>
76    * instance for creating SOAP connections with a given server.
77    *
78    * @param host Name or IP address of the server's host.
79    * @param port Server's listening port.
80    * @param timeout Duration in seconds during which a SOAP connection might
81    * be inactive before being considered as dead (0 for never).
82    */

83   public static javax.jms.ConnectionFactory JavaDoc
84                 create(String JavaDoc host, int port, int timeout) {
85     return new SoapConnectionFactory(host, port, timeout);
86   }
87
88   /**
89    * Admin method creating a <code>javax.jms.ConnectionFactory</code> instance
90    * for creating SOAP connections with the local server.
91    *
92    * @param timeout Duration in seconds during which a SOAP connection might
93    * be inactive before being considered as dead (0 for never).
94    *
95    * @exception ConnectException If the admin connection is closed or broken.
96    */

97   public static javax.jms.ConnectionFactory JavaDoc create(int timeout)
98                 throws java.net.ConnectException JavaDoc {
99     return create(AdminModule.getLocalHost(),
100                   AdminModule.getLocalPort(),
101                   timeout);
102   }
103 }
104
Popular Tags