org.elkoserver.server.workshop
Class WorkshopActor

java.lang.Object
  extended by org.elkoserver.foundation.actor.Actor
      extended by org.elkoserver.foundation.actor.RoutingActor
          extended by org.elkoserver.server.workshop.WorkshopActor
All Implemented Interfaces:
BasicProtocolActor, Deliverer, DispatchTarget, MessageHandler

public class WorkshopActor
extends RoutingActor
implements BasicProtocolActor

Actor for a connection to a workshop. An actor may be associated with either or both of the two service protocols offered by a workshop (admin and client), according to the permissions granted by the factory.


Method Summary
 void connectionDied(Connection connection, Throwable reason)
          Handle loss of connection from the actor.
 boolean doAuth(BasicProtocolHandler handler, AuthDesc auth, String label)
          Do the actual work of authorizing an actor.
 void doDisconnect()
          Do the actual work of disconnecting an actor.
 void ensureAuthorizedAdmin()
          Guard function to guarantee that an operation is being attempted by an actor who is authorized to do admin operations.
 void ensureAuthorizedClient()
          Guard function to guarantee that an operation is being attempted by an actor who is authorized to do workshop client operations.
 String toString()
           
 
Methods inherited from class org.elkoserver.foundation.actor.RoutingActor
processMessage
 
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, wait, wait, wait
 
Methods inherited from interface org.elkoserver.foundation.json.Deliverer
send
 

Method Detail

connectionDied

public void connectionDied(Connection connection,
                           Throwable reason)
Handle loss of connection from the actor.

Specified by:
connectionDied in interface MessageHandler
Parameters:
connection - The connection that died.
reason - Exception explaining why.

doAuth

public boolean doAuth(BasicProtocolHandler handler,
                      AuthDesc auth,
                      String label)
Do the actual work of authorizing an actor.

Specified by:
doAuth in interface BasicProtocolActor
Parameters:
handler - Handler requesting the authorization.
auth - Authorization information from the authorization request message, or null if no authorization information was provided.
label - Label (e.g., displayable user name) string from the authorization request message, or "<anonymous>" if no value was specified.
Returns:
true if the authorization succeeded and the session should be allowed to proceed, false if it did not and the session should be disconnected.

doDisconnect

public void doDisconnect()
Do the actual work of disconnecting an actor.

Specified by:
doDisconnect in interface BasicProtocolActor

ensureAuthorizedAdmin

public void ensureAuthorizedAdmin()
                           throws MessageHandlerException
Guard function to guarantee that an operation is being attempted by an actor who is authorized to do admin operations.

Throws:
MessageHandlerException

ensureAuthorizedClient

public void ensureAuthorizedClient()
                            throws MessageHandlerException
Guard function to guarantee that an operation is being attempted by an actor who is authorized to do workshop client operations.

Throws:
MessageHandlerException

toString

public String toString()
Overrides:
toString in class Object
Returns:
a printable representation of this actor.