use of com.github.dedis.popstellar.utility.handler.data.HandlerContext in project popstellar by dedis.
the class MessageHandler method handleMessage.
/**
* Send messages to the corresponding handler.
*
* @param laoRepository the repository to access the messages and LAOs
* @param messageSender the service used to send messages to the backend
* @param channel the channel on which the message was received
* @param message the message that was received
*/
public void handleMessage(LAORepository laoRepository, MessageSender messageSender, Channel channel, MessageGeneral message) throws DataHandlingException {
Log.d(TAG, "handle incoming message");
// Put the message in the state
laoRepository.getMessageById().put(message.getMessageId(), message);
Data data = message.getData();
Log.d(TAG, "data with class: " + data.getClass());
Objects dataObj = Objects.find(data.getObject());
Action dataAction = Action.find(data.getAction());
registry.handle(new HandlerContext(laoRepository, keyManager, messageSender, channel, message), data, dataObj, dataAction);
notifyLaoUpdate(laoRepository, data, channel);
}
Aggregations