Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/message/ActiveMQTopic.java


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.activemq.message;
20  
21  import javax.jms.Destination;
22  import javax.jms.Topic;
23  
24  import org.activemq.management.JMSDestinationStats;
25  import org.activemq.management.JMSTopicStatsImpl;
26  
27  
28  /**
29   * A <CODE>Topic</CODE> object encapsulates a provider-specific topic name.
30   * It is the way a client specifies the identity of a topic to JMS API methods.
31   * For those methods that use a <CODE>Destination</CODE> as a parameter, a
32   * <CODE>Topic</CODE> object may used as an argument . For
33   * example, a Topic can be used to create a <CODE>MessageConsumer</CODE>
34   * and a <CODE>MessageProducer</CODE>
35   * by calling:
36   * <UL>
37   * <LI> <CODE>Session.CreateConsumer(Destination destination)</CODE>
38   * <LI> <CODE>Session.CreateProducer(Destination destination)</CODE>
39   * <p/>
40   * </UL>
41   * <p/>
42   * <P>Many publish/subscribe (pub/sub) providers group topics into hierarchies
43   * and provide various options for subscribing to parts of the hierarchy. The
44   * JMS API places no restriction on what a <CODE>Topic</CODE> object
45   * represents. It may be a leaf in a topic hierarchy, or it may be a larger
46   * part of the hierarchy.
47   * <p/>
48   * <P>The organization of topics and the granularity of subscriptions to
49   * them is an important part of a pub/sub application's architecture. The JMS
50   * API
51   * does not specify a policy for how this should be done. If an application
52   * takes advantage of a provider-specific topic-grouping mechanism, it
53   * should document this. If the application is installed using a different
54   * provider, it is the job of the administrator to construct an equivalent
55   * topic architecture and create equivalent <CODE>Topic</CODE> objects.
56   *
57   * @see javax.jms.Session#createConsumer(javax.jms.Destination)
58   * @see javax.jms.Session#createProducer(javax.jms.Destination)
59   * @see javax.jms.TopicSession#createTopic(String)
60   */
61  
62  public class ActiveMQTopic extends ActiveMQDestination implements Topic {
63  
64      private static final long serialVersionUID = -4243052759456351987L;
65  
66      /**
67       * Default constructor for an ActiveMQTopic Destination
68       */
69      public ActiveMQTopic() {
70          super();
71      }
72  
73      /**
74       * Construct a named ActiveMQTopic Destination
75       *
76       * @param name
77       */
78  
79      public ActiveMQTopic(String name) {
80          super(name);
81      }
82  
83      /**
84       * Gets the name of this Topic.
85       * <p/>
86       * <P>Clients that depend upon the name are not portable.
87       *
88       * @return the Topic name
89       */
90  
91      public String getTopicName() {
92          return super.getPhysicalName();
93      }
94  
95      /**
96       * @return Returns the Destination type
97       */
98  
99      public int getDestinationType() {
100         return ACTIVEMQ_TOPIC;
101     }
102 
103     protected Destination createDestination(String name) {
104         return new ActiveMQTopic(name);
105     }
106 
107     protected JMSDestinationStats createDestinationStats() {
108         return new JMSTopicStatsImpl();
109     }
110 
111 }