Further implementation of body/place/chat stuff. Mostly location related.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@109 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// $Id: CrowdServer.java,v 1.1 2001/07/23 21:14:27 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.server;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.threerings.cocktail.cher.server.CherServer;
|
||||
|
||||
import com.threerings.cocktail.party.Log;
|
||||
import com.threerings.cocktail.party.data.BodyObject;
|
||||
|
||||
/**
|
||||
* The party server extends the cher server by configuring it to use the
|
||||
* extensions provided by the party layer to support party services.
|
||||
*/
|
||||
public class PartyServer extends CherServer
|
||||
{
|
||||
/** The namespace used for server config properties. */
|
||||
public static final String CONFIG_KEY = "party";
|
||||
|
||||
/**
|
||||
* Initializes all of the server services and prepares for operation.
|
||||
*/
|
||||
public void init ()
|
||||
throws IOException
|
||||
{
|
||||
// do the cher server initialization
|
||||
super.init();
|
||||
|
||||
// bind the party server config into the namespace
|
||||
config.bindProperties(CONFIG_KEY, CONFIG_PATH);
|
||||
|
||||
// configure the client to use the body object
|
||||
clmgr.setClientObjectClass(BodyObject.class);
|
||||
|
||||
// register our invocation service providers
|
||||
registerProviders(config.getValue(PROVIDERS_KEY, (String[])null));
|
||||
|
||||
Log.info("Party server initialized.");
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
PartyServer server = new PartyServer();
|
||||
try {
|
||||
server.init();
|
||||
server.run();
|
||||
} catch (Exception e) {
|
||||
Log.warning("Unable to initialize server.");
|
||||
Log.logStackTrace(e);
|
||||
}
|
||||
}
|
||||
|
||||
// the path to the config file
|
||||
protected final static String CONFIG_PATH =
|
||||
"rsrc/config/cocktail/party/server";
|
||||
|
||||
// the config key for our list of invocation provider mappings
|
||||
protected final static String PROVIDERS_KEY = CONFIG_KEY + ".providers";
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// $Id: LocationProvider.java,v 1.1 2001/07/23 21:14:27 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.server;
|
||||
|
||||
import com.threerings.cocktail.cher.dobj.DObject;
|
||||
import com.threerings.cocktail.cher.server.CherServer;
|
||||
import com.threerings.cocktail.cher.server.InvocationProvider;
|
||||
|
||||
import com.threerings.cocktail.party.Log;
|
||||
import com.threerings.cocktail.party.data.*;
|
||||
|
||||
/**
|
||||
* This class provides the server end of the location services.
|
||||
*/
|
||||
public class LocationProvider extends InvocationProvider
|
||||
{
|
||||
/**
|
||||
* Processes a request from a client to move to a new place.
|
||||
*/
|
||||
public Object[] handleMoveToRequest (BodyObject source, int placeId)
|
||||
{
|
||||
// make sure the place in question actually exists
|
||||
DObject pobj = CherServer.omgr.getObject(placeId);
|
||||
if (pobj == null || !(pobj instanceof PlaceObject)) {
|
||||
Log.info("Requested to move to non-existent place " +
|
||||
"[source=" + source + ", place=" + placeId + "].");
|
||||
return createResponse("MoveFailed", "m.no_such_place");
|
||||
}
|
||||
|
||||
// add the body object id to the place object's occupant list
|
||||
PlaceObject place = (PlaceObject)pobj;
|
||||
place.addToOccupants(source.getOid());
|
||||
return createResponse("MoveSucceeded");
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: PlaceManager.java,v 1.1 2001/07/20 20:07:37 mdb Exp $
|
||||
// $Id: PlaceManager.java,v 1.2 2001/07/23 21:14:27 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.party.place;
|
||||
package com.threerings.cocktail.party.server;
|
||||
|
||||
public class PlaceManager
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user