Modified invocation request procedure to provide a reference to the client
object that initiated the request. Implemented the invocation notification side of things. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@76 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestClient.java,v 1.6 2001/07/19 18:08:20 mdb Exp $
|
||||
// $Id: TestClient.java,v 1.7 2001/07/19 19:18:06 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.client.test;
|
||||
|
||||
@@ -38,6 +38,9 @@ public class TestClient
|
||||
Log.info("Client did logon [client=" + client + "].");
|
||||
// try subscribing to a test object
|
||||
client.getDObjectManager().subscribeToObject(2, this);
|
||||
// register our test notification receiver
|
||||
client.getInvocationManager().registerReceiver(TestService.MODULE,
|
||||
new TestReceiver());
|
||||
// issue a test invocation request
|
||||
TestService.test(client, "foo", 1, this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// $Id: TestReceiver.java,v 1.1 2001/07/19 19:18:06 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.client.test;
|
||||
|
||||
import com.threerings.cocktail.cher.Log;
|
||||
import com.threerings.cocktail.cher.client.InvocationReceiver;
|
||||
|
||||
public class TestReceiver extends InvocationReceiver
|
||||
{
|
||||
public void handleTestNotification (int one, String two)
|
||||
{
|
||||
Log.info("Received tell notification [one=" + one +
|
||||
", two=" + two + "].");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
//
|
||||
// $Id: TestProvider.java,v 1.3 2001/07/19 18:08:20 mdb Exp $
|
||||
// $Id: TestProvider.java,v 1.4 2001/07/19 19:18:07 mdb Exp $
|
||||
|
||||
package com.threerings.cocktail.cher.server.test;
|
||||
|
||||
import com.threerings.cocktail.cher.Log;
|
||||
import com.threerings.cocktail.cher.client.test.TestService;
|
||||
import com.threerings.cocktail.cher.data.ClientObject;
|
||||
import com.threerings.cocktail.cher.server.CherServer;
|
||||
import com.threerings.cocktail.cher.server.InvocationProvider;
|
||||
|
||||
/**
|
||||
@@ -11,9 +14,17 @@ import com.threerings.cocktail.cher.server.InvocationProvider;
|
||||
*/
|
||||
public class TestProvider extends InvocationProvider
|
||||
{
|
||||
public Object[] handleTestRequest (String one, int two)
|
||||
public Object[] handleTestRequest (
|
||||
ClientObject source, String one, int two)
|
||||
{
|
||||
Log.info("Test request [one=" + one + ", two=" + two + "].");
|
||||
|
||||
// issue a test notification just for kicks
|
||||
Object[] args = new Object[] { new Integer(1), "two" };
|
||||
CherServer.invmgr.sendNotification(
|
||||
source.getOid(), TestService.MODULE, "Test", args);
|
||||
|
||||
// and issue a response to this invocation request
|
||||
return createResponse("TestSucceeded", one, new Integer(two));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user