Commit 086338f6 authored by yannick legoc's avatar yannick legoc

Added get variable list request in CommandZoneAccessor for getting the list of...

Added get variable list request in CommandZoneAccessor for getting the list of available loop variables in a given command box
parent ba4b1d5e
......@@ -18,6 +18,7 @@
package fr.ill.ics.nscclient.command;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
......@@ -2530,6 +2531,45 @@ public class CommandZoneAccessor {
return 1;
}
public String[] getVariableList(int commandBoxID) {
// Create the message type.
CommandZoneRequests.Message type = CommandZoneRequests.Message.newBuilder()
.setType(CommandZoneRequests.Message.Type.GetVariableList)
.build();
// Create the request.
CommandZoneRequests.CommandBoxRequest request = CommandZoneRequests.CommandBoxRequest.newBuilder()
.setCommandBoxID(commandBoxID)
.build();
commandBoxRequester.sendTwoParts(type.toByteArray(), request.toByteArray());
try {
Common.StringArrayResponse response = Common.StringArrayResponse.parseFrom(commandBoxRequester.receive());
// Test the error.
if (response.hasError()) {
processError(response.getError(), commandBoxID);
}
else {
int size = response.getValueCount();
String[] result = new String[size];
for (int i = 0; i < size; ++i) {
result[i] = response.getValue(i);
}
return result;
}
}
catch (InvalidProtocolBufferException e) {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "getVariableList", "error in parsing response for command box " + commandBoxID);
}
return null;
}
public int create() {
......
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