If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 5cdb3355 authored by legoc's avatar legoc

Some new sync notification messages

parent ec4251a9
......@@ -244,4 +244,34 @@ public abstract class CommandWrapper implements IServerCommand, ICommandBoxEvent
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
......@@ -35,4 +35,11 @@ public interface ICommandBoxSyncEventListener {
void onSetExpression(String value);
void onSetForLoopType(ForLoopType type);
void onSetForLoopValues(int lineIndex, String value);
void onSetForLoopVariableName(int lineIndex, String value);
void onSetForLoopStartValue(int lineIndex, double value);
void onSetForLoopEndValue(int lineIndex, double value);
void onSetForLoopStepSize(int lineIndex, double value);
void onAddForLoopLine(int lineIndex);
void onRemoveForLoopLine(int lineIndex);
}
\ No newline at end of file
......@@ -31,4 +31,10 @@ public interface ServerCommandBoxSyncListener {
void onSetExpression(String value);
void onSetForLoopType(ForLoopType type);
void onSetForLoopValues(int lineIndex, String value);
void onSetForLoopVariableName(int lineIndex, String value);
void onSetForLoopStartValue(int lineIndex, double value);
void onSetForLoopEndValue(int lineIndex, double value);
void onSetForLoopStepSize(int lineIndex, double value);
void onAddForLoopLine(int lineIndex);
void onRemoveForLoopLine(int lineIndex);
}
\ 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.nscclient.notification.commandzone.sync;
public class AddForLoopLine extends CommandBoxSyncEvent {
private int lineIndex;
public AddForLoopLine(int commandBoxId, int lineIndex) {
super(commandBoxId);
this.lineIndex = lineIndex;
}
public int getLineIndex() {
return lineIndex;
}
}
\ No newline at end of file
......@@ -171,6 +171,20 @@ public class CommandZoneSyncEventClient {
}
}
private void notifySetForLoopVariableName(SetForLoopVariableName event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onSetForLoopVariableName(event.getLineIndex(), event.getValue());
}
}
}
}
private void notifySetPropertyName(SetPropertyName event) {
synchronized (commandBoxListeners) {
......@@ -213,6 +227,76 @@ public class CommandZoneSyncEventClient {
}
}
private void notifySetForLoopStartValue(SetForLoopStartValue event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onSetForLoopStartValue(event.getLineIndex(), event.getValue());
}
}
}
}
private void notifySetForLoopEndValue(SetForLoopEndValue event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onSetForLoopEndValue(event.getLineIndex(), event.getValue());
}
}
}
}
private void notifySetForLoopStepSize(SetForLoopStepSize event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onSetForLoopStepSize(event.getLineIndex(), event.getValue());
}
}
}
}
private void notifyAddForLoopLine(AddForLoopLine event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onAddForLoopLine(event.getLineIndex());
}
}
}
}
private void notifyRemoveForLoopLine(RemoveForLoopLine event) {
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(event.getCommandBoxId())) {
HashSet<ICommandBoxSyncEventListener> listeners = commandBoxListeners.get(event.getCommandBoxId());
Iterator<ICommandBoxSyncEventListener> it = listeners.iterator();
while (it.hasNext()) {
it.next().onRemoveForLoopLine(event.getLineIndex());
}
}
}
}
private void notifyAddNewAtomicCommandBox(AddNewAtomicCommandBox event) {
synchronized (commandZoneListeners) {
......@@ -376,6 +460,9 @@ public class CommandZoneSyncEventClient {
else if (event instanceof SetForLoopValues) {
notifySetForLoopValues((SetForLoopValues)event);
}
else if (event instanceof SetForLoopVariableName) {
notifySetForLoopVariableName((SetForLoopVariableName)event);
}
else if (event instanceof SetPropertyName) {
notifySetPropertyName((SetPropertyName)event);
}
......@@ -385,6 +472,21 @@ public class CommandZoneSyncEventClient {
else if (event instanceof SetValue) {
notifySetValue((SetValue)event);
}
else if (event instanceof SetForLoopStartValue) {
notifySetForLoopStartValue((SetForLoopStartValue)event);
}
else if (event instanceof SetForLoopEndValue) {
notifySetForLoopEndValue((SetForLoopEndValue)event);
}
else if (event instanceof SetForLoopStepSize) {
notifySetForLoopStepSize((SetForLoopStepSize)event);
}
else if (event instanceof AddForLoopLine) {
notifyAddForLoopLine((AddForLoopLine)event);
}
else if (event instanceof RemoveForLoopLine) {
notifyRemoveForLoopLine((RemoveForLoopLine)event);
}
// Command zone events.
else if (event instanceof AddNewAtomicCommandBox) {
notifyAddNewAtomicCommandBox((AddNewAtomicCommandBox)event);
......
......@@ -296,6 +296,14 @@ public class CommandZoneSyncEventNotifier {
return new SetForLoopType(request.getCommandBoxID(), (forLoopType == CommandZoneRequests.ForLoopType.Type.VALUES ? ForLoopType.VALUES : ForLoopType.RANGE));
}
}
else if (type == CommandZoneRequests.Message.Type.SetVariableName) {
CommandZoneRequests.SetForLoopStringValueRequest request = CommandZoneRequests.SetForLoopStringValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new SetForLoopVariableName(request.getCommandBoxID(), request.getLineIndex(), request.getValue());
}
}
else if (type == CommandZoneRequests.Message.Type.SetValues) {
CommandZoneRequests.SetForLoopStringValueRequest request = CommandZoneRequests.SetForLoopStringValueRequest.parseFrom(message.getSerializedContent());
......@@ -304,7 +312,46 @@ public class CommandZoneSyncEventNotifier {
return new SetForLoopValues(request.getCommandBoxID(), request.getLineIndex(), request.getValue());
}
}
else if (type == CommandZoneRequests.Message.Type.SetStartValue) {
CommandZoneRequests.SetForLoopValueRequest request = CommandZoneRequests.SetForLoopValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new SetForLoopStartValue(request.getCommandBoxID(), request.getLineIndex(), request.getValue());
}
}
else if (type == CommandZoneRequests.Message.Type.SetEndValue) {
CommandZoneRequests.SetForLoopValueRequest request = CommandZoneRequests.SetForLoopValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new SetForLoopEndValue(request.getCommandBoxID(), request.getLineIndex(), request.getValue());
}
}
else if (type == CommandZoneRequests.Message.Type.SetStepSize) {
CommandZoneRequests.SetForLoopValueRequest request = CommandZoneRequests.SetForLoopValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new SetForLoopStepSize(request.getCommandBoxID(), request.getLineIndex(), request.getValue());
}
}
else if (type == CommandZoneRequests.Message.Type.AddForLoopLine) {
CommandZoneRequests.GetForLoopValueRequest request = CommandZoneRequests.GetForLoopValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new AddForLoopLine(request.getCommandBoxID(), request.getLineIndex());
}
}
else if (type == CommandZoneRequests.Message.Type.RemoveForLoopLine) {
CommandZoneRequests.GetForLoopValueRequest request = CommandZoneRequests.GetForLoopValueRequest.parseFrom(message.getSerializedContent());
// Notify only if it is the same client that was the originator of the request.
if (request.getClientID() != getClientID()) {
return new RemoveForLoopLine(request.getCommandBoxID(), request.getLineIndex());
}
}
else {
System.out.println("Unable to process command zone sync message of type " + type);
}
......
/*
* 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.nscclient.notification.commandzone.sync;
public class RemoveForLoopLine extends CommandBoxSyncEvent {
private int lineIndex;
public RemoveForLoopLine(int commandBoxId, int lineIndex) {
super(commandBoxId);
this.lineIndex = lineIndex;
}
public int getLineIndex() {
return lineIndex;
}
}
\ 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.nscclient.notification.commandzone.sync;
public class SetForLoopEndValue extends CommandBoxSyncEvent {
private int lineIndex;
private double value;
public SetForLoopEndValue(int commandBoxId, int lineIndex, double value) {
super(commandBoxId);
this.lineIndex = lineIndex;
this.value = value;
}
public int getLineIndex() {
return lineIndex;
}
public double getValue() {
return value;
}
}
\ 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.nscclient.notification.commandzone.sync;
public class SetForLoopStartValue extends CommandBoxSyncEvent {
private int lineIndex;
private double value;
public SetForLoopStartValue(int commandBoxId, int lineIndex, double value) {
super(commandBoxId);
this.lineIndex = lineIndex;
this.value = value;
}
public int getLineIndex() {
return lineIndex;
}
public double getValue() {
return value;
}
}
\ 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.nscclient.notification.commandzone.sync;
public class SetForLoopStepSize extends CommandBoxSyncEvent {
private int lineIndex;
private double value;
public SetForLoopStepSize(int commandBoxId, int lineIndex, double value) {
super(commandBoxId);
this.lineIndex = lineIndex;
this.value = value;
}
public int getLineIndex() {
return lineIndex;
}
public double getValue() {
return value;
}
}
\ 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.nscclient.notification.commandzone.sync;
public class SetForLoopVariableName extends CommandBoxSyncEvent {
private int lineIndex;
private String value;
public SetForLoopVariableName(int commandBoxId, int lineIndex, String value) {
super(commandBoxId);
this.lineIndex = lineIndex;
this.value = value;
}
public int getLineIndex() {
return lineIndex;
}
public String getValue() {
return value;
}
}
\ 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