pl.bristleback.server.bristle.actions
Class ActionsDispatcher

java.lang.Object
  extended by pl.bristleback.server.bristle.actions.ActionsDispatcher

public final class ActionsDispatcher
extends java.lang.Object

This class maintains incoming messages and executes action classes based on information taken from message. It uses token's 'type' variable to indicate which action should be executed. If requested action class is not set to be a singleton, it creates new instance of action class (with dependencies and other fields injected). Even if the action with name given in message is found, dispatcher checks rights of the connector, so programmer can control whether connector is able to call this action. Any exception can be caught by ExceptionHandler implementations. For more information about handling action exception, please refer to action exception handler documentation.

Created on: 2010-09-03 16:02:22

Author:
Wojciech Niemiec

Constructor Summary
ActionsDispatcher()
           
 
Method Summary
 ActionsContainer getContainer()
          Gets actions container, containing action wrappers.
 void performAction(org.jwebsocket.api.WebSocketConnector connector, org.jwebsocket.token.Token token)
          Performs action with name given in token content.
 void performReservedAction(org.jwebsocket.api.WebSocketConnector connector, ReservedActionName actionName, org.jwebsocket.token.Token token)
          Performs actions with names reserved by plugin.
 void setContainer(ActionsContainer container)
          Sets actions container.
 void setExceptionHandlersContainer(ExceptionHandlersContainer exceptionHandlersContainer)
          Sets exception handlers container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionsDispatcher

public ActionsDispatcher()
Method Detail

performAction

public void performAction(org.jwebsocket.api.WebSocketConnector connector,
                          org.jwebsocket.token.Token token)
Performs action with name given in token content.

Parameters:
connector - connector.
token - message content and additional information.

performReservedAction

public void performReservedAction(org.jwebsocket.api.WebSocketConnector connector,
                                  ReservedActionName actionName,
                                  org.jwebsocket.token.Token token)
Performs actions with names reserved by plugin.

Parameters:
connector - websocket connector.
actionName - name of the action to invoke.
token - content of the message.

getContainer

public ActionsContainer getContainer()
Gets actions container, containing action wrappers.

Returns:
actions container.

setContainer

public void setContainer(ActionsContainer container)
Sets actions container. This method is invoked by plugin.

Parameters:
container - actions container.

setExceptionHandlersContainer

public void setExceptionHandlersContainer(ExceptionHandlersContainer exceptionHandlersContainer)
Sets exception handlers container. This method is invoked by plugin.

Parameters:
exceptionHandlersContainer - exception handlers container.


Copyright © 2011. All Rights Reserved.