001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.mq.server;
023:
024: import javax.jms.Destination;
025: import javax.jms.JMSException;
026: import javax.jms.Queue;
027: import javax.jms.TemporaryQueue;
028: import javax.jms.TemporaryTopic;
029: import javax.jms.Topic;
030: import javax.transaction.xa.Xid;
031:
032: import org.jboss.logging.Logger;
033: import org.jboss.mq.AcknowledgementRequest;
034: import org.jboss.mq.ConnectionToken;
035: import org.jboss.mq.DurableSubscriptionID;
036: import org.jboss.mq.Recoverable;
037: import org.jboss.mq.SpyDestination;
038: import org.jboss.mq.SpyMessage;
039: import org.jboss.mq.SpyTopic;
040: import org.jboss.mq.Subscription;
041: import org.jboss.mq.TransactionRequest;
042:
043: /**
044: * A pass through JMSServerInvoker.
045: *
046: * @author <a href="mailto:pra@tim.se">Peter Antman</a>
047: * @author <a href="adrian@jboss.org">Adrian Brock</a>
048: * @version $Revision: 57198 $
049: */
050: public class JMSServerInterceptorSupport implements
051: JMSServerInterceptor, Recoverable {
052: protected Logger log;
053: /**
054: * Next invoker in chain.
055: */
056: protected JMSServerInterceptor nextInterceptor = null;
057:
058: public JMSServerInterceptorSupport() {
059: log = Logger.getLogger(this .getClass().getName());
060: }
061:
062: public void setNext(JMSServerInterceptor server) {
063: this .nextInterceptor = server;
064: }
065:
066: public JMSServerInterceptor getNext() {
067: return this .nextInterceptor;
068: }
069:
070: public ThreadGroup getThreadGroup() {
071: return nextInterceptor.getThreadGroup();
072: }
073:
074: public String getID() throws JMSException {
075: String ID = nextInterceptor.getID();
076: return ID;
077: }
078:
079: public TemporaryTopic getTemporaryTopic(ConnectionToken dc)
080: throws JMSException {
081: return nextInterceptor.getTemporaryTopic(dc);
082: }
083:
084: public TemporaryQueue getTemporaryQueue(ConnectionToken dc)
085: throws JMSException {
086: return nextInterceptor.getTemporaryQueue(dc);
087: }
088:
089: public void connectionClosing(ConnectionToken dc)
090: throws JMSException {
091: nextInterceptor.connectionClosing(dc);
092: }
093:
094: public void checkID(String ID) throws JMSException {
095: nextInterceptor.checkID(ID);
096: }
097:
098: public void addMessage(ConnectionToken dc, SpyMessage message)
099: throws JMSException {
100: nextInterceptor.addMessage(dc, message);
101: }
102:
103: public Queue createQueue(ConnectionToken dc, String dest)
104: throws JMSException {
105: return nextInterceptor.createQueue(dc, dest);
106: }
107:
108: public Topic createTopic(ConnectionToken dc, String dest)
109: throws JMSException {
110: return nextInterceptor.createTopic(dc, dest);
111: }
112:
113: public void deleteTemporaryDestination(ConnectionToken dc,
114: SpyDestination dest) throws JMSException {
115: nextInterceptor.deleteTemporaryDestination(dc, dest);
116: }
117:
118: public void transact(ConnectionToken dc, TransactionRequest t)
119: throws JMSException {
120: nextInterceptor.transact(dc, t);
121: }
122:
123: public void acknowledge(ConnectionToken dc,
124: AcknowledgementRequest item) throws JMSException {
125: nextInterceptor.acknowledge(dc, item);
126: }
127:
128: public SpyMessage[] browse(ConnectionToken dc, Destination dest,
129: String selector) throws JMSException {
130: return nextInterceptor.browse(dc, dest, selector);
131: }
132:
133: public SpyMessage receive(ConnectionToken dc, int subscriberId,
134: long wait) throws JMSException {
135: return nextInterceptor.receive(dc, subscriberId, wait);
136: }
137:
138: public void setEnabled(ConnectionToken dc, boolean enabled)
139: throws JMSException {
140: nextInterceptor.setEnabled(dc, enabled);
141: }
142:
143: public void unsubscribe(ConnectionToken dc, int subscriptionId)
144: throws JMSException {
145: nextInterceptor.unsubscribe(dc, subscriptionId);
146: }
147:
148: public void destroySubscription(ConnectionToken dc,
149: DurableSubscriptionID id) throws JMSException {
150: nextInterceptor.destroySubscription(dc, id);
151: }
152:
153: public String checkUser(String userName, String password)
154: throws JMSException {
155: return nextInterceptor.checkUser(userName, password);
156: }
157:
158: public String authenticate(String userName, String password)
159: throws JMSException {
160: return nextInterceptor.authenticate(userName, password);
161: }
162:
163: public void subscribe(org.jboss.mq.ConnectionToken dc,
164: org.jboss.mq.Subscription s) throws JMSException {
165: nextInterceptor.subscribe(dc, s);
166: }
167:
168: public void ping(ConnectionToken dc, long clientTime)
169: throws JMSException {
170: nextInterceptor.ping(dc, clientTime);
171: }
172:
173: public SpyTopic getDurableTopic(DurableSubscriptionID sub)
174: throws JMSException {
175: return nextInterceptor.getDurableTopic(sub);
176: }
177:
178: public Subscription getSubscription(ConnectionToken dc,
179: int subscriberId) throws JMSException {
180: return nextInterceptor.getSubscription(dc, subscriberId);
181: }
182:
183: public Xid[] recover(ConnectionToken dc, int flags)
184: throws Exception {
185: JMSServerInterceptor next = nextInterceptor;
186: while (next != null && next instanceof Recoverable == false)
187: next = next.getNext();
188: if (next == null)
189: throw new IllegalStateException(
190: "No interceptor implements "
191: + Recoverable.class.getName());
192: Recoverable recoverable = (Recoverable) next;
193: return recoverable.recover(dc, flags);
194: }
195: }
|