The great invocation services rethink of 2002! Rearchitected the remote

method invocation services and converted everything to the new style.
Could this be my biggest checkin ever?


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1642 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-08-14 19:08:01 +00:00
parent 4481c5f835
commit e54a4d41f4
161 changed files with 6083 additions and 2805 deletions
@@ -1,34 +1,32 @@
//
// $Id: AdminService.java,v 1.1 2002/06/07 06:22:24 mdb Exp $
// $Id: AdminService.java,v 1.2 2002/08/14 19:07:48 mdb Exp $
package com.threerings.admin.client;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationDirector;
import com.threerings.presents.client.InvocationService;
import com.threerings.admin.Log;
import com.threerings.admin.data.AdminCodes;
/**
* Handles the client side of the admin invocation services.
* Defines the client side of the admin invocation services.
*/
public class AdminService
implements AdminCodes
public interface AdminService extends InvocationService
{
/**
* Requests the list of config objects. This will result in a call to
*
* <pre>
* public void handleConfigInfoResponse (int invid, String[] keys,
* int[] oids)
* </pre>
*
* on the response target.
* Used to communicate a response to a {@link #getConfigInfo} request.
*/
public static void getConfigInfo (Client client, Object rsptarget)
public static interface ConfigInfoListener extends InvocationListener
{
InvocationDirector invdir = client.getInvocationDirector();
invdir.invoke(MODULE_NAME, GET_CONFIG_INFO_REQUEST, null, rsptarget);
Log.debug("Sent getConfigInfo request.");
/**
* Delivers a successful response to a {@link #getConfigInfo}
* request.
*/
public void gotConfigInfo (String[] keys, int[] oids);
}
/**
* Requests the list of config objects.
*/
public void getConfigInfo (Client client, ConfigInfoListener listener);
}
@@ -1,5 +1,5 @@
//
// $Id: ConfigEditorPanel.java,v 1.3 2002/07/09 21:13:20 ray Exp $
// $Id: ConfigEditorPanel.java,v 1.4 2002/08/14 19:07:48 mdb Exp $
package com.threerings.admin.client;
@@ -20,6 +20,7 @@ import com.threerings.admin.Log;
* displays their fields in a tree widget to be viewed and edited.
*/
public class ConfigEditorPanel extends JTabbedPane
implements AdminService.ConfigInfoListener
{
/**
* Constructs an editor panel which will use the supplied context to
@@ -39,8 +40,11 @@ public class ConfigEditorPanel extends JTabbedPane
// if we have no children, ship off a getConfigInfo request to
// find out what config objects are available for editing
if (getComponentCount() == 0) {
// locate our admin service and use it to make a request
AdminService service = (AdminService)
_ctx.getClient().requireService(AdminService.class);
Log.info("Sending get config info.");
AdminService.getConfigInfo(_ctx.getClient(), this);
service.getConfigInfo(_ctx.getClient(), this);
}
}
@@ -48,7 +52,7 @@ public class ConfigEditorPanel extends JTabbedPane
* Called in response to our getConfigInfo server-side service
* request.
*/
public void handleConfigInfo (int invid, String[] keys, int[] oids)
public void gotConfigInfo (String[] keys, int[] oids)
{
Log.info("Got config info: " + StringUtil.toString(keys));
// create object editor panels for each of the categories
@@ -60,6 +64,12 @@ public class ConfigEditorPanel extends JTabbedPane
}
}
// documentation inherited from interface
public void requestFailed (String reason)
{
Log.warning("Failed to get config info [reason=" + reason + "].");
}
/**
* Called when the panel is hidden; this instructs all of our object
* editors to clear out their subscriptions.