Commit e960a6e7 authored by Jerome Locatelli's avatar Jerome Locatelli
Browse files

Merge remote-tracking branch 'origin/cameo-v2'

parents 0468f8af 8fb8e81a
4.1.0 07/06/2022
------
* Migration to cameo v2
* Re-structurated configuration files of nomad
4.0.135 04/03/2022
-------
* Use last version of nomad-command-system (4.0.53).
......
......@@ -73,7 +73,7 @@ controlCommandType=control
textModeAllowedInServerScan=false
#Directory for Nomad plot preferences saving
nomadPlotPreferencesDirectory=nomadPlotPreferences
nomadPlotPreferencesDirectory=.nomad
#Directory for multiplot viewer images
offscreenImagesDir=offscreenImages
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadgui</artifactId>
<version>4.0.135</version>
<version>4.1.0</version>
<name>NomadGUI</name>
<description>Graphical user interface for Nomad</description>
<scm>
......@@ -142,7 +142,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>4.0.53</version>
<version>4.1.0</version>
</dependency>
<dependency> <!-- For CollectionUtils -->
<groupId>org.apache.commons</groupId>
......
......@@ -4,8 +4,7 @@ import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.Application.This;
import fr.ill.ics.cameo.base.This;
public class LogsTransfer {
......@@ -44,7 +43,7 @@ public class LogsTransfer {
}
finally {
// Do not forget to terminate This.
Application.This.terminate();
This.terminate();
}
}
}
......@@ -4,8 +4,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import fr.ill.ics.cameo.Application.Instance;
import fr.ill.ics.cameo.Server;
import fr.ill.ics.cameo.base.App;
import fr.ill.ics.cameo.base.Server;
public class LogsTransferCaller {
......@@ -17,20 +17,17 @@ public class LogsTransferCaller {
}
try {
// Get the Cameo server.
Server server = null;
// The server endpoint is the first argument.
server = new Server(args[0]);
// Get the Cameo server. The server endpoint is the first argument.
Server server = Server.create(args[0]);
// Start the app.
Instance app = server.start("logstransfer");
App app = server.start("logstransfer");
app.waitFor();
System.out.println("Application finished");
System.out.println("Application has result: " + app.hasResult());
byte[] fileContent = app.getBinaryResult();
byte[] fileContent = app.getResult();
System.out.println("Got file content " + fileContent.length);
......
......@@ -39,9 +39,10 @@ import fr.ill.ics.bridge.events.ServerEndedEvent;
import fr.ill.ics.bridge.listeners.ClientDisconnectedListener;
import fr.ill.ics.bridge.listeners.ServerConfigurationChangeListener;
import fr.ill.ics.bridge.listeners.ServerEndedListener;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.Application.Instance;
import fr.ill.ics.cameo.Server;
import fr.ill.ics.cameo.base.App;
import fr.ill.ics.cameo.base.Server;
import fr.ill.ics.cameo.base.StartException;
import fr.ill.ics.cameo.base.This;
import fr.ill.ics.client.control.admin.AdministratorLogin;
import fr.ill.ics.client.control.command.CommandWindow;
import fr.ill.ics.client.control.command.ServerCommandZone;
......@@ -120,8 +121,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private Server cameoServer;
private Instance nomadLogsInstance;
private Instance nomadSurveyInstance;
private App nomadLogsInstance;
private App nomadSurveyInstance;
private static final String VIRTUAL_HOME = "virtualHome";
private static final String VISA = "visa";
......@@ -211,9 +212,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
} finally {
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().closePlots();
}
PlotyManager.getInstance().closePlots();
ServerConnection.getInstance(CommandZoneWrapper.SERVER_ID).reset();
......@@ -223,7 +222,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
System.out.println("Terminating Cameo application");
Application.This.terminate();
This.terminate();
System.out.println("Terminated Cameo application");
}
......@@ -693,7 +692,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
if (cameoServer == null) {
String serverLocation = ConfigManager.getInstance().getServerEndpoint();
if (serverLocation != null) {
cameoServer = new Server(serverLocation);
cameoServer = Server.create(serverLocation);
cameoServer.init();
}
}
if (cameoServer != null) {
......@@ -722,16 +722,16 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
for (String arg: args) {
System.out.println("arg " + arg);
}
nomadLogsInstance = cameoServer.start(NOMADLOGS_APP_NAME, args);
if (nomadLogsInstance.exists()) {
try {
nomadLogsInstance = cameoServer.start(NOMADLOGS_APP_NAME, args);
System.out.println("Starting " + nomadLogsInstance);
/* waiting for a real "is running" status (see YLG)
nomadLogsInstance.waitFor(Application.State.RUNNING);
System.out.println(nomadLogsInstance + " started");
*/
} else if (nomadLogsInstance.getErrorMessage() != null) {
DialogManager.getInstance().nomadMessageDialog(nomadLogsInstance.getErrorMessage(), "viewLogsMessage");
// // waiting for a real "is running" status (see YLG)
// nomadLogsInstance.waitFor(State.RUNNING);
// System.out.println(nomadLogsInstance + " started");
} catch (StartException e) {
DialogManager.getInstance().nomadMessageDialog(e.getMessage(), "viewLogsMessage");
}
} else {
......@@ -765,7 +765,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private boolean nomadLogsIsOpen() {
if (cameoServer != null) {
nomadLogsInstance = cameoServer.connect(NOMADLOGS_APP_NAME);
return (nomadLogsInstance.exists());
return (nomadLogsInstance != null);
}
return false;
}
......@@ -774,7 +774,7 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
private boolean nomadSurveyIsOpen() {
if (cameoServer != null) {
nomadSurveyInstance = cameoServer.connect(NOMADSURVEY_APP_NAME);
return (nomadSurveyInstance.exists());
return (nomadSurveyInstance != null);
}
return false;
}
......@@ -860,7 +860,8 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
if (cameoServer == null) {
String serverLocation = ConfigManager.getInstance().getServerEndpoint();
if (serverLocation != null) {
cameoServer = new Server(serverLocation);
cameoServer = Server.create(serverLocation);
cameoServer.init();
}
}
if (cameoServer != null) {
......@@ -882,11 +883,12 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
for (String arg: args) {
System.out.println("arg " + arg);
}
nomadSurveyInstance = cameoServer.start(NOMADSURVEY_APP_NAME, args);
if (nomadSurveyInstance.exists()) {
try {
nomadSurveyInstance = cameoServer.start(NOMADSURVEY_APP_NAME, args);
System.out.println("Starting " + nomadSurveyInstance);
} else if (nomadSurveyInstance.getErrorMessage() != null) {
DialogManager.getInstance().nomadMessageDialog(nomadSurveyInstance.getErrorMessage(), "viewSurveyTitle");
} catch (StartException e) {
DialogManager.getInstance().nomadMessageDialog(e.getMessage(), "viewSurveyTitle");
}
} else {
......
......@@ -30,8 +30,9 @@ import fr.ill.ics.bridge.LoginManager;
import fr.ill.ics.bridge.ResourceManager;
import fr.ill.ics.bridge.command.CommandZoneWrapper;
import fr.ill.ics.bridge.commandline.CommandLineProxyWrapper;
import fr.ill.ics.cameo.Application.Instance;
import fr.ill.ics.cameo.Server;
import fr.ill.ics.cameo.base.App;
import fr.ill.ics.cameo.base.Server;
import fr.ill.ics.cameo.base.StartException;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.command.content.CommandBox;
import fr.ill.ics.client.control.command.content.ForLoopCommandZone;
......@@ -83,10 +84,10 @@ public class CommandWindow {
private boolean appendingToServerTab = false;
private Map<String, Instance> simulatedServers = new ConcurrentHashMap<String, Instance>();
private Map<String, App> simulatedServers = new ConcurrentHashMap<String, App>();
private Server cameoServer;
private Instance simulatedServer;
private App simulatedServer;
protected CommandWindow() {
}
......@@ -467,14 +468,15 @@ public class CommandWindow {
String nomadServerLocation = ServerInstance.getInstance().getNomadServerEndpoint();
if (nomadServerLocation != null) {
cameoServer = new Server(nomadServerLocation);
cameoServer = Server.create(nomadServerLocation);
cameoServer.init();
}
}
if (cameoServer != null) {
simulatedServer = cameoServer.start(SIMULATION_APPLICATION_NAME);
try {
simulatedServer = cameoServer.start(SIMULATION_APPLICATION_NAME);
if (simulatedServer.exists()) {
System.out.println("Starting " + simulatedServer);
String serverId = simulatedServer.getId()+"";
......@@ -503,7 +505,9 @@ public class CommandWindow {
} else {
DialogManager.getInstance().nomadMessageDialog("cameoUnableToStartSimulationServerMessage", "cameoErrorTitle");
}
}
} catch (StartException e) {
DialogManager.getInstance().nomadMessageDialog(e.getMessage(), "cameoErrorTitle");
}
} else {
DialogManager.getInstance().nomadMessageDialog("unableToLocateNomadServerPropertyMessage", "configurationErrorMessage");
}
......@@ -515,7 +519,7 @@ public class CommandWindow {
public void stopSimulationServerForId(String serverId) {
MainWindowPeer.getInstance().setCursorToWait();
Instance simulatedServer = simulatedServers.get(serverId);
App simulatedServer = simulatedServers.get(serverId);
if (simulatedServer != null) {
System.out.println("Killing " + simulatedServer.getNameId());
simulatedServer.kill();
......
......@@ -60,8 +60,6 @@ public class PlotPreferencesData {
public final static String XAXISTITLE = "xAxisTitle";
public final static String YAXISTITLE = "yAxisTitle";
public final static String PLOT_PREFERENCES_DIR = ConfigManager.NOMAD_CLIENT_FILES + ConfigManager.FILE_SEPARATOR + ConfigManager.getInstance().getString("nomadPlotPreferencesDirectory");
public void init() {
processMenuFile();
}
......@@ -71,7 +69,7 @@ public class PlotPreferencesData {
*/
private void processMenuFile() {
String xmlFileName = PLOT_PREFERENCES_DIR + ConfigManager.FILE_SEPARATOR + "plotPreferencesData.xml";
String xmlFileName = ConfigManager.DEFAULT_LOCAL_FILES_DIRECTORY + ConfigManager.FILE_SEPARATOR + "NomadGUIPlotPreferencesData.xml";
// Create a handler to handle the SAX events generated during parsing
PlotPreferencesParser handler = new PlotPreferencesParser();
......@@ -167,13 +165,8 @@ public class PlotPreferencesData {
HashMap<String, IPlotViewer> plotViewers = getPlotViewers(plotTabFolder);
// Creates scans directory if it doesn't exist
if (!new File(PLOT_PREFERENCES_DIR).exists()) {
// Directory does not exist: create it
(new File(PLOT_PREFERENCES_DIR)).mkdir();
}
String fileName = PLOT_PREFERENCES_DIR + ConfigManager.FILE_SEPARATOR + "plotPreferencesData.xml";
File plotPreferencesFile = new File(fileName);
String xmlFileName = ConfigManager.DEFAULT_LOCAL_FILES_DIRECTORY + ConfigManager.FILE_SEPARATOR + "NomadGUIPlotPreferencesData.xml";
File plotPreferencesFile = new File(xmlFileName);
try {
......
......@@ -24,7 +24,7 @@ import java.io.IOException;
import fr.ill.ics.bridge.LoginManager;
import fr.ill.ics.bridge.command.CommandZoneWrapper;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.base.This;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.command.CommandWindow;
import fr.ill.ics.client.control.login.ServerConnection;
......@@ -94,7 +94,7 @@ public class Startup {
MainWindowPeer.setRefresh(false);
Application.This.init("nomadgui", ConfigManager.getInstance().getServerEndpoint());
This.init("nomadgui", ConfigManager.getInstance().getServerEndpoint());
ServerInstance.getInstance().init();
// Save the session information: the server endpoint is serialised so that in case the client is running on a VISA instance and crashes,
......@@ -166,18 +166,15 @@ public class Startup {
if (displayDebugMessages) {
System.out.println("Step " + currentStep + " " + MainWindow.getElapsedTime());
}
ConfigManager.getInstance().setPlotyVersion();
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
boolean plotyOk = PlotyManager.getInstance().init();
// if connection unsuccessful, do not go to next step
if (!plotyOk) {
advanceToNextStep = false;
informationKey = "clientInitialisingConnectionToPlotyFailed";
STARTUP_FAILED = true;
} else {
// set information key for next stage
informationKey = "";
}
boolean plotyOk = PlotyManager.getInstance().init();
// if connection unsuccessful, do not go to next step
if (!plotyOk) {
advanceToNextStep = false;
informationKey = "clientInitialisingConnectionToPlotyFailed";
STARTUP_FAILED = true;
} else {
// set information key for next stage
informationKey = "";
}
break;
......
......@@ -246,9 +246,7 @@ public class TokenManager implements TokenEventListener {
// Request token
SessionManager.getInstance(CommandZoneWrapper.SERVER_ID).requestToken();
// For synchronization restore plots when token info are synchronized in gui
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().restorePlots();
}
PlotyManager.getInstance().restorePlots();
}
......
......@@ -21,7 +21,7 @@ package fr.ill.ics.client.standalone;
import fr.ill.ics.bridge.ChangeManager;
import fr.ill.ics.bridge.LoginManager;
import fr.ill.ics.bridge.command.CommandZoneWrapper;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.base.This;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.command.CommandWindow;
import fr.ill.ics.client.control.command.CommandWindowLite;
......@@ -73,7 +73,7 @@ public class NomadLite {
public void init() {
ConfigManager.initInstance("");
Nomad.setLite();
Application.This.init("nomadgui", ConfigManager.getInstance().getServerEndpoint());
This.init("nomadgui", ConfigManager.getInstance().getServerEndpoint());
ServerInstance.getInstance().init();
ServerConnection login = new ServerConnection();
......
......@@ -28,7 +28,7 @@ import java.util.Set;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import fr.ill.ics.cameo.Application;
import fr.ill.ics.cameo.base.This;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.command.CommandWindow;
import fr.ill.ics.client.control.parser.ControllerCommandViewParser;
......@@ -79,7 +79,7 @@ public class TestClientConfiguration {
exitCode = e.getExitCode();
} finally {
Application.This.terminate();
This.terminate();
System.out.println("Terminated Cameo application");
}
......
......@@ -1078,12 +1078,12 @@ public abstract class ControllerPluginPeer extends PluginPeer {
} else if (widgetDescriptor.getType().equals(ControllerViewParser.TAG_PLOT)) {
if (plotDatas != null) {
Property numorProperty = controllerPlugin.getNumorProperty();
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
widget = PWidgetFactory.getInstance().createPlotLauncherImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty, widgetDescriptor.isMultipleYAxis());
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
// if (ConfigManager.getInstance().getPlotyVersion() == 1) {
// widget = PWidgetFactory.getInstance().createPlotLauncherImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty, widgetDescriptor.isMultipleYAxis());
// }
// else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
widget = PWidgetFactory.getInstance().createPlotLauncherExternImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty, widgetDescriptor.isMultipleYAxis());
}
// }
if (plotWidgets == null) {
plotWidgets = new ArrayList<NomadWidget>();
}
......
......@@ -77,18 +77,18 @@ public abstract class PlotLauncher extends NomadWidget implements IPlotDataHolde
}
protected void onClick() {
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
int previousMode = WidgetFactory.CURRENT_MODE;
WidgetFactory.CURRENT_MODE = WidgetFactory.PLOT_WINDOW_MODE;
MainWindowPeer.getInstance().setCursorToWait();
plotKey = PlotManager.getInstance().activatePlot(plotDatas, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
PlotManager.getInstance().openPlotWindow();
MainWindowPeer.getInstance().setCursorToDefault();
WidgetFactory.CURRENT_MODE = previousMode;
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
// if (ConfigManager.getInstance().getPlotyVersion() == 1) {
// int previousMode = WidgetFactory.CURRENT_MODE;
// WidgetFactory.CURRENT_MODE = WidgetFactory.PLOT_WINDOW_MODE;
// MainWindowPeer.getInstance().setCursorToWait();
// plotKey = PlotManager.getInstance().activatePlot(plotDatas, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
// PlotManager.getInstance().openPlotWindow();
// MainWindowPeer.getInstance().setCursorToDefault();
// WidgetFactory.CURRENT_MODE = previousMode;
// }
// else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plotDatas), plotDatas, title, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, multipleYAxis);
}
// }
}
public void updatePlotData(List<PlotData> plotDatas) {
......
......@@ -89,9 +89,7 @@ public abstract class PlotLauncherExternImageButton extends PlotLauncher impleme
}
}
imageKey = controllerType + ".png";
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyInstance.getInstance().addSpyPlotChangeListener(this);
}
PlotyInstance.getInstance().addSpyPlotChangeListener(this);
// File parentDirectory = FileUtils.getFile(System.getenv("HOME") + "/offscreenImages/spy");
// FileAlterationObserver observer = new FileAlterationObserver(parentDirectory);
//
......@@ -127,9 +125,7 @@ public abstract class PlotLauncherExternImageButton extends PlotLauncher impleme
}
protected void closePlotWindow() {
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyInstance.getInstance().removeSpyPlotChangeListener(this);
}
PlotyInstance.getInstance().removeSpyPlotChangeListener(this);
// try {
// monitor.stop();
// } catch (Exception e) {
......
......@@ -239,14 +239,14 @@ public abstract class MultiplotWindow implements IPropertyChangeListener {
Property yAxisTitleProperty = PropertyManager.getInstance().getProperty(controller, yAxisTitlePropertyName + "." + plotIndex, PluginType.GENERAL);
boolean multipleYAxis = plotDataDescriptor.getMultipleYAxis();
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
PlotManager.getInstance().activatePlot(plots, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, null);
PlotManager.getInstance().openPlotWindow();
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
// if (ConfigManager.getInstance().getPlotyVersion() == 1) {
// PlotManager.getInstance().activatePlot(plots, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, null);
// PlotManager.getInstance().openPlotWindow();
// }
// else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plots), plots, title, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty, multipleYAxis);
}
// }
}
} catch (PropertyNotFoundException e) {
......
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