KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > api > jms > MantaTopicSession


1 /*
2  * Copyright 2002 by
3  * <a HREF="http://www.coridan.com">Coridan</a>
4  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
5  *
6  * The contents of this file are subject to the Mozilla Public License Version
7  * 1.1 (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  * http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is "MantaRay" (TM).
17  *
18  * The Initial Developer of the Original Code is Nimo.
19  * Portions created by the Initial Developer are Copyright (C) 2006
20  * Coridan Inc. All Rights Reserved.
21  *
22  * Contributor(s): all the names of the contributors are added in the source
23  * code where applicable.
24  *
25  * Alternatively, the contents of this file may be used under the terms of the
26  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
27  * provisions of LGPL are applicable instead of those above. If you wish to
28  * allow use of your version of this file only under the terms of the LGPL
29  * License and not to allow others to use your version of this file under
30  * the MPL, indicate your decision by deleting the provisions above and
31  * replace them with the notice and other provisions required by the LGPL.
32  * If you do not delete the provisions above, a recipient may use your version
33  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
34  
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Lesser General Public License as published by the Free Software Foundation;
39  * either version 2.1 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
44  * License for more details.
45  */

46 package org.mr.api.jms;
47
48 import java.io.Serializable JavaDoc;
49
50 import javax.jms.IllegalStateException JavaDoc;
51 import javax.jms.JMSException JavaDoc;
52 import javax.jms.Queue JavaDoc;
53 import javax.jms.QueueBrowser JavaDoc;
54 import javax.jms.TemporaryQueue JavaDoc;
55
56 /**
57  * A <CODE>TopicSession</CODE> object provides methods for creating <CODE>
58  * TopicPublisher</CODE>,<CODE>TopicSubscriber</CODE>, and <CODE>
59  * TemporaryTopic</CODE> objects. It also provides a method for deleting its
60  * client's durable subscribers.
61  *
62  * <P>
63  * A <CODE>TopicSession</CODE> is used for creating Pub/Sub specific objects.
64  * In general, use the <CODE>Session</CODE> object, and use <CODE>
65  * TopicSession</CODE> only to support existing code. Using the <CODE>Session
66  * </CODE> object simplifies the programming model, and allows transactions to
67  * be used across the two messaging domains.
68  *
69  * <P>
70  * A <CODE>TopicSession</CODE> cannot be used to create objects specific to
71  * the point-to-point domain. The following methods inherit from <CODE>Session
72  * </CODE>, but must throw an <CODE>IllegalStateException</CODE> if used
73  * from <CODE>TopicSession</CODE>:
74  * <UL>
75  * <LI><CODE>createBrowser</CODE>
76  * <LI><CODE>createQueue</CODE>
77  * <LI><CODE>createTemporaryQueue</CODE>
78  * </UL>
79  *
80  * @author Nimo
81  *
82  */

83 public class MantaTopicSession extends MantaSession implements Serializable JavaDoc, javax.jms.TopicSession JavaDoc {
84
85     /**
86      * Construct a TopicSession object.
87      *
88      * @param clientId - the id for this session
89      * @param con - the creating connection
90      * @param transactedMode - is it transacted?
91      * @param acknowledgeMode - what's the ack mode on the session?
92      * @throws JMSException
93      */

94     public MantaTopicSession(String JavaDoc clientId, MantaConnection con, boolean transactedMode, int acknowledgeMode)
95                 throws JMSException JavaDoc {
96         super(clientId,con,acknowledgeMode,transactedMode);
97     }//MantaTopicSession
98

99     
100     /**
101      * These methods must throw IllegalStateException.
102      */

103     
104     
105     /**
106      * Unavailable on a Topic Session
107      */

108     public Queue JavaDoc createQueue(String JavaDoc queueName) throws JMSException JavaDoc {
109         throw new IllegalStateException JavaDoc("MNJMS000B1 : FAILED ON METHOD createQueue(). ILLEGAL CALL FROM A TOPIC SESSION.");
110     }
111     
112     /**
113      * Unavailable on a Topic Session
114      */

115     public QueueBrowser JavaDoc createBrowser(Queue JavaDoc queue) throws JMSException JavaDoc {
116         
117         throw new IllegalStateException JavaDoc("MNJMS000B2 : FAILED ON METHOD createBrowser(). ILLEGAL CALL FROM A TOPIC SESSION.");
118     }
119     
120     /**
121      * Unavailable on a Topic Session
122      */

123     public QueueBrowser JavaDoc createBrowser(Queue JavaDoc queue, String JavaDoc messageSelector) throws JMSException JavaDoc {
124         throw new IllegalStateException JavaDoc("MNJMS000B2 : FAILED ON METHOD createBrowser(). ILLEGAL CALL FROM A TOPIC SESSION.");
125     }
126     
127     /**
128      * Unavailable on a Topic Session
129      */

130     public TemporaryQueue JavaDoc createTemporaryQueue() throws JMSException JavaDoc {
131         throw new IllegalStateException JavaDoc("MNJMS000B3 : FAILED ON METHOD createTemporaryQueue(). ILLEGAL CALL FROM A TOPIC SESSION.");
132     }
133 }//MantaTopicSession
134
Popular Tags