org.elkoserver.foundation.actor
Class Actor

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

public abstract class Actor
extends Object
implements Deliverer, MessageHandler

An object representing some entity interacting with this server (whatever server this is) over the net. It sits on top of a Connection. It is both a Deliverer that delivers outgoing messages over the connection and a message acceptor that receives and dispatches incoming messages arriving on the connection.


Constructor Summary
Actor(Connection connection)
          Construct a new Actor.
 
Method Summary
 void close()
          Close this Actor's connection.
static JSONLiteral msgAuth(Referenceable target, AuthDesc auth, String label)
          Create an 'auth' message.
static JSONLiteral msgAuth(String target, AuthDesc auth, String label)
          Create an 'auth' message.
 void send(JSONLiteral message)
          Send a message over this Actor's connection to the entity at the other end.
 
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, processMessage
 

Constructor Detail

Actor

public Actor(Connection connection)
Construct a new Actor.

Parameters:
connection - Connection to communicate with the entity at the other end.
Method Detail

close

public void close()
Close this Actor's connection.


send

public void send(JSONLiteral message)
Send a message over this Actor's connection to the entity at the other end.

Specified by:
send in interface Deliverer
Parameters:
message - The message to send.

msgAuth

public static JSONLiteral msgAuth(Referenceable target,
                                  AuthDesc auth,
                                  String label)
Create an 'auth' message.

Parameters:
target - Object the message is being sent to.
auth - Authentication information to use.
label - Label to identify the entity seeking authorization.

msgAuth

public static JSONLiteral msgAuth(String target,
                                  AuthDesc auth,
                                  String label)
Create an 'auth' message.

Parameters:
target - Object the message is being sent to.
auth - Authentication information to use.
label - Label to identify the entity seeking authorization.