Updated to use new Client-reference-free style.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6398 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2010-12-31 22:28:21 +00:00
parent b60112ae93
commit e80409a7f4
33 changed files with 146 additions and 144 deletions
@@ -43,5 +43,5 @@ public interface AdminService extends InvocationService
/** /**
* Requests the list of config objects. * Requests the list of config objects.
*/ */
void getConfigInfo (Client client, ConfigInfoListener listener); void getConfigInfo (ConfigInfoListener listener);
} }
@@ -85,7 +85,7 @@ public class ConfigEditorPanel extends JPanel
// ship off a getConfigInfo request to find out what config // ship off a getConfigInfo request to find out what config
// objects are available for editing // objects are available for editing
AdminService service = _ctx.getClient().requireService(AdminService.class); AdminService service = _ctx.getClient().requireService(AdminService.class);
service.getConfigInfo(_ctx.getClient(), this); service.getConfigInfo(this);
} }
@Override @Override
@@ -96,7 +96,7 @@ public class ConfigObjectManager implements AdminService.ConfigInfoListener
*/ */
protected void getConfigInfo () protected void getConfigInfo ()
{ {
_service.getConfigInfo(_client, this); _service.getConfigInfo(this);
} }
/** /**
@@ -79,12 +79,12 @@ public class AdminMarshaller extends InvocationMarshaller
public static final int GET_CONFIG_INFO = 1; public static final int GET_CONFIG_INFO = 1;
// from interface AdminService // from interface AdminService
public void getConfigInfo (Client arg1, AdminService.ConfigInfoListener arg2) public void getConfigInfo (AdminService.ConfigInfoListener arg1)
{ {
AdminMarshaller.ConfigInfoMarshaller listener2 = new AdminMarshaller.ConfigInfoMarshaller(); AdminMarshaller.ConfigInfoMarshaller listener1 = new AdminMarshaller.ConfigInfoMarshaller();
listener2.listener = arg2; listener1.listener = arg1;
sendRequest(arg1, GET_CONFIG_INFO, new Object[] { sendRequest(GET_CONFIG_INFO, new Object[] {
listener2 listener1
}); });
} }
} }
@@ -56,7 +56,7 @@ public abstract class BureauDirector extends BasicDirector
public void clientDidLogon (Client client) public void clientDidLogon (Client client)
{ {
super.clientDidLogon(client); super.clientDidLogon(client);
_bureauService.bureauInitialized(_ctx.getClient(), _ctx.getBureauId()); _bureauService.bureauInitialized(_ctx.getBureauId());
} }
/** /**
@@ -103,7 +103,7 @@ public abstract class BureauDirector extends BasicDirector
} else { } else {
subscriber.unsubscribe(_ctx.getDObjectManager()); subscriber.unsubscribe(_ctx.getDObjectManager());
} }
_bureauService.agentDestroyed(_ctx.getClient(), agentId); _bureauService.agentDestroyed(agentId);
} }
} }
@@ -124,12 +124,12 @@ public abstract class BureauDirector extends BasicDirector
agent.start(); agent.start();
} catch (Throwable t) { } catch (Throwable t) {
log.warning("Could not create agent", "obj", agentObject, t); log.warning("Could not create agent", "obj", agentObject, t);
_bureauService.agentCreationFailed(_ctx.getClient(), oid); _bureauService.agentCreationFailed(oid);
return; return;
} }
_agents.put(oid, agent); _agents.put(oid, agent);
_bureauService.agentCreated(_ctx.getClient(), oid); _bureauService.agentCreated(oid);
} }
/** /**
@@ -34,31 +34,31 @@ public interface BureauService extends InvocationService
* requests via the <code>BureauReceiver</code>. * requests via the <code>BureauReceiver</code>.
* @see BureauReceiver * @see BureauReceiver
*/ */
void bureauInitialized (Client client, String bureauId); void bureauInitialized (String bureauId);
/** /**
* Notifies the server that this bureau has encountered a critical error and needs to be shut * Notifies the server that this bureau has encountered a critical error and needs to be shut
* down. * down.
*/ */
void bureauError (Client client, String message); void bureauError (String message);
/** /**
* Notify the server that a previosuly requested agent is now created and ready to use. * Notify the server that a previosuly requested agent is now created and ready to use.
* @see BureauReceiver#createAgent * @see BureauReceiver#createAgent
*/ */
void agentCreated (Client client, int agentId); void agentCreated (int agentId);
/** /**
* Notify the server that a previosuly requested agent could not be created. * Notify the server that a previosuly requested agent could not be created.
* @see BureauReceiver#createAgent * @see BureauReceiver#createAgent
*/ */
void agentCreationFailed (Client client, int agentId); void agentCreationFailed (int agentId);
/** /**
* Notify the server that an agent is no longer running. Normally called in response * Notify the server that an agent is no longer running. Normally called in response
* to a call to <code>destroyAgent</code> * to a call to <code>destroyAgent</code>
* @see BureauReceiver#destroyAgent * @see BureauReceiver#destroyAgent
*/ */
void agentDestroyed (Client client, int agentId); void agentDestroyed (int agentId);
} }
@@ -43,10 +43,10 @@ public class BureauMarshaller extends InvocationMarshaller
public static final int AGENT_CREATED = 1; public static final int AGENT_CREATED = 1;
// from interface BureauService // from interface BureauService
public void agentCreated (Client arg1, int arg2) public void agentCreated (int arg1)
{ {
sendRequest(arg1, AGENT_CREATED, new Object[] { sendRequest(AGENT_CREATED, new Object[] {
Integer.valueOf(arg2) Integer.valueOf(arg1)
}); });
} }
@@ -54,10 +54,10 @@ public class BureauMarshaller extends InvocationMarshaller
public static final int AGENT_CREATION_FAILED = 2; public static final int AGENT_CREATION_FAILED = 2;
// from interface BureauService // from interface BureauService
public void agentCreationFailed (Client arg1, int arg2) public void agentCreationFailed (int arg1)
{ {
sendRequest(arg1, AGENT_CREATION_FAILED, new Object[] { sendRequest(AGENT_CREATION_FAILED, new Object[] {
Integer.valueOf(arg2) Integer.valueOf(arg1)
}); });
} }
@@ -65,10 +65,10 @@ public class BureauMarshaller extends InvocationMarshaller
public static final int AGENT_DESTROYED = 3; public static final int AGENT_DESTROYED = 3;
// from interface BureauService // from interface BureauService
public void agentDestroyed (Client arg1, int arg2) public void agentDestroyed (int arg1)
{ {
sendRequest(arg1, AGENT_DESTROYED, new Object[] { sendRequest(AGENT_DESTROYED, new Object[] {
Integer.valueOf(arg2) Integer.valueOf(arg1)
}); });
} }
@@ -76,10 +76,10 @@ public class BureauMarshaller extends InvocationMarshaller
public static final int BUREAU_ERROR = 4; public static final int BUREAU_ERROR = 4;
// from interface BureauService // from interface BureauService
public void bureauError (Client arg1, String arg2) public void bureauError (String arg1)
{ {
sendRequest(arg1, BUREAU_ERROR, new Object[] { sendRequest(BUREAU_ERROR, new Object[] {
arg2 arg1
}); });
} }
@@ -87,10 +87,10 @@ public class BureauMarshaller extends InvocationMarshaller
public static final int BUREAU_INITIALIZED = 5; public static final int BUREAU_INITIALIZED = 5;
// from interface BureauService // from interface BureauService
public void bureauInitialized (Client arg1, String arg2) public void bureauInitialized (String arg1)
{ {
sendRequest(arg1, BUREAU_INITIALIZED, new Object[] { sendRequest(BUREAU_INITIALIZED, new Object[] {
arg2 arg1
}); });
} }
} }
@@ -34,5 +34,5 @@ public interface ChannelSpeakService extends InvocationService
/** /**
* Requests to speak the supplied message on the specified channel. * Requests to speak the supplied message on the specified channel.
*/ */
public void speak (Client client, ChatChannel channel, String message, byte mode); public void speak (ChatChannel channel, String message, byte mode);
} }
@@ -467,7 +467,7 @@ public class ChatDirector extends BasicDirector
} }
// dispatch a speak request using the supplied speak service // dispatch a speak request using the supplied speak service
speakService.speak(_ctx.getClient(), message, mode); speakService.speak(message, mode);
} }
/** /**
@@ -482,7 +482,7 @@ public class ChatDirector extends BasicDirector
displayFeedback(_bundle, MessageBundle.compose("m.broadcast_failed", "m.filtered")); displayFeedback(_bundle, MessageBundle.compose("m.broadcast_failed", "m.filtered"));
return; return;
} }
_cservice.broadcast(_ctx.getClient(), message, new ChatService.InvocationListener() { _cservice.broadcast(message, new ChatService.InvocationListener() {
public void requestFailed (String reason) { public void requestFailed (String reason) {
reason = MessageBundle.compose("m.broadcast_failed", reason); reason = MessageBundle.compose("m.broadcast_failed", reason);
displayFeedback(_bundle, reason); displayFeedback(_bundle, reason);
@@ -555,7 +555,7 @@ public class ChatDirector extends BasicDirector
} }
}; };
_cservice.tell(_ctx.getClient(), target, message, listener); _cservice.tell(target, message, listener);
} }
/** /**
@@ -572,7 +572,7 @@ public class ChatDirector extends BasicDirector
} }
} }
// pass the buck right on along // pass the buck right on along
_cservice.away(_ctx.getClient(), message); _cservice.away(message);
} }
/** /**
@@ -58,7 +58,7 @@ public interface ChatService extends InvocationService
* @param message the contents of the message. * @param message the contents of the message.
* @param listener the reference that will receive the tell response. * @param listener the reference that will receive the tell response.
*/ */
void tell (Client client, Name target, String message, TellListener listener); void tell (Name target, String message, TellListener listener);
/** /**
* Requests that a message be broadcast to all users in the system. * Requests that a message be broadcast to all users in the system.
@@ -67,11 +67,11 @@ public interface ChatService extends InvocationService
* @param message the contents of the message. * @param message the contents of the message.
* @param listener the reference that will receive a failure response. * @param listener the reference that will receive a failure response.
*/ */
void broadcast (Client client, String message, InvocationListener listener); void broadcast (String message, InvocationListener listener);
/** /**
* Sets this client's away message. If the message is null or the empty string, the away * Sets this client's away message. If the message is null or the empty string, the away
* message will be cleared. * message will be cleared.
*/ */
void away (Client client, String message); void away (String message);
} }
@@ -41,5 +41,5 @@ public interface SpeakService extends InvocationService
* application specific manner. It's useful for differentiating * application specific manner. It's useful for differentiating
* between regular speech, emotes, etc. * between regular speech, emotes, etc.
*/ */
void speak (Client client, String message, byte mode); void speak (String message, byte mode);
} }
@@ -43,10 +43,10 @@ public class ChannelSpeakMarshaller extends InvocationMarshaller
public static final int SPEAK = 1; public static final int SPEAK = 1;
// from interface ChannelSpeakService // from interface ChannelSpeakService
public void speak (Client arg1, ChatChannel arg2, String arg3, byte arg4) public void speak (ChatChannel arg1, String arg2, byte arg3)
{ {
sendRequest(arg1, SPEAK, new Object[] { sendRequest(SPEAK, new Object[] {
arg2, arg3, Byte.valueOf(arg4) arg1, arg2, Byte.valueOf(arg3)
}); });
} }
} }
@@ -81,10 +81,10 @@ public class ChatMarshaller extends InvocationMarshaller
public static final int AWAY = 1; public static final int AWAY = 1;
// from interface ChatService // from interface ChatService
public void away (Client arg1, String arg2) public void away (String arg1)
{ {
sendRequest(arg1, AWAY, new Object[] { sendRequest(AWAY, new Object[] {
arg2 arg1
}); });
} }
@@ -92,12 +92,12 @@ public class ChatMarshaller extends InvocationMarshaller
public static final int BROADCAST = 2; public static final int BROADCAST = 2;
// from interface ChatService // from interface ChatService
public void broadcast (Client arg1, String arg2, InvocationService.InvocationListener arg3) public void broadcast (String arg1, InvocationService.InvocationListener arg2)
{ {
ListenerMarshaller listener3 = new ListenerMarshaller(); ListenerMarshaller listener2 = new ListenerMarshaller();
listener3.listener = arg3; listener2.listener = arg2;
sendRequest(arg1, BROADCAST, new Object[] { sendRequest(BROADCAST, new Object[] {
arg2, listener3 arg1, listener2
}); });
} }
@@ -105,12 +105,12 @@ public class ChatMarshaller extends InvocationMarshaller
public static final int TELL = 3; public static final int TELL = 3;
// from interface ChatService // from interface ChatService
public void tell (Client arg1, Name arg2, String arg3, ChatService.TellListener arg4) public void tell (Name arg1, String arg2, ChatService.TellListener arg3)
{ {
ChatMarshaller.TellMarshaller listener4 = new ChatMarshaller.TellMarshaller(); ChatMarshaller.TellMarshaller listener3 = new ChatMarshaller.TellMarshaller();
listener4.listener = arg4; listener3.listener = arg3;
sendRequest(arg1, TELL, new Object[] { sendRequest(TELL, new Object[] {
arg2, arg3, listener4 arg1, arg2, listener3
}); });
} }
} }
@@ -43,10 +43,10 @@ public class SpeakMarshaller extends InvocationMarshaller
public static final int SPEAK = 1; public static final int SPEAK = 1;
// from interface SpeakService // from interface SpeakService
public void speak (Client arg1, String arg2, byte arg3) public void speak (String arg1, byte arg2)
{ {
sendRequest(arg1, SPEAK, new Object[] { sendRequest(SPEAK, new Object[] {
arg2, Byte.valueOf(arg3) arg1, Byte.valueOf(arg2)
}); });
} }
} }
@@ -33,5 +33,5 @@ public interface BodyService extends InvocationService
* Requests to set the idle state of the client to the specified * Requests to set the idle state of the client to the specified
* value. * value.
*/ */
void setIdle (Client client, boolean idle); void setIdle (boolean idle);
} }
@@ -159,7 +159,7 @@ public class LocationDirector extends BasicDirector
// issue a moveTo request // issue a moveTo request
log.info("Issuing moveTo(" + placeId + ")."); log.info("Issuing moveTo(" + placeId + ").");
_lservice.moveTo(_ctx.getClient(), placeId, new LocationService.MoveListener() { _lservice.moveTo(placeId, new LocationService.MoveListener() {
public void moveSucceeded (PlaceConfig config) { public void moveSucceeded (PlaceConfig config) {
// handle the successful move // handle the successful move
didMoveTo(_pendingPlaceId, config); didMoveTo(_pendingPlaceId, config);
@@ -210,7 +210,7 @@ public class LocationDirector extends BasicDirector
return false; return false;
} }
_lservice.leavePlace(_ctx.getClient()); _lservice.leavePlace();
didLeavePlace(); didLeavePlace();
// let our observers know that we're no longer in a location // let our observers know that we're no longer in a location
@@ -52,10 +52,10 @@ public interface LocationService extends InvocationService
* @param placeId the object id of the place object to which the body should be moved. * @param placeId the object id of the place object to which the body should be moved.
* @param listener the listener that will be informed of success or failure. * @param listener the listener that will be informed of success or failure.
*/ */
void moveTo (Client client, int placeId, MoveListener listener); void moveTo (int placeId, MoveListener listener);
/** /**
* Requests that we leave our current place and move to nowhere land. * Requests that we leave our current place and move to nowhere land.
*/ */
void leavePlace (Client client); void leavePlace ();
} }
@@ -43,10 +43,10 @@ public class BodyMarshaller extends InvocationMarshaller
public static final int SET_IDLE = 1; public static final int SET_IDLE = 1;
// from interface BodyService // from interface BodyService
public void setIdle (Client arg1, boolean arg2) public void setIdle (boolean arg1)
{ {
sendRequest(arg1, SET_IDLE, new Object[] { sendRequest(SET_IDLE, new Object[] {
Boolean.valueOf(arg2) Boolean.valueOf(arg1)
}); });
} }
} }
@@ -79,9 +79,9 @@ public class LocationMarshaller extends InvocationMarshaller
public static final int LEAVE_PLACE = 1; public static final int LEAVE_PLACE = 1;
// from interface LocationService // from interface LocationService
public void leavePlace (Client arg1) public void leavePlace ()
{ {
sendRequest(arg1, LEAVE_PLACE, new Object[] { sendRequest(LEAVE_PLACE, new Object[] {
}); });
} }
@@ -89,12 +89,12 @@ public class LocationMarshaller extends InvocationMarshaller
public static final int MOVE_TO = 2; public static final int MOVE_TO = 2;
// from interface LocationService // from interface LocationService
public void moveTo (Client arg1, int arg2, LocationService.MoveListener arg3) public void moveTo (int arg1, LocationService.MoveListener arg2)
{ {
LocationMarshaller.MoveMarshaller listener3 = new LocationMarshaller.MoveMarshaller(); LocationMarshaller.MoveMarshaller listener2 = new LocationMarshaller.MoveMarshaller();
listener3.listener = arg3; listener2.listener = arg2;
sendRequest(arg1, MOVE_TO, new Object[] { sendRequest(MOVE_TO, new Object[] {
Integer.valueOf(arg2), listener3 Integer.valueOf(arg1), listener2
}); });
} }
} }
@@ -38,11 +38,11 @@ public interface CrowdPeerService extends InvocationService
* Used to forward a tell request to the server on which the destination user actually * Used to forward a tell request to the server on which the destination user actually
* occupies. * occupies.
*/ */
void deliverTell (Client client, UserMessage message, Name target, void deliverTell (UserMessage message, Name target,
ChatService.TellListener listener); ChatService.TellListener listener);
/** /**
* Dispatches a broadcast message on this peer. * Dispatches a broadcast message on this peer.
*/ */
void deliverBroadcast (Client client, Name from, byte levelOrMode, String bundle, String msg); void deliverBroadcast (Name from, byte levelOrMode, String bundle, String msg);
} }
@@ -47,10 +47,10 @@ public class CrowdPeerMarshaller extends InvocationMarshaller
public static final int DELIVER_BROADCAST = 1; public static final int DELIVER_BROADCAST = 1;
// from interface CrowdPeerService // from interface CrowdPeerService
public void deliverBroadcast (Client arg1, Name arg2, byte arg3, String arg4, String arg5) public void deliverBroadcast (Name arg1, byte arg2, String arg3, String arg4)
{ {
sendRequest(arg1, DELIVER_BROADCAST, new Object[] { sendRequest(DELIVER_BROADCAST, new Object[] {
arg2, Byte.valueOf(arg3), arg4, arg5 arg1, Byte.valueOf(arg2), arg3, arg4
}); });
} }
@@ -58,12 +58,12 @@ public class CrowdPeerMarshaller extends InvocationMarshaller
public static final int DELIVER_TELL = 2; public static final int DELIVER_TELL = 2;
// from interface CrowdPeerService // from interface CrowdPeerService
public void deliverTell (Client arg1, UserMessage arg2, Name arg3, ChatService.TellListener arg4) public void deliverTell (UserMessage arg1, Name arg2, ChatService.TellListener arg3)
{ {
ChatMarshaller.TellMarshaller listener4 = new ChatMarshaller.TellMarshaller(); ChatMarshaller.TellMarshaller listener3 = new ChatMarshaller.TellMarshaller();
listener4.listener = arg4; listener3.listener = arg3;
sendRequest(arg1, DELIVER_TELL, new Object[] { sendRequest(DELIVER_TELL, new Object[] {
arg2, arg3, listener4 arg1, arg2, listener3
}); });
} }
} }
@@ -93,7 +93,7 @@ public abstract class CrowdPeerManager extends PeerManager
// we have to use auth username to look up their ClientInfo // we have to use auth username to look up their ClientInfo
CrowdClientInfo cinfo = (CrowdClientInfo)cnobj.clients.get(username); CrowdClientInfo cinfo = (CrowdClientInfo)cnobj.clients.get(username);
if (cinfo != null) { if (cinfo != null) {
cnobj.crowdPeerService.deliverTell(peer.getClient(), message, target, listener); cnobj.crowdPeerService.deliverTell(message, target, listener);
return true; return true;
} }
} }
@@ -106,7 +106,7 @@ public abstract class CrowdPeerManager extends PeerManager
for (PeerNode peer : _peers.values()) { for (PeerNode peer : _peers.values()) {
if (peer.nodeobj != null) { if (peer.nodeobj != null) {
((CrowdNodeObject)peer.nodeobj).crowdPeerService.deliverBroadcast( ((CrowdNodeObject)peer.nodeobj).crowdPeerService.deliverBroadcast(
peer.getClient(), from, levelOrMode, bundle, msg); from, levelOrMode, bundle, msg);
} }
} }
} }
@@ -9,5 +9,5 @@ import com.threerings.presents.client.InvocationReceiver.Registration;
*/ */
public interface RegistrationService public interface RegistrationService
{ {
void registerReceiver(Client client, Registration registration); void registerReceiver(Registration registration);
} }
@@ -41,5 +41,5 @@ public interface TimeBaseService extends InvocationService
/** /**
* Requests the oid of the specified time base object be fetched. * Requests the oid of the specified time base object be fetched.
*/ */
void getTimeOid (Client client, String timeBase, GotTimeBaseListener listener); void getTimeOid (String timeBase, GotTimeBaseListener listener);
} }
@@ -282,13 +282,15 @@ public class InvocationMarshaller
_invdir.sendRequest(_invOid, _invCode, methodId, args, transport); _invdir.sendRequest(_invOid, _invCode, methodId, args, transport);
} }
@Deprecated /** @deprecated use client-argument-free version. */ /** @deprecated use client-argument-free version. */
@Deprecated
protected void sendRequest (Client client, int methodId, Object[] args) protected void sendRequest (Client client, int methodId, Object[] args)
{ {
sendRequest(client, methodId, args, Transport.DEFAULT); sendRequest(client, methodId, args, Transport.DEFAULT);
} }
@Deprecated /** @deprecated use client-argument-free version. */ /** @deprecated use client-argument-free version. */
@Deprecated
protected void sendRequest (Client client, int methodId, Object[] args, Transport transport) protected void sendRequest (Client client, int methodId, Object[] args, Transport transport)
{ {
client.getInvocationDirector().sendRequest(_invOid, _invCode, methodId, args, transport); client.getInvocationDirector().sendRequest(_invOid, _invCode, methodId, args, transport);
@@ -22,10 +22,10 @@ public class RegistrationMarshaller extends InvocationMarshaller
public static final int REGISTER_RECEIVER = 1; public static final int REGISTER_RECEIVER = 1;
// from interface RegistrationService // from interface RegistrationService
public void registerReceiver (Client arg1, InvocationReceiver.Registration arg2) public void registerReceiver (InvocationReceiver.Registration arg1)
{ {
sendRequest(arg1, REGISTER_RECEIVER, new Object[] { sendRequest(REGISTER_RECEIVER, new Object[] {
arg2 arg1
}); });
} }
} }
@@ -78,12 +78,12 @@ public class TimeBaseMarshaller extends InvocationMarshaller
public static final int GET_TIME_OID = 1; public static final int GET_TIME_OID = 1;
// from interface TimeBaseService // from interface TimeBaseService
public void getTimeOid (Client arg1, String arg2, TimeBaseService.GotTimeBaseListener arg3) public void getTimeOid (String arg1, TimeBaseService.GotTimeBaseListener arg2)
{ {
TimeBaseMarshaller.GotTimeBaseMarshaller listener3 = new TimeBaseMarshaller.GotTimeBaseMarshaller(); TimeBaseMarshaller.GotTimeBaseMarshaller listener2 = new TimeBaseMarshaller.GotTimeBaseMarshaller();
listener3.listener = arg3; listener2.listener = arg2;
sendRequest(arg1, GET_TIME_OID, new Object[] { sendRequest(GET_TIME_OID, new Object[] {
arg2, listener3 arg1, listener2
}); });
} }
} }
@@ -34,18 +34,18 @@ public interface PeerService extends InvocationService
* Informs the node that the sending peer ratifies its acquisition or release of the specified * Informs the node that the sending peer ratifies its acquisition or release of the specified
* lock. * lock.
*/ */
void ratifyLockAction (Client client, Lock lock, boolean acquire); void ratifyLockAction (Lock lock, boolean acquire);
/** /**
* Requests that the specified action be invoked on this server. * Requests that the specified action be invoked on this server.
*/ */
void invokeAction (Client client, byte[] serializedAction); void invokeAction (byte[] serializedAction);
/** /**
* Requests that the specified request be invoked on this server and wants a confirmation * Requests that the specified request be invoked on this server and wants a confirmation
* when it's complete. * when it's complete.
*/ */
void invokeRequest (Client client, byte[] serializedAction, ResultListener listener); void invokeRequest (byte[] serializedAction, ResultListener listener);
/** /**
* Generates a server status report for this peer and returns it to the supplied listener. The * Generates a server status report for this peer and returns it to the supplied listener. The
@@ -53,5 +53,5 @@ public interface PeerService extends InvocationService
* *
* @param type the type of report to generate. See ReportManager for more information. * @param type the type of report to generate. See ReportManager for more information.
*/ */
void generateReport (Client client, String type, ResultListener listener); void generateReport (String type, ResultListener listener);
} }
@@ -44,12 +44,12 @@ public class PeerMarshaller extends InvocationMarshaller
public static final int GENERATE_REPORT = 1; public static final int GENERATE_REPORT = 1;
// from interface PeerService // from interface PeerService
public void generateReport (Client arg1, String arg2, InvocationService.ResultListener arg3) public void generateReport (String arg1, InvocationService.ResultListener arg2)
{ {
InvocationMarshaller.ResultMarshaller listener3 = new InvocationMarshaller.ResultMarshaller(); InvocationMarshaller.ResultMarshaller listener2 = new InvocationMarshaller.ResultMarshaller();
listener3.listener = arg3; listener2.listener = arg2;
sendRequest(arg1, GENERATE_REPORT, new Object[] { sendRequest(GENERATE_REPORT, new Object[] {
arg2, listener3 arg1, listener2
}); });
} }
@@ -57,10 +57,10 @@ public class PeerMarshaller extends InvocationMarshaller
public static final int INVOKE_ACTION = 2; public static final int INVOKE_ACTION = 2;
// from interface PeerService // from interface PeerService
public void invokeAction (Client arg1, byte[] arg2) public void invokeAction (byte[] arg1)
{ {
sendRequest(arg1, INVOKE_ACTION, new Object[] { sendRequest(INVOKE_ACTION, new Object[] {
arg2 arg1
}); });
} }
@@ -68,12 +68,12 @@ public class PeerMarshaller extends InvocationMarshaller
public static final int INVOKE_REQUEST = 3; public static final int INVOKE_REQUEST = 3;
// from interface PeerService // from interface PeerService
public void invokeRequest (Client arg1, byte[] arg2, InvocationService.ResultListener arg3) public void invokeRequest (byte[] arg1, InvocationService.ResultListener arg2)
{ {
InvocationMarshaller.ResultMarshaller listener3 = new InvocationMarshaller.ResultMarshaller(); InvocationMarshaller.ResultMarshaller listener2 = new InvocationMarshaller.ResultMarshaller();
listener3.listener = arg3; listener2.listener = arg2;
sendRequest(arg1, INVOKE_REQUEST, new Object[] { sendRequest(INVOKE_REQUEST, new Object[] {
arg2, listener3 arg1, listener2
}); });
} }
@@ -81,10 +81,10 @@ public class PeerMarshaller extends InvocationMarshaller
public static final int RATIFY_LOCK_ACTION = 4; public static final int RATIFY_LOCK_ACTION = 4;
// from interface PeerService // from interface PeerService
public void ratifyLockAction (Client arg1, NodeObject.Lock arg2, boolean arg3) public void ratifyLockAction (NodeObject.Lock arg1, boolean arg2)
{ {
sendRequest(arg1, RATIFY_LOCK_ACTION, new Object[] { sendRequest(RATIFY_LOCK_ACTION, new Object[] {
arg2, Boolean.valueOf(arg3) arg1, Boolean.valueOf(arg2)
}); });
} }
} }
@@ -434,7 +434,7 @@ public abstract class PeerManager
// now send it to any remote node that is also appropriate // now send it to any remote node that is also appropriate
for (PeerNode peer : _peers.values()) { for (PeerNode peer : _peers.values()) {
if (peer.nodeobj != null && action.isApplicable(peer.nodeobj)) { if (peer.nodeobj != null && action.isApplicable(peer.nodeobj)) {
peer.nodeobj.peerService.invokeAction(peer.getClient(), actionBytes); peer.nodeobj.peerService.invokeAction(actionBytes);
invoked = true; invoked = true;
} }
} }
@@ -457,7 +457,7 @@ public abstract class PeerManager
{ {
PeerNode peer = _peers.get(nodeName); PeerNode peer = _peers.get(nodeName);
if (peer != null) { if (peer != null) {
peer.nodeobj.peerService.invokeAction(peer.getClient(), flattenAction(action)); peer.nodeobj.peerService.invokeAction(flattenAction(action));
} else if (nodeName.equals(_nodeName)) { } else if (nodeName.equals(_nodeName)) {
invokeAction(null, flattenAction(action)); invokeAction(null, flattenAction(action));
} }
@@ -1299,7 +1299,7 @@ public abstract class PeerManager
{ {
PeerNode peer = _peers.get(nodeName); PeerNode peer = _peers.get(nodeName);
if (peer != null) { if (peer != null) {
peer.nodeobj.peerService.invokeRequest(peer.getClient(), requestBytes, listener); peer.nodeobj.peerService.invokeRequest(requestBytes, listener);
} else if (nodeName.equals(_nodeName)) { } else if (nodeName.equals(_nodeName)) {
invokeRequest(null, requestBytes, listener); invokeRequest(null, requestBytes, listener);
} }
@@ -1370,7 +1370,7 @@ public abstract class PeerManager
_acquire = acquire; _acquire = acquire;
// ratify the action // ratify the action
peer.nodeobj.peerService.ratifyLockAction(peer.getClient(), lock, acquire); peer.nodeobj.peerService.ratifyLockAction(lock, acquire);
// listen for the act to take place // listen for the act to take place
peer.nodeobj.addListener(this); peer.nodeobj.addListener(this);
@@ -69,7 +69,7 @@ public class TestClient
three.add(3); three.add(3);
three.add(4); three.add(4);
three.add(5); three.add(5);
service.test(client, "one", 2, three, new TestService.TestFuncListener() { service.test("one", 2, three, new TestService.TestFuncListener() {
public void testSucceeded (String one, int two) { public void testSucceeded (String one, int two) {
log.info("Got test response [one=" + one + ", two=" + two + "]."); log.info("Got test response [one=" + one + ", two=" + two + "].");
} }
@@ -79,7 +79,7 @@ public class TestClient
}); });
// get the test object id // get the test object id
service.getTestOid(client, this); service.getTestOid(this);
} }
// from interface SessionObserver // from interface SessionObserver
@@ -116,7 +116,7 @@ public class TestClient
// ask for the power // ask for the power
TestService service = _client.requireService(TestService.class); TestService service = _client.requireService(TestService.class);
service.giveMeThePower(_client, new TestService.ConfirmListener() { service.giveMeThePower(new TestService.ConfirmListener() {
public void requestProcessed () { public void requestProcessed () {
log.info("We have the power!"); log.info("We have the power!");
// now try blowing through our message limit again // now try blowing through our message limit again
@@ -43,12 +43,12 @@ public interface TestService extends InvocationService
} }
/** Issues a test request. */ /** Issues a test request. */
public void test (Client client, String one, int two, List<Integer> three, public void test (String one, int two, List<Integer> three,
TestFuncListener listener); TestFuncListener listener);
/** Issues a request for the test oid. */ /** Issues a request for the test oid. */
public void getTestOid (Client client, TestOidListener listener); public void getTestOid (TestOidListener listener);
/** Tests upping the client's maximum message rate. */ /** Tests upping the client's maximum message rate. */
public void giveMeThePower (Client client, ConfirmListener listener); public void giveMeThePower (ConfirmListener listener);
} }
@@ -115,12 +115,12 @@ public class TestMarshaller extends InvocationMarshaller
public static final int GET_TEST_OID = 1; public static final int GET_TEST_OID = 1;
// from interface TestService // from interface TestService
public void getTestOid (Client arg1, TestService.TestOidListener arg2) public void getTestOid (TestService.TestOidListener arg1)
{ {
TestMarshaller.TestOidMarshaller listener2 = new TestMarshaller.TestOidMarshaller(); TestMarshaller.TestOidMarshaller listener1 = new TestMarshaller.TestOidMarshaller();
listener2.listener = arg2; listener1.listener = arg1;
sendRequest(arg1, GET_TEST_OID, new Object[] { sendRequest(GET_TEST_OID, new Object[] {
listener2 listener1
}); });
} }
@@ -128,12 +128,12 @@ public class TestMarshaller extends InvocationMarshaller
public static final int GIVE_ME_THE_POWER = 2; public static final int GIVE_ME_THE_POWER = 2;
// from interface TestService // from interface TestService
public void giveMeThePower (Client arg1, InvocationService.ConfirmListener arg2) public void giveMeThePower (InvocationService.ConfirmListener arg1)
{ {
InvocationMarshaller.ConfirmMarshaller listener2 = new InvocationMarshaller.ConfirmMarshaller(); InvocationMarshaller.ConfirmMarshaller listener1 = new InvocationMarshaller.ConfirmMarshaller();
listener2.listener = arg2; listener1.listener = arg1;
sendRequest(arg1, GIVE_ME_THE_POWER, new Object[] { sendRequest(GIVE_ME_THE_POWER, new Object[] {
listener2 listener1
}); });
} }
@@ -141,12 +141,12 @@ public class TestMarshaller extends InvocationMarshaller
public static final int TEST = 3; public static final int TEST = 3;
// from interface TestService // from interface TestService
public void test (Client arg1, String arg2, int arg3, List<Integer> arg4, TestService.TestFuncListener arg5) public void test (String arg1, int arg2, List<Integer> arg3, TestService.TestFuncListener arg4)
{ {
TestMarshaller.TestFuncMarshaller listener5 = new TestMarshaller.TestFuncMarshaller(); TestMarshaller.TestFuncMarshaller listener4 = new TestMarshaller.TestFuncMarshaller();
listener5.listener = arg5; listener4.listener = arg4;
sendRequest(arg1, TEST, new Object[] { sendRequest(TEST, new Object[] {
arg2, Integer.valueOf(arg3), arg4, listener5 arg1, Integer.valueOf(arg2), arg3, listener4
}); });
} }
} }