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:
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// $Id: AdminDispatcher.java,v 1.1 2002/08/14 19:07:48 mdb Exp $
|
||||
|
||||
package com.threerings.admin.server;
|
||||
|
||||
import com.threerings.admin.client.AdminService;
|
||||
import com.threerings.admin.client.AdminService.ConfigInfoListener;
|
||||
import com.threerings.admin.data.AdminMarshaller;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.server.InvocationDispatcher;
|
||||
import com.threerings.presents.server.InvocationException;
|
||||
|
||||
/**
|
||||
* Dispatches requests to the {@link AdminProvider}.
|
||||
*/
|
||||
public class AdminDispatcher extends InvocationDispatcher
|
||||
{
|
||||
/**
|
||||
* Creates a dispatcher that may be registered to dispatch invocation
|
||||
* service requests for the specified provider.
|
||||
*/
|
||||
public AdminDispatcher (AdminProvider provider)
|
||||
{
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public InvocationMarshaller createMarshaller ()
|
||||
{
|
||||
return new AdminMarshaller();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void dispatchRequest (
|
||||
ClientObject source, int methodId, Object[] args)
|
||||
throws InvocationException
|
||||
{
|
||||
switch (methodId) {
|
||||
case AdminMarshaller.GET_CONFIG_INFO:
|
||||
((AdminProvider)provider).getConfigInfo(
|
||||
source,
|
||||
(ConfigInfoListener)args[0]
|
||||
);
|
||||
return;
|
||||
|
||||
default:
|
||||
super.dispatchRequest(source, methodId, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
//
|
||||
// $Id: AdminProvider.java,v 1.1 2002/06/07 06:22:24 mdb Exp $
|
||||
// $Id: AdminProvider.java,v 1.2 2002/08/14 19:07:48 mdb Exp $
|
||||
|
||||
package com.threerings.admin.server;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.server.InvocationManager;
|
||||
import com.threerings.presents.server.InvocationProvider;
|
||||
import com.threerings.presents.server.ServiceFailedException;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
import com.threerings.admin.Log;
|
||||
import com.threerings.admin.data.AdminCodes;
|
||||
import com.threerings.admin.client.AdminService;
|
||||
|
||||
/**
|
||||
* Provides the server-side interface to various administrator services.
|
||||
* Provides the server-side implementation of various administrator
|
||||
* services.
|
||||
*/
|
||||
public class AdminProvider extends InvocationProvider
|
||||
implements AdminCodes
|
||||
public class AdminProvider implements InvocationProvider
|
||||
{
|
||||
/**
|
||||
* Constructs an admin provider and registers it with the invocation
|
||||
@@ -25,15 +23,15 @@ public class AdminProvider extends InvocationProvider
|
||||
*/
|
||||
public static void init (InvocationManager invmgr)
|
||||
{
|
||||
invmgr.registerProvider(MODULE_NAME, new AdminProvider());
|
||||
invmgr.registerDispatcher(
|
||||
new AdminDispatcher(new AdminProvider()), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a request from a client to obtain the configuration keys
|
||||
* and oids for all registered configuration objects.
|
||||
* Handles a request for the list of config objects.
|
||||
*/
|
||||
public void handleGetConfigInfoRequest (BodyObject source, int invid)
|
||||
throws ServiceFailedException
|
||||
public void getConfigInfo (
|
||||
ClientObject caller, AdminService.ConfigInfoListener listener)
|
||||
{
|
||||
// we don't have to validate the request because the user can't do
|
||||
// anything with the keys or oids unless they're an admin (we put
|
||||
@@ -46,6 +44,6 @@ public class AdminProvider extends InvocationProvider
|
||||
for (int ii = 0; ii < keys.length; ii++) {
|
||||
oids[ii] = ConfObjRegistry.getObject(keys[ii]).getOid();
|
||||
}
|
||||
sendResponse(source, invid, CONFIG_INFO_RESPONSE, keys, oids);
|
||||
listener.gotConfigInfo(keys, oids);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user