Added support for streaming List and ArrayList natively. A List will be
unmarshalled into an ArrayList on the receiver. Along the way, I improved support for generic types as arguments to invocation services (which required one unfortunate "sweeping" warning suppression, but since this is in generated code, I think we can be sure it won't be doing anything untoward). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4375 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
|
||||
package com.threerings.presents.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.samskivert.util.Queue;
|
||||
import com.samskivert.util.RunQueue;
|
||||
|
||||
@@ -36,8 +38,7 @@ import com.threerings.presents.net.*;
|
||||
*/
|
||||
public class TestClient
|
||||
implements RunQueue, SessionObserver, Subscriber<TestObject>, EventListener,
|
||||
TestService.TestFuncListener, TestService.TestOidListener,
|
||||
TestReceiver
|
||||
TestService.TestOidListener, TestReceiver
|
||||
{
|
||||
public void setClient (Client client)
|
||||
{
|
||||
@@ -71,12 +72,26 @@ public class TestClient
|
||||
Log.info("Client did logon [client=" + client + "].");
|
||||
|
||||
// register ourselves as a test notification receiver
|
||||
client.getInvocationDirector().registerReceiver(
|
||||
new TestDecoder(this));
|
||||
client.getInvocationDirector().registerReceiver(new TestDecoder(this));
|
||||
|
||||
// get the test object id
|
||||
TestService service = (TestService)
|
||||
client.requireService(TestService.class);
|
||||
|
||||
// send a test request
|
||||
ArrayList<Integer> three = new ArrayList<Integer>();
|
||||
three.add(3);
|
||||
three.add(4);
|
||||
three.add(5);
|
||||
service.test(client, "one", 2, three, new TestService.TestFuncListener() {
|
||||
public void testSucceeded (String one, int two) {
|
||||
Log.info("Got test response [one=" + one + ", two=" + two + "].");
|
||||
}
|
||||
public void requestFailed (String reason) {
|
||||
Log.info("Urk! Request failed [reason=" + reason + "].");
|
||||
}
|
||||
});
|
||||
|
||||
// get the test object id
|
||||
service.getTestOid(client, this);
|
||||
}
|
||||
|
||||
@@ -114,12 +129,6 @@ public class TestClient
|
||||
_client.logoff(true);
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void testSucceeded (String one, int two)
|
||||
{
|
||||
Log.info("Got test response [one=" + one + ", two=" + two + "].");
|
||||
}
|
||||
|
||||
// documentation inherited from interface
|
||||
public void gotTestOid (int testOid)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TestService.java,v 1.7 2004/08/27 02:21:02 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
package com.threerings.presents.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A test of the invocation services.
|
||||
*/
|
||||
@@ -35,7 +37,8 @@ public interface TestService extends InvocationService
|
||||
|
||||
/** Issues a test request. */
|
||||
public void test (
|
||||
Client client, String one, int two, TestFuncListener listener);
|
||||
Client client, String one, int two, ArrayList<Integer> three,
|
||||
TestFuncListener listener);
|
||||
|
||||
/** Used to dispatch responses to {@link #getTestOid} requests. */
|
||||
public static interface TestOidListener extends InvocationListener
|
||||
|
||||
Reference in New Issue
Block a user