KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > server > JMSServerInterceptorSupport


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mq.server;
23
24 import javax.jms.Destination JavaDoc;
25 import javax.jms.JMSException JavaDoc;
26 import javax.jms.Queue JavaDoc;
27 import javax.jms.TemporaryQueue JavaDoc;
28 import javax.jms.TemporaryTopic JavaDoc;
29 import javax.jms.Topic JavaDoc;
30 import javax.transaction.xa.Xid JavaDoc;
31
32 import org.jboss.logging.Logger;
33 import org.jboss.mq.AcknowledgementRequest;
34 import org.jboss.mq.ConnectionToken;
35 import org.jboss.mq.DurableSubscriptionID;
36 import org.jboss.mq.Recoverable;
37 import org.jboss.mq.SpyDestination;
38 import org.jboss.mq.SpyMessage;
39 import org.jboss.mq.SpyTopic;
40 import org.jboss.mq.Subscription;
41 import org.jboss.mq.TransactionRequest;
42
43 /**
44  * A pass through JMSServerInvoker.
45  *
46  * @author <a HREF="mailto:pra@tim.se">Peter Antman</a>
47  * @author <a HREF="adrian@jboss.org">Adrian Brock</a>
48  * @version $Revision: 45317 $
49  */

50 public class JMSServerInterceptorSupport implements JMSServerInterceptor, Recoverable
51 {
52    protected Logger log;
53    /**
54     * Next invoker in chain.
55     */

56    protected JMSServerInterceptor nextInterceptor = null;
57
58    public JMSServerInterceptorSupport()
59    {
60       log = Logger.getLogger(this.getClass().getName());
61    }
62
63    public void setNext(JMSServerInterceptor server)
64    {
65       this.nextInterceptor = server;
66    }
67
68    public JMSServerInterceptor getNext()
69    {
70       return this.nextInterceptor;
71    }
72
73    public ThreadGroup JavaDoc getThreadGroup()
74    {
75       return nextInterceptor.getThreadGroup();
76    }
77
78    public String JavaDoc getID() throws JMSException JavaDoc
79    {
80       String JavaDoc ID = nextInterceptor.getID();
81       return ID;
82    }
83
84    public TemporaryTopic JavaDoc getTemporaryTopic(ConnectionToken dc) throws JMSException JavaDoc
85    {
86       return nextInterceptor.getTemporaryTopic(dc);
87    }
88
89    public TemporaryQueue JavaDoc getTemporaryQueue(ConnectionToken dc) throws JMSException JavaDoc
90    {
91       return nextInterceptor.getTemporaryQueue(dc);
92    }
93
94    public void connectionClosing(ConnectionToken dc) throws JMSException JavaDoc
95    {
96       nextInterceptor.connectionClosing(dc);
97    }
98
99    public void checkID(String JavaDoc ID) throws JMSException JavaDoc
100    {
101       nextInterceptor.checkID(ID);
102    }
103
104    public void addMessage(ConnectionToken dc, SpyMessage message) throws JMSException JavaDoc
105    {
106       nextInterceptor.addMessage(dc, message);
107    }
108
109    public Queue JavaDoc createQueue(ConnectionToken dc, String JavaDoc dest) throws JMSException JavaDoc
110    {
111       return nextInterceptor.createQueue(dc, dest);
112    }
113
114    public Topic JavaDoc createTopic(ConnectionToken dc, String JavaDoc dest) throws JMSException JavaDoc
115    {
116       return nextInterceptor.createTopic(dc, dest);
117    }
118
119    public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination dest) throws JMSException JavaDoc
120    {
121       nextInterceptor.deleteTemporaryDestination(dc, dest);
122    }
123
124    public void transact(ConnectionToken dc, TransactionRequest t) throws JMSException JavaDoc
125    {
126       nextInterceptor.transact(dc, t);
127    }
128
129    public void acknowledge(ConnectionToken dc, AcknowledgementRequest item) throws JMSException JavaDoc
130    {
131       nextInterceptor.acknowledge(dc, item);
132    }
133
134    public SpyMessage[] browse(ConnectionToken dc, Destination JavaDoc dest, String JavaDoc selector) throws JMSException JavaDoc
135    {
136       return nextInterceptor.browse(dc, dest, selector);
137    }
138
139    public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait) throws JMSException JavaDoc
140    {
141       return nextInterceptor.receive(dc, subscriberId, wait);
142    }
143
144    public void setEnabled(ConnectionToken dc, boolean enabled) throws JMSException JavaDoc
145    {
146       nextInterceptor.setEnabled(dc, enabled);
147    }
148
149    public void unsubscribe(ConnectionToken dc, int subscriptionId) throws JMSException JavaDoc
150    {
151       nextInterceptor.unsubscribe(dc, subscriptionId);
152    }
153
154    public void destroySubscription(ConnectionToken dc, DurableSubscriptionID id) throws JMSException JavaDoc
155    {
156       nextInterceptor.destroySubscription(dc, id);
157    }
158
159    public String JavaDoc checkUser(String JavaDoc userName, String JavaDoc password) throws JMSException JavaDoc
160    {
161       return nextInterceptor.checkUser(userName, password);
162    }
163
164    public String JavaDoc authenticate(String JavaDoc userName, String JavaDoc password) throws JMSException JavaDoc
165    {
166       return nextInterceptor.authenticate(userName, password);
167    }
168
169    public void subscribe(org.jboss.mq.ConnectionToken dc, org.jboss.mq.Subscription s) throws JMSException JavaDoc
170    {
171       nextInterceptor.subscribe(dc, s);
172    }
173
174    public void ping(ConnectionToken dc, long clientTime) throws JMSException JavaDoc
175    {
176       nextInterceptor.ping(dc, clientTime);
177    }
178
179    public SpyTopic getDurableTopic(DurableSubscriptionID sub) throws JMSException JavaDoc
180    {
181       return nextInterceptor.getDurableTopic(sub);
182    }
183
184    public Subscription getSubscription(ConnectionToken dc, int subscriberId) throws JMSException JavaDoc
185    {
186       return nextInterceptor.getSubscription(dc, subscriberId);
187    }
188
189    public Xid JavaDoc[] recover(ConnectionToken dc, int flags) throws Exception JavaDoc
190    {
191       JMSServerInterceptor next = nextInterceptor;
192       while (next != null && next instanceof Recoverable == false)
193          next = next.getNext();
194       if (next == null)
195          throw new IllegalStateException JavaDoc("No interceptor implements " + Recoverable.class.getName());
196       Recoverable recoverable = (Recoverable) next;
197       return recoverable.recover(dc, flags);
198    }
199 }
200
Popular Tags