org.elkoserver.foundation.actor
Class RoutingActor

java.lang.Object
  extended by org.elkoserver.foundation.actor.Actor
      extended by org.elkoserver.foundation.actor.RoutingActor
All Implemented Interfaces:
Deliverer, DispatchTarget, MessageHandler
Direct Known Subclasses:
InternalActor, ServiceActor, WorkshopActor

public abstract class RoutingActor
extends Actor
implements DispatchTarget

An Actor that receives targeted JSON messages over its connection.

This class is abstract, in that its implementation of the MessageHandler interface is incomplete: it implements the processMessage() method, but subclasses must implement connectionDied() method (as well as any JSONMethod methods for whatever specific object behavior the subclass is intended for).


Constructor Summary
RoutingActor(Connection connection, RefTable refTable)
          Constructor.
 
Method Summary
 void processMessage(Connection connection, Object receivedMessage)
          Process a received message by dispatching it to the object that the message addresses as its target, according to the RefTable that was provided in this actor's constructor.
 
Methods inherited from class org.elkoserver.foundation.actor.Actor
close, msgAuth, msgAuth, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.elkoserver.foundation.net.MessageHandler
connectionDied
 

Constructor Detail

RoutingActor

public RoutingActor(Connection connection,
                    RefTable refTable)
Constructor.

Parameters:
connection - Connection associated with this actor.
refTable - Table for object ref decoding and message dispatch.
Method Detail

processMessage

public void processMessage(Connection connection,
                           Object receivedMessage)
Process a received message by dispatching it to the object that the message addresses as its target, according to the RefTable that was provided in this actor's constructor.

Specified by:
processMessage in interface MessageHandler
Parameters:
connection - Connection over which the message was received.
receivedMessage - The message received. Normally this should be a JSONObject, but it could be a Throwable indicating a problem receiving or parsing the message.