Commit 14d277b3 authored by yannick legoc's avatar yannick legoc

No commit message

No commit message
parent a31ac548
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib64/avalon-framework-4.2.0.jar"/>
<classpathentry kind="lib" path="lib64/jacorb.jar"/>
<classpathentry kind="lib" path="lib64/logkit-2.0.jar"/>
<classpathentry kind="lib" path="lib64/protobuf-2.5.0.jar"/>
<classpathentry kind="lib" path="lib64/nappli-java-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/avalon-framework-4.1.5.jar"/>
<classpathentry kind="lib" path="lib/jacorb.jar"/>
<classpathentry kind="lib" path="lib/logkit-1.2.jar"/>
<classpathentry kind="lib" path="lib/protobuf-java-2.5.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>NomadCommandSystem</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
This diff is collapsed.
This diff is collapsed.
/*
* 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;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import fr.ill.ics.nscclient.log.LogSubcriberImpl;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
import fr.ill.ics.nscclient.notification.commandzone.CommandZoneEventClient;
import fr.ill.ics.nscclient.survey.SurveySubcriberImpl;
public class ChangeManager {
private static ChangeManager instance = null;
private ChangeManager() {
}
public static ChangeManager getInstance() {
if (instance == null) {
instance = new ChangeManager();
}
return instance;
}
public void readAndDispatch() {
DataNotificationClient.getInstance().readAndDispatch();
CommandZoneEventClient.getInstance().readAndDispatch();
// Iterating the map of log subscribers
Map<String, LogSubcriberImpl> logSubscriberMap = LogSubcriberImpl.getInstances();
Iterator<Entry<String, LogSubcriberImpl>> it = logSubscriberMap.entrySet().iterator();
while (it.hasNext()) {
LogSubcriberImpl logSubscriber = it.next().getValue();
logSubscriber.readAndDispatch();
}
// Iterating the map of survey subscribers
Map<String, SurveySubcriberImpl> surveySubscriberMap = SurveySubcriberImpl.getInstances();
Iterator<Entry<String, SurveySubcriberImpl>> it2 = surveySubscriberMap.entrySet().iterator();
while (it2.hasNext()) {
SurveySubcriberImpl surveySubscriber = it2.next().getValue();
surveySubscriber.readAndDispatch();
}
}
public void readAndDispatchALotOfEvents() {
}
}
\ 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;
public class ClientCalculator {
native public double[] multiGaussianFit(double[] yData);
native public int getNumberOfPeaks();
native public double[] exponentialFit(double[] yData, double[] xData);
native public double[] simpleGaussianFit(double[] yData);
static {
System.loadLibrary("clientcalculator");
}
}
\ 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;
import java.util.Map;
import java.util.Set;
import fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener;
import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
import fr.ill.ics.bridge.listeners.ServerPropertyChangeListener;
import fr.ill.ics.bridge.listeners.ServerResetCommandListener;
public interface Controller {
public String getName();
public String getType();
public Set getCommandNames();
public String getControllerNameWithRole(String role);
public Map getPropertyNamesAndTypes();
public String getPropertyType(String propertyName);
public void addServerPropertyChangeListener(ServerPropertyChangeListener listener);
public void removeServerPropertyChangeListener(ServerPropertyChangeListener listener);
public void addServerProgressChangeListener(ServerProgressChangeListener listener);
public void removeServerProgressChangeListener(ServerProgressChangeListener listener);
public void addServerCommandStateChangeListener(ServerCommandStateChangeListener listener);
public void removeServerCommandStateChangeListener(ServerCommandStateChangeListener listener);
public void addServerResetCommandListener(ServerResetCommandListener listener);
public void removeServerResetCommandListener(ServerResetCommandListener listener);
public Controller getLinkedController();
public void updateDynamicProperties();
public int getDatabaseId();
}
\ 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;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import fr.ill.ics.bridge.listeners.ServerConfigurationChangeListener;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
import fr.ill.ics.nscclient.servant.CorbaControllerManager;
public abstract class ControllerManager {
private static ControllerManager instance = null;
public static ControllerManager getInstance() {
return instance;
}
public static void initInstance(String serverId) {
instance = new CorbaControllerManager(serverId);
instance.init();
}
public static void resetInstance() {
instance = null;
}
protected abstract void init();
public abstract Set getCommandsOfType(String controllerType);
public abstract String getType(String controllerName);
public abstract Map getInstalledCommands();
public abstract Map<String, Map<String, List<String>>> getInstalledControllers();
public abstract Set<String> getControllerTypes();
//public abstract Map getInstalledControllers();
public abstract Set<String> getControllersOfType(String type, boolean onlyVisibleOnes);
public abstract boolean controllerIsEnabled(String controllerName);
public abstract LinkedHashSet<String> getControllersOfTypeInDisplayOrder(String controllerType, boolean onlyVisibleOnes);
public abstract Set getStartedControllers();
public abstract Controller getController(String controllerName);
public abstract Controller cloneController(String controllerName);
public abstract void removeController(String controllerName);
public abstract String getFamily(String controllerName);
public abstract String getSubfamily(String controllerName);
public void addConfigurationChangeListener(ServerConfigurationChangeListener listener) {
DataNotificationClient.getInstance().addConfigurationChangeListener(listener);
}
public abstract HashMap<String, LinkedHashMap<String, String>> getPropertiesForGeneric();
public abstract void updateDynamicProperties(Controller controller);
public abstract void reloadControllers();
public abstract String getControllerNameWithRole(Controller controller, String role);
}
/*
* 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;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import fr.ill.ics.nscclient.servant.CorbaDriverManager;
public abstract class DriverManager {
private static DriverManager instance = null;
public static DriverManager getInstance() {
return instance;
}
public static void initInstance(String serverId) {
instance = new CorbaDriverManager(serverId);
instance.init();
}
public static void resetInstance() {
instance = null;
}
protected abstract void init();
public abstract String getType(String treeItemText);
public abstract Map getInstalledDrivers();
public abstract void setPaused(boolean checked);
public abstract Set getStartedControllers();
public abstract Controller getDriver(String driverName);
public abstract Collection getControllersOfType(String controllerType);
public abstract Long getChannel(String driverName);
public abstract void reconnectDriver(String driverName);
}
\ 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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import fr.ill.ics.bridge.events.ServerErrorEvent;
import fr.ill.ics.bridge.listeners.ServerErrorListener;
/**
*
* @author ortizh
*
*/
public class ErrorManager {
private static Map<String, ErrorManager> instances = new HashMap<String, ErrorManager>();
private List<ServerErrorListener> serverErrorListeners;
private ErrorManager() {
serverErrorListeners = new ArrayList<ServerErrorListener>();
}
public static ErrorManager getInstance(String serverId) {
if (!instances.containsKey(serverId)) {
ErrorManager instance = new ErrorManager();
instances.put(serverId, instance);
}
return instances.get(serverId);
}
/**
* Add new listener for server error events
* @param listener
*/
public void addServerErrorListener(ServerErrorListener listener) {
synchronized(serverErrorListeners) {
if (!serverErrorListeners.contains(listener)) {
serverErrorListeners.add(listener);
}
}
}
/**
* Remove listener for server error events
* @param listener
*/
public void removeServerErrorListener(ServerErrorListener listener) {
synchronized(serverErrorListeners) {
if (serverErrorListeners.contains(listener)) {
serverErrorListeners.remove(listener);
}
}
}
/**
* Notify all server error listeners
* @param anEvent
*/
public void notifyServerErrorListeners(ServerErrorEvent anEvent) {
// Make a copy of the list to allow the client to do and add/remove during a notification
ArrayList<ServerErrorListener> changeListeners;
synchronized (serverErrorListeners) {
changeListeners = new ArrayList(serverErrorListeners);
}
for (int i = 0; i < changeListeners.size(); i++) {
ServerErrorListener aListener = changeListeners.get(i);
aListener.serverError(anEvent);
}
}
}
\ 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;
import java.util.HashMap;
import java.util.Map;
import fr.ill.ics.bridge.listeners.ServerLogEventListener;
import fr.ill.ics.bridge.listeners.ServerLogXMLListener;
import fr.ill.ics.nscclient.log.LogSubcriberImpl;
public class LogEventSender {
private static Map<String, LogEventSender> instances = new HashMap<String, LogEventSender>();
private String serverId;
private LogEventSender(String serverId) {
this.serverId = serverId;
}
public static LogEventSender getInstance(String serverId) {
if (!instances.containsKey(serverId)) {
LogEventSender instance = new LogEventSender(serverId);
instances.put(serverId, instance);
}
return instances.get(serverId);
}
/**
* Add new listener for server log events
* @param listener
*/
public void addLogEventListener(ServerLogEventListener listener) {
LogSubcriberImpl.getInstance(serverId).addLogEventListener(listener);
}
public void removeLogEventListener(ServerLogEventListener listener) {
LogSubcriberImpl.getInstance(serverId).removeLogEventListener(listener);
}
public void addLogXMLListener(ServerLogXMLListener listener) {
LogSubcriberImpl.getInstance(serverId).addLogXMLListener(listener);
}