KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > TopicPublisher


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2001 - ScalAgent Distributed Technologies
4  * Copyright (C) 1996 - Dyade
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  *
21  * Initial developer(s): Frederic Maistre (INRIA)
22  * Contributor(s):
23  */

24 package org.objectweb.joram.client.jms;
25
26 import javax.jms.IllegalStateException JavaDoc;
27 import javax.jms.JMSException JavaDoc;
28
29 /**
30  * Implements the <code>javax.jms.TopicPublisher</code> interface.
31  */

32 public class TopicPublisher extends MessageProducer
33                             implements javax.jms.TopicPublisher JavaDoc
34 {
35   /**
36    * Constructs a publisher.
37    *
38    * @param sess The session the publisher belongs to.
39    * @param topic The topic the publisher publishs messages on.
40    *
41    * @exception IllegalStateException If the connection is broken.
42    * @exception JMSException If the creation fails for any other reason.
43    */

44   TopicPublisher(TopicSession sess, Destination topic) throws JMSException JavaDoc {
45     super(sess, topic);
46   }
47
48   /** Returns a string view of this receiver. */
49   public String JavaDoc toString()
50   {
51     return "TopicPub:" + sess.getId();
52   }
53
54   /**
55    * API method.
56    *
57    * @exception IllegalStateException If the publisher is closed.
58    */

59   public javax.jms.Topic JavaDoc getTopic() throws JMSException JavaDoc
60   {
61     if (closed)
62       throw new IllegalStateException JavaDoc("Forbidden call on a closed publisher.");
63
64     return (javax.jms.Topic JavaDoc) super.dest;
65   }
66
67   /**
68    * API method.
69    *
70    * @exception IllegalStateException If the publisher is closed, or if the
71    * connection is broken.
72    * @exception JMSException If the request fails for any other reason.
73    */

74   public void publish(javax.jms.Message JavaDoc message, int deliveryMode,
75                       int priority, long timeToLive) throws JMSException JavaDoc
76   {
77     super.send(message, deliveryMode, priority, timeToLive);
78   }
79     
80   /**
81    * API method.
82    *
83    * @exception IllegalStateException If the publisher is closed, or if the
84    * connection is broken.
85    * @exception JMSException If the request fails for any other reason.
86    */

87   public void publish(javax.jms.Message JavaDoc message) throws JMSException JavaDoc
88   {
89     super.send(message);
90   }
91
92   /**
93    * API method.
94    *
95    * @exception IllegalStateException If the publisher is closed, or if the
96    * connection is broken.
97    * @exception JMSException If the request fails for any other reason.
98    */

99   public void publish(javax.jms.Topic JavaDoc topic, javax.jms.Message JavaDoc message)
100             throws JMSException JavaDoc
101   {
102     super.send(topic, message);
103   }
104
105   /**
106    * API method.
107    *
108    * @exception IllegalStateException If the publisher is closed, or if the
109    * connection is broken.
110    * @exception JMSException If the request fails for any other reason.
111    */

112   public void publish(javax.jms.Topic JavaDoc topic, javax.jms.Message JavaDoc message,
113                       int deliveryMode, int priority,
114                       long timeToLive) throws JMSException JavaDoc
115   {
116     super.send(topic, message, deliveryMode, priority, timeToLive);
117   }
118 }
119
Popular Tags