More style-related cleanup.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5247 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-22 12:51:17 +00:00
parent 0aa0e48c28
commit 09f8a25876
29 changed files with 48 additions and 64 deletions
@@ -56,8 +56,7 @@ public class AdminDispatcher extends InvocationDispatcher<AdminMarshaller>
switch (methodId) { switch (methodId) {
case AdminMarshaller.GET_CONFIG_INFO: case AdminMarshaller.GET_CONFIG_INFO:
((AdminProvider)provider).getConfigInfo( ((AdminProvider)provider).getConfigInfo(
source, source, (AdminService.ConfigInfoListener)args[0]
(AdminService.ConfigInfoListener)args[0]
); );
return; return;
@@ -115,6 +115,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
return new DatabaseObjectRecord(path, object); return new DatabaseObjectRecord(path, object);
} }
/** Stores settings in a database. */
protected class DatabaseObjectRecord extends ObjectRecord protected class DatabaseObjectRecord extends ObjectRecord
{ {
public DatabaseObjectRecord (String path, DObject object) public DatabaseObjectRecord (String path, DObject object)
@@ -134,7 +135,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
_data = _repo.loadConfig(_node, _path); _data = _repo.loadConfig(_node, _path);
} catch (PersistenceException pe) { } catch (PersistenceException pe) {
log.warning("Failed to load object configuration [path=" + _path + "].", pe); log.warning("Failed to load object configuration [path=" + _path + "].", pe);
_data = new HashMap<String,String>(); _data = new HashMap<String, String>();
} }
super.init(); super.init();
@@ -321,7 +322,7 @@ public class DatabaseConfigRegistry extends ConfigRegistry
} }
protected String _path; protected String _path;
protected HashMap<String,String> _data; protected HashMap<String, String> _data;
} }
protected ConfigRepository _repo; protected ConfigRepository _repo;
@@ -59,6 +59,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
return new PeerDatabaseObjectRecord(path, object); return new PeerDatabaseObjectRecord(path, object);
} }
/** Stores settings in a database and broadcasts changes to peers. */
protected class PeerDatabaseObjectRecord extends DatabaseObjectRecord protected class PeerDatabaseObjectRecord extends DatabaseObjectRecord
implements PeerManager.StaleCacheObserver implements PeerManager.StaleCacheObserver
{ {
@@ -71,8 +72,8 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
// from interface PeerManager.StaleCacheObserver // from interface PeerManager.StaleCacheObserver
public void changedCacheData (Streamable data) public void changedCacheData (Streamable data)
{ {
@SuppressWarnings("unchecked") StreamableTuple<String,Object> change = @SuppressWarnings("unchecked") StreamableTuple<String, Object> change =
(StreamableTuple<String,Object>)data; (StreamableTuple<String, Object>)data;
// note that we should ignore the attribute change event we're about to generate // note that we should ignore the attribute change event we're about to generate
// because it is not a real configuration change but rather a sync // because it is not a real configuration change but rather a sync
@@ -112,7 +113,7 @@ public class PeeredDatabaseConfigRegistry extends DatabaseConfigRegistry
{ {
// broadcast to the other nodes that this value has changed // broadcast to the other nodes that this value has changed
_peermgr.broadcastStaleCacheData( _peermgr.broadcastStaleCacheData(
PEER_CACHE_PREFIX + _path, new StreamableTuple<String,Object>(field, value)); PEER_CACHE_PREFIX + _path, new StreamableTuple<String, Object>(field, value));
} }
protected ArrayList<String> _pendingSyncs = new ArrayList<String>(); protected ArrayList<String> _pendingSyncs = new ArrayList<String>();
@@ -48,7 +48,7 @@ public class ConfigRepository extends DepotRepository
* *
* @return a map containing field/value pairs for all stored configuration data. * @return a map containing field/value pairs for all stored configuration data.
*/ */
public HashMap<String,String> loadConfig (String node, String object) public HashMap<String, String> loadConfig (String node, String object)
throws PersistenceException throws PersistenceException
{ {
HashMap<String, String> data = new HashMap<String, String>(); HashMap<String, String> data = new HashMap<String, String>();
@@ -21,7 +21,6 @@
package com.threerings.bureau.client; package com.threerings.bureau.client;
import com.threerings.bureau.client.BureauReceiver;
import com.threerings.presents.client.InvocationDecoder; import com.threerings.presents.client.InvocationDecoder;
/** /**
@@ -55,29 +55,25 @@ public class BureauDispatcher extends InvocationDispatcher<BureauMarshaller>
switch (methodId) { switch (methodId) {
case BureauMarshaller.AGENT_CREATED: case BureauMarshaller.AGENT_CREATED:
((BureauProvider)provider).agentCreated( ((BureauProvider)provider).agentCreated(
source, source, ((Integer)args[0]).intValue()
((Integer)args[0]).intValue()
); );
return; return;
case BureauMarshaller.AGENT_CREATION_FAILED: case BureauMarshaller.AGENT_CREATION_FAILED:
((BureauProvider)provider).agentCreationFailed( ((BureauProvider)provider).agentCreationFailed(
source, source, ((Integer)args[0]).intValue()
((Integer)args[0]).intValue()
); );
return; return;
case BureauMarshaller.AGENT_DESTROYED: case BureauMarshaller.AGENT_DESTROYED:
((BureauProvider)provider).agentDestroyed( ((BureauProvider)provider).agentDestroyed(
source, source, ((Integer)args[0]).intValue()
((Integer)args[0]).intValue()
); );
return; return;
case BureauMarshaller.BUREAU_INITIALIZED: case BureauMarshaller.BUREAU_INITIALIZED:
((BureauProvider)provider).bureauInitialized( ((BureauProvider)provider).bureauInitialized(
source, source, (String)args[0]
(String)args[0]
); );
return; return;
@@ -21,6 +21,7 @@
package com.threerings.bureau.server; package com.threerings.bureau.server;
import com.threerings.bureau.client.BureauService;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationProvider; import com.threerings.presents.server.InvocationProvider;
@@ -22,7 +22,6 @@
package com.threerings.bureau.server; package com.threerings.bureau.server;
import com.threerings.bureau.client.BureauDecoder; import com.threerings.bureau.client.BureauDecoder;
import com.threerings.bureau.client.BureauReceiver;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationSender; import com.threerings.presents.server.InvocationSender;
@@ -1260,8 +1260,8 @@ public class ChatDirector extends BasicDirector
} }
// clear out from the history any tells that are mistypes // clear out from the history any tells that are mistypes
for (Iterator iter = _history.iterator(); iter.hasNext(); ) { for (Iterator<String> iter = _history.iterator(); iter.hasNext(); ) {
String hist = (String)iter.next(); String hist = iter.next();
if (hist.startsWith("/" + command)) { if (hist.startsWith("/" + command)) {
String harg = hist.substring(command.length() + 1).trim(); String harg = hist.substring(command.length() + 1).trim();
// we blow away any historic tells that have msg content // we blow away any historic tells that have msg content
@@ -58,22 +58,19 @@ public class ChatDispatcher extends InvocationDispatcher<ChatMarshaller>
switch (methodId) { switch (methodId) {
case ChatMarshaller.AWAY: case ChatMarshaller.AWAY:
((ChatProvider)provider).away( ((ChatProvider)provider).away(
source, source, (String)args[0]
(String)args[0]
); );
return; return;
case ChatMarshaller.BROADCAST: case ChatMarshaller.BROADCAST:
((ChatProvider)provider).broadcast( ((ChatProvider)provider).broadcast(
source, source, (String)args[0], (InvocationService.InvocationListener)args[1]
(String)args[0], (InvocationService.InvocationListener)args[1]
); );
return; return;
case ChatMarshaller.TELL: case ChatMarshaller.TELL:
((ChatProvider)provider).tell( ((ChatProvider)provider).tell(
source, source, (Name)args[0], (String)args[1], (ChatService.TellListener)args[2]
(Name)args[0], (String)args[1], (ChatService.TellListener)args[2]
); );
return; return;
@@ -55,8 +55,7 @@ public class SpeakDispatcher extends InvocationDispatcher<SpeakMarshaller>
switch (methodId) { switch (methodId) {
case SpeakMarshaller.SPEAK: case SpeakMarshaller.SPEAK:
((SpeakProvider)provider).speak( ((SpeakProvider)provider).speak(
source, source, (String)args[0], ((Byte)args[1]).byteValue()
(String)args[0], ((Byte)args[1]).byteValue()
); );
return; return;
@@ -21,6 +21,7 @@
package com.threerings.crowd.chat.server; package com.threerings.crowd.chat.server;
import com.threerings.crowd.chat.client.SpeakService;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationProvider; import com.threerings.presents.server.InvocationProvider;
@@ -21,7 +21,6 @@
package com.threerings.crowd.client; package com.threerings.crowd.client;
import com.threerings.crowd.client.LocationReceiver;
import com.threerings.presents.client.InvocationDecoder; import com.threerings.presents.client.InvocationDecoder;
/** /**
@@ -154,14 +154,14 @@ public abstract class PlaceController extends Controller
// keep a handle on our place object // keep a handle on our place object
_plobj = plobj; _plobj = plobj;
if (_view != null ) { if (_view != null) {
// let the UI hierarchy know that we've got our place // let the UI hierarchy know that we've got our place
PlaceViewUtil.dispatchWillEnterPlace(_view, plobj); PlaceViewUtil.dispatchWillEnterPlace(_view, plobj);
// and display the user interface // and display the user interface
_ctx.setPlaceView(_view); _ctx.setPlaceView(_view);
} }
// let our delegates know what's up // let our delegates know what's up
applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) { applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) {
@Override @Override
public void apply (PlaceControllerDelegate delegate) { public void apply (PlaceControllerDelegate delegate) {
@@ -183,7 +183,7 @@ public abstract class PlaceController extends Controller
*/ */
public void mayLeavePlace (final PlaceObject plobj) public void mayLeavePlace (final PlaceObject plobj)
{ {
// let our delegates know what's up // let our delegates know what's up
applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) { applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) {
@Override @Override
public void apply (PlaceControllerDelegate delegate) { public void apply (PlaceControllerDelegate delegate) {
@@ -201,7 +201,7 @@ public abstract class PlaceController extends Controller
*/ */
public void didLeavePlace (final PlaceObject plobj) public void didLeavePlace (final PlaceObject plobj)
{ {
// let our delegates know what's up // let our delegates know what's up
applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) { applyToDelegates(new DelegateOp(PlaceControllerDelegate.class) {
@Override @Override
public void apply (PlaceControllerDelegate delegate) { public void apply (PlaceControllerDelegate delegate) {
@@ -210,7 +210,7 @@ public abstract class PlaceController extends Controller
}); });
// let the UI hierarchy know that we're outta here // let the UI hierarchy know that we're outta here
if (_view != null ) { if (_view != null) {
PlaceViewUtil.dispatchDidLeavePlace(_view, plobj); PlaceViewUtil.dispatchDidLeavePlace(_view, plobj);
_ctx.clearPlaceView(_view); _ctx.clearPlaceView(_view);
_view = null; _view = null;
@@ -64,7 +64,7 @@ public interface PlaceView
* *
* @param plobj the place object that was just entered. * @param plobj the place object that was just entered.
*/ */
public void willEnterPlace (PlaceObject plobj); void willEnterPlace (PlaceObject plobj);
/** /**
* Called after the client has left a place and needs to clean up * Called after the client has left a place and needs to clean up
@@ -72,5 +72,5 @@ public interface PlaceView
* *
* @param plobj the place object that was just left. * @param plobj the place object that was just left.
*/ */
public void didLeavePlace (PlaceObject plobj); void didLeavePlace (PlaceObject plobj);
} }
@@ -26,8 +26,6 @@ import com.threerings.util.Name;
import com.threerings.presents.dobj.DSet; import com.threerings.presents.dobj.DSet;
import com.threerings.crowd.data.BodyObject;
/** /**
* The occupant info object contains all of the information about an occupant of a place that * The occupant info object contains all of the information about an occupant of a place that
* should be shared with other occupants of the place. These objects are stored in the place object * should be shared with other occupants of the place. These objects are stored in the place object
@@ -38,12 +38,11 @@ public interface CrowdPeerService extends InvocationService
* Used to forward a tell request to the server on which the destination user actually * Used to forward a tell request to the server on which the destination user actually
* occupies. * occupies.
*/ */
public void deliverTell (Client client, UserMessage message, Name target, void deliverTell (Client client, UserMessage message, Name target,
ChatService.TellListener listener); ChatService.TellListener listener);
/** /**
* Dispatches a broadcast message on this peer. * Dispatches a broadcast message on this peer.
*/ */
public void deliverBroadcast ( void deliverBroadcast (Client client, Name from, String bundle, String msg, boolean attention);
Client client, Name from, String bundle, String msg, boolean attention);
} }
@@ -58,15 +58,13 @@ public class CrowdPeerDispatcher extends InvocationDispatcher<CrowdPeerMarshalle
switch (methodId) { switch (methodId) {
case CrowdPeerMarshaller.DELIVER_BROADCAST: case CrowdPeerMarshaller.DELIVER_BROADCAST:
((CrowdPeerProvider)provider).deliverBroadcast( ((CrowdPeerProvider)provider).deliverBroadcast(
source, source, (Name)args[0], (String)args[1], (String)args[2], ((Boolean)args[3]).booleanValue()
(Name)args[0], (String)args[1], (String)args[2], ((Boolean)args[3]).booleanValue()
); );
return; return;
case CrowdPeerMarshaller.DELIVER_TELL: case CrowdPeerMarshaller.DELIVER_TELL:
((CrowdPeerProvider)provider).deliverTell( ((CrowdPeerProvider)provider).deliverTell(
source, source, (UserMessage)args[0], (Name)args[1], (ChatService.TellListener)args[2]
(UserMessage)args[0], (Name)args[1], (ChatService.TellListener)args[2]
); );
return; return;
@@ -23,6 +23,7 @@ package com.threerings.crowd.peer.server;
import com.threerings.crowd.chat.client.ChatService; 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.client.CrowdPeerService;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationException;
import com.threerings.presents.server.InvocationProvider; import com.threerings.presents.server.InvocationProvider;
@@ -55,8 +55,7 @@ public class BodyDispatcher extends InvocationDispatcher<BodyMarshaller>
switch (methodId) { switch (methodId) {
case BodyMarshaller.SET_IDLE: case BodyMarshaller.SET_IDLE:
((BodyProvider)provider).setIdle( ((BodyProvider)provider).setIdle(
source, source, ((Boolean)args[0]).booleanValue()
((Boolean)args[0]).booleanValue()
); );
return; return;
@@ -48,7 +48,7 @@ public class BodyManager
* @return true if changes were made and thus the object should be published anew to the * @return true if changes were made and thus the object should be published anew to the
* place object, false if no publish should be done. * place object, false if no publish should be done.
*/ */
public boolean update (OccupantInfo oinfo); boolean update (OccupantInfo oinfo);
} }
/** /**
@@ -21,6 +21,7 @@
package com.threerings.crowd.server; package com.threerings.crowd.server;
import com.threerings.crowd.client.BodyService;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationProvider; import com.threerings.presents.server.InvocationProvider;
@@ -56,14 +56,13 @@ public class LocationDispatcher extends InvocationDispatcher<LocationMarshaller>
switch (methodId) { switch (methodId) {
case LocationMarshaller.LEAVE_PLACE: case LocationMarshaller.LEAVE_PLACE:
((LocationProvider)provider).leavePlace( ((LocationProvider)provider).leavePlace(
source source
); );
return; return;
case LocationMarshaller.MOVE_TO: case LocationMarshaller.MOVE_TO:
((LocationProvider)provider).moveTo( ((LocationProvider)provider).moveTo(
source, source, ((Integer)args[0]).intValue(), (LocationService.MoveListener)args[1]
((Integer)args[0]).intValue(), (LocationService.MoveListener)args[1]
); );
return; return;
@@ -22,7 +22,6 @@
package com.threerings.crowd.server; package com.threerings.crowd.server;
import com.threerings.crowd.client.LocationDecoder; import com.threerings.crowd.client.LocationDecoder;
import com.threerings.crowd.client.LocationReceiver;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationSender; import com.threerings.presents.server.InvocationSender;
@@ -92,7 +92,7 @@ public class PlaceManager
* @param event the message event received. * @param event the message event received.
* @param pmgr the place manager for which the message is being handled. * @param pmgr the place manager for which the message is being handled.
*/ */
public void handleEvent (MessageEvent event, PlaceManager pmgr); void handleEvent (MessageEvent event, PlaceManager pmgr);
} }
/** /**
@@ -667,7 +667,7 @@ public class PlaceManager
_shutdownInterval = new Interval(_omgr) { _shutdownInterval = new Interval(_omgr) {
@Override @Override
public void expired () { public void expired () {
log.debug("Unloading idle place '" + where () + "'."); log.debug("Unloading idle place '" + where() + "'.");
shutdown(); shutdown();
} }
}; };
@@ -735,7 +735,7 @@ public class PlaceManager
protected PlaceConfig _config; protected PlaceConfig _config;
/** Message handlers are used to process message events. */ /** Message handlers are used to process message events. */
protected Map<String,MessageHandler> _msghandlers; protected Map<String, MessageHandler> _msghandlers;
/** A list of the delegates in use by this manager. */ /** A list of the delegates in use by this manager. */
protected List<PlaceManagerDelegate> _delegates; protected List<PlaceManagerDelegate> _delegates;
@@ -53,7 +53,7 @@ public class PlaceRegistry
/** Used in conjunction with {@link #createPlace}. */ /** Used in conjunction with {@link #createPlace}. */
public static interface PreStartupHook public static interface PreStartupHook
{ {
public void invoke (PlaceManager plmgr); void invoke (PlaceManager plmgr);
} }
/** /**
@@ -87,7 +87,7 @@ public class PlaceRegistry
/** /**
* Creates and registers a new place manager with no delegates. * Creates and registers a new place manager with no delegates.
* *
* @see #createPlace(PlaceConfig,List<PlaceManagerDelegate>) * @see #createPlace(PlaceConfig,List)
*/ */
public PlaceManager createPlace (PlaceConfig config) public PlaceManager createPlace (PlaceConfig config)
throws InstantiationException, InvocationException throws InstantiationException, InvocationException
@@ -56,15 +56,13 @@ public class PeerDispatcher extends InvocationDispatcher<PeerMarshaller>
switch (methodId) { switch (methodId) {
case PeerMarshaller.INVOKE_ACTION: case PeerMarshaller.INVOKE_ACTION:
((PeerProvider)provider).invokeAction( ((PeerProvider)provider).invokeAction(
source, source, (byte[])args[0]
(byte[])args[0]
); );
return; return;
case PeerMarshaller.RATIFY_LOCK_ACTION: case PeerMarshaller.RATIFY_LOCK_ACTION:
((PeerProvider)provider).ratifyLockAction( ((PeerProvider)provider).ratifyLockAction(
source, source, (NodeObject.Lock)args[0], ((Boolean)args[1]).booleanValue()
(NodeObject.Lock)args[0], ((Boolean)args[1]).booleanValue()
); );
return; return;
@@ -22,6 +22,7 @@
package com.threerings.presents.peer.server; package com.threerings.presents.peer.server;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.peer.client.PeerService;
import com.threerings.presents.peer.data.NodeObject; import com.threerings.presents.peer.data.NodeObject;
import com.threerings.presents.server.InvocationProvider; import com.threerings.presents.server.InvocationProvider;
@@ -54,8 +54,7 @@ public class TimeBaseDispatcher extends InvocationDispatcher<TimeBaseMarshaller>
switch (methodId) { switch (methodId) {
case TimeBaseMarshaller.GET_TIME_OID: case TimeBaseMarshaller.GET_TIME_OID:
((TimeBaseProvider)provider).getTimeOid( ((TimeBaseProvider)provider).getTimeOid(
source, source, (String)args[0], (TimeBaseService.GotTimeBaseListener)args[1]
(String)args[0], (TimeBaseService.GotTimeBaseListener)args[1]
); );
return; return;