Class ShortMessageService
- java.lang.Object
-
- org.activecomponents.shortmessages.ShortMessageService
-
- All Implemented Interfaces:
IShortMessageService
public class ShortMessageService extends java.lang.Object implements IShortMessageService
Service that sends messages to followers. - Follower is online: directly call a client message - Follower is offline: add to his postbox
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccesscomponentThe component.protected java.util.Map<User,java.util.Collection<ShortMessage>>postboxesThe post boxes of the users.
-
Constructor Summary
Constructors Constructor Description ShortMessageService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMessageToPostbox(User user, ShortMessage message)Add a message to a postbox of a user.IFuture<java.util.Collection<ShortMessage>>getMessages(java.lang.String usertoken)Get all messages.voidinit()Init of serviceIFuture<java.lang.Void>sendMessage(java.lang.String text, java.lang.String usertoken)Send a message to the followers.
-
-
-
Field Detail
-
component
protected IInternalAccess component
The component.
-
postboxes
protected java.util.Map<User,java.util.Collection<ShortMessage>> postboxes
The post boxes of the users.
-
-
Method Detail
-
init
public void init()
Init of service
-
sendMessage
public IFuture<java.lang.Void> sendMessage(java.lang.String text, java.lang.String usertoken)
Send a message to the followers.- Specified by:
sendMessagein interfaceIShortMessageService- Parameters:
text- The text.sender- The sender.
-
getMessages
public IFuture<java.util.Collection<ShortMessage>> getMessages(java.lang.String usertoken)
Get all messages.- Specified by:
getMessagesin interfaceIShortMessageService- Parameters:
usertoken- The user token.- Returns:
- the messages.
-
addMessageToPostbox
protected void addMessageToPostbox(User user, ShortMessage message)
Add a message to a postbox of a user.- Parameters:
user- The user.message- The message.
-
-