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
This commit is contained in:
Michael Bayne
2008-07-18 18:32:59 +00:00
parent 45f0f9d8b7
commit e41dda3018
37 changed files with 103 additions and 110 deletions
@@ -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);
}
@@ -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
{
@@ -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));
@@ -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<String,ConfigObject>();
_serverconfig = new HashMap<String, ConfigObject>();
_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<ConfigObject>
{
@@ -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<String,ConfigObject> _serverconfig;
/** Our local copy of the server-side runtime configuration. */
protected HashMap<String, ConfigObject> _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;
}
@@ -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;
}
@@ -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);
}
}
}
@@ -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<ConfigObject> _safesub;
protected ConfigObject _object;
protected static final int BORDER = 5;
}
@@ -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;
@@ -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;
@@ -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() +
@@ -404,7 +403,7 @@ public abstract class ConfigRegistry
}
/** A mapping from identifying key to config object. */
protected HashMap<String,ObjectRecord> _configs = new HashMap<String,ObjectRecord>();
protected HashMap<String, ObjectRecord> _configs = new HashMap<String, ObjectRecord>();
/** If we need to transition serialized Streamables to a new class format in init.. */
protected boolean _transitioning;
@@ -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;
@@ -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
{
@@ -53,7 +53,7 @@ public abstract class BureauClient extends Client
protected BureauContext createContext ()
{
return new BureauContext () {
return new BureauContext() {
public BureauDirector getBureauDirector () {
return _director;
}
@@ -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<AgentObject> 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,8 +98,7 @@ 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;
@@ -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);
}
@@ -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
@@ -29,8 +29,8 @@ 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
@@ -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);
}
@@ -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;
@@ -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);
}
@@ -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.
@@ -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;
}
@@ -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);
}
@@ -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;
@@ -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;
}
@@ -21,7 +21,6 @@
package com.threerings.crowd.server;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -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;
@@ -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);
}
@@ -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;
/**
@@ -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;
@@ -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