1 /*** 2 * 3 * Copyright 2004 Protique Ltd 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 **/ 18 19 package org.codehaus.activemq.message; 20 21 import javax.jms.Topic; 22 23 24 /*** 25 * A <CODE>Topic</CODE> object encapsulates a provider-specific topic name. 26 * It is the way a client specifies the identity of a topic to JMS API methods. 27 * For those methods that use a <CODE>Destination</CODE> as a parameter, a 28 * <CODE>Topic</CODE> object may used as an argument . For 29 * example, a Topic can be used to create a <CODE>MessageConsumer</CODE> 30 * and a <CODE>MessageProducer</CODE> 31 * by calling: 32 * <UL> 33 * <LI> <CODE>Session.CreateConsumer(Destination destination)</CODE> 34 * <LI> <CODE>Session.CreateProducer(Destination destination)</CODE> 35 * <p/> 36 * </UL> 37 * <p/> 38 * <P>Many publish/subscribe (pub/sub) providers group topics into hierarchies 39 * and provide various options for subscribing to parts of the hierarchy. The 40 * JMS API places no restriction on what a <CODE>Topic</CODE> object 41 * represents. It may be a leaf in a topic hierarchy, or it may be a larger 42 * part of the hierarchy. 43 * <p/> 44 * <P>The organization of topics and the granularity of subscriptions to 45 * them is an important part of a pub/sub application's architecture. The JMS 46 * API 47 * does not specify a policy for how this should be done. If an application 48 * takes advantage of a provider-specific topic-grouping mechanism, it 49 * should document this. If the application is installed using a different 50 * provider, it is the job of the administrator to construct an equivalent 51 * topic architecture and create equivalent <CODE>Topic</CODE> objects. 52 * 53 * @see javax.jms.Session#createConsumer(javax.jms.Destination) 54 * @see javax.jms.Session#createProducer(javax.jms.Destination) 55 * @see javax.jms.TopicSession#createTopic(String) 56 */ 57 58 public class ActiveMQTopic extends ActiveMQDestination implements Topic { 59 60 61 /*** 62 * Default constructor for an ActiveMQTopic Destination 63 */ 64 public ActiveMQTopic() { 65 super(); 66 } 67 68 /*** 69 * Construct a named ActiveMQTopic Destination 70 * 71 * @param name 72 */ 73 74 public ActiveMQTopic(String name) { 75 super(name); 76 } 77 78 /*** 79 * Gets the name of this Topic. 80 * <p/> 81 * <P>Clients that depend upon the name are not portable. 82 * 83 * @return the Topic name 84 */ 85 86 public String getTopicName() { 87 return super.getPhysicalName(); 88 } 89 90 /*** 91 * @return Returns the Destination type 92 */ 93 94 public int getDestinationType() { 95 return ACTIVEMQ_TOPIC; 96 } 97 }