KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > ConnectionFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.jms;
25
26 /** A <CODE>ConnectionFactory</CODE> object encapsulates a set of connection
27   * configuration
28   * parameters that has been defined by an administrator. A client uses
29   * it to create a connection with a JMS provider.
30   *
31   * <P>A <CODE>ConnectionFactory</CODE> object is a JMS administered object and
32   * supports concurrent use.
33   *
34   * <P>JMS administered objects are objects containing configuration
35   * information that are created by an administrator and later used by
36   * JMS clients. They make it practical to administer the JMS API in the
37   * enterprise.
38   *
39   * <P>Although the interfaces for administered objects do not explicitly
40   * depend on the Java Naming and Directory Interface (JNDI) API, the JMS API
41   * establishes the convention that JMS clients find administered objects by
42   * looking them up in a JNDI namespace.
43   *
44   * <P>An administrator can place an administered object anywhere in a
45   * namespace. The JMS API does not define a naming policy.
46   *
47   * <P>It is expected that JMS providers will provide the tools an
48   * administrator needs to create and configure administered objects in a
49   * JNDI namespace. JMS provider implementations of administered objects
50   * should be both <CODE>javax.jndi.Referenceable</CODE> and
51   * <CODE>java.io.Serializable</CODE> so that they can be stored in all
52   * JNDI naming contexts. In addition, it is recommended that these
53   * implementations follow the JavaBeans<SUP><FONT SIZE="-2">TM</FONT></SUP>
54   * design patterns.
55   *
56   * <P>This strategy provides several benefits:
57   *
58   * <UL>
59   * <LI>It hides provider-specific details from JMS clients.
60   * <LI>It abstracts administrative information into objects in the Java
61   * programming language ("Java objects")
62   * that are easily organized and administered from a common
63   * management console.
64   * <LI>Since there will be JNDI providers for all popular naming
65   * services, this means that JMS providers can deliver one implementation
66   * of administered objects that will run everywhere.
67   * </UL>
68   *
69   * <P>An administered object should not hold on to any remote resources.
70   * Its lookup should not use remote resources other than those used by the
71   * JNDI API itself.
72   *
73   * <P>Clients should think of administered objects as local Java objects.
74   * Looking them up should not have any hidden side effects or use surprising
75   * amounts of local resources.
76   *
77   * @version 1.1 - February 1, 2002
78   * @author Mark Hapner
79   * @author Rich Burridge
80   * @author Kate Stout
81   *
82   * @see javax.jms.Connection
83   * @see javax.jms.QueueConnectionFactory
84   * @see javax.jms.TopicConnectionFactory
85   */

86
87 public interface ConnectionFactory {
88         /** Creates a connection with the default user identity.
89       * The connection is created in stopped mode. No messages
90       * will be delivered until the <code>Connection.start</code> method
91       * is explicitly called.
92       *
93       * @return a newly created connection
94       *
95       * @exception JMSException if the JMS provider fails to create the
96       * connection due to some internal error.
97       * @exception JMSSecurityException if client authentication fails due to
98       * an invalid user name or password.
99        * @since 1.1
100      */

101
102     Connection JavaDoc
103     createConnection() throws JMSException JavaDoc;
104
105
106     /** Creates a connection with the specified user identity.
107       * The connection is created in stopped mode. No messages
108       * will be delivered until the <code>Connection.start</code> method
109       * is explicitly called.
110       *
111       * @param userName the caller's user name
112       * @param password the caller's password
113       *
114       * @return a newly created connection
115       *
116       * @exception JMSException if the JMS provider fails to create the
117       * connection due to some internal error.
118       * @exception JMSSecurityException if client authentication fails due to
119       * an invalid user name or password.
120       * @since 1.1
121       */

122
123     Connection JavaDoc
124     createConnection(String JavaDoc userName, String JavaDoc password)
125                          throws JMSException JavaDoc;
126 }
127
Popular Tags