1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2000-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License ("CDDL") (collectively, the "License"). You may
9 * not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or mq/legal/LICENSE.txt. See the License for the specific language
12 * governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at mq/legal/LICENSE.txt. Sun designates
16 * this particular file as subject to the "Classpath" exception as provided by
17 * Sun in the GPL Version 2 section of the License file that accompanied this
18 * code. If applicable, add the following below the License Header, with the
19 * fields enclosed by brackets [] replaced by your own identifying information:
20 * "Portions Copyrighted [year] [name of copyright owner]"
21 *
22 * Contributor(s):
23 *
24 * If you wish your version of this file to be governed by only the CDDL or
25 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26 * elects to include this software in this distribution under the [CDDL or GPL
27 * Version 2] license." If you don't indicate a single choice of license, a
28 * recipient has the option to distribute your version of this file under
29 * either the CDDL, the GPL Version 2 or to extend the choice of license to
30 * its licensees as provided above. However, if you add GPL Version 2 code
31 * and therefore, elected the GPL Version 2 license, then the option applies
32 * only if the new code is made subject to such option by the copyright holder.
33 */
34
35 /*
36 * @(#)Topic.java 1.19 07/02/07
37 */
38
39 package javax.jms;
40
41
42 /** A <CODE>Topic</CODE> object encapsulates a provider-specific topic name.
43 * It is the way a client specifies the identity of a topic to JMS API methods.
44 * For those methods that use a <CODE>Destination</CODE> as a parameter, a
45 * <CODE>Topic</CODE> object may used as an argument . For
46 * example, a Topic can be used to create a <CODE>MessageConsumer</CODE>
47 * and a <CODE>MessageProducer</CODE>
48 * by calling:
49 *<UL>
50 *<LI> <CODE>Session.CreateConsumer(Destination destination)</CODE>
51 *<LI> <CODE>Session.CreateProducer(Destination destination)</CODE>
52 *
53 *</UL>
54 *
55 * <P>Many publish/subscribe (pub/sub) providers group topics into hierarchies
56 * and provide various options for subscribing to parts of the hierarchy. The
57 * JMS API places no restriction on what a <CODE>Topic</CODE> object
58 * represents. It may be a leaf in a topic hierarchy, or it may be a larger
59 * part of the hierarchy.
60 *
61 * <P>The organization of topics and the granularity of subscriptions to
62 * them is an important part of a pub/sub application's architecture. The JMS
63 * API
64 * does not specify a policy for how this should be done. If an application
65 * takes advantage of a provider-specific topic-grouping mechanism, it
66 * should document this. If the application is installed using a different
67 * provider, it is the job of the administrator to construct an equivalent
68 * topic architecture and create equivalent <CODE>Topic</CODE> objects.
69 *
70 * @see Session#createConsumer(Destination)
71 * @see Session#createProducer(Destination)
72 * @see javax.jms.TopicSession#createTopic(String)
73 */
74
75 public interface Topic extends Destination {
76
77 /** Gets the name of this topic.
78 *
79 * <P>Clients that depend upon the name are not portable.
80 *
81 * @return the topic name
82 *
83 * @exception JMSException if the JMS provider implementation of
84 * <CODE>Topic</CODE> fails to return the topic
85 * name due to some internal
86 * error.
87 */
88
89 String
90 getTopicName() throws JMSException;
91
92
93 /** Returns a string representation of this object.
94 *
95 * @return the provider-specific identity values for this topic
96 */
97
98 String
99 toString();
100 }