|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.util.Invoker.Unit
com.threerings.presents.server.ClientResolver
public class ClientResolver
Used to resolve client data when a user starts a session (or when some other entity needs access
to a client object). Implementations will want to extend this class and override resolveClientData(com.threerings.presents.data.ClientObject), making the necessary database calls and populating the client object
appropriately.
| Nested Class Summary | |
|---|---|
static class |
ClientResolver.ClientDisconnectedException
Thrown during resolution if the client disconnects. |
| Field Summary | |
|---|---|
protected ClientManager |
_clmgr
|
protected ClientObject |
_clobj
The resolving client object. |
protected Exception |
_failure
A place to keep an exception around for a moment. |
protected Invoker |
_invoker
|
protected List<ClientResolutionListener> |
_listeners
The entities to notify of success or failure. |
protected RootDObjectManager |
_omgr
|
protected Name |
_username
The name of the user whose client object is being resolved. |
| Fields inherited from class com.samskivert.util.Invoker.Unit |
|---|
_name, queueStamp |
| Constructor Summary | |
|---|---|
ClientResolver()
|
|
| Method Summary | |
|---|---|
void |
addResolutionListener(ClientResolutionListener listener)
Adds a resolution listener to this active resolver. |
ClientObject |
createClientObject()
Creates the ClientObject derived class that should be created to kick off the
resolution process. |
ClientLocal |
createLocalAttribute()
Creates a record that will be maintained only on the server to track client related bits. |
protected void |
enforceConnected()
Throws an exception if the client being resolved is no longer connected. |
protected void |
finishResolution(ClientObject clobj)
This method is called on the dobj thread after resolveClientData returns normally, it should finish populating the client object with any data that is NOT loaded from a database. |
void |
handleResult()
|
void |
init(Name username)
Initializes this instance. |
boolean |
invoke()
|
void |
objectAvailable(ClientObject object)
Called once our client object is registered with the distributed object system. |
protected void |
reportFailure(Exception cause)
Reports failure to our resolution listeners. |
protected void |
reportSuccess()
Reports success to our resolution listeners. |
protected void |
resolveClientData(ClientObject clobj)
This method is called on the invoker thread which means that it can do things like blocking database requests and generally whatever is necessary to load up all the client data that is desired by the implentation system. |
String |
toString()
|
| Methods inherited from class com.samskivert.util.Invoker.Unit |
|---|
getDetail, getLongThreshold, run |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Name _username
protected List<ClientResolutionListener> _listeners
protected ClientObject _clobj
protected Exception _failure
@Inject protected Invoker _invoker
@Inject protected RootDObjectManager _omgr
@Inject protected ClientManager _clmgr
| Constructor Detail |
|---|
public ClientResolver()
| Method Detail |
|---|
public void init(Name username)
username - the username of the user to be resolved.public void addResolutionListener(ClientResolutionListener listener)
public ClientObject createClientObject()
ClientObject derived class that should be created to kick off the
resolution process.
public ClientLocal createLocalAttribute()
public void objectAvailable(ClientObject object)
public boolean invoke()
invoke in class Invoker.Unitpublic void handleResult()
handleResult in class Invoker.Unitpublic String toString()
toString in class Invoker.Unit
protected void resolveClientData(ClientObject clobj)
throws Exception
Exceptionprotected void finishResolution(ClientObject clobj)
protected void reportSuccess()
protected void reportFailure(Exception cause)
protected void enforceConnected()
throws ClientResolver.ClientDisconnectedException
ClientResolver.ClientDisconnectedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||