KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > client > impl > LocalDestination


1 package com.ubermq.jms.client.impl;
2
3 import javax.jms.*;
4
5 abstract class LocalDestination
6     implements Destination, java.io.Serializable JavaDoc
7 {
8     /**
9      * A prefix for queue names that yields the actual UberMQ
10      * topic name for the queue.
11      */

12     public static final String JavaDoc QUEUE_TOPIC_PREFIX = ".queue.";
13
14     /**
15      * Returns a destination of the appropriate type
16      * given an internal topic name.
17      *
18      * @param name an internal topic name,
19      * such as that returned by the <code>getInternalTopicName</code>
20      * method.
21      *
22      * @return a Destination
23      */

24     public static Destination getDestination(String JavaDoc name)
25     {
26         if (name == null)
27             return null;
28         else if (name.startsWith(QUEUE_TOPIC_PREFIX))
29         {
30             return new LocalQueue(name.substring(QUEUE_TOPIC_PREFIX.length()));
31         }
32         else
33             return new LocalTopic(name);
34     }
35
36     /**
37      * Returns the UberMQ topic name that is used internally.
38      */

39     abstract String JavaDoc getInternalTopicName();
40 }
41
Popular Tags