KickJava   Java API By Example, From Geeks To Geeks.

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


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.IllegalStateException JavaDoc;
24 import javax.jms.JMSException JavaDoc;
25 import javax.jms.Message JavaDoc;
26 import javax.jms.Topic JavaDoc;
27 import javax.jms.TopicPublisher JavaDoc;
28
29 /**
30  * Implemenation of the interface <code>javax.jms.TopicPublisher</code>.
31  *
32  * @see javax.jms.TopicPublisher
33  * @author Dan Greff
34  */

35 public final class JmsTopicPublisher extends JmsMessageProducer
36     implements TopicPublisher JavaDoc
37 {
38
39   private final JmsTopic topic;
40
41     /////////////////////////////////////////////////////////////////////////
42
// Constructors //
43
/////////////////////////////////////////////////////////////////////////
44

45   JmsTopicPublisher(JmsTopicSession session, JmsTopic topic)
46   {
47     super(session);
48     this.topic = topic;
49   }
50
51
52     /////////////////////////////////////////////////////////////////////////
53
// Public Methods //
54
/////////////////////////////////////////////////////////////////////////
55

56
57   public Topic JavaDoc getTopic() throws JMSException JavaDoc
58   {
59     return topic;
60   }
61
62
63   public final void publish(Message JavaDoc message) throws JMSException JavaDoc
64   {
65     prepareAndSend(this.topic, message, this.deliveryMode,
66                    this.priority, this.timeToLive);
67   }
68
69
70   public final void publish(Message JavaDoc message,
71                                   int deliveryMode,
72                                   int priority,
73                                   long timeToLive) throws JMSException JavaDoc
74   {
75     prepareAndSend(this.topic, message, deliveryMode, priority, timeToLive);
76   }
77
78
79     
80   public final void publish(Topic JavaDoc topic, Message JavaDoc message) throws JMSException JavaDoc
81   {
82     prepareAndSend(topic, message, this.deliveryMode,
83                    this.priority, this.timeToLive);
84   }
85
86
87     
88   public final void publish(Topic JavaDoc topic,
89                                 Message JavaDoc message,
90                                 int deliveryMode,
91                                 int priority,
92                                 long timeToLive) throws JMSException JavaDoc
93   {
94     prepareAndSend(topic, message, deliveryMode, priority, timeToLive);
95   }
96
97 }
Popular Tags