KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > connector > OutboundQueueSession


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

23 package org.objectweb.joram.client.connector;
24
25 import javax.jms.JMSException JavaDoc;
26 import javax.jms.Queue JavaDoc;
27 import javax.jms.Session JavaDoc;
28
29 import org.objectweb.util.monolog.api.BasicLevel;
30
31 /**
32  * An <code>OutboundQueueSession</code> instance wraps a JMS QueueSession
33  * (XA or not) for a component involved in PTP outbound messaging.
34  */

35 public class OutboundQueueSession extends OutboundSession
36                                   implements javax.jms.QueueSession JavaDoc
37 {
38   /**
39    * Constructs an <code>OutboundQueueSession</code> instance.
40    */

41   OutboundQueueSession(Session JavaDoc sess, OutboundConnection cnx) {
42     super(sess, cnx);
43     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
44       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
45                                     "OutboundQueueSession(" + sess +
46                                     ", " + cnx + ")");
47   }
48
49   /**
50    * Constructs an <code>OutboundQueueSession</code> instance.
51    */

52   OutboundQueueSession(Session JavaDoc sess,
53                        OutboundConnection cnx,
54                        boolean transacted) {
55     super(sess, cnx, transacted);
56     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
57       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
58                                     "OutboundQueueSession(" + sess +
59                                     ", " + cnx + ")");
60   }
61
62   /**
63    * Delegates the call to the wrapped JMS session.
64    */

65   public javax.jms.QueueSender JavaDoc createSender(Queue JavaDoc queue)
66     throws JMSException JavaDoc {
67     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
68       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " createSender(" + queue + ")");
69
70     checkValidity();
71     return new OutboundSender(sess.createProducer(queue), this);
72   }
73
74   /**
75    * Delegates the call to the wrapped JMS session.
76    */

77   public javax.jms.QueueReceiver JavaDoc createReceiver(Queue JavaDoc queue, String JavaDoc selector)
78     throws JMSException JavaDoc {
79     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
80       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
81                                     this + " createReceiver(" + queue +
82                                     ", " + selector + ")");
83
84     checkValidity();
85     return new OutboundReceiver(queue,
86                                 sess.createConsumer(queue, selector),
87                                 this);
88   }
89
90   /**
91    * Delegates the call to the wrapped JMS session.
92    */

93   public javax.jms.QueueReceiver JavaDoc createReceiver(Queue JavaDoc queue)
94     throws JMSException JavaDoc {
95     if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
96       AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " createReceiver(" + queue + ")");
97
98     checkValidity();
99     return new OutboundReceiver(queue, sess.createConsumer(queue), this);
100   }
101
102   /**
103    * API method.
104    *
105    * @exception javax.jms.IllegalStateException Systematically.
106    */

107   public javax.jms.TopicSubscriber JavaDoc
108       createDurableSubscriber(javax.jms.Topic JavaDoc topic,
109                               String JavaDoc name,
110                               String JavaDoc selector,
111                               boolean noLocal)
112     throws JMSException JavaDoc {
113     throw new javax.jms.IllegalStateException JavaDoc("Forbidden call on a OutboundQueueSession.");
114   }
115
116   /**
117    * API method.
118    *
119    * @exception javax.jms.IllegalStateException Systematically.
120    */

121   public javax.jms.TopicSubscriber JavaDoc
122          createDurableSubscriber(javax.jms.Topic JavaDoc topic,
123                                  String JavaDoc name)
124          throws JMSException JavaDoc {
125     throw new javax.jms.IllegalStateException JavaDoc("Forbidden call on a OutboundQueueSession.");
126   }
127
128   /**
129    * API method.
130    *
131    * @exception javax.jms.IllegalStateException Systematically.
132    */

133   public javax.jms.Topic JavaDoc createTopic(String JavaDoc topicName)
134     throws JMSException JavaDoc {
135     throw new javax.jms.IllegalStateException JavaDoc("Forbidden call on a OutboundQueueSession.");
136   }
137
138   /**
139    * API method.
140    *
141    * @exception javax.jms.IllegalStateException Systematically.
142    */

143   public javax.jms.TemporaryTopic JavaDoc createTemporaryTopic()
144     throws JMSException JavaDoc {
145     throw new javax.jms.IllegalStateException JavaDoc("Forbidden call on a OutboundQueueSession.");
146   }
147
148   /**
149    * API method.
150    *
151    * @exception javax.jms.IllegalStateException Systematically.
152    */

153   public void unsubscribe(String JavaDoc name)
154     throws JMSException JavaDoc {
155     throw new javax.jms.IllegalStateException JavaDoc("Forbidden call on a OutboundQueueSession.");
156   }
157
158   public String JavaDoc toString() {
159     if (sess != null)
160       return sess.toString();
161     return null;
162   }
163 }
164
Popular Tags