If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 13e843d3 authored by yannick legoc's avatar yannick legoc

Added the request to get the list of controller types inheriting another type

parent f86ccdfa
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>3.2.1</version>
<version>3.2.1-SNAPSHOT</version>
<name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description>
<scm>
......
......@@ -128,11 +128,16 @@ public class ControllerManager implements ServerConfigurationChangeListener {
return ServantDatabase.getInstance().getControllersOfType(type, onlyVisibleOnes);
}
public Set<String> getControllerTypes() {
return ServantDatabase.getInstance().getControllerTypes();
}
public Set<String> getControllerTypesInheritingType(int databaseID, String controllerType) {
return ServantManagerAccessor.getInstance(serverId).getControllerTypesInheritingType(databaseID, controllerType);
}
public boolean controllerIsEnabled(String controllerName) {
return ServantDatabase.getInstance().controllerIsEnabled(controllerName);
......
......@@ -19,11 +19,13 @@
package fr.ill.ics.nscclient.dataprovider;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.logging.Level;
......@@ -1027,4 +1029,34 @@ public class ServantManagerAccessor {
}
}
public Set<String> getControllerTypesInheritingType(int databaseID, String controllerType) {
// Create the message type.
ServantManagerRequest.Message type = ServantManagerRequest.Message.newBuilder()
.setType(ServantManagerRequest.Message.Type.GetControllerTypesInheritingType)
.build();
// Create the request.
ServantManagerRequest.GetControllerTypesInheritingTypeRequest request = ServantManagerRequest.GetControllerTypesInheritingTypeRequest.newBuilder()
.setDatabaseID(databaseID)
.setType(controllerType)
.build();
servantManagerRequester.sendTwoParts(type.toByteArray(), request.toByteArray());
try {
Common.StringArrayResponse response = Common.StringArrayResponse.parseFrom(servantManagerRequester.receive());
HashSet<String> result = new HashSet<String>();
Iterator<String> t = response.getValueList().iterator();
while (t.hasNext()) {
result.add(t.next());
}
return result;
}
catch (InvalidProtocolBufferException e) {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "getControllerTypesInheritingType", "error in parsing response");
}
return null;
}
}
\ No newline at end of file
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