public class OccupantDirector extends BasicDirector implements LocationObserver, SetListener<OccupantInfo>
It will eventually provide a framework for keeping track of occupant information in a network efficient manner. The idea being that we want to store as little information about occupants as possible in the place object (probably just body oid and username), but upon entering a place, this will be all we know about the occupants. We then dispatch a request to get information about all of the occupants in the room (things like avatar information for a graphical display or perhaps their ratings in the game that is associated with a place for a gaming site) which we then pass on to the occupant observers when it becomes available.
This information would be cached and we could return cached information for occupants for which we have cached info. We will probably want to still make a request for the occupant info so that we can update non-static occupant data rather than permanently using what's in the cache.
| Constructor and Description |
|---|
OccupantDirector(CrowdContext ctx)
Constructs a new occupant director with the supplied context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOccupantObserver(OccupantObserver obs)
Adds the specified occupant observer to the list.
|
void |
clientDidLogoff(Client client)
Called after the client has been logged off of the server and has disconnected.
|
void |
entryAdded(EntryAddedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant shows up.
|
void |
entryRemoved(EntryRemovedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant leaves.
|
void |
entryUpdated(EntryUpdatedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant is updated.
|
OccupantInfo |
getOccupantInfo(int bodyOid)
Returns the occupant info for the user in question if it exists in
the currently occupied place.
|
OccupantInfo |
getOccupantInfo(Name username)
Returns the occupant info for the user in question if it exists in
the currently occupied place.
|
void |
locationChangeFailed(int placeId,
String reason)
This is called on all location observers when a location change
request is rejected by the server or fails for some other reason.
|
void |
locationDidChange(PlaceObject place)
Called when we have switched to a new location.
|
boolean |
locationMayChange(int placeId)
Called when someone has requested that we switch to a new location.
|
void |
removeOccupantObserver(OccupantObserver obs)
Removes the specified occupant observer from the list.
|
clientDidLogon, clientObjectDidChange, clientWillLogon, isAvailableInStandalone, setAvailableInStandalonepublic OccupantDirector(CrowdContext ctx)
public void addOccupantObserver(OccupantObserver obs)
public void removeOccupantObserver(OccupantObserver obs)
public OccupantInfo getOccupantInfo(int bodyOid)
public OccupantInfo getOccupantInfo(Name username)
public void clientDidLogoff(Client client)
SessionObserverclientDidLogoff in interface SessionObserverclientDidLogoff in class BasicDirectorpublic boolean locationMayChange(int placeId)
LocationObserverlocationMayChange in interface LocationObserverpublic void locationDidChange(PlaceObject place)
LocationObserverlocationDidChange in interface LocationObserverplace - the place object that represents the new location or
null if we have switched to no location.public void locationChangeFailed(int placeId,
String reason)
LocationObserverlocationChangeFailed in interface LocationObserverplaceId - the place id to which we attempted to relocate, but
failed.reason - the reason code that explains why the location change
request was rejected or otherwise failed.public void entryAdded(EntryAddedEvent<OccupantInfo> event)
entryAdded in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.public void entryUpdated(EntryUpdatedEvent<OccupantInfo> event)
entryUpdated in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.public void entryRemoved(EntryRemovedEvent<OccupantInfo> event)
entryRemoved in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.Copyright © 2015. All rights reserved.