View Javadoc

    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 org.codehaus.activemq.management.JMSDestinationStats;
    22  import org.codehaus.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      /***
    53       * Default constructor for an ActiveMQQueue Destination
    54       */
    55      public ActiveMQQueue() {
    56          super();
    57      }
    58
    59      /***
    60       * Construct a named ActiveMQQueue Destination
    61       *
    62       * @param name
    63       */
    64
    65      public ActiveMQQueue(String name) {
    66          super(name);
    67      }
    68
    69      /***
    70       * Gets the name of this queue.
    71       * <p/>
    72       * <P>Clients that depend upon the name are not portable.
    73       *
    74       * @return the queue name
    75       */
    76
    77      public String getQueueName() {
    78          return super.getPhysicalName();
    79      }
    80
    81      /***
    82       * @return Returns the Destination type
    83       */
    84
    85      public int getDestinationType() {
    86          return ACTIVEMQ_QUEUE;
    87      }
    88
    89      protected Destination createDestination(String name) {
    90          return new ActiveMQQueue(name);
    91      }
    92
    93      protected JMSDestinationStats createDestinationStats() {
    94          return new JMSQueueStatsImpl();
    95      }
    96
    97  }