com.threerings.crowd.chat.server
Class SpeakHandler

java.lang.Object
  extended by com.threerings.crowd.chat.server.SpeakHandler
All Implemented Interfaces:
SpeakProvider, InvocationProvider

public class SpeakHandler
extends Object
implements SpeakProvider

Wires up the SpeakService to a particular distributed object. A server entity can make "speech" available among the subscribers of a particular distributed object by constructing a speak handler and registering it with the InvocationManager, then placing the resulting marshaller into the distributed object in question so that subscribers to that object can use it to generate "speak" requests on that object.


Nested Class Summary
static interface SpeakHandler.SpeakerValidator
          Used to prevent abitrary users from issuing speak requests.
 
Field Summary
protected  BodyLocator _locator
          Used for acquiring BodyObject references from Names and ClientObjects.
protected  DObject _speakObj
          Our speech object.
protected  SpeakHandler.SpeakerValidator _validator
          The entity that will validate our speakers.
 
Constructor Summary
SpeakHandler(BodyLocator locator, DObject speakObj, SpeakHandler.SpeakerValidator validator)
          Creates a handler that will provide speech on the supplied distributed object.
SpeakHandler(DObject speakObj, SpeakHandler.SpeakerValidator validator)
          Creates a handler that will provide speech on the supplied distributed object.
 
Method Summary
protected  void sendSpeak(BodyObject source, String message, byte mode)
          Sends the actual speak message.
 void speak(ClientObject caller, String message, byte mode)
          Handles a SpeakService.speak(java.lang.String, byte) request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_locator

protected BodyLocator _locator
Used for acquiring BodyObject references from Names and ClientObjects.


_speakObj

protected DObject _speakObj
Our speech object.


_validator

protected SpeakHandler.SpeakerValidator _validator
The entity that will validate our speakers.

Constructor Detail

SpeakHandler

public SpeakHandler(DObject speakObj,
                    SpeakHandler.SpeakerValidator validator)
Creates a handler that will provide speech on the supplied distributed object.

Parameters:
speakObj - the object for which speech requests will be processed.
validator - an optional validator that can be used to prevent arbitrary users from using the speech services on this object.

SpeakHandler

public SpeakHandler(BodyLocator locator,
                    DObject speakObj,
                    SpeakHandler.SpeakerValidator validator)
Creates a handler that will provide speech on the supplied distributed object.

Parameters:
locator - the object we use to look up BodyObjects from ClientObjects
speakObj - the object for which speech requests will be processed.
validator - an optional validator that can be used to prevent arbitrary users from using the speech services on this object.
Method Detail

speak

public void speak(ClientObject caller,
                  String message,
                  byte mode)
Description copied from interface: SpeakProvider
Handles a SpeakService.speak(java.lang.String, byte) request.

Specified by:
speak in interface SpeakProvider

sendSpeak

protected void sendSpeak(BodyObject source,
                         String message,
                         byte mode)
Sends the actual speak message.