Source code: org/activemq/message/ActiveMQQueue.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 org.activemq.management.JMSDestinationStats;
22 import org.activemq.management.JMSQueueStatsImpl;
23
24 import javax.jms.Destination;
25 import javax.jms.Queue;
26
27
28 /**
29 * A <CODE>Queue</CODE> object encapsulates a provider-specific queue name.
30 * It is the way a client specifies the identity of a queue to JMS API methods.
31 * For those methods that use a <CODE>Destination</CODE> as a parameter, a
32 * <CODE>Queue</CODE> object used as an argument. For example, a queue can
33 * be used to create a <CODE>MessageConsumer</CODE> and a
34 * <CODE>MessageProducer</CODE> by calling:
35 * <UL>
36 * <LI> <CODE>Session.CreateConsumer(Destination destination)</CODE>
37 * <LI> <CODE>Session.CreateProducer(Destination destination)</CODE>
38 * <p/>
39 * </UL>
40 * <p/>
41 * <P>The actual length of time messages are held by a queue and the
42 * consequences of resource overflow are not defined by the JMS API.
43 *
44 * @see javax.jms.Session#createConsumer(javax.jms.Destination)
45 * @see javax.jms.Session#createProducer(javax.jms.Destination)
46 * @see javax.jms.Session#createQueue(String)
47 * @see javax.jms.QueueSession#createQueue(String)
48 */
49
50 public class ActiveMQQueue extends ActiveMQDestination implements Queue {
51
52 private static final long serialVersionUID = -8153802971552885826L;
53
54 /**
55 * Default constructor for an ActiveMQQueue Destination
56 */
57 public ActiveMQQueue() {
58 super();
59 }
60
61 /**
62 * Construct a named ActiveMQQueue Destination
63 *
64 * @param name
65 */
66
67 public ActiveMQQueue(String name) {
68 super(name);
69 }
70
71 /**
72 * Gets the name of this queue.
73 * <p/>
74 * <P>Clients that depend upon the name are not portable.
75 *
76 * @return the queue name
77 */
78
79 public String getQueueName() {
80 return super.getPhysicalName();
81 }
82
83 /**
84 * @return Returns the Destination type
85 */
86
87 public int getDestinationType() {
88 return ACTIVEMQ_QUEUE;
89 }
90
91 /**
92 * Returns true if a Topic Destination
93 *
94 * @return true/false
95 */
96
97 public boolean isTopic() {
98 return false;
99 }
100
101 /**
102 * Returns true if a Queue Destination
103 *
104 * @return true/false
105 */
106 public boolean isQueue() {
107 return true;
108 }
109
110 protected Destination createDestination(String name) {
111 return new ActiveMQQueue(name);
112 }
113
114 protected JMSDestinationStats createDestinationStats() {
115 return new JMSQueueStatsImpl();
116 }
117
118 }