PageRenderTime 41ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerFilter.java

https://github.com/apache/activemq
Java | 411 lines | 314 code | 75 blank | 22 comment | 0 complexity | 35bf9377a306ba5e5617c10c3c697051 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package org.apache.activemq.broker;
  18. import java.net.URI;
  19. import java.util.Map;
  20. import java.util.Set;
  21. import java.util.concurrent.ThreadPoolExecutor;
  22. import org.apache.activemq.broker.region.Destination;
  23. import org.apache.activemq.broker.region.MessageReference;
  24. import org.apache.activemq.broker.region.Subscription;
  25. import org.apache.activemq.broker.region.virtual.VirtualDestination;
  26. import org.apache.activemq.command.ActiveMQDestination;
  27. import org.apache.activemq.command.BrokerId;
  28. import org.apache.activemq.command.BrokerInfo;
  29. import org.apache.activemq.command.ConnectionInfo;
  30. import org.apache.activemq.command.ConsumerControl;
  31. import org.apache.activemq.command.ConsumerInfo;
  32. import org.apache.activemq.command.DestinationInfo;
  33. import org.apache.activemq.command.Message;
  34. import org.apache.activemq.command.MessageAck;
  35. import org.apache.activemq.command.MessageDispatch;
  36. import org.apache.activemq.command.MessageDispatchNotification;
  37. import org.apache.activemq.command.MessagePull;
  38. import org.apache.activemq.command.ProducerInfo;
  39. import org.apache.activemq.command.RemoveSubscriptionInfo;
  40. import org.apache.activemq.command.Response;
  41. import org.apache.activemq.command.SessionInfo;
  42. import org.apache.activemq.command.TransactionId;
  43. import org.apache.activemq.store.PListStore;
  44. import org.apache.activemq.thread.Scheduler;
  45. import org.apache.activemq.usage.Usage;
  46. /**
  47. * Allows you to intercept broker operation so that features such as security
  48. * can be implemented as a pluggable filter.
  49. *
  50. *
  51. */
  52. public class BrokerFilter implements Broker {
  53. protected final Broker next;
  54. public BrokerFilter(Broker next) {
  55. this.next = next;
  56. }
  57. public Broker getNext() {
  58. return next;
  59. }
  60. @Override
  61. public Broker getAdaptor(Class<?> type) {
  62. return type.isInstance(this) ? this : getNext().getAdaptor(type);
  63. }
  64. @Override
  65. public Map<ActiveMQDestination, Destination> getDestinationMap() {
  66. return getNext().getDestinationMap();
  67. }
  68. @Override
  69. public Map<ActiveMQDestination, Destination> getDestinationMap(ActiveMQDestination destination) {
  70. return getNext().getDestinationMap(destination);
  71. }
  72. @Override
  73. public Set<Destination> getDestinations(ActiveMQDestination destination) {
  74. return getNext().getDestinations(destination);
  75. }
  76. @Override
  77. public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception {
  78. getNext().acknowledge(consumerExchange, ack);
  79. }
  80. @Override
  81. public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception {
  82. return getNext().messagePull(context, pull);
  83. }
  84. @Override
  85. public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
  86. getNext().addConnection(context, info);
  87. }
  88. @Override
  89. public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
  90. return getNext().addConsumer(context, info);
  91. }
  92. @Override
  93. public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
  94. getNext().addProducer(context, info);
  95. }
  96. @Override
  97. public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception {
  98. getNext().commitTransaction(context, xid, onePhase);
  99. }
  100. @Override
  101. public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception {
  102. getNext().removeSubscription(context, info);
  103. }
  104. @Override
  105. public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception {
  106. return getNext().getPreparedTransactions(context);
  107. }
  108. @Override
  109. public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception {
  110. return getNext().prepareTransaction(context, xid);
  111. }
  112. @Override
  113. public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
  114. getNext().removeConnection(context, info, error);
  115. }
  116. @Override
  117. public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
  118. getNext().removeConsumer(context, info);
  119. }
  120. @Override
  121. public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
  122. getNext().removeProducer(context, info);
  123. }
  124. @Override
  125. public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception {
  126. getNext().rollbackTransaction(context, xid);
  127. }
  128. @Override
  129. public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception {
  130. getNext().send(producerExchange, messageSend);
  131. }
  132. @Override
  133. public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception {
  134. getNext().beginTransaction(context, xid);
  135. }
  136. @Override
  137. public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception {
  138. getNext().forgetTransaction(context, transactionId);
  139. }
  140. @Override
  141. public Connection[] getClients() throws Exception {
  142. return getNext().getClients();
  143. }
  144. @Override
  145. public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
  146. return getNext().addDestination(context, destination,createIfTemporary);
  147. }
  148. @Override
  149. public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
  150. getNext().removeDestination(context, destination, timeout);
  151. }
  152. @Override
  153. public ActiveMQDestination[] getDestinations() throws Exception {
  154. return getNext().getDestinations();
  155. }
  156. @Override
  157. public void start() throws Exception {
  158. getNext().start();
  159. }
  160. @Override
  161. public void stop() throws Exception {
  162. getNext().stop();
  163. }
  164. @Override
  165. public void addSession(ConnectionContext context, SessionInfo info) throws Exception {
  166. getNext().addSession(context, info);
  167. }
  168. @Override
  169. public void removeSession(ConnectionContext context, SessionInfo info) throws Exception {
  170. getNext().removeSession(context, info);
  171. }
  172. @Override
  173. public BrokerId getBrokerId() {
  174. return getNext().getBrokerId();
  175. }
  176. @Override
  177. public String getBrokerName() {
  178. return getNext().getBrokerName();
  179. }
  180. @Override
  181. public void gc() {
  182. getNext().gc();
  183. }
  184. @Override
  185. public void addBroker(Connection connection, BrokerInfo info) {
  186. getNext().addBroker(connection, info);
  187. }
  188. @Override
  189. public void removeBroker(Connection connection, BrokerInfo info) {
  190. getNext().removeBroker(connection, info);
  191. }
  192. @Override
  193. public BrokerInfo[] getPeerBrokerInfos() {
  194. return getNext().getPeerBrokerInfos();
  195. }
  196. @Override
  197. public void preProcessDispatch(MessageDispatch messageDispatch) {
  198. getNext().preProcessDispatch(messageDispatch);
  199. }
  200. @Override
  201. public void postProcessDispatch(MessageDispatch messageDispatch) {
  202. getNext().postProcessDispatch(messageDispatch);
  203. }
  204. @Override
  205. public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception {
  206. getNext().processDispatchNotification(messageDispatchNotification);
  207. }
  208. @Override
  209. public boolean isStopped() {
  210. return getNext().isStopped();
  211. }
  212. @Override
  213. public Set<ActiveMQDestination> getDurableDestinations() {
  214. return getNext().getDurableDestinations();
  215. }
  216. @Override
  217. public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
  218. getNext().addDestinationInfo(context, info);
  219. }
  220. @Override
  221. public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
  222. getNext().removeDestinationInfo(context, info);
  223. }
  224. @Override
  225. public boolean isFaultTolerantConfiguration() {
  226. return getNext().isFaultTolerantConfiguration();
  227. }
  228. @Override
  229. public ConnectionContext getAdminConnectionContext() {
  230. return getNext().getAdminConnectionContext();
  231. }
  232. @Override
  233. public void setAdminConnectionContext(ConnectionContext adminConnectionContext) {
  234. getNext().setAdminConnectionContext(adminConnectionContext);
  235. }
  236. @Override
  237. public PListStore getTempDataStore() {
  238. return getNext().getTempDataStore();
  239. }
  240. @Override
  241. public URI getVmConnectorURI() {
  242. return getNext().getVmConnectorURI();
  243. }
  244. @Override
  245. public void brokerServiceStarted() {
  246. getNext().brokerServiceStarted();
  247. }
  248. @Override
  249. public BrokerService getBrokerService() {
  250. return getNext().getBrokerService();
  251. }
  252. @Override
  253. public boolean isExpired(MessageReference messageReference) {
  254. return getNext().isExpired(messageReference);
  255. }
  256. @Override
  257. public void messageExpired(ConnectionContext context, MessageReference message, Subscription subscription) {
  258. getNext().messageExpired(context, message, subscription);
  259. }
  260. @Override
  261. public boolean sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference,
  262. Subscription subscription, Throwable poisonCause) {
  263. return getNext().sendToDeadLetterQueue(context, messageReference, subscription, poisonCause);
  264. }
  265. @Override
  266. public Broker getRoot() {
  267. return getNext().getRoot();
  268. }
  269. @Override
  270. public long getBrokerSequenceId() {
  271. return getNext().getBrokerSequenceId();
  272. }
  273. @Override
  274. public void fastProducer(ConnectionContext context,ProducerInfo producerInfo,ActiveMQDestination destination) {
  275. getNext().fastProducer(context, producerInfo, destination);
  276. }
  277. @Override
  278. public void isFull(ConnectionContext context,Destination destination, Usage<?> usage) {
  279. getNext().isFull(context,destination, usage);
  280. }
  281. @Override
  282. public void messageConsumed(ConnectionContext context,MessageReference messageReference) {
  283. getNext().messageConsumed(context, messageReference);
  284. }
  285. @Override
  286. public void messageDelivered(ConnectionContext context,MessageReference messageReference) {
  287. getNext().messageDelivered(context, messageReference);
  288. }
  289. @Override
  290. public void messageDiscarded(ConnectionContext context,Subscription sub, MessageReference messageReference) {
  291. getNext().messageDiscarded(context, sub, messageReference);
  292. }
  293. @Override
  294. public void slowConsumer(ConnectionContext context, Destination destination,Subscription subs) {
  295. getNext().slowConsumer(context, destination,subs);
  296. }
  297. @Override
  298. public void virtualDestinationAdded(ConnectionContext context,
  299. VirtualDestination virtualDestination) {
  300. getNext().virtualDestinationAdded(context, virtualDestination);
  301. }
  302. @Override
  303. public void virtualDestinationRemoved(ConnectionContext context,
  304. VirtualDestination virtualDestination) {
  305. getNext().virtualDestinationRemoved(context, virtualDestination);
  306. }
  307. @Override
  308. public void nowMasterBroker() {
  309. getNext().nowMasterBroker();
  310. }
  311. @Override
  312. public void processConsumerControl(ConsumerBrokerExchange consumerExchange,
  313. ConsumerControl control) {
  314. getNext().processConsumerControl(consumerExchange, control);
  315. }
  316. @Override
  317. public void reapplyInterceptor() {
  318. getNext().reapplyInterceptor();
  319. }
  320. @Override
  321. public Scheduler getScheduler() {
  322. return getNext().getScheduler();
  323. }
  324. @Override
  325. public ThreadPoolExecutor getExecutor() {
  326. return getNext().getExecutor();
  327. }
  328. @Override
  329. public void networkBridgeStarted(BrokerInfo brokerInfo, boolean createdByDuplex, String remoteIp) {
  330. getNext().networkBridgeStarted(brokerInfo, createdByDuplex, remoteIp);
  331. }
  332. @Override
  333. public void networkBridgeStopped(BrokerInfo brokerInfo) {
  334. getNext().networkBridgeStopped(brokerInfo);
  335. }
  336. }