KickJava   Java API By Example, From Geeks To Geeks.

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


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.JMSException JavaDoc;
27 import javax.jms.IllegalStateException JavaDoc;
28
29
30 /**
31  * Implements the <code>javax.jms.QueueSender</code> interface.
32  */

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

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

60   public javax.jms.Queue JavaDoc getQueue() throws JMSException JavaDoc
61   {
62     if (closed)
63       throw new IllegalStateException JavaDoc("Forbidden call on a closed sender.");
64
65     return (javax.jms.Queue JavaDoc) super.dest;
66   }
67
68   /**
69    * API method.
70    *
71    * @exception UnsupportedOperationException When the sender did not
72    * properly identify itself.
73    * @exception JMSSecurityException If the user if not a WRITER on the
74    * specified queue.
75    * @exception IllegalStateException If the sender is closed, or if the
76    * connection is broken.
77    * @exception JMSException If the request fails for any other reason.
78    */

79   public void send(javax.jms.Queue JavaDoc queue, javax.jms.Message JavaDoc message)
80             throws JMSException JavaDoc
81   {
82     super.send(queue, message);
83   }
84
85   /**
86    * API method.
87    *
88    * @exception UnsupportedOperationException When the sender did not
89    * properly identify itself.
90    * @exception JMSSecurityException If the user if not a WRITER on the
91    * specified queue.
92    * @exception IllegalStateException If the sender is closed, or if the
93    * connection is broken.
94    * @exception JMSException If the request fails for any other reason.
95    */

96   public void send(javax.jms.Queue JavaDoc queue, javax.jms.Message JavaDoc message,
97                    int deliveryMode, int priority,
98                    long timeToLive) throws JMSException JavaDoc
99   {
100     super.send(queue, message, deliveryMode, priority, timeToLive);
101   }
102 }
103
Popular Tags