From 89455c00f62775ead9b7cd76398b5be2012e432c Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 6 Dec 2013 16:24:04 -0500 Subject: [PATCH] Create messaging.simp.broker package --- .../{handler => broker}/AbstractBrokerMessageHandler.java | 5 ++++- .../{handler => broker}/AbstractSubscriptionRegistry.java | 2 +- .../{handler => broker}/DefaultSubscriptionRegistry.java | 2 +- .../{handler => broker}/SimpleBrokerMessageHandler.java | 6 +++++- .../simp/{handler => broker}/SubscriptionRegistry.java | 2 +- .../springframework/messaging/simp/broker/package-info.java | 5 +++++ .../messaging/simp/config/AbstractBrokerRegistration.java | 2 +- .../simp/config/AbstractMessageBrokerConfiguration.java | 4 ++-- .../messaging/simp/config/MessageBrokerRegistry.java | 2 +- .../messaging/simp/config/SimpleBrokerRegistration.java | 2 +- .../simp/stomp/StompBrokerRelayMessageHandler.java | 2 +- .../DefaultSubscriptionRegistryTests.java | 5 +++-- .../SimpleBrokerMessageHandlerTests.java | 3 ++- .../simp/config/MessageBrokerConfigurationTests.java | 2 +- .../socket/config/MessageBrokerBeanDefinitionParser.java | 2 +- .../web/socket/config/spring-websocket-4.0.xsd | 2 +- .../config/MessageBrokerBeanDefinitionParserTests.java | 2 +- 17 files changed, 32 insertions(+), 18 deletions(-) rename spring-messaging/src/main/java/org/springframework/messaging/simp/{handler => broker}/AbstractBrokerMessageHandler.java (96%) rename spring-messaging/src/main/java/org/springframework/messaging/simp/{handler => broker}/AbstractSubscriptionRegistry.java (98%) rename spring-messaging/src/main/java/org/springframework/messaging/simp/{handler => broker}/DefaultSubscriptionRegistry.java (99%) rename spring-messaging/src/main/java/org/springframework/messaging/simp/{handler => broker}/SimpleBrokerMessageHandler.java (95%) rename spring-messaging/src/main/java/org/springframework/messaging/simp/{handler => broker}/SubscriptionRegistry.java (96%) create mode 100644 spring-messaging/src/main/java/org/springframework/messaging/simp/broker/package-info.java rename spring-messaging/src/test/java/org/springframework/messaging/simp/{handler => broker}/DefaultSubscriptionRegistryTests.java (97%) rename spring-messaging/src/test/java/org/springframework/messaging/simp/{handler => broker}/SimpleBrokerMessageHandlerTests.java (98%) diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractBrokerMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java similarity index 96% rename from spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractBrokerMessageHandler.java rename to spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java index 4be8bddf88..dece80b408 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractBrokerMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import java.util.Collection; import java.util.Collections; @@ -32,6 +32,9 @@ import org.springframework.messaging.simp.BrokerAvailabilityEvent; import org.springframework.util.CollectionUtils; /** + * Abstract base class for a {@link MessageHandler} that manages subscriptions and + * propagates messages to subscribers. + * * @author Rossen Stoyanchev * @since 4.0 */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractSubscriptionRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java similarity index 98% rename from spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractSubscriptionRegistry.java rename to spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java index 7505b617ce..a946f37cdc 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AbstractSubscriptionRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java similarity index 99% rename from spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistry.java rename to spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java index d8accd01b3..9ec2cc998f 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import java.util.Collection; import java.util.HashSet; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java similarity index 95% rename from spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandler.java rename to spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java index 902f59fbce..d0cc6312d6 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import java.util.Collection; @@ -28,6 +28,10 @@ import org.springframework.util.Assert; import org.springframework.util.MultiValueMap; /** + * A "simple" message broker that recognizes the message types defined in + * {@link SimpMessageType}, keeps track of subscriptions with the help of a + * {@link SubscriptionRegistry} and sends messages to subscribers. + * * @author Rossen Stoyanchev * @since 4.0 */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SubscriptionRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SubscriptionRegistry.java similarity index 96% rename from spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SubscriptionRegistry.java rename to spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SubscriptionRegistry.java index 52d500bbb4..6755ee92ef 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/SubscriptionRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/SubscriptionRegistry.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import org.springframework.messaging.Message; import org.springframework.util.MultiValueMap; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/package-info.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/package-info.java new file mode 100644 index 0000000000..46e45bb944 --- /dev/null +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/package-info.java @@ -0,0 +1,5 @@ +/** + * Provides a "simple" message broker implementation along with an abstract base + * class and other supporting types such as a registry for subscriptions. + */ +package org.springframework.messaging.simp.broker; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractBrokerRegistration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractBrokerRegistration.java index ff8d542702..8a085da3ea 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractBrokerRegistration.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractBrokerRegistration.java @@ -23,7 +23,7 @@ import java.util.List; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; -import org.springframework.messaging.simp.handler.AbstractBrokerMessageHandler; +import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler; import org.springframework.util.Assert; /** diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java index dabb3836a8..6a94298521 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java @@ -29,10 +29,10 @@ import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.converter.StringMessageConverter; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; -import org.springframework.messaging.simp.handler.AbstractBrokerMessageHandler; +import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler; import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationResolver; import org.springframework.messaging.simp.handler.UserSessionRegistry; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java index 1a01db94d5..0911ef2374 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java @@ -21,7 +21,7 @@ import java.util.Collection; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; import org.springframework.util.Assert; diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java index df1ed72ec4..2c683ebe34 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/SimpleBrokerRegistration.java @@ -18,7 +18,7 @@ package org.springframework.messaging.simp.config; import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; /** * Registration class for configuring a {@link SimpleBrokerMessageHandler}. diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java index 5971b64b11..658958b8d7 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.java @@ -27,7 +27,7 @@ import org.springframework.messaging.MessageDeliveryException; import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; -import org.springframework.messaging.simp.handler.AbstractBrokerMessageHandler; +import org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler; import org.springframework.messaging.support.MessageBuilder; import org.springframework.messaging.tcp.FixedIntervalReconnectStrategy; import org.springframework.messaging.tcp.TcpConnection; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistryTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java similarity index 97% rename from spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistryTests.java rename to spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java index 2403646fb3..854e00d3c0 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultSubscriptionRegistryTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import java.util.Arrays; import java.util.Collections; @@ -25,13 +25,14 @@ import org.junit.Test; import org.springframework.messaging.Message; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; +import org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry; import org.springframework.messaging.support.MessageBuilder; import org.springframework.util.MultiValueMap; import static org.junit.Assert.*; /** - * Test fixture for {@link DefaultSubscriptionRegistry}. + * Test fixture for {@link org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry}. * * @author Rossen Stoyanchev */ diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandlerTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandlerTests.java similarity index 98% rename from spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandlerTests.java rename to spring-messaging/src/test/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandlerTests.java index f86c6f54e4..7b15b2f49b 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpleBrokerMessageHandlerTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandlerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.messaging.simp.handler; +package org.springframework.messaging.simp.broker; import java.util.Collections; @@ -29,6 +29,7 @@ import org.springframework.messaging.MessageChannel; import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessageType; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.support.MessageBuilder; import static org.junit.Assert.*; diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java index e1f166dd34..d94c0e5b71 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java @@ -34,7 +34,7 @@ import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.simp.annotation.SubscribeMapping; import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; import org.springframework.messaging.simp.handler.UserSessionRegistry; import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java index 2d0259b7e4..76f6929e79 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java @@ -41,7 +41,7 @@ import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler; import org.springframework.messaging.support.ExecutorSubscribableChannel; diff --git a/spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd b/spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd index 622788810f..470822417a 100644 --- a/spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd +++ b/spring-websocket/src/main/resources/org/springframework/web/socket/config/spring-websocket-4.0.xsd @@ -294,7 +294,7 @@ - diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java index 92bfafeaf2..517e1e271b 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java @@ -32,7 +32,7 @@ import org.springframework.messaging.converter.MessageConverter; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler; import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver; -import org.springframework.messaging.simp.handler.SimpleBrokerMessageHandler; +import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationMessageHandler; import org.springframework.messaging.simp.handler.UserDestinationResolver; import org.springframework.messaging.simp.handler.UserSessionRegistry;