KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > presumo > jms > client > JmsQueue


1 /**
2  * This file is part of Presumo.
3  *
4  * Presumo is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Presumo is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Presumo; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  *
19  * Copyright 2001 Dan Greff
20  */

21 package com.presumo.jms.client;
22
23 import javax.jms.Queue JavaDoc;
24 import javax.jms.JMSException JavaDoc;
25 import javax.jms.InvalidDestinationException JavaDoc;
26
27
28 /**
29  * @see javax.jms.Queue
30  */

31 public final class JmsQueue extends JmsDestination
32     implements Queue JavaDoc, java.io.Serializable JavaDoc
33 {
34
35   public static final String JavaDoc QUEUE_PREFIX = "queue:";
36   
37   private final String JavaDoc queueName;
38   
39     /////////////////////////////////////////////////////////////////////////
40
// Constructors //
41
/////////////////////////////////////////////////////////////////////////
42

43   /**
44    * Initialize the object with the given <code>queuename</code>.
45    */

46   public JmsQueue(String JavaDoc queueName) throws JMSException JavaDoc
47   {
48     if (queueName == null) throw new
49       InvalidDestinationException JavaDoc("Can not create a null queue");
50   
51     if (queueName.startsWith(QUEUE_PREFIX))
52       this.queueName = queueName;
53     else
54       this.queueName = QUEUE_PREFIX + queueName;
55   }
56     
57
58     /////////////////////////////////////////////////////////////////////////
59
// Public Methods //
60
/////////////////////////////////////////////////////////////////////////
61

62   public String JavaDoc toString()
63   {
64     return queueName;
65   }
66   
67   public String JavaDoc getQueueName()
68   {
69     return queueName;
70   }
71
72 }
73
Popular Tags