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