Commit d81edde7 authored by Cristina Cocho's avatar Cristina Cocho

Merge done with master

parents 6bf61a59 296ec324
......@@ -6,6 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......
3.1.1
3.1.10 DD/MM/YYYY
------
3.1.9 12/10/2018
-----
* Change HashMap to TreeMap so that controller and property combo in generic command boxes are sorted.
3.1.8 DD/MM/YYYY
-----
* Remove deprecated code (since Java 10).
3.1.7 30/08/2018
-----
* Modifications for dynamic properties management.
3.1.6 06/04/2018
-----
* Added more control on the subscriber termination in survey.
3.1.5 06/04/2018
-----
* Do not call logoutAll in login. The call is made in the main application (NomadGUI, etc.).
3.1.4 13/03/2018
-----
* Avoid a NullPointerException when ConfigurationException.controllerName is null.
* Fix bug: Bad initialisation of a for loop command box while launching Nomad while the command zone already contains a for loop command box.
3.1.3 09/01/2018
-----
* Fix bug: when getting servant for a property, Nomad searches among controllers without checking before that the servant is really a controller and not a driver...
* Moved ParameterizableScan1D related classes to GUI special modules.
3.1.2 11/12/2017
-----
* Add methods for getting controller and family icon keys map from server (needed for tablette client).
* Replaced protocol buffers array encoding with Xavier training's project to speed up the transfers.
3.1.1 19/10/2017
-----
* Catch exception thrown when trying to format a invalid float value (avoid a client crash : see brisp 03 nov 2016).
* Replaced Corba with Cameo.
......
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description>
<scm>
......@@ -54,14 +54,25 @@
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-api-java-jzmq</artifactId>
<version>0.1.2-SNAPSHOT</version>
<artifactId>protobuf-lite</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-api</artifactId>
<version>0.1.4</version>
<exclusions>
<exclusion>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-com-jeromq</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-com-jzmq</artifactId>
<version>0.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
......@@ -159,6 +170,11 @@
<arg line="${protoFlags} ${protoDir}/CommandLineRequests.proto" />
</exec>
<echo message="Generating VariableManagerRequests.java" />
<exec executable="protoc">
<arg line="${protoFlags} ${protoDir}/VariableManagerRequests.proto" />
</exec>
<echo message="Generating ConditionManagerRequests.java" />
<exec executable="protoc">
<arg line="${protoFlags} ${protoDir}/ConditionManagerRequests.proto" />
......
......@@ -25,7 +25,7 @@ import java.util.Map.Entry;
import fr.ill.ics.nscclient.log.LogSubscriber;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
import fr.ill.ics.nscclient.survey.SurveySubcriberImpl;
import fr.ill.ics.nscclient.survey.SurveySubscriberImpl;
public class ChangeManager {
......@@ -56,10 +56,10 @@ public class ChangeManager {
}
// Iterating the map of survey subscribers
Map<String, SurveySubcriberImpl> surveySubscriberMap = SurveySubcriberImpl.getInstances();
Iterator<Entry<String, SurveySubcriberImpl>> it2 = surveySubscriberMap.entrySet().iterator();
Map<String, SurveySubscriberImpl> surveySubscriberMap = SurveySubscriberImpl.getInstances();
Iterator<Entry<String, SurveySubscriberImpl>> it2 = surveySubscriberMap.entrySet().iterator();
while (it2.hasNext()) {
SurveySubcriberImpl surveySubscriber = it2.next().getValue();
SurveySubscriberImpl surveySubscriber = it2.next().getValue();
surveySubscriber.readAndDispatch();
}
}
......
......@@ -41,30 +41,30 @@ import fr.ill.ics.util.exception.ControllerNotFoundException;
public class ControllerManager implements ServerConfigurationChangeListener {
private String serverId;
private HashMap<String, LinkedHashSet<String>> visibleControllerNamesByType; // KEY=controller type VALUE=list of matching controller names
private HashMap<String, LinkedHashSet<String>> allControllerNamesByType; // KEY=controller type VALUE=list of matching controller names
private static ControllerManager instance = null;
public static ControllerManager getInstance() {
return instance;
}
public static void initInstance(String serverId) {
instance = new ControllerManager(serverId);
instance.init();
}
public static void resetInstance() {
instance = null;
}
public static ControllerManager getInstance() {
return instance;
}
public static void initInstance(String serverId) {
instance = new ControllerManager(serverId);
instance.init();
}
public static void resetInstance() {
instance = null;
}
public void addConfigurationChangeListener(ServerConfigurationChangeListener listener) {
DataNotificationClient.getInstance().addConfigurationChangeListener(listener);
}
public ControllerManager(String serverId) {
this.serverId = serverId;
......@@ -81,7 +81,7 @@ public class ControllerManager implements ServerConfigurationChangeListener {
protected void reset() {
try {
ServantManagerAccessor.getInstance(serverId).updateWholeConfiguration();
} catch (LoadConfigurationFailure e) {
System.err.println("Unable to update the whole configuration");
}
......@@ -92,16 +92,17 @@ public class ControllerManager implements ServerConfigurationChangeListener {
/**
*
*/
public ControllerServant getController(String controllerName) {
public ControllerServant getController(String controllerName) throws ControllerNotFoundException {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
ControllerServant controller = ServantManagerAccessor.getInstance(serverId).getController(descriptor);
return controller;
}
ControllerNotFoundException cnfe = new ControllerNotFoundException(controllerName, "", getClass().getCanonicalName(), "getController");
return null;
throw cnfe;
}
public ControllerServant cloneController(String controllerName) throws ControllerNotFoundException {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
......@@ -126,8 +127,8 @@ public class ControllerManager implements ServerConfigurationChangeListener {
public Set<String> getControllersOfType(String type, boolean onlyVisibleOnes) {
return ServantDatabase.getInstance().getControllersOfType(type, onlyVisibleOnes);
}
public Set<String> getControllerTypes() {
return ServantDatabase.getInstance().getControllerTypes();
}
......@@ -138,11 +139,11 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
public HashMap<String, LinkedHashMap<String, String>> getPropertiesForGeneric() {
public TreeMap<String, LinkedHashMap<String, String>> getPropertiesForGeneric() {
return ServantManagerAccessor.getInstance(serverId).getPropertiesForGeneric();
}
public String getType(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
......@@ -150,26 +151,26 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
return null;
}
private Map<String, Map<String, List<String>>> getInstalledControllers(boolean testCommand) {
Map<String, Map<String, List<String>>> installedControllers = new TreeMap<String, Map<String, List<String>>>();
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
boolean testCommandOk = true;
if (testCommand && !descriptor.isCommand()) {
testCommandOk = false;
}
if (testCommandOk && descriptor.isEnabled() && descriptor.isVisible()) {
String family = descriptor.getFamily();
String subfamily = descriptor.getSubfamily();
Map<String, List<String>> familyMembers = installedControllers.get(family);
if (familyMembers == null) {
familyMembers = new TreeMap<String, List<String>>();
......@@ -177,23 +178,23 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
if (subfamily.equals("none")) {
familyMembers.put(descriptor.getName(), new ArrayList<String>());
} else {
List<String> subfamilyMembers = familyMembers.get(subfamily);
if (subfamilyMembers == null) {
subfamilyMembers = new ArrayList<String>();
familyMembers.put(subfamily, subfamilyMembers);
}
subfamilyMembers.add(descriptor.getName());
}
}
}
return installedControllers;
}
......@@ -201,7 +202,7 @@ public class ControllerManager implements ServerConfigurationChangeListener {
public Map<String, Map<String, List<String>>> getInstalledControllers() {
return getInstalledControllers(false);
}
public Map<String, Map<String, List<String>>> getInstalledCommands() {
return getInstalledControllers(true);
}
......@@ -246,13 +247,17 @@ public class ControllerManager implements ServerConfigurationChangeListener {
public Set getStartedControllers() {
Set startedCommands = new HashSet();
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
ControllerServant controller = getController(descriptor.getName());
if (controller.isStarted()) {
startedCommands.add(controller);
try {
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
ControllerServant controller = getController(descriptor.getName());
if (controller.isStarted()) {
startedCommands.add(controller);
}
}
} catch (ControllerNotFoundException e) {
e.printStackTrace();
}
return startedCommands;
}
......@@ -278,7 +283,7 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
return null;
}
public String getSubfamily(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
......@@ -302,13 +307,17 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
public void configurationChanged(int servantID, ClientEnableState enable) {
// the reload of controllers is not made here but in the CommandsSelectionPlugin
// and SettingsSelectionPlugin classes
ServantManagerAccessor.getInstance(serverId).updateDynamicProperties(servantID);
public void configurationChanged(int servantID, ClientConfigurationState enable) {
// The reloading of controllers is not made here but in the CommandsSelectionPlugin
// and SettingsSelectionPlugin classes.
if (enable == ClientConfigurationState.PROPERTY) {
ServantManagerAccessor.getInstance(serverId).updateDynamicProperties(servantID);
System.out.println("ServantManagerAccessor updateDynamicProperties " + servantID);
}
}
public void reloadControllers() {
// reset controller information
reset();
......@@ -318,11 +327,11 @@ public class ControllerManager implements ServerConfigurationChangeListener {
ControllerServant controller = (ControllerServant)servant;
return ServantManagerAccessor.getInstance(serverId).getControllerNameWithRole(controller.getId(), role);
}
public HashMap<String, String> getServantPropertiesValue(int databaseID, int servantID) {
return ServantManagerAccessor.getInstance(serverId).getServantPropertiesValue(databaseID, servantID);
}
public HashMap<String, Integer> getServantCommandStates(int databaseID, int servantID) {
return ServantManagerAccessor.getInstance(serverId).getServantCommandStates(databaseID, servantID);
}
......
......@@ -152,4 +152,9 @@ public class DriverManager {
ServantManagerAccessor.getInstance(serverId).reconnectDriver(driver.getDatabaseId(), driver.getId());
}
}
public Set<String> getDriverTypes() {
return ServantDatabase.getInstance().getDriverTypes();
}
}
\ No newline at end of file
......@@ -19,6 +19,8 @@
package fr.ill.ics.bridge;
import java.util.HashMap;
import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor;
import fr.ill.ics.nscclient.servant.ResourceNotFoundException;
......@@ -85,7 +87,7 @@ public class ResourceManager {
public void setFileContent(String controllerType, String fileName, String content) {
System.out.println("H.ORTIZ: call to writeResourceFile commented .................................................." + fileName);
//System.out.println("H.ORTIZ: call to writeResourceFile commented .................................................." + fileName);
//ServantManagerAccessor.getInstance(serverId).writeResourceFile(controllerType, fileName, content);
......@@ -104,4 +106,13 @@ public class ResourceManager {
}
*/
}
public HashMap<String, String> getFamilyImageKeys() {
return ServantManagerAccessor.getInstance(serverId).getFamilyImageKeys();
}
public HashMap<String, String> getControllerIconKeys() {
return ServantManagerAccessor.getInstance(serverId).getControllerIconKeys();
}
}
......@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import fr.ill.ics.bridge.listeners.ServerSurveyXMLListener;
import fr.ill.ics.nscclient.survey.SurveySubcriberImpl;
import fr.ill.ics.nscclient.survey.SurveySubscriberImpl;
public class SurveyEventSender {
......@@ -47,11 +47,11 @@ public class SurveyEventSender {
* @param listener
*/
public void addSurveyXMLListener(ServerSurveyXMLListener listener) {
SurveySubcriberImpl.getInstance(serverId).addSurveyXMLListener(listener);
SurveySubscriberImpl.getInstance(serverId).addSurveyXMLListener(listener);
}
public void removeSurveyXMLListener(ServerSurveyXMLListener listener) {
SurveySubcriberImpl.getInstance(serverId).removeSurveyXMLListener(listener);
SurveySubscriberImpl.getInstance(serverId).removeSurveyXMLListener(listener);
}
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.bridge.events;
/**
*
* @author ortizh
*
*/
public class ServerVariableStateChangeEvent {
private String variableName;
private VariableState state;
public enum VariableState {DISABLED, ENABLED}
public ServerVariableStateChangeEvent(String variableName) {
this.variableName = variableName;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public VariableState getState() {
return state;
}
public void setState(VariableState state) {
this.state = state;
};
public boolean isEnabled() {
return (state == VariableState.ENABLED);
}
public boolean isDisabled() {
return (state == VariableState.DISABLED);
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.bridge.events;
/**
*
* @author ortizh
*
*/
public class ServerVariableValueChangeEvent {
private String variableName;
private double variableValue;
public ServerVariableValueChangeEvent(String variableName, double variableValue) {
this.variableName = variableName;
this.variableValue = variableValue;
}
public String getVariableName() {
return variableName;
}
public void setVariableName(String variableName) {
this.variableName = variableName;
}
public double getVariableValue() {
return variableValue;
}
public void setVariableValue(double variableValue) {
this.variableValue = variableValue;
}
}
......@@ -21,8 +21,8 @@ package fr.ill.ics.bridge.listeners;
public interface ServerConfigurationChangeListener {
public enum ClientEnableState {ENABLED, DISABLED, NO_CHANGE};
public enum ClientConfigurationState {ENABLED, DISABLED, TREE, PROPERTY};
void configurationChanged(int servantID, ClientEnableState enable);
void configurationChanged(int servantID, ClientConfigurationState enable);
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.bridge.listeners;
import fr.ill.ics.bridge.events.ServerVariableStateChangeEvent;
import fr.ill.ics.bridge.events.ServerVariableValueChangeEvent;
/**
*
* @author ortizh
*
*/
public interface ServerVariableValueChangeListener {
public void variableValueChanged(ServerVariableValueChangeEvent variableValueChangeEvent);
public void variableStateChanged(ServerVariableStateChangeEvent variableStateChangeEvent);
}
\ No newline at end of file
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,