From e41dda3018a29cbb1d2965b80802dddcb290b481 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 18 Jul 2008 18:32:59 +0000 Subject: [PATCH] Style fixes and import pruning. Beware, CheckStyle is (finally) coming to town. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5240 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/admin/client/AdminService.java | 4 +-- .../admin/client/AsStringFieldEditor.java | 4 +-- .../admin/client/BooleanFieldEditor.java | 2 +- .../admin/client/ConfigEditorPanel.java | 2 +- .../admin/client/ConfigObjectManager.java | 30 +++++++++---------- .../threerings/admin/client/DSetEditor.java | 9 ++++-- .../threerings/admin/client/FieldEditor.java | 3 +- .../admin/client/ObjectEditorPanel.java | 7 +++-- .../admin/client/PulldownFieldEditor.java | 8 ++--- .../admin/server/ConfigRegistry.java | 15 +++++----- .../admin/server/DatabaseConfigRegistry.java | 4 +-- .../admin/server/PrefsConfigRegistry.java | 1 + .../admin/server/persist/ConfigRecord.java | 3 ++ .../server/persist/ConfigRepository.java | 2 +- .../bureau/client/BureauClient.java | 4 +-- .../bureau/client/BureauDirector.java | 30 ++++++++----------- .../bureau/client/BureauReceiver.java | 6 ++-- .../bureau/client/BureauService.java | 2 +- .../threerings/bureau/data/AgentObject.java | 7 +++-- .../bureau/data/BureauCredentials.java | 6 ++-- .../bureau/server/BureauAuthenticator.java | 4 +-- .../bureau/server/BureauProvider.java | 8 ++--- .../bureau/server/BureauRegistry.java | 20 ++++++------- .../crowd/chat/server/ChatProvider.java | 1 - .../crowd/chat/server/SpeakProvider.java | 2 +- .../crowd/client/OccupantDirector.java | 1 - .../crowd/peer/server/CrowdPeerProvider.java | 4 +-- .../threerings/crowd/server/BodyProvider.java | 2 +- .../threerings/crowd/server/CrowdServer.java | 6 ---- .../crowd/server/LocationProvider.java | 4 +-- .../threerings/crowd/server/PlaceManager.java | 1 - .../presents/peer/server/PeerManager.java | 1 - .../presents/peer/server/PeerProvider.java | 4 +-- .../presents/tools/GenReceiverTask.java | 1 - .../presents/tools/GenServiceTask.java | 1 - .../threerings/presents/tools/provider.tmpl | 2 +- .../com/threerings/util/DependencyGraph.java | 2 +- 37 files changed, 103 insertions(+), 110 deletions(-) diff --git a/src/java/com/threerings/admin/client/AdminService.java b/src/java/com/threerings/admin/client/AdminService.java index 89d20a8e8..fb5a821c4 100644 --- a/src/java/com/threerings/admin/client/AdminService.java +++ b/src/java/com/threerings/admin/client/AdminService.java @@ -38,11 +38,11 @@ public interface AdminService extends InvocationService * Delivers a successful response to a {@link #getConfigInfo} * request. */ - public void gotConfigInfo (String[] keys, int[] oids); + void gotConfigInfo (String[] keys, int[] oids); } /** * Requests the list of config objects. */ - public void getConfigInfo (Client client, ConfigInfoListener listener); + void getConfigInfo (Client client, ConfigInfoListener listener); } diff --git a/src/java/com/threerings/admin/client/AsStringFieldEditor.java b/src/java/com/threerings/admin/client/AsStringFieldEditor.java index dd6e8baf0..7651654ee 100644 --- a/src/java/com/threerings/admin/client/AsStringFieldEditor.java +++ b/src/java/com/threerings/admin/client/AsStringFieldEditor.java @@ -78,13 +78,13 @@ public class AsStringFieldEditor extends FieldEditor } else if (_field.getType().equals(int[].class)) { return StringUtil.parseIntArray(_value.getText()); - + } else if (_field.getType().equals(float[].class)) { return StringUtil.parseFloatArray(_value.getText()); } else if (_field.getType().equals(long[].class)) { return StringUtil.parseLongArray(_value.getText()); - + } else if (_field.getType().equals(Boolean.TYPE)) { return new Boolean(_value.getText().equalsIgnoreCase("true")); diff --git a/src/java/com/threerings/admin/client/BooleanFieldEditor.java b/src/java/com/threerings/admin/client/BooleanFieldEditor.java index dba9ec6a2..9561d2c24 100644 --- a/src/java/com/threerings/admin/client/BooleanFieldEditor.java +++ b/src/java/com/threerings/admin/client/BooleanFieldEditor.java @@ -35,7 +35,7 @@ import com.threerings.presents.dobj.DObject; import com.threerings.presents.util.PresentsContext; /** - * Provides "editing" of boolean fields + * Provides "editing" of boolean fields. */ public class BooleanFieldEditor extends FieldEditor { diff --git a/src/java/com/threerings/admin/client/ConfigEditorPanel.java b/src/java/com/threerings/admin/client/ConfigEditorPanel.java index 2bc4b1041..30013bfb1 100644 --- a/src/java/com/threerings/admin/client/ConfigEditorPanel.java +++ b/src/java/com/threerings/admin/client/ConfigEditorPanel.java @@ -58,7 +58,7 @@ public class ConfigEditorPanel extends JPanel _defaultPane = defaultPane; setLayout(new VGroupLayout(VGroupLayout.STRETCH, VGroupLayout.STRETCH, - 5, VGroupLayout.CENTER)); + VGroupLayout.DEFAULT_GAP, VGroupLayout.CENTER)); // create our objects tabbed pane add(_oeditors = new JTabbedPane(JTabbedPane.LEFT)); diff --git a/src/java/com/threerings/admin/client/ConfigObjectManager.java b/src/java/com/threerings/admin/client/ConfigObjectManager.java index f0ab0cf9e..d1368cb30 100644 --- a/src/java/com/threerings/admin/client/ConfigObjectManager.java +++ b/src/java/com/threerings/admin/client/ConfigObjectManager.java @@ -39,9 +39,9 @@ import static com.threerings.admin.Log.log; */ public class ConfigObjectManager implements AdminService.ConfigInfoListener { - public ConfigObjectManager(Client client) + public ConfigObjectManager (Client client) { - _serverconfig = new HashMap(); + _serverconfig = new HashMap(); _client = client; _client.addClientObserver(new ClientAdapter() { public void clientWillLogon (Client client) { @@ -62,7 +62,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener } /** - * Returns the ConfigObject identified by the given key + * Returns the ConfigObject identified by the given key. */ public ConfigObject getServerConfig (String key) { @@ -87,16 +87,16 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener /** * Convenience: generate a getConfigInfo request to the AdminService from the external class, - * instead from within the anonymous inner class + * instead from within the anonymous inner class. */ - protected void getConfigInfo() + protected void getConfigInfo () { _service.getConfigInfo(_client, this); } /** * This class takes care of the details of subscribing to and placing an individual - * ConfigObject that the server knows about into a HashMap + * ConfigObject that the server knows about into a HashMap. */ protected class ConfigObjectSubscriber implements Subscriber { @@ -133,28 +133,28 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener _serverconfig.remove(_key); } - /** The object that we are tracking */ + /** The object that we are tracking. */ protected ConfigObject _cobj; - /** The name of the config object that we are subscribing to */ + /** The name of the config object to which we are subscribing. */ protected String _key; - /** The oid of the object that we're tracking */ + /** The oid of the object that we're tracking. */ protected int _oid; } - /** An array of handlers that each subscribe to a single ConfigObject */ + /** An array of handlers that each subscribe to a single ConfigObject. */ protected ConfigObjectSubscriber[] _csubscribers; - /** Our local copy of the server-side runtime configuration */ - protected HashMap _serverconfig; + /** Our local copy of the server-side runtime configuration. */ + protected HashMap _serverconfig; - /** Our distributed object manager */ + /** Our distributed object manager. */ protected DObjectManager _dobjmgr; - /** Our admin service that we're using to fetch data */ + /** Our admin service that we're using to fetch data. */ protected AdminService _service; - /** Our client object */ + /** Our client object. */ protected Client _client; } diff --git a/src/java/com/threerings/admin/client/DSetEditor.java b/src/java/com/threerings/admin/client/DSetEditor.java index 25fbc9304..e78da893e 100644 --- a/src/java/com/threerings/admin/client/DSetEditor.java +++ b/src/java/com/threerings/admin/client/DSetEditor.java @@ -125,7 +125,7 @@ public class DSetEditor extends JPanel public Dimension getPreferredSize () { Dimension d = super.getPreferredSize(); - d.height = Math.min(d.height, 200); + d.height = Math.min(d.height, MIN_HEIGHT); return d; } @@ -193,8 +193,8 @@ public class DSetEditor extends JPanel // documentation inherited from interface ActionListener public void actionPerformed (ActionEvent event) { - CommandEvent ce = (CommandEvent) event; - _setter.updateSet(_setName, (DSet.Entry) ce.getArgument()); + CommandEvent ce = (CommandEvent)event; + _setter.updateSet(_setName, (DSet.Entry)ce.getArgument()); } protected void refreshData () @@ -223,4 +223,7 @@ public class DSetEditor extends JPanel /** The table used to edit. */ protected ObjectEditorTable _table; + + /** The minimum height for our editor UI. */ + protected static final int MIN_HEIGHT = 200; } diff --git a/src/java/com/threerings/admin/client/FieldEditor.java b/src/java/com/threerings/admin/client/FieldEditor.java index 79fca1a8b..c6ce8d8f2 100644 --- a/src/java/com/threerings/admin/client/FieldEditor.java +++ b/src/java/com/threerings/admin/client/FieldEditor.java @@ -105,8 +105,7 @@ public abstract class FieldEditor extends JPanel try { _object.changeAttribute(_field.getName(), value); } catch (ObjectAccessException oae) { - log.warning("Failed to update field " + _field.getName() + - ": "+ oae); + log.warning("Failed to update field " + _field.getName() + ": " + oae); } } } diff --git a/src/java/com/threerings/admin/client/ObjectEditorPanel.java b/src/java/com/threerings/admin/client/ObjectEditorPanel.java index 68382e981..979062d1e 100644 --- a/src/java/com/threerings/admin/client/ObjectEditorPanel.java +++ b/src/java/com/threerings/admin/client/ObjectEditorPanel.java @@ -30,7 +30,6 @@ import com.samskivert.swing.ScrollablePanel; import com.samskivert.swing.VGroupLayout; import com.samskivert.swing.util.SwingUtil; -import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.ObjectAccessException; import com.threerings.presents.dobj.Subscriber; import com.threerings.presents.util.PresentsContext; @@ -60,8 +59,8 @@ public class ObjectEditorPanel extends ScrollablePanel public ObjectEditorPanel (PresentsContext ctx, String key, int oid) { super(new VGroupLayout(VGroupLayout.NONE, VGroupLayout.STRETCH, - 5, VGroupLayout.TOP)); - setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + VGroupLayout.DEFAULT_GAP, VGroupLayout.TOP)); + setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER)); // keep this business around _ctx = ctx; @@ -127,4 +126,6 @@ public class ObjectEditorPanel extends ScrollablePanel protected String _key; protected SafeSubscriber _safesub; protected ConfigObject _object; + + protected static final int BORDER = 5; } diff --git a/src/java/com/threerings/admin/client/PulldownFieldEditor.java b/src/java/com/threerings/admin/client/PulldownFieldEditor.java index 37eddfe08..17983fcdf 100644 --- a/src/java/com/threerings/admin/client/PulldownFieldEditor.java +++ b/src/java/com/threerings/admin/client/PulldownFieldEditor.java @@ -48,13 +48,13 @@ public class PulldownFieldEditor extends FieldEditor /** * Construct a pulldown choice. */ - public Choice (String displayName, Object value) + public Choice (String displayName, Object val) { if (displayName == null) { throw new NullPointerException("displayName cannot be null."); } _name = displayName; - this.value = value; + value = val; } // documentation inherited @@ -117,14 +117,14 @@ public class PulldownFieldEditor extends FieldEditor if (obj == null) { return null; } - return ((Choice) obj).value; + return ((Choice)obj).value; } // documentation inherited protected void displayValue (Object value) { for (int ii = _value.getItemCount() - 1; ii >= 0; ii--) { - Choice choice = (Choice) _value.getItemAt(ii); + Choice choice = (Choice)_value.getItemAt(ii); if (ObjectUtil.equals(value, choice.value)) { _value.setSelectedIndex(ii); return; diff --git a/src/java/com/threerings/admin/server/ConfigRegistry.java b/src/java/com/threerings/admin/server/ConfigRegistry.java index 80ffee23d..17ba6743b 100644 --- a/src/java/com/threerings/admin/server/ConfigRegistry.java +++ b/src/java/com/threerings/admin/server/ConfigRegistry.java @@ -33,7 +33,6 @@ import com.samskivert.util.StringUtil; import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; -import com.threerings.presents.dobj.AccessController; import com.threerings.presents.dobj.AttributeChangeListener; import com.threerings.presents.dobj.AttributeChangedEvent; import com.threerings.presents.dobj.DObject; @@ -79,7 +78,7 @@ public abstract class ConfigRegistry /** * Creates a ConfigRegistry. - * + * * @param transitioning if true, serialized Streamable instances stored in the registry will * be written back out immediately to allow them to be transitioned to new class names. */ @@ -143,9 +142,9 @@ public abstract class ConfigRegistry { public DObject object; - public ObjectRecord (DObject object) + public ObjectRecord (DObject obj) { - this.object = object; + object = obj; } public void init () @@ -238,7 +237,7 @@ public abstract class ConfigRegistry } else if (value instanceof String[]) { setValue(key, (String[])value); } else if (value instanceof long[]) { - setValue(key, (long[]) value); + setValue(key, (long[])value); } else { log.info("Unable to flush config obj change [cobj=" + object.getClass().getName() + ", key=" + key + ", type=" + value.getClass().getName() + @@ -310,7 +309,7 @@ public abstract class ConfigRegistry Object deserializedValue = oin.readObject(); field.set(object, deserializedValue); if (_transitioning) { - // Use serialize rather than serializeAttribute so we don't get + // Use serialize rather than serializeAttribute so we don't get // ObjectAccessExceptions serialize(key, nameToKey(key), deserializedValue); } @@ -404,8 +403,8 @@ public abstract class ConfigRegistry } /** A mapping from identifying key to config object. */ - protected HashMap _configs = new HashMap(); - + protected HashMap _configs = new HashMap(); + /** If we need to transition serialized Streamables to a new class format in init.. */ protected boolean _transitioning; } diff --git a/src/java/com/threerings/admin/server/DatabaseConfigRegistry.java b/src/java/com/threerings/admin/server/DatabaseConfigRegistry.java index 4970b2ed3..d16467d14 100644 --- a/src/java/com/threerings/admin/server/DatabaseConfigRegistry.java +++ b/src/java/com/threerings/admin/server/DatabaseConfigRegistry.java @@ -59,10 +59,10 @@ public class DatabaseConfigRegistry extends ConfigRegistry { this(ctx, invoker, false); } - + /** * Creates a configuration registry and prepares it for operation. - * + * * @param ctx will provide access to our database. * @param invoker this will be used to perform all database activity (except first time * initialization) so as to avoid blocking the distributed object thread. diff --git a/src/java/com/threerings/admin/server/PrefsConfigRegistry.java b/src/java/com/threerings/admin/server/PrefsConfigRegistry.java index ff37c983d..8992bc107 100644 --- a/src/java/com/threerings/admin/server/PrefsConfigRegistry.java +++ b/src/java/com/threerings/admin/server/PrefsConfigRegistry.java @@ -40,6 +40,7 @@ public class PrefsConfigRegistry extends ConfigRegistry return new PrefsObjectRecord(path, object); } + /** Stores preferences using the Java preferences system. */ protected class PrefsObjectRecord extends ObjectRecord { public PrefsConfig config; diff --git a/src/java/com/threerings/admin/server/persist/ConfigRecord.java b/src/java/com/threerings/admin/server/persist/ConfigRecord.java index 5d98a9c1e..94ffc850d 100644 --- a/src/java/com/threerings/admin/server/persist/ConfigRecord.java +++ b/src/java/com/threerings/admin/server/persist/ConfigRecord.java @@ -28,6 +28,9 @@ import com.samskivert.jdbc.depot.annotation.Entity; import com.samskivert.jdbc.depot.annotation.Id; import com.samskivert.jdbc.depot.expression.ColumnExp; +/** + * Stores information about a configuration entry in the database. + */ @Entity(name="CONFIG") public class ConfigRecord extends PersistentRecord { diff --git a/src/java/com/threerings/admin/server/persist/ConfigRepository.java b/src/java/com/threerings/admin/server/persist/ConfigRepository.java index 1a5e87ad0..95c4d079f 100644 --- a/src/java/com/threerings/admin/server/persist/ConfigRepository.java +++ b/src/java/com/threerings/admin/server/persist/ConfigRepository.java @@ -45,7 +45,7 @@ public class ConfigRepository extends DepotRepository /** * Loads up the configuration data for the specified object. - * + * * @return a map containing field/value pairs for all stored configuration data. */ public HashMap loadConfig (String node, String object) diff --git a/src/java/com/threerings/bureau/client/BureauClient.java b/src/java/com/threerings/bureau/client/BureauClient.java index 961e02ecb..1eca5b42a 100644 --- a/src/java/com/threerings/bureau/client/BureauClient.java +++ b/src/java/com/threerings/bureau/client/BureauClient.java @@ -28,7 +28,7 @@ import com.threerings.bureau.util.BureauContext; import com.threerings.presents.dobj.DObjectManager; import com.samskivert.util.Config; -/** +/** * Represents a client embedded in a bureau. */ public abstract class BureauClient extends Client @@ -53,7 +53,7 @@ public abstract class BureauClient extends Client protected BureauContext createContext () { - return new BureauContext () { + return new BureauContext() { public BureauDirector getBureauDirector () { return _director; } diff --git a/src/java/com/threerings/bureau/client/BureauDirector.java b/src/java/com/threerings/bureau/client/BureauDirector.java index b1b85a680..86f5e8c5d 100644 --- a/src/java/com/threerings/bureau/client/BureauDirector.java +++ b/src/java/com/threerings/bureau/client/BureauDirector.java @@ -51,7 +51,7 @@ public abstract class BureauDirector extends BasicDirector log.info("Subscribing to object " + agentId); - SafeSubscriber subscriber = + SafeSubscriber subscriber = new SafeSubscriber(agentId, delegator); _subscribers.put(agentId, subscriber); subscriber.subscribe(_ctx.getDObjectManager()); @@ -67,19 +67,16 @@ public abstract class BureauDirector extends BasicDirector if (agent == null) { log.warning("Lost an agent, id " + agentId); - } - else { + } else { try { agent.stop(); - } - catch (Throwable t) { + } catch (Throwable t) { log.warning("Stopping an agent caused an exception", t); } SafeSubscriber subscriber = _subscribers.remove(agentId); if (subscriber == null) { log.warning("Lost a subscriber for agent " + agent); - } - else { + } else { subscriber.unsubscribe(_ctx.getDObjectManager()); } _bureauService.agentDestroyed(_ctx.getClient(), agentId); @@ -87,7 +84,8 @@ public abstract class BureauDirector extends BasicDirector } /** - * Callback for when the a request to subscribe to an object finishes and the object is available. + * Callback for when the a request to subscribe to an object finishes and the object is + * available. */ protected synchronized void objectAvailable (AgentObject agentObject) { @@ -100,13 +98,12 @@ public abstract class BureauDirector extends BasicDirector agent = createAgent(agentObject); agent.init(agentObject); agent.start(); - } - catch (Throwable t) { + } catch (Throwable t) { log.warning("Could not create agent [obj=" + agentObject + "]", t); _bureauService.agentCreationFailed(_ctx.getClient(), oid); return; } - + _agents.put(oid, agent); _bureauService.agentCreated(_ctx.getClient(), oid); } @@ -127,9 +124,8 @@ public abstract class BureauDirector extends BasicDirector // Require the bureau services client.addServiceGroup(BureauCodes.BUREAU_GROUP); - // Set up our decoder so we can receive method calls - // from the server - BureauReceiver receiver = new BureauReceiver () { + // Set up our decoder so we can receive method calls from the server + BureauReceiver receiver = new BureauReceiver() { public void createAgent (int agentId) { BureauDirector.this.createAgent(agentId); } @@ -151,8 +147,8 @@ public abstract class BureauDirector extends BasicDirector } /** - * Called when it is time to create an Agent. Subclasses should read the - * agentObject's type and/or properties to determine what kind of Agent to + * Called when it is time to create an Agent. Subclasses should read the + * agentObject's type and/or properties to determine what kind of Agent to * create. * @param agentObj the distributed and object * @return a new Agent that will govern the distributed object @@ -162,6 +158,6 @@ public abstract class BureauDirector extends BasicDirector protected BureauContext _ctx; protected BureauService _bureauService; protected IntMap _agents = IntMaps.newHashIntMap(); - protected IntMap> _subscribers = + protected IntMap> _subscribers = IntMaps.newHashIntMap(); } diff --git a/src/java/com/threerings/bureau/client/BureauReceiver.java b/src/java/com/threerings/bureau/client/BureauReceiver.java index 59762de91..73286eb5d 100644 --- a/src/java/com/threerings/bureau/client/BureauReceiver.java +++ b/src/java/com/threerings/bureau/client/BureauReceiver.java @@ -29,7 +29,7 @@ import com.threerings.presents.client.InvocationReceiver; public interface BureauReceiver extends InvocationReceiver { /** - * Creates a new agent. Implementors should create a new {@link Agent} and give it access to + * Creates a new agent. Implementors should create a new {@link Agent} and give it access to * the {@link AgentObject} referred to by the agentId parameter and must notify * the service that the agent has been created using {@link BureauService#agentCreated}. * @param client the client receiving the request @@ -38,11 +38,11 @@ public interface BureauReceiver extends InvocationReceiver void createAgent (int agentId); /** - * Destroys a previously created agent. Implementors should destroy the agent that was created + * Destroys a previously created agent. Implementors should destroy the agent that was created * by the call to createAgent with the same agent id and must notify * the service that the agent has been created using {@link BureauService#agentDestroyed}. * @param client the client receiving the request - * @param agentId the id of the AgentObject whose Agent + * @param agentId the id of the AgentObject whose Agent * should be destroyed */ void destroyAgent (int agentId); diff --git a/src/java/com/threerings/bureau/client/BureauService.java b/src/java/com/threerings/bureau/client/BureauService.java index 90ca92b1f..c9363cb0b 100644 --- a/src/java/com/threerings/bureau/client/BureauService.java +++ b/src/java/com/threerings/bureau/client/BureauService.java @@ -24,7 +24,7 @@ package com.threerings.bureau.client; import com.threerings.presents.client.Client; import com.threerings.presents.client.InvocationService; -/** +/** * Interface for the bureau to communicate with the server. */ public interface BureauService extends InvocationService diff --git a/src/java/com/threerings/bureau/data/AgentObject.java b/src/java/com/threerings/bureau/data/AgentObject.java index 83aa704e3..78a161d35 100644 --- a/src/java/com/threerings/bureau/data/AgentObject.java +++ b/src/java/com/threerings/bureau/data/AgentObject.java @@ -23,6 +23,9 @@ package com.threerings.bureau.data; import com.threerings.presents.dobj.DObject; +/** + * Contains information for configuring and communicating with an agent. + */ public class AgentObject extends DObject { // AUTO-GENERATED: FIELDS START @@ -55,11 +58,11 @@ public class AgentObject extends DObject * some other description that the bureau can use to load and execute the agent's code. */ public String code; - /** The main class within the code to use when launching an agent. Whther this value is + /** The main class within the code to use when launching an agent. Whther this value is * used depends on the type of bureau and will be resolve in the bureau client. */ public String className; - /** The id of the client running this agent (only set after the agent is assigned to a + /** The id of the client running this agent (only set after the agent is assigned to a * bureau and run). */ public int clientOid; diff --git a/src/java/com/threerings/bureau/data/BureauCredentials.java b/src/java/com/threerings/bureau/data/BureauCredentials.java index 188cbf73b..0c2074827 100644 --- a/src/java/com/threerings/bureau/data/BureauCredentials.java +++ b/src/java/com/threerings/bureau/data/BureauCredentials.java @@ -29,11 +29,11 @@ import com.threerings.util.Name; */ public class BureauCredentials extends Credentials { - public static String PREFIX = "@@bureau:"; - public static String SUFFIX = "@@"; + public static final String PREFIX = "@@bureau:"; + public static final String SUFFIX = "@@"; /** - * The token to pass to the server when logging in. This is usually just passed to the bureau + * The token to pass to the server when logging in. This is usually just passed to the bureau * on the command line to guard against outside connections being established. */ public String sessionToken; diff --git a/src/java/com/threerings/bureau/server/BureauAuthenticator.java b/src/java/com/threerings/bureau/server/BureauAuthenticator.java index 41738cf55..45d19f5d8 100644 --- a/src/java/com/threerings/bureau/server/BureauAuthenticator.java +++ b/src/java/com/threerings/bureau/server/BureauAuthenticator.java @@ -31,7 +31,7 @@ public class BureauAuthenticator extends ChainedAuthenticator @Override // from Authenticator protected void processAuthentication ( - AuthingConnection conn, + AuthingConnection conn, AuthResponse rsp) { AuthRequest req = conn.getAuthRequest(); @@ -42,7 +42,7 @@ public class BureauAuthenticator extends ChainedAuthenticator rsp.getData().code = AuthResponseData.SUCCESS; } else { - log.warning("Received invalid bureau auth request [creds=" + + log.warning("Received invalid bureau auth request [creds=" + creds + "], problem: " + problem); rsp.getData().code = AuthCodes.SERVER_ERROR; } diff --git a/src/java/com/threerings/bureau/server/BureauProvider.java b/src/java/com/threerings/bureau/server/BureauProvider.java index 1eea2d0eb..b3dd06d64 100644 --- a/src/java/com/threerings/bureau/server/BureauProvider.java +++ b/src/java/com/threerings/bureau/server/BureauProvider.java @@ -32,20 +32,20 @@ public interface BureauProvider extends InvocationProvider /** * Handles a {@link BureauService#agentCreated} request. */ - public void agentCreated (ClientObject caller, int arg1); + void agentCreated (ClientObject caller, int arg1); /** * Handles a {@link BureauService#agentCreationFailed} request. */ - public void agentCreationFailed (ClientObject caller, int arg1); + void agentCreationFailed (ClientObject caller, int arg1); /** * Handles a {@link BureauService#agentDestroyed} request. */ - public void agentDestroyed (ClientObject caller, int arg1); + void agentDestroyed (ClientObject caller, int arg1); /** * Handles a {@link BureauService#bureauInitialized} request. */ - public void bureauInitialized (ClientObject caller, String arg1); + void bureauInitialized (ClientObject caller, String arg1); } diff --git a/src/java/com/threerings/bureau/server/BureauRegistry.java b/src/java/com/threerings/bureau/server/BureauRegistry.java index 41557eced..7a0ff9b31 100644 --- a/src/java/com/threerings/bureau/server/BureauRegistry.java +++ b/src/java/com/threerings/bureau/server/BureauRegistry.java @@ -57,8 +57,8 @@ import static com.threerings.bureau.Log.log; public class BureauRegistry { /** - * Defines how a bureau is launched. Instances are associated to bureau types by the server on - * startup. The instances are used whenever the registry needs to launch a bureau for an agent + * Defines how a bureau is launched. Instances are associated to bureau types by the server on + * startup. The instances are used whenever the registry needs to launch a bureau for an agent * with the assocated bureau type. */ public static interface Launcher @@ -168,7 +168,7 @@ public class BureauRegistry } if (!bureau.token.equals(creds.sessionToken)) { - return "Bureau " + creds.bureauId + + return "Bureau " + creds.bureauId + " does not match credentials token"; } @@ -183,11 +183,11 @@ public class BureauRegistry * @param cmdGenerator the generator to be used for bureaus of bureauType */ public void setCommandGenerator ( - String bureauType, + String bureauType, final CommandGenerator cmdGenerator) { setLauncher(bureauType, new Launcher () { - public void launchBureau (String bureauId, String token) + public void launchBureau (String bureauId, String token) throws IOException { ProcessBuilder builder = new ProcessBuilder( cmdGenerator.createCommand(bureauId, token)); @@ -338,7 +338,7 @@ public class BureauRegistry } if (bureau.client != null) { log.warning( - "Multiple sessions for the same bureau", "id", id, "client", client, "bureau", + "Multiple sessions for the same bureau", "id", id, "client", client, "bureau", bureau); } bureau.client = client; @@ -353,7 +353,7 @@ public class BureauRegistry } if (bureau.client == null) { log.warning( - "Multiple logouts from the same bureau", "id", id, "client", client, "bureau", + "Multiple logouts from the same bureau", "id", id, "client", client, "bureau", bureau); } bureau.client = null; @@ -564,12 +564,12 @@ public class BureauRegistry } /** - * Create a hard-to-guess token that the bureau can use to authenticate itself when it tries + * Create a hard-to-guess token that the bureau can use to authenticate itself when it tries * to log in. */ protected String generateToken (String bureauId) { - String tokenSource = bureauId + "@" + + String tokenSource = bureauId + "@" + System.currentTimeMillis() + "r" + Math.random(); return StringUtil.md5hex(tokenSource); } @@ -581,7 +581,7 @@ public class BureauRegistry { LauncherUnit (Bureau bureau) { - super("LauncherUnit for " + bureau + ": " + + super("LauncherUnit for " + bureau + ": " + StringUtil.toString(bureau.launcher)); _bureau = bureau; } diff --git a/src/java/com/threerings/crowd/chat/server/ChatProvider.java b/src/java/com/threerings/crowd/chat/server/ChatProvider.java index 9534e5d86..f90383c2f 100644 --- a/src/java/com/threerings/crowd/chat/server/ChatProvider.java +++ b/src/java/com/threerings/crowd/chat/server/ChatProvider.java @@ -44,7 +44,6 @@ import com.threerings.crowd.data.CrowdCodes; import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.server.BodyLocator; -import com.threerings.crowd.server.CrowdServer; import com.threerings.crowd.server.PlaceRegistry; import com.threerings.crowd.chat.client.ChatService.TellListener; diff --git a/src/java/com/threerings/crowd/chat/server/SpeakProvider.java b/src/java/com/threerings/crowd/chat/server/SpeakProvider.java index 2b39ec78d..92e2fe9b7 100644 --- a/src/java/com/threerings/crowd/chat/server/SpeakProvider.java +++ b/src/java/com/threerings/crowd/chat/server/SpeakProvider.java @@ -32,5 +32,5 @@ public interface SpeakProvider extends InvocationProvider /** * Handles a {@link SpeakService#speak} request. */ - public void speak (ClientObject caller, String arg1, byte arg2); + void speak (ClientObject caller, String arg1, byte arg2); } diff --git a/src/java/com/threerings/crowd/client/OccupantDirector.java b/src/java/com/threerings/crowd/client/OccupantDirector.java index 3970e3579..f91f6d23b 100644 --- a/src/java/com/threerings/crowd/client/OccupantDirector.java +++ b/src/java/com/threerings/crowd/client/OccupantDirector.java @@ -35,7 +35,6 @@ import com.threerings.crowd.data.OccupantInfo; import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.util.CrowdContext; - /** * The occupant director listens for occupants of places to enter and * exit, and dispatches notices to interested parties about these events. diff --git a/src/java/com/threerings/crowd/peer/server/CrowdPeerProvider.java b/src/java/com/threerings/crowd/peer/server/CrowdPeerProvider.java index 3cf877361..5155f1841 100644 --- a/src/java/com/threerings/crowd/peer/server/CrowdPeerProvider.java +++ b/src/java/com/threerings/crowd/peer/server/CrowdPeerProvider.java @@ -36,11 +36,11 @@ public interface CrowdPeerProvider extends InvocationProvider /** * Handles a {@link CrowdPeerService#deliverBroadcast} request. */ - public void deliverBroadcast (ClientObject caller, Name arg1, String arg2, String arg3, boolean arg4); + void deliverBroadcast (ClientObject caller, Name arg1, String arg2, String arg3, boolean arg4); /** * Handles a {@link CrowdPeerService#deliverTell} request. */ - public void deliverTell (ClientObject caller, UserMessage arg1, Name arg2, ChatService.TellListener arg3) + void deliverTell (ClientObject caller, UserMessage arg1, Name arg2, ChatService.TellListener arg3) throws InvocationException; } diff --git a/src/java/com/threerings/crowd/server/BodyProvider.java b/src/java/com/threerings/crowd/server/BodyProvider.java index 4c40b9dd1..f3ed0a5a8 100644 --- a/src/java/com/threerings/crowd/server/BodyProvider.java +++ b/src/java/com/threerings/crowd/server/BodyProvider.java @@ -32,5 +32,5 @@ public interface BodyProvider extends InvocationProvider /** * Handles a {@link BodyService#setIdle} request. */ - public void setIdle (ClientObject caller, boolean arg1); + void setIdle (ClientObject caller, boolean arg1); } diff --git a/src/java/com/threerings/crowd/server/CrowdServer.java b/src/java/com/threerings/crowd/server/CrowdServer.java index f7a46a4f4..bd04e24bc 100644 --- a/src/java/com/threerings/crowd/server/CrowdServer.java +++ b/src/java/com/threerings/crowd/server/CrowdServer.java @@ -25,22 +25,16 @@ import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Singleton; -import com.samskivert.util.Invoker; import com.threerings.util.Name; import com.threerings.presents.net.AuthRequest; import com.threerings.presents.server.ClientFactory; -import com.threerings.presents.server.ClientManager; import com.threerings.presents.server.ClientResolver; -import com.threerings.presents.server.InvocationManager; import com.threerings.presents.server.PresentsClient; -import com.threerings.presents.server.PresentsDObjectMgr; import com.threerings.presents.server.PresentsServer; -import com.threerings.presents.server.net.ConnectionManager; import com.threerings.crowd.chat.server.ChatProvider; -import com.threerings.crowd.data.BodyObject; import static com.threerings.crowd.Log.log; diff --git a/src/java/com/threerings/crowd/server/LocationProvider.java b/src/java/com/threerings/crowd/server/LocationProvider.java index ec04bd4fd..c3d2b7beb 100644 --- a/src/java/com/threerings/crowd/server/LocationProvider.java +++ b/src/java/com/threerings/crowd/server/LocationProvider.java @@ -34,11 +34,11 @@ public interface LocationProvider extends InvocationProvider /** * Handles a {@link LocationService#leavePlace} request. */ - public void leavePlace (ClientObject caller); + void leavePlace (ClientObject caller); /** * Handles a {@link LocationService#moveTo} request. */ - public void moveTo (ClientObject caller, int arg1, LocationService.MoveListener arg2) + void moveTo (ClientObject caller, int arg1, LocationService.MoveListener arg2) throws InvocationException; } diff --git a/src/java/com/threerings/crowd/server/PlaceManager.java b/src/java/com/threerings/crowd/server/PlaceManager.java index 784a16761..44730a5ea 100644 --- a/src/java/com/threerings/crowd/server/PlaceManager.java +++ b/src/java/com/threerings/crowd/server/PlaceManager.java @@ -21,7 +21,6 @@ package com.threerings.crowd.server; -import java.util.Iterator; import java.util.List; import java.util.Map; diff --git a/src/java/com/threerings/presents/peer/server/PeerManager.java b/src/java/com/threerings/presents/peer/server/PeerManager.java index 0145859b9..3862b4bd1 100644 --- a/src/java/com/threerings/presents/peer/server/PeerManager.java +++ b/src/java/com/threerings/presents/peer/server/PeerManager.java @@ -36,7 +36,6 @@ import com.google.inject.Injector; import com.samskivert.jdbc.RepositoryUnit; import com.samskivert.jdbc.WriteOnlyUnit; -import com.samskivert.jdbc.depot.PersistenceContext; import com.samskivert.util.ArrayIntSet; import com.samskivert.util.ChainedResultListener; import com.samskivert.util.Interval; diff --git a/src/java/com/threerings/presents/peer/server/PeerProvider.java b/src/java/com/threerings/presents/peer/server/PeerProvider.java index 703a27aba..a509f9345 100644 --- a/src/java/com/threerings/presents/peer/server/PeerProvider.java +++ b/src/java/com/threerings/presents/peer/server/PeerProvider.java @@ -33,10 +33,10 @@ public interface PeerProvider extends InvocationProvider /** * Handles a {@link PeerService#invokeAction} request. */ - public void invokeAction (ClientObject caller, byte[] arg1); + void invokeAction (ClientObject caller, byte[] arg1); /** * Handles a {@link PeerService#ratifyLockAction} request. */ - public void ratifyLockAction (ClientObject caller, NodeObject.Lock arg1, boolean arg2); + void ratifyLockAction (ClientObject caller, NodeObject.Lock arg1, boolean arg2); } diff --git a/src/java/com/threerings/presents/tools/GenReceiverTask.java b/src/java/com/threerings/presents/tools/GenReceiverTask.java index 149bf4d24..a6e25c299 100644 --- a/src/java/com/threerings/presents/tools/GenReceiverTask.java +++ b/src/java/com/threerings/presents/tools/GenReceiverTask.java @@ -38,7 +38,6 @@ import com.samskivert.util.StringUtil; import com.threerings.presents.client.InvocationDecoder; import com.threerings.presents.data.ClientObject; -import com.threerings.presents.net.Transport; import com.threerings.presents.server.InvocationSender; /** diff --git a/src/java/com/threerings/presents/tools/GenServiceTask.java b/src/java/com/threerings/presents/tools/GenServiceTask.java index ac7350ceb..481b04dd5 100644 --- a/src/java/com/threerings/presents/tools/GenServiceTask.java +++ b/src/java/com/threerings/presents/tools/GenServiceTask.java @@ -39,7 +39,6 @@ import com.threerings.presents.client.InvocationService; import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.InvocationMarshaller; import com.threerings.presents.dobj.InvocationResponseEvent; -import com.threerings.presents.net.Transport; import com.threerings.presents.server.InvocationDispatcher; import com.threerings.presents.server.InvocationException; import com.threerings.presents.server.InvocationProvider; diff --git a/src/java/com/threerings/presents/tools/provider.tmpl b/src/java/com/threerings/presents/tools/provider.tmpl index c67924297..6420d69bd 100644 --- a/src/java/com/threerings/presents/tools/provider.tmpl +++ b/src/java/com/threerings/presents/tools/provider.tmpl @@ -16,7 +16,7 @@ public interface ${name}Provider extends InvocationProvider /** * Handles a {@link ${name}Service#$m.method.name} request. */ - public void $m.method.name (ClientObject caller#if ($m.hasArgs(true)), #end$m.getArgList(true))#if ($m.listenerArgs.size() > 0) + void $m.method.name (ClientObject caller#if ($m.hasArgs(true)), #end$m.getArgList(true))#if ($m.listenerArgs.size() > 0) throws InvocationException#end; #end diff --git a/src/java/com/threerings/util/DependencyGraph.java b/src/java/com/threerings/util/DependencyGraph.java index d1b039b22..8f12ae3c8 100644 --- a/src/java/com/threerings/util/DependencyGraph.java +++ b/src/java/com/threerings/util/DependencyGraph.java @@ -145,4 +145,4 @@ public class DependencyGraph this.children = new ArrayList>(); } } -} \ No newline at end of file +}