001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker;
018
019import java.net.URI;
020import java.util.Collections;
021import java.util.Map;
022import java.util.Set;
023import java.util.concurrent.ThreadPoolExecutor;
024
025import org.apache.activemq.broker.region.Destination;
026import org.apache.activemq.broker.region.MessageReference;
027import org.apache.activemq.broker.region.Subscription;
028import org.apache.activemq.command.ActiveMQDestination;
029import org.apache.activemq.command.BrokerId;
030import org.apache.activemq.command.BrokerInfo;
031import org.apache.activemq.command.ConnectionInfo;
032import org.apache.activemq.command.ConsumerControl;
033import org.apache.activemq.command.ConsumerInfo;
034import org.apache.activemq.command.DestinationInfo;
035import org.apache.activemq.command.Message;
036import org.apache.activemq.command.MessageAck;
037import org.apache.activemq.command.MessageDispatch;
038import org.apache.activemq.command.MessageDispatchNotification;
039import org.apache.activemq.command.MessagePull;
040import org.apache.activemq.command.ProducerInfo;
041import org.apache.activemq.command.RemoveSubscriptionInfo;
042import org.apache.activemq.command.Response;
043import org.apache.activemq.command.SessionInfo;
044import org.apache.activemq.command.TransactionId;
045import org.apache.activemq.store.PListStore;
046import org.apache.activemq.thread.Scheduler;
047import org.apache.activemq.usage.Usage;
048
049/**
050 * Dumb implementation - used to be overriden by listeners
051 *
052 *
053 */
054public class EmptyBroker implements Broker {
055
056    @Override
057    public BrokerId getBrokerId() {
058        return null;
059    }
060
061    @Override
062    public String getBrokerName() {
063        return null;
064    }
065
066    @Override
067    public Broker getAdaptor(Class type) {
068        if (type.isInstance(this)) {
069            return this;
070        }
071        return null;
072    }
073
074    @Override
075    @SuppressWarnings("unchecked")
076    public Map<ActiveMQDestination, Destination> getDestinationMap() {
077        return Collections.EMPTY_MAP;
078    }
079
080    @Override
081    public Map<ActiveMQDestination, Destination> getDestinationMap(ActiveMQDestination destination) {
082        return Collections.EMPTY_MAP;
083    }
084
085    @Override
086    public Set getDestinations(ActiveMQDestination destination) {
087        return Collections.EMPTY_SET;
088    }
089
090    @Override
091    public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
092
093    }
094
095    @Override
096    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
097
098    }
099
100    @Override
101    public void addSession(ConnectionContext context, SessionInfo info) throws Exception {
102
103    }
104
105    @Override
106    public void removeSession(ConnectionContext context, SessionInfo info) throws Exception {
107
108    }
109
110    @Override
111    public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
112
113    }
114
115    @Override
116    public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
117
118    }
119
120    @Override
121    public Connection[] getClients() throws Exception {
122
123        return null;
124    }
125
126    @Override
127    public ActiveMQDestination[] getDestinations() throws Exception {
128
129        return null;
130    }
131
132    @Override
133    public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception {
134
135        return null;
136    }
137
138    @Override
139    public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception {
140
141    }
142
143    @Override
144    public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception {
145
146        return 0;
147    }
148
149    @Override
150    public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception {
151
152    }
153
154    @Override
155    public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception {
156
157    }
158
159    @Override
160    public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception {
161
162    }
163
164    @Override
165    public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean flag) throws Exception {
166
167        return null;
168    }
169
170    @Override
171    public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
172
173    }
174
175    @Override
176    public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
177        return null;
178    }
179
180    @Override
181    public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
182
183    }
184
185    @Override
186    public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception {
187
188    }
189
190    @Override
191    public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception {
192
193    }
194
195    @Override
196    public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception {
197
198    }
199
200    @Override
201    public void gc() {
202
203    }
204
205    @Override
206    public void start() throws Exception {
207
208    }
209
210    @Override
211    public void stop() throws Exception {
212
213    }
214
215    @Override
216    public void addBroker(Connection connection, BrokerInfo info) {
217
218    }
219
220    @Override
221    public void removeBroker(Connection connection, BrokerInfo info) {
222
223    }
224
225    @Override
226    public BrokerInfo[] getPeerBrokerInfos() {
227        return null;
228    }
229
230    @Override
231    public void preProcessDispatch(MessageDispatch messageDispatch) {
232    }
233
234    @Override
235    public void postProcessDispatch(MessageDispatch messageDispatch) {
236    }
237
238    @Override
239    public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception {
240
241    }
242
243    @Override
244    public boolean isStopped() {
245        return false;
246    }
247
248    @Override
249    public Set<ActiveMQDestination> getDurableDestinations() {
250        return null;
251    }
252
253    @Override
254    public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
255    }
256
257    @Override
258    public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
259    }
260
261    @Override
262    public boolean isFaultTolerantConfiguration() {
263        return false;
264    }
265
266    @Override
267    public ConnectionContext getAdminConnectionContext() {
268        return null;
269    }
270
271    @Override
272    public void setAdminConnectionContext(ConnectionContext adminConnectionContext) {
273    }
274
275    @Override
276    public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception {
277        return null;
278    }
279
280    @Override
281    public PListStore getTempDataStore() {
282        return null;
283    }
284
285    @Override
286    public URI getVmConnectorURI() {
287        return null;
288    }
289
290    @Override
291    public void brokerServiceStarted() {
292    }
293
294    @Override
295    public BrokerService getBrokerService() {
296        return null;
297    }
298
299    @Override
300    public boolean isExpired(MessageReference messageReference) {
301        return false;
302    }
303
304    @Override
305    public void messageExpired(ConnectionContext context, MessageReference message, Subscription subscription) {
306    }
307
308    @Override
309    public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference,
310                                         Subscription subscription, Throwable poisonCause) {
311        return false;
312    }
313
314    @Override
315    public Broker getRoot() {
316        return null;
317    }
318
319    @Override
320    public long getBrokerSequenceId() {
321        return -1l;
322    }
323
324    @Override
325    public void fastProducer(ConnectionContext context,ProducerInfo producerInfo,ActiveMQDestination destination) {
326    }
327
328    @Override
329    public void isFull(ConnectionContext context, Destination destination,Usage usage) {
330    }
331
332    @Override
333    public void messageConsumed(ConnectionContext context,MessageReference messageReference) {
334    }
335
336    @Override
337    public void messageDelivered(ConnectionContext context,MessageReference messageReference) {
338    }
339
340    @Override
341    public void messageDiscarded(ConnectionContext context, Subscription sub, MessageReference messageReference) {
342    }
343
344    @Override
345    public void slowConsumer(ConnectionContext context,Destination destination, Subscription subs) {
346    }
347
348    @Override
349    public void nowMasterBroker() {
350    }
351
352    @Override
353    public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) {
354    }
355
356    @Override
357    public void networkBridgeStopped(BrokerInfo brokerInfo) {
358    }
359
360    @Override
361    public void processConsumerControl(ConsumerBrokerExchange consumerExchange,
362            ConsumerControl control) {
363    }
364
365    @Override
366    public void reapplyInterceptor() {
367
368    }
369
370    @Override
371    public Scheduler getScheduler() {
372        return null;
373    }
374
375    @Override
376    public ThreadPoolExecutor getExecutor() {
377        return null;
378    }
379}