Commit 90c631ae authored by legoc's avatar legoc
Browse files

Client ID in CommandLineStateRequest

parent 3a7bcd83
......@@ -28,12 +28,14 @@ import fr.ill.ics.cameo.RequesterCreationException;
import fr.ill.ics.nomadserver.commandline.CommandLineRequest;
import fr.ill.ics.nomadserver.common.Common;
import fr.ill.ics.nscclient.serverconnection.ServerInstance;
import fr.ill.ics.nscclient.sessionmanagement.SessionManager;
public class CommandLineAccessor {
private static Map<String, CommandLineAccessor> instances = new HashMap<String, CommandLineAccessor>();
private String serverId;
private Integer clientId;
private Application.Requester commandLineRequester;
private CommandLineAccessor(String serverId) {
......@@ -78,6 +80,16 @@ public class CommandLineAccessor {
commandLineRequester.terminate();
}
private int getClientID() {
if (clientId == null) {
// Get the client id from the session manager.
clientId = SessionManager.getInstance(serverId).getClientId();
}
return clientId;
}
public synchronized void executeCommand(String text) {
// Create the message type.
......@@ -243,6 +255,7 @@ public class CommandLineAccessor {
// Create the request.
CommandLineRequest.CommandLineStateRequest request = CommandLineRequest.CommandLineStateRequest.newBuilder()
.setClientID(getClientID())
.setState(state)
.build();
......
......@@ -41,7 +41,7 @@ public class CommandLineSyncEventNotifier {
return clientId;
}
public ICommandLineSyncEvent processMessage(NotificationMessage.CommandLineSync message) {
try {
......@@ -51,10 +51,10 @@ public class CommandLineSyncEventNotifier {
CommandLineRequest.CommandLineStateRequest request = CommandLineRequest.CommandLineStateRequest.parseFrom(message.getSerializedContent());
// Notify if it is not the same client that sent the request.
//if (request.getClientID() != getClientID()) {
if (request.getClientID() != getClientID()) {
System.out.println("Process command line sync message of type " + type);
return new CommandLineSyncEvent();
//}
}
}
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment