KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > BrokerFilter


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.broker;
19
20 import org.apache.activemq.broker.region.Destination;
21 import org.apache.activemq.broker.region.Subscription;
22 import org.apache.activemq.broker.region.policy.PendingDurableSubscriberMessageStoragePolicy;
23 import org.apache.activemq.command.ActiveMQDestination;
24 import org.apache.activemq.command.BrokerId;
25 import org.apache.activemq.command.BrokerInfo;
26 import org.apache.activemq.command.ConnectionInfo;
27 import org.apache.activemq.command.ConsumerInfo;
28 import org.apache.activemq.command.DestinationInfo;
29 import org.apache.activemq.command.Message;
30 import org.apache.activemq.command.MessageAck;
31 import org.apache.activemq.command.MessageDispatch;
32 import org.apache.activemq.command.MessageDispatchNotification;
33 import org.apache.activemq.command.MessagePull;
34 import org.apache.activemq.command.ProducerInfo;
35 import org.apache.activemq.command.RemoveSubscriptionInfo;
36 import org.apache.activemq.command.Response;
37 import org.apache.activemq.command.SessionInfo;
38 import org.apache.activemq.command.TransactionId;
39 import org.apache.activemq.kaha.Store;
40
41 import java.net.URI JavaDoc;
42 import java.util.Map JavaDoc;
43 import java.util.Set JavaDoc;
44
45 /**
46  * Allows you to intercept broker operation so that features such as security can be
47  * implemented as a pluggable filter.
48  *
49  * @version $Revision: 1.10 $
50  */

51 public class BrokerFilter implements Broker {
52     
53     final protected Broker next;
54
55     public BrokerFilter(Broker next) {
56         this.next=next;
57     }
58    
59     public Broker getAdaptor(Class JavaDoc type){
60         if (type.isInstance(this)){
61             return this;
62         }
63         return next.getAdaptor(type);
64     }
65
66     public Map JavaDoc getDestinationMap() {
67         return next.getDestinationMap();
68     }
69
70     public Set JavaDoc getDestinations(ActiveMQDestination destination) {
71         return next.getDestinations(destination);
72     }
73
74     public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception JavaDoc {
75         next.acknowledge(consumerExchange, ack);
76     }
77
78     public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception JavaDoc {
79         return next.messagePull(context, pull);
80     }
81
82     public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception JavaDoc {
83         next.addConnection(context, info);
84     }
85
86     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc {
87         return next.addConsumer(context, info);
88     }
89
90     public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception JavaDoc {
91         next.addProducer(context, info);
92     }
93
94     public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception JavaDoc {
95         next.commitTransaction(context, xid, onePhase);
96     }
97
98     public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception JavaDoc {
99         next.removeSubscription(context, info);
100     }
101
102     public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception JavaDoc {
103         return next.getPreparedTransactions(context);
104     }
105
106     public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
107         return next.prepareTransaction(context, xid);
108     }
109
110     public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable JavaDoc error) throws Exception JavaDoc {
111         next.removeConnection(context, info, error);
112     }
113
114     public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc {
115         next.removeConsumer(context, info);
116     }
117
118     public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception JavaDoc {
119         next.removeProducer(context, info);
120     }
121
122     public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
123         next.rollbackTransaction(context, xid);
124     }
125
126     public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception JavaDoc {
127         next.send(producerExchange, messageSend);
128     }
129
130     public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
131         next.beginTransaction(context, xid);
132     }
133
134     public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception JavaDoc {
135         next.forgetTransaction(context, transactionId);
136     }
137
138     public Connection[] getClients() throws Exception JavaDoc {
139         return next.getClients();
140     }
141
142     public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception JavaDoc {
143         return next.addDestination(context, destination);
144     }
145
146     public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception JavaDoc {
147         next.removeDestination(context, destination, timeout);
148     }
149
150     public ActiveMQDestination[] getDestinations() throws Exception JavaDoc {
151         return next.getDestinations();
152     }
153
154     public void start() throws Exception JavaDoc {
155         next.start();
156     }
157
158     public void stop() throws Exception JavaDoc {
159         next.stop();
160     }
161
162     public void addSession(ConnectionContext context, SessionInfo info) throws Exception JavaDoc {
163         next.addSession(context, info);
164     }
165
166     public void removeSession(ConnectionContext context, SessionInfo info) throws Exception JavaDoc {
167         next.removeSession(context, info);
168     }
169
170     public BrokerId getBrokerId() {
171         return next.getBrokerId();
172     }
173
174     public String JavaDoc getBrokerName() {
175         return next.getBrokerName();
176     }
177     
178     public void gc() {
179         next.gc();
180     }
181
182
183     public void addBroker(Connection connection,BrokerInfo info){
184         next.addBroker(connection, info);
185     }
186     
187     public void removeBroker(Connection connection,BrokerInfo info){
188         next.removeBroker(connection, info);
189     }
190
191
192     public BrokerInfo[] getPeerBrokerInfos(){
193         return next.getPeerBrokerInfos();
194     }
195     
196     public void processDispatch(MessageDispatch messageDispatch){
197         next.processDispatch(messageDispatch);
198     }
199     
200     public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception JavaDoc{
201         next.processDispatchNotification(messageDispatchNotification);
202     }
203     
204     public boolean isSlaveBroker(){
205         return next.isSlaveBroker();
206     }
207     
208     public boolean isStopped(){
209         return next.isStopped();
210     }
211     
212     public Set JavaDoc getDurableDestinations(){
213         return next.getDurableDestinations();
214     }
215     
216     public void addDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception JavaDoc{
217         next.addDestinationInfo(context, info);
218         
219     }
220
221     public void removeDestinationInfo(ConnectionContext context,DestinationInfo info) throws Exception JavaDoc{
222         next.removeDestinationInfo(context, info);
223         
224     }
225
226     public boolean isFaultTolerantConfiguration(){
227         return next.isFaultTolerantConfiguration();
228     }
229
230     public ConnectionContext getAdminConnectionContext() {
231         return next.getAdminConnectionContext();
232     }
233
234     public void setAdminConnectionContext(ConnectionContext adminConnectionContext) {
235         next.setAdminConnectionContext(adminConnectionContext);
236     }
237     
238     public Store getTempDataStore() {
239         return next.getTempDataStore();
240     }
241     
242     public URI JavaDoc getVmConnectorURI(){
243         return next.getVmConnectorURI();
244     }
245     
246 }
247
Popular Tags