Commit 71b31688 authored by helene ortiz's avatar helene ortiz
Browse files

Method getDatabaseId was both in AtomicCommandWrapper and CorbaServant =>...

Method getDatabaseId was both in AtomicCommandWrapper and CorbaServant => method moved in parent interface : Controller
parent b977f17f
......@@ -49,4 +49,6 @@ public interface Controller {
public Controller getLinkedController();
public void updateDynamicProperties();
public int getDatabaseId();
}
\ No newline at end of file
......@@ -108,7 +108,7 @@ public class AtomicCommandWrapper extends CommandWrapper implements Controller {
return serverAtomicCommandBox.getSettingsFileName();
}
public int getDatabaseID() {
public int getDatabaseId() {
return serverAtomicCommandBox.getDatabaseID();
}
......
......@@ -116,7 +116,7 @@ public class ControlCommandWrapper extends CommandWrapper {
return new CommandZoneIteratorWrapper(serverControlCommandBox.getContent(thenBlock));
}
public int getDatabaseID() {
public int getDatabaseId() {
return serverControlCommandBox.getDatabaseID();
}
......
......@@ -199,7 +199,7 @@ public class ForLoopCommandWrapper extends CommandWrapper implements IForLoopEve
return getCommandBoxID();
}
public int getDatabaseID() {
public int getDatabaseId() {
return serverForLoopCommandBox.getDatabaseID();
}
......
......@@ -86,7 +86,7 @@ public class GenericCommandWrapper extends CommandWrapper {
return "generic";
}
public int getDatabaseID() {
public int getDatabaseId() {
return serverGenericCommandBox.getDatabaseID();
}
......
......@@ -25,7 +25,7 @@ public interface ICommandBoxEventListener {
void commandTerminated();
void progressChanged(double progress);
int getDatabaseID();
int getDatabaseId();
int getCommandBoxID();
void onReset();
void onExpressionChanged();
......
......@@ -22,7 +22,7 @@ public interface IForLoopEventListener {
void currentValueChanged(double value, int lineIndex);
int getDatabaseID();
int getDatabaseId();
int getForLoopCommandBoxID();
}
\ No newline at end of file
......@@ -80,7 +80,7 @@ public class ScanCommandWrapper extends CommandWrapper {
return commandId;
}
public int getDatabaseID() {
public int getDatabaseId() {
return serverScanCommandBox.getDatabaseID();
}
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ public class CommandManager {
} else {
int id = CommandDatabase.getInstance().getCommandId(servantId, commandName);
if (id != -1) {
command = new Command(((CorbaServant)controller).getDatabaseId(), id, commandName);
command = new Command(controller.getDatabaseId(), id, commandName);
allCommands.put(commandName, command);
}
}
......
/*
* Nomad Instrument Control Software
² * Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
......@@ -118,7 +118,7 @@ public class PropertyManager {
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getDrivers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
boolean clientFilesExist = readPropertiesClientFilesFor(descriptor.getType());
if (clientFilesExist) {
Controller controller = DriverManager.getInstance().getDriver(descriptor.getName());
......@@ -151,17 +151,17 @@ public class PropertyManager {
* @return
*/
private boolean readPropertiesClientFilesFor(String controllerType) {
if (clientFilesFoundPerControllerType.containsKey(controllerType)) {
return clientFilesFoundPerControllerType.get(controllerType);
}
// Necessary for NomadServerGUI: the client project of the PropertyManager can be another project that NomadGUI, but the client files remain in NomadGUI
String prefix = "";
if (nomadHome != null) {
prefix = nomadHome + ConfigManager.FILE_SEPARATOR;
}
String[] files = FileHelper.getFilesListByExtension(prefix + ConfigManager.CONTROLLERS_DIRECTORY + controllerType + ConfigManager.FILE_SEPARATOR, ConfigManager.PROPERTIES_PATTERN, true, true);
if (files == null || files.length == 0) {
......@@ -200,7 +200,7 @@ public class PropertyManager {
LinkedHashMap<String, XMLPropertyDescriptor> propertiesFromFile = new LinkedHashMap<String, XMLPropertyDescriptor>(propertyParser.getProperties().size());
propertiesFromFile.putAll(propertyParser.getProperties());
propertiesByControllerType.put(propertyParser.getControllerType(), propertiesFromFile);
if (!propertyParser.getDynamicProperties().isEmpty()) {
......@@ -344,11 +344,11 @@ public class PropertyManager {
return property;
}
public void getDynamicPropertyForCommandBox(AtomicCommandWrapper controller) {
}
/**
*
......@@ -358,10 +358,10 @@ public class PropertyManager {
// create dynamically a list of properties and create a new xml file
Map propertyNamesAndTypes = servant.getPropertyNamesAndTypes();
// Does controllerTypeProperties.xml file exist on client side ?
String fileName = ConfigManager.CONTROLLERS_DIRECTORY + servant.getType() + ConfigManager.FILE_SEPARATOR + servant.getType() + ConfigManager.PROPERTIES_PATTERN;
boolean existsOnClientSide = new File(fileName).exists();
if (!existsOnClientSide) {
fileName = servant.getType() + ConfigManager.PROPERTIES_PATTERN;
......@@ -377,7 +377,7 @@ public class PropertyManager {
LinkedHashMap<String, XMLPropertyDescriptor> propertiesFromFile = new LinkedHashMap<String, XMLPropertyDescriptor>(propertyParser.getProperties().size());
propertiesFromFile.putAll(propertyParser.getProperties());
propertiesByControllerType.put(propertyParser.getControllerType(), propertiesFromFile);
Map propertiesTypesFromFile = new LinkedHashMap<String, String>(propertyParser.getPropertyTypes().size());
propertiesTypesFromFile.putAll(propertyParser.getPropertyTypes());
}
......@@ -429,18 +429,18 @@ public class PropertyManager {
ConfigManager.CONFIGURATION_ERROR = true;
return null;
}
if (propertyDescriptor != null) {
Property property = PropertyFactory.getInstance().createProperty(servant.getDatabaseId(), id, getPropertyDescriptor(servant.getType(), propertyName), false);
properties.put(propertyName, property);
return property;
}
// create the property from database
Property property = PropertyFactory.getInstance().createProperty(servant.getDatabaseId(), id, "unknown", false);
properties.put(propertyName, property);
return property;
}
......@@ -463,7 +463,7 @@ public class PropertyManager {
ConfigManager.CONFIGURATION_ERROR = true;
return null;
}
if (propertyDescriptor != null) {
Property property = PropertyFactory.getInstance().createProperty(command.getId(), propertyId, getPropertyDescriptor(command.getType(), propertyName), true);
......@@ -471,11 +471,11 @@ public class PropertyManager {
properties.put(propertyName, property);
return property;
}
// create the property from database
Property property = PropertyFactory.getInstance().createProperty(command.getId(), propertyId, "unknown", true);
properties.put(propertyName, property);
return property;
}
......@@ -691,13 +691,13 @@ public class PropertyManager {
int servantId = ServantDatabase.getInstance().getServantId(controllerName);
return PropertyDatabase.getInstance().getSpyPropertyDescriptors(servantId);
}
public boolean spyHasContent(String controllerName) {
Set<SpyPropertyDescriptor> setOfDescriptors = getListOfpropertyDescriptorForSpy(controllerName);
if (setOfDescriptors != null && setOfDescriptors.size() > 0) {
if (setOfDescriptors.size() == 1) {
// Verify the only property loaded is not a commandStatus property
Iterator<SpyPropertyDescriptor> it = setOfDescriptors.iterator();
......@@ -782,7 +782,7 @@ public class PropertyManager {
* @return a set containing all property names for given controller type
*/
public Set getPropertiesForControllersType(String controllerType) {
SortedSet properties = new TreeSet();
if (propertiesByControllerType.get(controllerType) != null) {
properties.addAll(propertiesByControllerType.get(controllerType).keySet());
......@@ -797,10 +797,10 @@ public class PropertyManager {
*/
public Set<String> getPropertiesForController(String controllerName) {
int servantId = ServantDatabase.getInstance().getServantId(controllerName);
SortedSet<String> properties = new TreeSet<String>();
Map<String, String> namesAndTypes = PropertyDatabase.getInstance().getPropertyNamesAndTypes(servantId);
if (namesAndTypes != null) {
properties.addAll(namesAndTypes.keySet());
} else {
......@@ -816,10 +816,10 @@ public class PropertyManager {
*/
public Set<String> getDynamicPropertiesForController(String controllerName) {
int servantId = ServantDatabase.getInstance().getServantId(controllerName);
SortedSet<String> properties = new TreeSet<String>();
Map<String, String> namesAndTypes = PropertyDatabase.getInstance().getDynamicPropertyNamesAndTypes(servantId);
if (namesAndTypes != null) {
properties.addAll(namesAndTypes.keySet());
} else {
......@@ -848,20 +848,20 @@ public class PropertyManager {
* @return
*/
public Property getProperty(int servantId, String propertyName) {
Property property = propertyMap.get(servantId).get(propertyName);
if (property == null) {
int propertyId = PropertyDatabase.getInstance().getPropertyIdForServant(servantId, propertyName);
// create the property from database
// container id should not be important unless for properties of command box that should already have been created
// should we test is command box?
property = PropertyFactory.getInstance().createProperty(0, propertyId, "unknown", false);
propertyMap.get(servantId).put(propertyName, property);
}
return property;
}
......@@ -963,8 +963,8 @@ public class PropertyManager {
public void removePropertyDescriptor(String controllerType) {
propertiesByControllerType.remove(controllerType);
}
static class CommandBoxKey {
private String serverId;
private int commandBoxId;
......
......@@ -85,7 +85,7 @@ public class CommandZoneEventClient {
public void addCommandBoxListener(ICommandBoxEventListener listener) {
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseID(), listener.getCommandBoxID());
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseId(), listener.getCommandBoxID());
synchronized (commandBoxListeners) {
if (!commandBoxListeners.containsKey(key)) {
......@@ -97,7 +97,7 @@ public class CommandZoneEventClient {
public void removeCommandBoxListener(ICommandBoxEventListener listener) {
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseID(), listener.getCommandBoxID());
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseId(), listener.getCommandBoxID());
synchronized (commandBoxListeners) {
if (commandBoxListeners.containsKey(key)) {
......@@ -166,7 +166,7 @@ public class CommandZoneEventClient {
public void addForLoopListener(IForLoopEventListener listener) {
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseID(), listener.getForLoopCommandBoxID());
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseId(), listener.getForLoopCommandBoxID());
synchronized (forLoopListeners) {
if (!forLoopListeners.containsKey(key)) {
......@@ -178,7 +178,7 @@ public class CommandZoneEventClient {
public void removeCommandBoxListener(IForLoopEventListener listener) {
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseID(), listener.getForLoopCommandBoxID());
CommandZoneBoxKey key = new CommandZoneBoxKey(listener.getDatabaseId(), listener.getForLoopCommandBoxID());
synchronized (forLoopListeners) {
if (forLoopListeners.containsKey(key)) {
......
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