Unixed import nixage, service regen, some dependency injection.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5205 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-06-29 12:42:06 +00:00
parent 733ec9e5ab
commit 34439e3461
19 changed files with 24 additions and 46 deletions
@@ -32,7 +32,6 @@ import com.threerings.util.Name;
import com.threerings.crowd.util.CrowdContext; import com.threerings.crowd.util.CrowdContext;
import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.BasicDirector;
import com.threerings.presents.client.Client;
/** /**
* Manages the mutelist. * Manages the mutelist.
@@ -24,8 +24,6 @@ package com.threerings.crowd.chat.data;
import com.threerings.presents.data.InvocationCodes; import com.threerings.presents.data.InvocationCodes;
import com.threerings.presents.data.Permission; import com.threerings.presents.data.Permission;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.chat.client.ChatDirector; import com.threerings.crowd.chat.client.ChatDirector;
import com.threerings.crowd.chat.client.SpeakService; import com.threerings.crowd.chat.client.SpeakService;
@@ -26,7 +26,6 @@ import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService; import com.threerings.presents.client.InvocationService;
import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.dobj.InvocationResponseEvent; import com.threerings.presents.dobj.InvocationResponseEvent;
import com.threerings.presents.net.Transport;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
@@ -24,7 +24,6 @@ package com.threerings.crowd.chat.data;
import com.threerings.crowd.chat.client.SpeakService; import com.threerings.crowd.chat.client.SpeakService;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.net.Transport;
/** /**
* Provides the implementation of the {@link SpeakService} interface * Provides the implementation of the {@link SpeakService} interface
@@ -25,7 +25,6 @@ import com.threerings.crowd.chat.client.ChatService;
import com.threerings.crowd.chat.data.ChatMarshaller; import com.threerings.crowd.chat.data.ChatMarshaller;
import com.threerings.presents.client.InvocationService; import com.threerings.presents.client.InvocationService;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
import com.threerings.util.Name; import com.threerings.util.Name;
@@ -33,7 +32,7 @@ import com.threerings.util.Name;
/** /**
* Dispatches requests to the {@link ChatProvider}. * Dispatches requests to the {@link ChatProvider}.
*/ */
public class ChatDispatcher extends InvocationDispatcher public class ChatDispatcher extends InvocationDispatcher<ChatMarshaller>
{ {
/** /**
* Creates a dispatcher that may be registered to dispatch invocation * Creates a dispatcher that may be registered to dispatch invocation
@@ -45,7 +44,7 @@ public class ChatDispatcher extends InvocationDispatcher
} }
@Override // documentation inherited @Override // documentation inherited
public InvocationMarshaller createMarshaller () public ChatMarshaller createMarshaller ()
{ {
return new ChatMarshaller(); return new ChatMarshaller();
} }
@@ -23,14 +23,13 @@ package com.threerings.crowd.chat.server;
import com.threerings.crowd.chat.data.SpeakMarshaller; import com.threerings.crowd.chat.data.SpeakMarshaller;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
/** /**
* Dispatches requests to the {@link SpeakProvider}. * Dispatches requests to the {@link SpeakProvider}.
*/ */
public class SpeakDispatcher extends InvocationDispatcher public class SpeakDispatcher extends InvocationDispatcher<SpeakMarshaller>
{ {
/** /**
* Creates a dispatcher that may be registered to dispatch invocation * Creates a dispatcher that may be registered to dispatch invocation
@@ -42,7 +41,7 @@ public class SpeakDispatcher extends InvocationDispatcher
} }
@Override // documentation inherited @Override // documentation inherited
public InvocationMarshaller createMarshaller () public SpeakMarshaller createMarshaller ()
{ {
return new SpeakMarshaller(); return new SpeakMarshaller();
} }
@@ -30,14 +30,11 @@ import com.google.common.collect.Maps;
import com.samskivert.util.ObserverList; import com.samskivert.util.ObserverList;
import com.threerings.util.Name; import com.threerings.util.Name;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.RootDObjectManager; import com.threerings.presents.dobj.RootDObjectManager;
import com.threerings.presents.server.InvocationProvider;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.chat.client.SpeakService;
import com.threerings.crowd.chat.data.ChatCodes; import com.threerings.crowd.chat.data.ChatCodes;
import com.threerings.crowd.chat.data.ChatMessage; import com.threerings.crowd.chat.data.ChatMessage;
import com.threerings.crowd.chat.data.SpeakObject; import com.threerings.crowd.chat.data.SpeakObject;
@@ -29,7 +29,6 @@ import com.threerings.presents.client.BasicDirector;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.util.SafeSubscriber; import com.threerings.presents.util.SafeSubscriber;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.ObjectAccessException; import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.dobj.Subscriber; import com.threerings.presents.dobj.Subscriber;
@@ -21,8 +21,6 @@
package com.threerings.crowd.client; package com.threerings.crowd.client;
import java.util.Iterator;
import com.samskivert.util.ObserverList; import com.samskivert.util.ObserverList;
import com.threerings.util.Name; import com.threerings.util.Name;
@@ -37,7 +35,6 @@ import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.util.CrowdContext; import com.threerings.crowd.util.CrowdContext;
import static com.threerings.crowd.Log.log;
/** /**
* The occupant director listens for occupants of places to enter and * The occupant director listens for occupants of places to enter and
@@ -24,7 +24,6 @@ package com.threerings.crowd.data;
import com.threerings.crowd.client.BodyService; import com.threerings.crowd.client.BodyService;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.net.Transport;
/** /**
* Provides the implementation of the {@link BodyService} interface * Provides the implementation of the {@link BodyService} interface
@@ -25,7 +25,6 @@ import com.threerings.crowd.client.LocationService;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.dobj.InvocationResponseEvent; import com.threerings.presents.dobj.InvocationResponseEvent;
import com.threerings.presents.net.Transport;
/** /**
* Provides the implementation of the {@link LocationService} interface * Provides the implementation of the {@link LocationService} interface
@@ -27,7 +27,6 @@ import com.threerings.crowd.chat.data.UserMessage;
import com.threerings.crowd.peer.client.CrowdPeerService; import com.threerings.crowd.peer.client.CrowdPeerService;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.net.Transport;
import com.threerings.util.Name; import com.threerings.util.Name;
/** /**
@@ -25,7 +25,6 @@ import com.threerings.crowd.chat.client.ChatService;
import com.threerings.crowd.chat.data.UserMessage; import com.threerings.crowd.chat.data.UserMessage;
import com.threerings.crowd.peer.data.CrowdPeerMarshaller; import com.threerings.crowd.peer.data.CrowdPeerMarshaller;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
import com.threerings.util.Name; import com.threerings.util.Name;
@@ -33,7 +32,7 @@ import com.threerings.util.Name;
/** /**
* Dispatches requests to the {@link CrowdPeerProvider}. * Dispatches requests to the {@link CrowdPeerProvider}.
*/ */
public class CrowdPeerDispatcher extends InvocationDispatcher public class CrowdPeerDispatcher extends InvocationDispatcher<CrowdPeerMarshaller>
{ {
/** /**
* Creates a dispatcher that may be registered to dispatch invocation * Creates a dispatcher that may be registered to dispatch invocation
@@ -45,7 +44,7 @@ public class CrowdPeerDispatcher extends InvocationDispatcher
} }
@Override // documentation inherited @Override // documentation inherited
public InvocationMarshaller createMarshaller () public CrowdPeerMarshaller createMarshaller ()
{ {
return new CrowdPeerMarshaller(); return new CrowdPeerMarshaller();
} }
@@ -37,14 +37,12 @@ import com.threerings.presents.peer.server.PeerManager;
import com.threerings.presents.peer.server.PeerNode; import com.threerings.presents.peer.server.PeerNode;
import com.threerings.crowd.chat.client.ChatService; import com.threerings.crowd.chat.client.ChatService;
import com.threerings.crowd.chat.data.ChatMessage;
import com.threerings.crowd.chat.data.UserMessage; import com.threerings.crowd.chat.data.UserMessage;
import com.threerings.crowd.chat.server.ChatProvider; import com.threerings.crowd.chat.server.ChatProvider;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.peer.data.CrowdClientInfo; import com.threerings.crowd.peer.data.CrowdClientInfo;
import com.threerings.crowd.peer.data.CrowdNodeObject; import com.threerings.crowd.peer.data.CrowdNodeObject;
import com.threerings.crowd.peer.data.CrowdPeerMarshaller;
/** /**
* Extends the standard peer manager and bridges certain Crowd services. * Extends the standard peer manager and bridges certain Crowd services.
@@ -148,8 +146,7 @@ public class CrowdPeerManager extends PeerManager
// register and initialize our invocation service // register and initialize our invocation service
CrowdNodeObject cnobj = (CrowdNodeObject)_nodeobj; CrowdNodeObject cnobj = (CrowdNodeObject)_nodeobj;
cnobj.setCrowdPeerService( cnobj.setCrowdPeerService(_invmgr.registerDispatcher(new CrowdPeerDispatcher(this)));
(CrowdPeerMarshaller)_invmgr.registerDispatcher(new CrowdPeerDispatcher(this)));
// register ourselves as a chat forwarder // register ourselves as a chat forwarder
_chatprov.setChatForwarder(this); _chatprov.setChatForwarder(this);
@@ -23,14 +23,13 @@ package com.threerings.crowd.server;
import com.threerings.crowd.data.BodyMarshaller; import com.threerings.crowd.data.BodyMarshaller;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
/** /**
* Dispatches requests to the {@link BodyProvider}. * Dispatches requests to the {@link BodyProvider}.
*/ */
public class BodyDispatcher extends InvocationDispatcher public class BodyDispatcher extends InvocationDispatcher<BodyMarshaller>
{ {
/** /**
* Creates a dispatcher that may be registered to dispatch invocation * Creates a dispatcher that may be registered to dispatch invocation
@@ -42,7 +41,7 @@ public class BodyDispatcher extends InvocationDispatcher
} }
@Override // documentation inherited @Override // documentation inherited
public InvocationMarshaller createMarshaller () public BodyMarshaller createMarshaller ()
{ {
return new BodyMarshaller(); return new BodyMarshaller();
} }
@@ -24,9 +24,7 @@ package com.threerings.crowd.server;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationManager; import com.threerings.presents.server.InvocationManager;
import com.threerings.presents.server.InvocationProvider;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.CrowdCodes; import com.threerings.crowd.data.CrowdCodes;
@@ -68,8 +66,7 @@ public class BodyManager
*/ */
public void updateOccupantInfo (BodyObject body, Place location, OccupantInfoOp occop) public void updateOccupantInfo (BodyObject body, Place location, OccupantInfoOp occop)
{ {
PlaceManager pmgr = (location == null) ? null : PlaceManager pmgr = (location == null) ? null : _plreg.getPlaceManager(location.placeOid);
CrowdServer.plreg.getPlaceManager(location.placeOid);
if (pmgr == null) { if (pmgr == null) {
return; return;
} }
@@ -120,4 +117,7 @@ public class BodyManager
log.debug("Setting user idle state [user=" + bobj.username + ", status=" + nstatus + "]."); log.debug("Setting user idle state [user=" + bobj.username + ", status=" + nstatus + "].");
updateOccupantStatus(bobj, bobj.location, nstatus); updateOccupantStatus(bobj, bobj.location, nstatus);
} }
/** Provides access to place managers. */
@Inject protected PlaceRegistry _plreg;
} }
@@ -21,13 +21,13 @@
package com.threerings.crowd.server; package com.threerings.crowd.server;
import com.threerings.presents.dobj.AccessController; import com.google.inject.Inject;
import com.threerings.presents.server.PresentsClient; import com.threerings.presents.server.PresentsClient;
import com.threerings.crowd.chat.server.SpeakUtil; import com.threerings.crowd.chat.server.SpeakUtil;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.server.CrowdServer;
/** /**
* The crowd client extends the presents client with crowd-specific client handling. * The crowd client extends the presents client with crowd-specific client handling.
@@ -42,7 +42,7 @@ public class CrowdClient extends PresentsClient
if (_clobj != null) { if (_clobj != null) {
// note that the user is disconnected // note that the user is disconnected
BodyObject bobj = (BodyObject)_clobj; BodyObject bobj = (BodyObject)_clobj;
CrowdServer.bodyman.updateOccupantStatus(bobj, bobj.location, OccupantInfo.DISCONNECTED); _bodyman.updateOccupantStatus(bobj, bobj.location, OccupantInfo.DISCONNECTED);
} }
} }
@@ -53,7 +53,7 @@ public class CrowdClient extends PresentsClient
// note that the user's active once more // note that the user's active once more
BodyObject bobj = (BodyObject)_clobj; BodyObject bobj = (BodyObject)_clobj;
CrowdServer.bodyman.updateOccupantStatus(bobj, bobj.location, OccupantInfo.ACTIVE); _bodyman.updateOccupantStatus(bobj, bobj.location, OccupantInfo.ACTIVE);
} }
// documentation inherited // documentation inherited
@@ -68,7 +68,7 @@ public class CrowdClient extends PresentsClient
// reset our status in case this object remains around until they start their next session // reset our status in case this object remains around until they start their next session
// (which could happen very soon) // (which could happen very soon)
CrowdServer.bodyman.updateOccupantStatus(body, null, OccupantInfo.ACTIVE); _bodyman.updateOccupantStatus(body, null, OccupantInfo.ACTIVE);
// clear our chat history // clear our chat history
if (body != null) { if (body != null) {
@@ -84,6 +84,9 @@ public class CrowdClient extends PresentsClient
*/ */
protected void clearLocation (BodyObject bobj) protected void clearLocation (BodyObject bobj)
{ {
CrowdServer.locman.leaveOccupiedPlace(bobj); _locman.leaveOccupiedPlace(bobj);
} }
@Inject protected BodyManager _bodyman;
@Inject protected LocationManager _locman;
} }
@@ -24,14 +24,13 @@ package com.threerings.crowd.server;
import com.threerings.crowd.client.LocationService; import com.threerings.crowd.client.LocationService;
import com.threerings.crowd.data.LocationMarshaller; import com.threerings.crowd.data.LocationMarshaller;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
/** /**
* Dispatches requests to the {@link LocationProvider}. * Dispatches requests to the {@link LocationProvider}.
*/ */
public class LocationDispatcher extends InvocationDispatcher public class LocationDispatcher extends InvocationDispatcher<LocationMarshaller>
{ {
/** /**
* Creates a dispatcher that may be registered to dispatch invocation * Creates a dispatcher that may be registered to dispatch invocation
@@ -43,7 +42,7 @@ public class LocationDispatcher extends InvocationDispatcher
} }
@Override // documentation inherited @Override // documentation inherited
public InvocationMarshaller createMarshaller () public LocationMarshaller createMarshaller ()
{ {
return new LocationMarshaller(); return new LocationMarshaller();
} }
@@ -30,7 +30,6 @@ import com.threerings.presents.dobj.RootDObjectManager;
import com.threerings.presents.server.ClientManager; import com.threerings.presents.server.ClientManager;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationManager; import com.threerings.presents.server.InvocationManager;
import com.threerings.presents.server.InvocationProvider;
import com.threerings.presents.server.PresentsClient; import com.threerings.presents.server.PresentsClient;
import com.threerings.crowd.client.LocationService; import com.threerings.crowd.client.LocationService;
@@ -40,7 +39,6 @@ import com.threerings.crowd.data.LocationCodes;
import com.threerings.crowd.data.Place; import com.threerings.crowd.data.Place;
import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.server.CrowdServer;
import static com.threerings.crowd.Log.log; import static com.threerings.crowd.Log.log;