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