Commit 45a66658 authored by Locatelli's avatar Locatelli

Merge remote-tracking branch 'origin/V3.3' into ploty2

parents 4b31d29f ea64319e
3.2.5 //2019
3.3.1 25/11/2019
-----
* Synchronise delete scan for multi clients.
* Synchronise clients for XBU and PAL files.
* Synchronise list of users' scripts and settings files between Nomad.
* Merged V3.2.
3.2.6 18/10/2019
-----
* Do not access to the command zone value of a property when its containerId is 0 but the database value.
* Reviewed the ServerControlCommandBox hierarchy and removed thenBlock argument.
3.2.5 08/07/2019
------
* Moved Property.ExpressionResult to expression package so that it is accessible to other classes.
......
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>3.2.5-SNAPSHOT</version>
<version>3.3.1</version>
<name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description>
<scm>
......@@ -42,6 +42,12 @@
</properties>
<dependencies>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-client</artifactId>
<version>3.1.10</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
......
......@@ -25,6 +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.notification.commandzone.sync.CommandZoneSyncEventClient;
import fr.ill.ics.nscclient.survey.SurveySubscriberImpl;
......@@ -44,10 +45,13 @@ public class ChangeManager {
}
public void readAndDispatch() {
// Start the event dispatchers.
DataNotificationClient.getInstance().readAndDispatch();
CommandZoneEventClient.getInstance().readAndDispatch();
CommandZoneSyncEventClient.getInstance().readAndDispatch();
// Iterating the map of log subscribers
// Iterate the map of log subscribers.
Map<String, LogSubscriber> logSubscriberMap = LogSubscriber.getInstances();
Iterator<Entry<String, LogSubscriber>> it = logSubscriberMap.entrySet().iterator();
while (it.hasNext()) {
......@@ -55,7 +59,7 @@ public class ChangeManager {
logSubscriber.readAndDispatch();
}
// Iterating the map of survey subscribers
// Iterate the map of survey subscribers.
Map<String, SurveySubscriberImpl> surveySubscriberMap = SurveySubscriberImpl.getInstances();
Iterator<Entry<String, SurveySubscriberImpl>> it2 = surveySubscriberMap.entrySet().iterator();
while (it2.hasNext()) {
......
......@@ -21,12 +21,22 @@ package fr.ill.ics.bridge;
import java.util.HashMap;
import fr.ill.ics.nscclient.command.CommandZoneAccessor;
import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor;
import fr.ill.ics.nscclient.servant.ResourceNotFoundException;
public class ResourceManager {
public final static String NAME = "name";
public final static String ISDIRECTORY = "isDirectory";
public final static String CHILDREN = "children";
public final static int SCRIPT_FILE = 0;
public final static int SETTINGS_FILE = 1;
public final static int PAL_FILE = 2;
public final static int XBU_FILE = 3;
private String serverId;
private static ResourceManager instance = null;
......@@ -61,28 +71,6 @@ public class ResourceManager {
public String getFileContent(String controllerType, String fileName) throws ResourceNotFoundException {
return ServantManagerAccessor.getInstance(serverId).readResourceFile(controllerType, fileName);
/*
String fullFilePath = "/home/dpt/ortizh/tmp/" + fileName;
if (new File(fullFilePath).exists()) {
try {
String content = "";
String line;
BufferedReader in = new BufferedReader(new FileReader(fullFilePath));
while ((line = in.readLine()) != null) {
content = content + line + "\n";
}
in.close();
return content;
} catch (IOException e) {
System.err.println("IOException while getting content of file " + fullFilePath);
e.printStackTrace();
}
} else {
throw new ResourceNotFoundException(fileName);
}
return null;
*/
}
public void setFileContent(String controllerType, String fileName, String content) {
......@@ -107,6 +95,27 @@ public class ResourceManager {
*/
}
public void saveFile(String fileName, String content, int fileType) {
CommandZoneAccessor.getInstance(serverId).saveFile(fileName, content, fileType);
}
public String getFileContent(String fileName) throws ResourceNotFoundException {
return CommandZoneAccessor.getInstance(serverId).getFileContent(fileName);
}
public String getTree(String rootDirectory, String extension) {
return CommandZoneAccessor.getInstance(serverId).getTree(rootDirectory, extension);
}
public void deleteFile(String fileName) {
CommandZoneAccessor.getInstance(serverId).deleteFile(fileName);
}
public HashMap<String, String> getFamilyImageKeys() {
return ServantManagerAccessor.getInstance(serverId).getFamilyImageKeys();
}
......
......@@ -124,4 +124,5 @@ public class AtomicCommandWrapper extends CommandWrapper implements Controller {
@Override
public void updateDynamicProperties() {
}
}
\ No newline at end of file
......@@ -21,15 +21,19 @@ package fr.ill.ics.bridge.command;
import fr.ill.ics.bridge.events.ServerCommandStateChangeEvent;
import fr.ill.ics.bridge.events.ServerCommandStateChangeEvent.CommandState;
import fr.ill.ics.bridge.events.ServerResetCommandEvent;
import fr.ill.ics.bridge.listeners.ServerCommandBoxSyncListener;
import fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener;
import fr.ill.ics.bridge.listeners.ServerExpressionChangeListener;
import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
import fr.ill.ics.bridge.listeners.ServerPropertyChangeListener;
import fr.ill.ics.bridge.listeners.ServerResetCommandListener;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopStepType;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ForLoopType;
import fr.ill.ics.nscclient.command.ServerCommandBox;
import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
import fr.ill.ics.nscclient.notification.commandzone.sync.CommandZoneSyncEventClient;
public abstract class CommandWrapper implements IServerCommand, ICommandBoxEventListener {
public abstract class CommandWrapper implements IServerCommand, ICommandBoxEventListener, ICommandBoxSyncEventListener {
private ServerCommandBox serverCommandBox;
......@@ -38,6 +42,7 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
private ServerPropertyChangeListener propertyListener;
private ServerResetCommandListener resetCommandListener;
private ServerExpressionChangeListener expressionChangeCommandListener;
private ServerCommandBoxSyncListener commandBoxSyncListener;
public CommandWrapper(ServerCommandBox serverCommandBox) {
this.serverCommandBox = serverCommandBox;
......@@ -59,7 +64,12 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
public void addServerResetCommandListener(ServerResetCommandListener listener) {
this.resetCommandListener = listener;
}
public void addServerCommandBoxSyncListener(ServerCommandBoxSyncListener listener) {
this.commandBoxSyncListener = listener;
CommandZoneSyncEventClient.getInstance().addCommandBoxListener(this);
}
public void removeServerCommandStateChangeListener(ServerCommandStateChangeListener listener) {
this.commandStateListener = null;
CommandZoneEventClient.getInstance().removeCommandBoxListener(this);
......@@ -73,6 +83,10 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
this.resetCommandListener = null;
}
public void removeServerCommandBoxSyncListener(ServerCommandBoxSyncListener listener) {
this.commandBoxSyncListener = null;
CommandZoneEventClient.getInstance().removeCommandBoxListener(this);
}
public void addServerExpressionChangeListener(ServerExpressionChangeListener listener) {
this.expressionChangeCommandListener = listener;
......@@ -186,5 +200,85 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
public int getProgression() {
return serverCommandBox.getProgression();
}
@Override
public final void onToggleParallel() {
commandBoxSyncListener.onToggleParallel();
}
@Override
public final void onToggleBackground() {
commandBoxSyncListener.onToggleBackground();
}
@Override
public void onSetSettingsFileName(String fileName) {
commandBoxSyncListener.onSetSettingsFileName(fileName);
}
@Override
public void onSetControllerName(String value) {
commandBoxSyncListener.onSetControllerName(value);
}
@Override
public void onSetPropertyName(String value) {
commandBoxSyncListener.onSetPropertyName(value);
}
@Override
public void onSetValue(String value) {
commandBoxSyncListener.onSetValue(value);
}
@Override
public void onSetExpression(String value) {
commandBoxSyncListener.onSetExpression(value);
}
@Override
public void onSetForLoopType(ForLoopType type, int lineIndex) {
commandBoxSyncListener.onSetForLoopType(type, lineIndex);
}
@Override
public void onSetForLoopStepType(ForLoopStepType type, int lineIndex) {
commandBoxSyncListener.onSetForLoopStepType(type, lineIndex);
}
@Override
public void onSetForLoopValues(int lineIndex, String value) {
commandBoxSyncListener.onSetForLoopValues(lineIndex, value);
}
@Override
public void onSetForLoopVariableName(int lineIndex, String value) {
commandBoxSyncListener.onSetForLoopVariableName(lineIndex, value);
}
@Override
public void onSetForLoopStartValue(int lineIndex, double value) {
commandBoxSyncListener.onSetForLoopStartValue(lineIndex, value);
}
@Override
public void onSetForLoopEndValue(int lineIndex, double value) {
commandBoxSyncListener.onSetForLoopEndValue(lineIndex, value);
}
@Override
public void onSetForLoopStepSize(int lineIndex, double value) {
commandBoxSyncListener.onSetForLoopStepSize(lineIndex, value);
}
@Override
public void onAddForLoopLine(int lineIndex) {
commandBoxSyncListener.onAddForLoopLine(lineIndex);
}
@Override
public void onRemoveForLoopLine(int lineIndex) {
commandBoxSyncListener.onRemoveForLoopLine(lineIndex);
}
}
\ No newline at end of file
......@@ -26,15 +26,18 @@ import fr.ill.ics.bridge.events.ServerCommandStateChangeEvent.CommandState;
import fr.ill.ics.bridge.events.ServerResetCommandEvent;
import fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener;
import fr.ill.ics.bridge.listeners.ServerCommandZoneErrorListener;
import fr.ill.ics.bridge.listeners.ServerCommandZoneSyncListener;
import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
import fr.ill.ics.bridge.listeners.ServerResetCommandListener;
import fr.ill.ics.nscclient.command.CommandZoneAccessor;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.ContainerType;
import fr.ill.ics.nscclient.command.ServerCommandZone;
import fr.ill.ics.nscclient.dataprovider.CommandDatabase;
import fr.ill.ics.nscclient.dataprovider.ServantDatabase;
import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
import fr.ill.ics.nscclient.notification.commandzone.sync.CommandZoneSyncEventClient;
public class CommandZoneWrapper implements ICommandZoneEventListener {
public class CommandZoneWrapper implements ICommandZoneEventListener, ICommandZoneSyncEventListener {
public final static String SERVER_ID = "real";
public final static String EDITOR_ID = "editor";
......@@ -49,32 +52,20 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
private ServerProgressChangeListener commandProgressListener;
private ServerResetCommandListener resetCommandListener;
private ServerCommandZoneErrorListener commandZoneErrorListener;
private ServerCommandZoneSyncListener commandZoneSyncListener;
// private static Map<Integer, CommandZoneWrapper> commandZoneWrappers = new HashMap<Integer, CommandZoneWrapper>();
public CommandZoneWrapper(String serverId, int commandZoneId) {
public CommandZoneWrapper(String serverId) {
this.serverId = serverId;
serverCommandZone = new ServerCommandZone(serverId, commandZoneId);
serverCommandZone = new ServerCommandZone(serverId, 0);
}
public static CommandZoneWrapper getInstance(String serverId) {
if (!instances.containsKey(serverId)) {
CommandZoneWrapper instance = new CommandZoneWrapper(serverId, 0);
CommandZoneWrapper instance = new CommandZoneWrapper(serverId);
instances.put(serverId, instance);
}
return instances.get(serverId);
}
/*
public static CommandZoneWrapper getInstance(int id) {
return commandZoneWrappers.get(id);
}
public static void initInstance(int id) {
CommandZoneWrapper wrapper = new CommandZoneWrapper(id);
commandZoneWrappers.put(id, wrapper);
}
*/
public void release() {
// do nothing for new server
......@@ -104,6 +95,11 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
public void addServerCommandZoneErrorListener(ServerCommandZoneErrorListener listener) {
this.commandZoneErrorListener = listener;
}
public void addServerCommandZoneSyncListener(ServerCommandZoneSyncListener listener) {
this.commandZoneSyncListener = listener;
CommandZoneSyncEventClient.getInstance().addCommandZoneListener(this);
}
public void removeServerProgressChangeListener(ServerProgressChangeListener listener) {
this.commandProgressListener = null;
......@@ -121,6 +117,11 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
public void removeServerCommandZoneErrorListener(ServerCommandZoneErrorListener listener) {
this.commandZoneErrorListener = null;
}
public void removeServerCommandZoneSyncListener(ServerCommandZoneSyncListener listener) {
this.commandZoneSyncListener = null;
CommandZoneSyncEventClient.getInstance().removeCommandZoneListener(this);
}
public void commandZoneStarted() {
if (commandStateListener != null) {
......@@ -294,4 +295,69 @@ public class CommandZoneWrapper implements ICommandZoneEventListener {
return serverCommandZone.print();
}
@Override
public void onAddNewAtomicCommandBoxAtEnd(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int newCommandBoxId) {
commandZoneSyncListener.onAddNewAtomicCommandBoxAtEnd(type, commandBoxId, commandId, isSettings, newCommandBoxId);
}
@Override
public void onAddNewAtomicCommandBox(ContainerType type, int commandBoxId, int commandId, boolean isSettings, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewAtomicCommandBox(type, commandBoxId, commandId, isSettings, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewControlCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId) {
commandZoneSyncListener.onAddNewControlCommandBoxAtEnd(type, commandBoxId, boxType, newCommandBoxId);
}
@Override
public void onAddNewControlCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewControlCommandBox(type, commandBoxId, boxType, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewForLoopCommandBoxAtEnd(ContainerType type, int commandBoxId, String variableName, int newCommandBoxId) {
commandZoneSyncListener.onAddNewForLoopCommandBoxAtEnd(type, commandBoxId, variableName, newCommandBoxId);
}
@Override
public void onAddNewForLoopCommandBox(ContainerType type, int commandBoxId, String variableName, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewForLoopCommandBox(type, commandBoxId, variableName, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewGenericCommandBoxAtEnd(ContainerType type, int commandBoxId, int boxType, int newCommandBoxId) {
commandZoneSyncListener.onAddNewGenericCommandBoxAtEnd(type, commandBoxId, boxType, newCommandBoxId);
}
@Override
public void onAddNewGenericCommandBox(ContainerType type, int commandBoxId, int boxType, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewGenericCommandBox(type, commandBoxId, boxType, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewScanCommandBox(ContainerType type, int commandBoxId, String scanName, int commandBoxIdToMove, boolean above, int newCommandBoxId) {
commandZoneSyncListener.onAddNewScanCommandBox(type, commandBoxId, scanName, commandBoxIdToMove, above, newCommandBoxId);
}
@Override
public void onAddNewScanCommandBoxAtEnd(ContainerType type, int commandBoxId, String scanName, int newCommandBoxId) {
commandZoneSyncListener.onAddNewScanCommandBoxAtEnd(type, commandBoxId, scanName, newCommandBoxId);
}
@Override
public void onMoveCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToMove, int commandBoxIdToShift, boolean above) {
commandZoneSyncListener.onMoveCommandBox(type, commandBoxId, commandBoxIdToMove, commandBoxIdToShift, above);
}
@Override
public void onMoveCommandBoxToEnd(ContainerType type, int commandBoxId, int commandBoxIdToMove) {
commandZoneSyncListener.onMoveCommandBoxToEnd(type, commandBoxId, commandBoxIdToMove);
}
@Override
public void onDeleteCommandBox(ContainerType type, int commandBoxId, int commandBoxIdToDelete) {
commandZoneSyncListener.deleteCommandBox(type, commandBoxId, commandBoxIdToDelete);
}
}
\ No newline at end of file
......@@ -60,60 +60,60 @@ public class ControlCommandWrapper extends CommandWrapper {
return "";
}
public AtomicCommandWrapper addNewCommand(boolean thenBlock, String controllerName, boolean isSettings) {
return new AtomicCommandWrapper(serverControlCommandBox.addNewAtomicCommandBoxAtEnd(thenBlock, getCommandId(controllerName), isSettings));
public AtomicCommandWrapper addNewCommand(String controllerName, boolean isSettings) {
return new AtomicCommandWrapper(serverControlCommandBox.addNewAtomicCommandBoxAtEnd(getCommandId(controllerName), isSettings));
}
public AtomicCommandWrapper addNewCommand(boolean thenBlock, String controllerName, boolean isSettings, IServerCommand serverCommandToShift, boolean above) {
return new AtomicCommandWrapper(serverControlCommandBox.addNewAtomicCommandBox(thenBlock, getCommandId(controllerName), isSettings, serverCommandToShift.getServerCommandBox(), above));
public AtomicCommandWrapper addNewCommand(String controllerName, boolean isSettings, IServerCommand serverCommandToShift, boolean above) {
return new AtomicCommandWrapper(serverControlCommandBox.addNewAtomicCommandBox(getCommandId(controllerName), isSettings, serverCommandToShift.getServerCommandBox(), above));
}
public ScanCommandWrapper addNewScan(boolean thenBlock, String scanName) {
return new ScanCommandWrapper(serverControlCommandBox.addNewScanCommandBoxAtEnd(thenBlock, scanName));
public ScanCommandWrapper addNewScan(String scanName) {
return new ScanCommandWrapper(serverControlCommandBox.addNewScanCommandBoxAtEnd(scanName));
}
public ScanCommandWrapper addNewScan(boolean thenBlock, String scanName, IServerCommand serverCommandToShift, boolean above) {
return new ScanCommandWrapper(serverControlCommandBox.addNewScanCommandBox(thenBlock, scanName, serverCommandToShift.getServerCommandBox(), above));
public ScanCommandWrapper addNewScan(String scanName, IServerCommand serverCommandToShift, boolean above) {
return new ScanCommandWrapper(serverControlCommandBox.addNewScanCommandBox(scanName, serverCommandToShift.getServerCommandBox(), above));
}
public ForLoopCommandWrapper addNewForLoop(boolean thenBlock, String variableName) {
return new ForLoopCommandWrapper(serverControlCommandBox.addNewForLoopCommandBoxAtEnd(thenBlock, variableName));
public ForLoopCommandWrapper addNewForLoop(String variableName) {
return new ForLoopCommandWrapper(serverControlCommandBox.addNewForLoopCommandBoxAtEnd(variableName));
}
public ForLoopCommandWrapper addNewForLoop(boolean thenBlock, String variableName, IServerCommand serverCommandToShift, boolean above) {
return new ForLoopCommandWrapper(serverControlCommandBox.addNewForLoopCommandBox(thenBlock, variableName, serverCommandToShift.getServerCommandBox(), above));
public ForLoopCommandWrapper addNewForLoop(String variableName, IServerCommand serverCommandToShift, boolean above) {
return new ForLoopCommandWrapper(serverControlCommandBox.addNewForLoopCommandBox(variableName, serverCommandToShift.getServerCommandBox(), above));
}
public GenericCommandWrapper addNewGenericCommand(boolean thenBlock, int boxType) {
return new GenericCommandWrapper(serverControlCommandBox.addNewGenericCommandBox(thenBlock, boxType));
public GenericCommandWrapper addNewGenericCommand(int boxType) {
return new GenericCommandWrapper(serverControlCommandBox.addNewGenericCommandBox(boxType));
}
public GenericCommandWrapper addNewGenericCommand(boolean thenBlock, int boxType, IServerCommand serverCommandToShift, boolean above) {
return new GenericCommandWrapper(serverControlCommandBox.addNewGenericCommandBox(thenBlock, boxType, serverCommandToShift.getServerCommandBox(), above));
public GenericCommandWrapper addNewGenericCommand(int boxType, IServerCommand serverCommandToShift, boolean above) {
return new GenericCommandWrapper(serverControlCommandBox.addNewGenericCommandBox(boxType, serverCommandToShift.getServerCommandBox(), above));
}
public ControlCommandWrapper addNewControlCommand(boolean thenBlock, int boxType) {
return new ControlCommandWrapper(serverControlCommandBox.addNewControlCommandBox(thenBlock, boxType));
public ControlCommandWrapper addNewControlCommand(int boxType) {
return new ControlCommandWrapper(serverControlCommandBox.addNewControlCommandBox(boxType));
}
public ControlCommandWrapper addNewControlCommand(boolean thenBlock, int boxType, IServerCommand serverCommandToShift, boolean above) {
return new ControlCommandWrapper(serverControlCommandBox.addNewControlCommandBox(thenBlock, boxType, serverCommandToShift.getServerCommandBox(), above));
public ControlCommandWrapper addNewControlCommand(int boxType, IServerCommand serverCommandToShift, boolean above) {
return new ControlCommandWrapper(serverControlCommandBox.addNewControlCommandBox(boxType, serverCommandToShift.getServerCommandBox(), above));
}
public boolean moveCommand(boolean thenBlock, IServerCommand serverCommandToMove, IServerCommand serverCommandToShift, boolean above) {
return serverControlCommandBox.moveCommandBox(thenBlock, serverCommandToMove.getServerCommandBox(), serverCommandToShift.getServerCommandBox(), above);
public boolean moveCommand(IServerCommand serverCommandToMove, IServerCommand serverCommandToShift, boolean above) {
return serverControlCommandBox.moveCommandBox(serverCommandToMove.getServerCommandBox(), serverCommandToShift.getServerCommandBox(), above);
}
public boolean moveCommandToEnd(boolean thenBlock, IServerCommand serverCommandToMove) {
return serverControlCommandBox.moveCommandBoxToEnd(thenBlock, serverCommandToMove.getServerCommandBox());
public boolean moveCommandToEnd(IServerCommand serverCommandToMove) {
return serverControlCommandBox.moveCommandBoxToEnd(serverCommandToMove.getServerCommandBox());
}
public boolean deleteCommand(boolean thenBlock, IServerCommand serverCommandToDelete) {
return serverControlCommandBox.deleteCommandBox(thenBlock, serverCommandToDelete.getServerCommandBox());
public boolean deleteCommand(IServerCommand serverCommandToDelete) {
return serverControlCommandBox.deleteCommandBox(serverCommandToDelete.getServerCommandBox());
}
public CommandZoneIteratorWrapper iterator(boolean thenBlock) {
return new CommandZoneIteratorWrapper(serverControlCommandBox.getContent(thenBlock));
public CommandZoneIteratorWrapper iterator() {
return new CommandZoneIteratorWrapper(serverControlCommandBox.getContent());
}
public int getDatabaseId() {
......
......@@ -39,6 +39,7 @@ public class ForLoopCommandWrapper extends CommandWrapper implements IForLoopEve
}
public enum LoopType {RANGE, VALUES};
public enum StepType {DELTA, NBPOINTS};
public String getCommandType() {
return "forloop";
......@@ -106,8 +107,23 @@ public class ForLoopCommandWrapper extends CommandWrapper implements IForLoopEve
}
return LoopType.RANGE;
}
public boolean addForLoopLine(int index) {
public void setForLoopStepType(int index, StepType stepType) {
if (stepType == StepType.DELTA) {
serverForLoopCommandBox.setForLoopStepType(index, CommandZoneAccessor.ForLoopStepType.DELTA);
} else {
serverForLoopCommandBox.setForLoopStepType(index, CommandZoneAccessor.ForLoopStepType.NBPOINTS);
}
}
public StepType getForLoopStepType(int index) {
if (serverForLoopCommandBox.getForLoopStepType(index) == CommandZoneAccessor.ForLoopStepType.DELTA) {
return StepType.DELTA;
}
return StepType.NBPOINTS;
}
public final boolean addForLoopLine(int index) {
return serverForLoopCommandBox.addForLoopLine(index);
}
......
/*
* 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 expres