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