Commit c091c2ac authored by Hélène Ortiz's avatar Hélène Ortiz
parents 216e20f9 13e843d3
3.2.1 DD/MM/YYYY
3.2.1 29/04/2019
------
* Overwritten equals method in Property class.
......
......@@ -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