Modify PresentsClient and ClientResolver creation so that we can inject

dependencies into both. Moved the legacy statics into CrowdServer so that at
least Presents can be pure (we should probably eventually move them into
BangServer and PiracyServer and fix everything else). Added some useful manager
references to PlaceManager delegate (_omgr, _invmgr) that handle the majority
of their service needs.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5170 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-08 20:23:49 +00:00
parent eeb2584c0d
commit 0128f6525a
13 changed files with 133 additions and 103 deletions
@@ -27,29 +27,30 @@ import com.threerings.presents.data.ClientObject;
import com.threerings.presents.net.AuthRequest;
/**
* Used to create a {@link PresentsClient} instance to manage an authenticated
* client.
* Used to determine what type of {@link PresentsClient} to use to manage an authenticated client
* as well the type of {@link ClientResolver} to use when resolving clients' runtime data.
*/
public interface ClientFactory
{
/** The default client factory. */
public static ClientFactory DEFAULT = new ClientFactory () {
public PresentsClient createClient (AuthRequest areq) {
return new PresentsClient();
public Class<? extends PresentsClient> getClientClass (AuthRequest areq) {
return PresentsClient.class;
}
public ClientResolver createClientResolver (Name username) {
return new ClientResolver();
public Class<? extends ClientResolver> getClientResolverClass (Name username) {
return ClientResolver.class;
}
};
/**
* Creates an uninitialized client instance for the client that has
* authenticated using the supplied request.
* Returns the {@link PresentsClient} derived class to use for the session that authenticated
* with the supplied request.
*/
public PresentsClient createClient (AuthRequest areq);
public Class<? extends PresentsClient> getClientClass (AuthRequest areq);
/**
* Requests a resolver for the client identified by the specified username.
* Returns the {@link ClientResolver} derived class to use to resolve a client with the
* specified username.
*/
public ClientResolver createClientResolver (Name username);
public Class <? extends ClientResolver> getClientResolverClass (Name username);
}