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