Browse Source

Add messaging.simp.user package

pull/425/head
Rossen Stoyanchev 11 years ago
parent
commit
307bf4bede
  1. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessagingTemplate.java
  2. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SendToUser.java
  3. 3
      spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/package-info.java
  4. 4
      spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java
  5. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java
  6. 10
      spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java
  7. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/package-info.java
  8. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java
  9. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistry.java
  10. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationMessageHandler.java
  11. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationResolver.java
  12. 2
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserSessionRegistry.java
  13. 9
      spring-messaging/src/main/java/org/springframework/messaging/simp/user/package-info.java
  14. 2
      spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java
  15. 4
      spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java
  16. 7
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolverTests.java
  17. 5
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistryTests.java
  18. 8
      spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java
  19. 6
      spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java
  20. 2
      spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistry.java
  21. 4
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java
  22. 8
      spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java
  23. 5
      spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistryTests.java

2
spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessagingTemplate.java

@ -57,7 +57,7 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String @@ -57,7 +57,7 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
/**
* Configure the prefix to use for destinations targeting a specific user.
* <p>The default value is "/user/".
* @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler
* @see org.springframework.messaging.simp.user.UserDestinationMessageHandler
*/
public void setUserDestinationPrefix(String prefix) {
Assert.notNull(prefix, "UserDestinationPrefix must not be null");

2
spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/SendToUser.java

@ -36,7 +36,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor; @@ -36,7 +36,7 @@ import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
* @author Rossen Stoyanchev
* @since 4.0
* @see org.springframework.messaging.handler.annotation.SendTo
* @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler
* @see org.springframework.messaging.simp.user.UserDestinationMessageHandler
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)

3
spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/package-info.java

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
/**
* Annotations and for handling messages from simple messaging protocols
* (like STOMP).
* Annotations and for handling messages from SImple Messaging Protocols such as STOMP.
*/
package org.springframework.messaging.simp.annotation;

4
spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractSubscriptionRegistry.java

@ -24,6 +24,10 @@ import org.springframework.messaging.simp.SimpMessageType; @@ -24,6 +24,10 @@ import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.util.MultiValueMap;
/**
* Abstract base class for implementations of {@link SubscriptionRegistry} that
* looks up information in messages but delegates to abstract methods for the
* actual storage and retrieval.
*
* @author Rossen Stoyanchev
* @since 4.0
*/

2
spring-messaging/src/main/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistry.java

@ -31,6 +31,8 @@ import org.springframework.util.LinkedMultiValueMap; @@ -31,6 +31,8 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* A default, simple in-memory implementation of {@link SubscriptionRegistry}.
*
* @author Rossen Stoyanchev
* @since 4.0
*/

10
spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java

@ -30,12 +30,12 @@ import org.springframework.messaging.converter.StringMessageConverter; @@ -30,12 +30,12 @@ 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.broker.AbstractBrokerMessageHandler;
import org.springframework.messaging.simp.handler.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.user.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
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;
import org.springframework.messaging.simp.user.UserDestinationMessageHandler;
import org.springframework.messaging.simp.user.UserDestinationResolver;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.support.AbstractSubscribableChannel;
import org.springframework.messaging.support.ExecutorSubscribableChannel;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/package-info.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
/**
* Generic support for SImple Messaging Protocols such as STOMP.
* Generic support for SImple Messaging Protocols including protocols such as STOMP.
*/
package org.springframework.messaging.simp;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultUserDestinationResolver.java → spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/handler/DefaultUserSessionRegistry.java → spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistry.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import org.springframework.util.Assert;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserDestinationMessageHandler.java → spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationMessageHandler.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import java.util.Set;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserDestinationResolver.java → spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserDestinationResolver.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import org.springframework.messaging.Message;

2
spring-messaging/src/main/java/org/springframework/messaging/simp/handler/UserSessionRegistry.java → spring-messaging/src/main/java/org/springframework/messaging/simp/user/UserSessionRegistry.java

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import java.util.Set;

9
spring-messaging/src/main/java/org/springframework/messaging/simp/user/package-info.java

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
/**
* Support for handling messages to "user" destinations (i.e. destinations that are
* unique to a user's sessions), primarily translating the destinations and then
* forwarding the updated message to the broker.
* <p>
* Also included is {@link org.springframework.messaging.simp.user.UserSessionRegistry}
* for keeping track of connected user sessions.
*/
package org.springframework.messaging.simp.user;

2
spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodMessageHandlerTests.java → spring-messaging/src/test/java/org/springframework/messaging/simp/annotation/support/SimpAnnotationMethodMessageHandlerTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.annotation.support;
import java.util.LinkedHashMap;
import java.util.Map;

4
spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java

@ -35,8 +35,8 @@ import org.springframework.messaging.simp.SimpMessageType; @@ -35,8 +35,8 @@ 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.broker.SimpleBrokerMessageHandler;
import org.springframework.messaging.simp.handler.UserDestinationMessageHandler;
import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.messaging.simp.user.UserDestinationMessageHandler;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;

7
spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultUserDestinationResolverTests.java → spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolverTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import org.junit.Before;
import org.junit.Test;
@ -22,6 +22,9 @@ import org.springframework.messaging.Message; @@ -22,6 +22,9 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.simp.TestPrincipal;
import org.springframework.messaging.simp.user.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.support.MessageBuilder;
import java.util.Set;
@ -29,7 +32,7 @@ import java.util.Set; @@ -29,7 +32,7 @@ import java.util.Set;
import static org.junit.Assert.assertEquals;
/**
* Unit tests for {@link DefaultUserDestinationResolver}.
* Unit tests for {@link org.springframework.messaging.simp.user.DefaultUserDestinationResolver}.
*/
public class DefaultUserDestinationResolverTests {

5
spring-messaging/src/test/java/org/springframework/messaging/simp/handler/DefaultUserSessionRegistryTests.java → spring-messaging/src/test/java/org/springframework/messaging/simp/user/DefaultUserSessionRegistryTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import java.util.Arrays;
import java.util.Collections;
@ -22,11 +22,12 @@ import java.util.LinkedHashSet; @@ -22,11 +22,12 @@ import java.util.LinkedHashSet;
import java.util.List;
import org.junit.Test;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
import static org.junit.Assert.*;
/**
* Test fixture for {@link DefaultUserSessionRegistry}
* Test fixture for {@link org.springframework.messaging.simp.user.DefaultUserSessionRegistry}
*
* @author Rossen Stoyanchev
* @since 4.0

8
spring-messaging/src/test/java/org/springframework/messaging/simp/handler/UserDestinationMessageHandlerTests.java → spring-messaging/src/test/java/org/springframework/messaging/simp/user/UserDestinationMessageHandlerTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.messaging.simp.handler;
package org.springframework.messaging.simp.user;
import org.junit.Before;
import org.junit.Test;
@ -28,13 +28,17 @@ import org.springframework.messaging.SubscribableChannel; @@ -28,13 +28,17 @@ import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.simp.TestPrincipal;
import org.springframework.messaging.simp.user.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.user.UserDestinationMessageHandler;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.support.MessageBuilder;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
/**
* Unit tests for {@link UserDestinationMessageHandler}.
* Unit tests for {@link org.springframework.messaging.simp.user.UserDestinationMessageHandler}.
*/
public class UserDestinationMessageHandlerTests {

6
spring-websocket/src/main/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParser.java

@ -39,10 +39,10 @@ import org.springframework.messaging.converter.MappingJackson2MessageConverter; @@ -39,10 +39,10 @@ import org.springframework.messaging.converter.MappingJackson2MessageConverter;
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.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.user.DefaultUserDestinationResolver;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.broker.SimpleBrokerMessageHandler;
import org.springframework.messaging.simp.handler.UserDestinationMessageHandler;
import org.springframework.messaging.simp.user.UserDestinationMessageHandler;
import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler;
import org.springframework.messaging.support.ExecutorSubscribableChannel;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

2
spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistry.java

@ -21,7 +21,7 @@ import java.util.LinkedHashMap; @@ -21,7 +21,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;

4
spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory; @@ -29,7 +29,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.simp.SimpMessageType;
import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.simp.stomp.*;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.Assert;
@ -66,7 +66,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler { @@ -66,7 +66,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler {
/**
* Provide a registry with which to register active user session ids.
* @see org.springframework.messaging.simp.handler.UserDestinationMessageHandler
* @see org.springframework.messaging.simp.user.UserDestinationMessageHandler
*/
public void setUserSessionRegistry(UserSessionRegistry registry) {
this.userSessionRegistry = registry;

8
spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java

@ -31,11 +31,11 @@ import org.springframework.messaging.converter.CompositeMessageConverter; @@ -31,11 +31,11 @@ import org.springframework.messaging.converter.CompositeMessageConverter;
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.user.DefaultUserDestinationResolver;
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;
import org.springframework.messaging.simp.user.UserDestinationMessageHandler;
import org.springframework.messaging.simp.user.UserDestinationResolver;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler;
import org.springframework.messaging.support.AbstractSubscribableChannel;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

5
spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistryTests.java

@ -24,11 +24,10 @@ import org.mockito.Mockito; @@ -24,11 +24,10 @@ import org.mockito.Mockito;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.simp.handler.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.handler.UserSessionRegistry;
import org.springframework.messaging.simp.user.DefaultUserSessionRegistry;
import org.springframework.messaging.simp.user.UserSessionRegistry;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry;
import org.springframework.web.socket.messaging.StompSubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolHandler;
import org.springframework.web.socket.messaging.SubProtocolWebSocketHandler;

Loading…
Cancel
Save