Commit 931b3e82 authored by Cristina Cocho's avatar Cristina Cocho

merged with last version of master in order to be able to use NomadGUI

parents e9e1c6fc a83a9a61
3.1.10 DD/MM/YYYY
3.2.1 29/04/2019
------
* Overwritten equals method in Property class.
3.2.0 11/02/2019
------
* Implementation of expressions and variables.
3.1.9 12/10/2018
-----
......
......@@ -174,6 +174,10 @@ public class ControllerManager implements ServerConfigurationChangeListener {
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);
}
......
......@@ -33,6 +33,9 @@ public class Int32Property extends IntegerProperty {
return true;
}
catch (NumberFormatException e) {
if (getPropertyFormat().acceptsValue(value)) { // Case of hexadecimal integer value
return true;
}
return false;
}
}
......
......@@ -865,6 +865,15 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
}
public String getControllerNameForDynamicOrNot() {
int servantId = PropertyDatabase.getInstance().getServantIdForProperty(id);
if (servantId == -1) {
servantId = PropertyDatabase.getInstance().getServantIdForDynamicProperty(id);
}
return getServantName(servantId);
}
private String getServantName(int servantId) {
if (ServantDatabase.getInstance().isController(servantId)) {
return ServantDatabase.getInstance().getControllerName(servantId);
......@@ -902,6 +911,18 @@ public abstract class Property implements ServerPropertyChangeListener, ICommand
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Property other = (Property)obj;
return id == other.getPropertyID();
}
public abstract String getType();
......
......@@ -267,7 +267,6 @@ public class PropertyManager {
return false;
}
} else {
for (int i = 0; i < files.length; i++) {
// We may have more than one "Properties.xml" file (see acquisition controller for example)
propertyParser.parseXmlFile(files[i]);
......@@ -276,9 +275,14 @@ public class PropertyManager {
}
ConfigManager.getInstance().initControllerProperties(controllerType);
/***** AVANT : les spies marchent ****/
clientFilesFoundPerControllerType.put(controllerType, true);
return true;
/*
APRES c'est pour le multiclient !!!!
clientFilesFoundPerControllerType.put(controllerType, !(files == null || files.length == 0));
return clientFilesFoundPerControllerType.get(controllerType);*/
}
......
......@@ -2530,6 +2530,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() {
......
......@@ -20,11 +20,13 @@ package fr.ill.ics.nscclient.dataprovider;
import java.util.ArrayList;
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;
......@@ -1217,4 +1219,35 @@ public class ServantManagerAccessor {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "logUserMessage", "error in parsing response");
}
}
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