public class PlaceManager extends Object implements MessageListener, SpeakHandler.SpeakerValidator
The base place manager class takes care of the necessary interactions with the place registry to manage place registration. It handles the place-related component of chatting. It also provides the basis for place-based access control.
A derived class is expected to handle initialization, cleanup and operational functionality
via the calldown functions didInit(), didStartup(), and didShutdown() as
well as through event listeners.
| Modifier and Type | Class and Description |
|---|---|
static class |
PlaceManager.DelegateOp
Used to call methods on this place manager's delegates.
|
static interface |
PlaceManager.MessageHandler
Deprecated.
Use dynamically bound methods instead. See
DynamicListener. |
| Constructor and Description |
|---|
PlaceManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDelegate(PlaceManagerDelegate delegate)
Adds the supplied delegate to the list for this manager.
|
void |
applyToDelegates(PlaceManager.DelegateOp op)
Applies the supplied operation to this manager's registered delegates.
|
void |
applyToOccupants(OccupantOp op)
Applies the supplied occupant operation to each occupant currently present in this place.
|
void |
bodyWillEnter(BodyObject body)
This is called to inform the manager that a body is on the way in.
|
void |
bodyWillLeave(BodyObject body)
Called to inform a manager that a body is about to leave this place.
|
String |
checkPermissions()
Provides an opportunity for place managers to ratify the creation of a place based on
whatever criterion they may require (based on information available to the manager at this
post-init() but pre-startup() phase of initialization).
|
PlaceConfig |
getConfig()
Returns a reference to our place configuration object.
|
Place |
getLocation()
Returns a
Place instance that identifies this place. |
PlaceObject |
getPlaceObject()
Returns the place object managed by this place manager.
|
void |
init(PlaceRegistry registry,
InvocationManager invmgr,
RootDObjectManager omgr,
BodyLocator locator,
PlaceConfig config)
Called by the place registry after creating this place manager.
|
boolean |
isValidSpeaker(DObject speakObj,
ClientObject speaker,
byte mode)
Should return true if the supplied speaker is allowed to speak via the speak provider
with which this validator was registered.
|
void |
messageReceived(MessageEvent event)
Called when an message event has been dispatched on an object.
|
String |
ratifyBodyEntry(BodyObject body)
Provides an opportunity for the place manager to prevent bodies from entering.
|
void |
registerMessageHandler(String name,
PlaceManager.MessageHandler handler)
Deprecated.
Use dynamically bound methods instead. See
DynamicListener. |
void |
shutdown()
Causes the place object being managed by this place manager to be destroyed and the place
manager to shut down.
|
void |
startup(PlaceObject plobj)
Called by the place manager after the place object has been successfully created.
|
String |
toString()
Generates a string representation of this manager.
|
<T extends OccupantInfo> |
updateOccupantInfo(int bodyOid,
OccupantInfo.Updater<T> updater)
Calls the supplied updater on the canonical occupant info record for the specified body
(which must be an occupant of this place) and broadcasts the update to all other occupants.
|
String |
where()
Returns a string that can be used in log messages to identify the place as sensibly as
possible to the developer who has to puzzle over log output trying to figure out what's
going on.
|
public PlaceConfig getConfig()
public PlaceObject getPlaceObject()
public void applyToOccupants(OccupantOp op)
public <T extends OccupantInfo> boolean updateOccupantInfo(int bodyOid, OccupantInfo.Updater<T> updater)
ClassCastException - thrown if the type of the supplied updater does not match the
type of OccupantInfo record used for the occupant. Caveat utilitor.public void init(PlaceRegistry registry, InvocationManager invmgr, RootDObjectManager omgr, BodyLocator locator, PlaceConfig config)
public void addDelegate(PlaceManagerDelegate delegate)
public void applyToDelegates(PlaceManager.DelegateOp op)
public String checkPermissions()
null should be returned if initialization is to be
allowed to proceed.public void startup(PlaceObject plobj)
public void shutdown()
public String ratifyBodyEntry(BodyObject body)
null if the body can enter, otherwise a translatable message explaining
the reason the body is blocked from enteringpublic void bodyWillEnter(BodyObject body)
bodyEntered(int) once all events relating to
body entry have been processed.public void bodyWillLeave(BodyObject body)
bodyLeft(int) once all events relating to body entry have been processed.@Deprecated public void registerMessageHandler(String name, PlaceManager.MessageHandler handler)
DynamicListener.name - the message name of the message events that should be handled by this handler.handler - the handler to be registered.public void messageReceived(MessageEvent event)
MessageListenermessageReceived in interface MessageListenerevent - The event that was dispatched on the object.public boolean isValidSpeaker(DObject speakObj, ClientObject speaker, byte mode)
SpeakHandler.SpeakerValidatorisValidSpeaker in interface SpeakHandler.SpeakerValidatorpublic String where()
public String toString()
toString in class ObjecttoString(StringBuilder)Copyright © 2015. All rights reserved.