Commit 4c9a41cf authored by yannick legoc's avatar yannick legoc
Browse files

Refactored IController into Controller to keep compatility with current

module compilation.
parent 92f62f65
......@@ -26,7 +26,7 @@ import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
import fr.ill.ics.bridge.listeners.ServerPropertyChangeListener;
import fr.ill.ics.bridge.listeners.ServerResetCommandListener;
public interface IController {
public interface Controller {
public String getName();
public String getType();
......@@ -47,7 +47,7 @@ public interface IController {
public void addServerResetCommandListener(ServerResetCommandListener listener);
public void removeServerResetCommandListener(ServerResetCommandListener listener);
public IController getLinkedController();
public Controller getLinkedController();
public void updateDynamicProperties();
public int getDatabaseId();
......
......@@ -35,7 +35,7 @@ import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor;
import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor.LoadConfigurationFailure;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
import fr.ill.ics.nscclient.servant.ClientServantDescriptor;
import fr.ill.ics.nscclient.servant.Controller;
import fr.ill.ics.nscclient.servant.ControllerServant;
import fr.ill.ics.util.exception.ControllerNotFoundException;
......@@ -92,20 +92,20 @@ public class ControllerManager implements ServerConfigurationChangeListener {
/**
*
*/
public Controller getController(String controllerName) {
public ControllerServant getController(String controllerName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
Controller controller = ServantManagerAccessor.getInstance(serverId).getController(descriptor);
ControllerServant controller = ServantManagerAccessor.getInstance(serverId).getController(descriptor);
return controller;
}
ControllerNotFoundException cnfe = new ControllerNotFoundException(controllerName, "", getClass().getCanonicalName(), "getController");
return null;
}
public Controller cloneController(String controllerName) throws ControllerNotFoundException {
public ControllerServant cloneController(String controllerName) throws ControllerNotFoundException {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getControllerDescriptor(controllerName);
if (descriptor != null) {
Controller controller = ServantManagerAccessor.getInstance(serverId).cloneController(descriptor);
ControllerServant controller = ServantManagerAccessor.getInstance(serverId).cloneController(descriptor);
return controller;
}
ControllerNotFoundException cnfe = new ControllerNotFoundException(controllerName, "", getClass().getCanonicalName(), "cloneController");
......@@ -249,7 +249,7 @@ public class ControllerManager implements ServerConfigurationChangeListener {
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getControllers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
Controller controller = getController(descriptor.getName());
ControllerServant controller = getController(descriptor.getName());
if (controller.isStarted()) {
startedCommands.add(controller);
}
......@@ -296,8 +296,8 @@ public class ControllerManager implements ServerConfigurationChangeListener {
}
public void updateDynamicProperties(IController servant) {
Controller controller = (Controller)servant;
public void updateDynamicProperties(Controller servant) {
ControllerServant controller = (ControllerServant)servant;
ServantManagerAccessor.getInstance(serverId).updateDynamicProperties(controller.getId());
}
......@@ -314,8 +314,8 @@ public class ControllerManager implements ServerConfigurationChangeListener {
reset();
}
public String getControllerNameWithRole(IController servant, String role) {
Controller controller = (Controller)servant;
public String getControllerNameWithRole(Controller servant, String role) {
ControllerServant controller = (ControllerServant)servant;
return ServantManagerAccessor.getInstance(serverId).getControllerNameWithRole(controller.getId(), role);
}
}
......@@ -30,7 +30,7 @@ import java.util.TreeMap;
import fr.ill.ics.nscclient.dataprovider.ServantDatabase;
import fr.ill.ics.nscclient.dataprovider.ServantManagerAccessor;
import fr.ill.ics.nscclient.servant.ClientServantDescriptor;
import fr.ill.ics.nscclient.servant.Driver;
import fr.ill.ics.nscclient.servant.DriverServant;
......@@ -60,10 +60,10 @@ public class DriverManager {
protected void init() {
}
public Driver getDriver(String driverName) {
public DriverServant getDriver(String driverName) {
ClientServantDescriptor descriptor = ServantDatabase.getInstance().getDriverDescriptor(driverName);
if (descriptor != null) {
Driver driver = ServantManagerAccessor.getInstance(serverId).getDriver(descriptor);
DriverServant driver = ServantManagerAccessor.getInstance(serverId).getDriver(descriptor);
return driver;
}
return null;
......@@ -123,7 +123,7 @@ public class DriverManager {
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getDrivers().iterator();
while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next();
Driver driver = getDriver(descriptor.getName());
DriverServant driver = getDriver(descriptor.getName());
if (driver.isStarted()) {
startedCommands.add(driver);
}
......@@ -138,7 +138,7 @@ public class DriverManager {
public Long getChannel(String driverName) {
Driver driver = getDriver(driverName);
DriverServant driver = getDriver(driverName);
if (driver != null) {
return getDriver(driverName).getChannel();
}
......@@ -147,7 +147,7 @@ public class DriverManager {
}
public void reconnectDriver(String driverName) {
Driver driver = getDriver(driverName);
DriverServant driver = getDriver(driverName);
if (driver != null) {
ServantManagerAccessor.getInstance(serverId).reconnectDriver(driver.getDatabaseId(), driver.getId());
}
......
......@@ -21,13 +21,13 @@ package fr.ill.ics.bridge.command;
import java.util.Map;
import java.util.Set;
import fr.ill.ics.bridge.IController;
import fr.ill.ics.bridge.Controller;
import fr.ill.ics.bridge.listeners.ServerPropertyChangeListener;
import fr.ill.ics.nscclient.command.ServerAtomicCommandBox;
import fr.ill.ics.nscclient.dataprovider.CommandDatabase;
import fr.ill.ics.nscclient.dataprovider.ServantDatabase;
public class AtomicCommandWrapper extends CommandWrapper implements IController {
public class AtomicCommandWrapper extends CommandWrapper implements Controller {
private ServerAtomicCommandBox serverAtomicCommandBox;
private int servantId;
......@@ -96,7 +96,7 @@ public class AtomicCommandWrapper extends CommandWrapper implements IController
// do nothing
}
public IController getLinkedController() {
public Controller getLinkedController() {
return null;
}
......
......@@ -21,7 +21,7 @@ package fr.ill.ics.core.command;
import java.util.HashMap;
import java.util.Map;
import fr.ill.ics.bridge.IController;
import fr.ill.ics.bridge.Controller;
import fr.ill.ics.bridge.command.AtomicCommandWrapper;
import fr.ill.ics.nscclient.dataprovider.CommandDatabase;
import fr.ill.ics.nscclient.servant.Servant;
......@@ -44,7 +44,7 @@ public class CommandManager {
return instance;
}
public Command getCommand(IController controller, String commandName, boolean createExceptionIfNotFound, PluginType pluginType) throws CommandNotFoundException {
public Command getCommand(Controller controller, String commandName, boolean createExceptionIfNotFound, PluginType pluginType) throws CommandNotFoundException {
// Create a new Map of commandName:Command instance if it doesn't exist for the abstract controller
if (controllerCommands == null) {
......
......@@ -33,7 +33,7 @@ import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import fr.ill.ics.bridge.IController;
import fr.ill.ics.bridge.Controller;
import fr.ill.ics.bridge.ControllerManager;
import fr.ill.ics.bridge.DriverManager;
import fr.ill.ics.bridge.ResourceManager;
......@@ -126,7 +126,7 @@ public class PropertyManager {
boolean clientFilesExist = readPropertiesClientFilesFor(descriptor.getType());
if (clientFilesExist) {
IController controller = DriverManager.getInstance().getDriver(descriptor.getName());
Controller controller = DriverManager.getInstance().getDriver(descriptor.getName());
createPropertiesForController((Servant)controller);
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) {
createDynamicPropertiesForController((Servant)controller);
......@@ -140,7 +140,7 @@ public class PropertyManager {
ClientServantDescriptor descriptor = it.next();
boolean clientFilesExist = readPropertiesClientFilesFor(descriptor.getType());
if (clientFilesExist) {
IController controller = ControllerManager.getInstance().getController(descriptor.getName());
Controller controller = ControllerManager.getInstance().getController(descriptor.getName());
createPropertiesForController((Servant)controller);
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) {
createDynamicPropertiesForController((Servant)controller);
......@@ -166,7 +166,7 @@ public class PropertyManager {
Set<String> drivers = ServantDatabase.getInstance().getDriversOfType(type, false);
if (drivers != null && !drivers.isEmpty()) {
for (String driverName : drivers) {
IController controller = DriverManager.getInstance().getDriver(driverName);
Controller controller = DriverManager.getInstance().getDriver(driverName);
createPropertiesForController((Servant)controller);
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) {
createDynamicPropertiesForController((Servant)controller);
......@@ -176,7 +176,7 @@ public class PropertyManager {
Set<String> controllers = ControllerManager.getInstance().getControllersOfType(type, false);
if (controllers != null && !controllers.isEmpty()) {
for (String controllerName : controllers) {
IController controller = ControllerManager.getInstance().getController(controllerName);
Controller controller = ControllerManager.getInstance().getController(controllerName);
createPropertiesForController((Servant)controller);
if (dynamicPropertiesByControllerType != null && dynamicPropertiesByControllerType.containsKey(((Servant)controller).getType())) {
createDynamicPropertiesForController((Servant)controller);
......@@ -304,7 +304,7 @@ public class PropertyManager {
* @return
* @throws PropertyNotFoundException
*/
public Property getProperty(IController controller, String propertyName, PluginType pluginType) throws PropertyNotFoundException {
public Property getProperty(Controller controller, String propertyName, PluginType pluginType) throws PropertyNotFoundException {
Property property;
if (controller instanceof Servant) {
property = getPropertyForServant((Servant)controller, propertyName);
......@@ -641,7 +641,7 @@ public class PropertyManager {
* @param propertyName
* @return
*/
public Property getDynamicPropertyChild(IController controller, String realPropertyName, PluginType pluginType) throws PropertyNotFoundException {
public Property getDynamicPropertyChild(Controller controller, String realPropertyName, PluginType pluginType) throws PropertyNotFoundException {
String parentPropertyName = realPropertyName.substring(0, realPropertyName.lastIndexOf("."));
int index = Integer.parseInt(realPropertyName.substring(realPropertyName.lastIndexOf(".")+1));
Property property = null;
......@@ -674,7 +674,7 @@ public class PropertyManager {
/**
* Search dynamic property
*/
public Property getDynamicProperty(IController controller, String propertyName) throws PropertyNotFoundException {
public Property getDynamicProperty(Controller controller, String propertyName) throws PropertyNotFoundException {
String parentPropertyName = propertyName.substring(0, propertyName.lastIndexOf("."));
int index = Integer.parseInt(propertyName.substring(propertyName.lastIndexOf(".")+1));
......@@ -882,7 +882,7 @@ public class PropertyManager {
* @param property
* @param isTrueString
*/
public void changeToString(IController controller, Property property, boolean isTrueString) {
public void changeToString(Controller controller, Property property, boolean isTrueString) {
if (controller instanceof AtomicCommandWrapper) {
AtomicCommandWrapper command = (AtomicCommandWrapper)controller;
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
......@@ -900,7 +900,7 @@ public class PropertyManager {
* @param property
* @param isTrueString
*/
public void changeDynamicToString(IController controller, Property property, boolean isTrueString) {
public void changeDynamicToString(Controller controller, Property property, boolean isTrueString) {
if (controller instanceof AtomicCommandWrapper) {
AtomicCommandWrapper command = (AtomicCommandWrapper)controller;
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
......@@ -970,7 +970,7 @@ public class PropertyManager {
*
* @param controller
*/
public void removeController(IController controller) {
public void removeController(Controller controller) {
if (controller instanceof AtomicCommandWrapper) {
AtomicCommandWrapper command = (AtomicCommandWrapper)controller;
CommandBoxKey key = new CommandBoxKey(command.getServerId(), command.getId());
......@@ -993,13 +993,13 @@ public class PropertyManager {
* @param dynamicPropertyName
* @return
*/
public int getNumberOfChildrenForDynamicProperty(IController controller, String dynamicPropertyName) {
public int getNumberOfChildrenForDynamicProperty(Controller controller, String dynamicPropertyName) {
int propertyId = PropertyDatabase.getInstance().getDynamicPropertyIdForServant(((Servant)controller).getId(), dynamicPropertyName);
return PropertyDatabase.getInstance().getNumberOfChildProperties(propertyId);
}
public int getNumberOfDecimalPlaces(IController controller, String propertyName) {
public int getNumberOfDecimalPlaces(Controller controller, String propertyName) {
try {
Property property = getProperty(controller, propertyName, PluginType.GENERAL);
if (property != null) {
......@@ -1023,7 +1023,7 @@ public class PropertyManager {
* @param propertyName
* @return
*/
public boolean isDynamic(IController controller, String propertyName) {
public boolean isDynamic(Controller controller, String propertyName) {
if (propertyMap.containsKey(((Servant)controller).getId())) {
Map map = propertyMap.get(((Servant)controller).getId());
if (map.containsKey(propertyName)) {
......
......@@ -43,9 +43,9 @@ import fr.ill.ics.nomadserver.configuration.ServantDataConfiguration.ServantSpyP
import fr.ill.ics.nomadserver.servantmanager.ServantManagerRequest;
import fr.ill.ics.nscclient.servant.ClientCommandDescriptor;
import fr.ill.ics.nscclient.servant.ClientServantDescriptor;
import fr.ill.ics.nscclient.servant.Controller;
import fr.ill.ics.nscclient.servant.Driver;
import fr.ill.ics.nscclient.servant.Driver.Mode;
import fr.ill.ics.nscclient.servant.ControllerServant;
import fr.ill.ics.nscclient.servant.DriverServant;
import fr.ill.ics.nscclient.servant.DriverServant.Mode;
import fr.ill.ics.nscclient.servant.Servant;
import fr.ill.ics.nscclient.servant.DynamicPropertyDescriptor;
import fr.ill.ics.nscclient.servant.ResourceNotFoundException;
......@@ -417,13 +417,13 @@ public class ServantManagerAccessor {
ServantDataConfiguration.ServantDescriptor.Mode pbMode = pbServant.getMode();
Driver.Mode mode = Driver.Mode.REAL;
DriverServant.Mode mode = DriverServant.Mode.REAL;
if (pbMode == ServantDataConfiguration.ServantDescriptor.Mode.REAL) {
mode = Driver.Mode.REAL;
mode = DriverServant.Mode.REAL;
} else if (pbMode == ServantDataConfiguration.ServantDescriptor.Mode.PERFECT) {
mode = Driver.Mode.PERFECT;
mode = DriverServant.Mode.PERFECT;
} else if (pbMode == ServantDataConfiguration.ServantDescriptor.Mode.SIMULATED) {
mode = Driver.Mode.SIMULATED;
mode = DriverServant.Mode.SIMULATED;
}
servant = createDriver(descriptor, pbServant.getChannel(), mode);
......@@ -526,9 +526,9 @@ public class ServantManagerAccessor {
}
}
private Driver createDriver(ClientServantDescriptor descriptor, int channel, Mode mode) {
private DriverServant createDriver(ClientServantDescriptor descriptor, int channel, Mode mode) {
Driver driver = new Driver(DATABASE_ID, descriptor.getId(), descriptor);
DriverServant driver = new DriverServant(DATABASE_ID, descriptor.getId(), descriptor);
driver.setChannel(channel);
driver.setMode(mode);
// no init here
......@@ -536,14 +536,14 @@ public class ServantManagerAccessor {
return driver;
}
private Controller createController(ClientServantDescriptor descriptor) {
private ControllerServant createController(ClientServantDescriptor descriptor) {
Controller controller = null;
ControllerServant controller = null;
if (descriptor.getType().equals(PARAMETERIZABLE_SCAN_1D)) {
controller = new CorbaIcsParameterizableScan1D(DATABASE_ID, descriptor.getId(), descriptor);
} else {
controller = new Controller(DATABASE_ID, descriptor.getId(), descriptor);
controller = new ControllerServant(DATABASE_ID, descriptor.getId(), descriptor);
}
// no initialisation here
servants.put(descriptor.getId(), controller);
......@@ -580,9 +580,9 @@ public class ServantManagerAccessor {
return null;
}
public Controller getController(ClientServantDescriptor descriptor) {
public ControllerServant getController(ClientServantDescriptor descriptor) {
Controller controller = (Controller)servants.get(descriptor.getId());
ControllerServant controller = (ControllerServant)servants.get(descriptor.getId());
if (controller != null) {
return controller;
} else {
......@@ -592,9 +592,9 @@ public class ServantManagerAccessor {
return null;
}
public Driver getDriver(ClientServantDescriptor descriptor) {
public DriverServant getDriver(ClientServantDescriptor descriptor) {
Driver driver = (Driver)servants.get(descriptor.getId());
DriverServant driver = (DriverServant)servants.get(descriptor.getId());
if (driver != null) {
return driver;
} else {
......@@ -630,9 +630,9 @@ public class ServantManagerAccessor {
return "?";
}
public Controller cloneController(ClientServantDescriptor descriptor) {
public ControllerServant cloneController(ClientServantDescriptor descriptor) {
Controller controller = null;
ControllerServant controller = null;
try {
// call to server to clone the controller
......@@ -641,7 +641,7 @@ public class ServantManagerAccessor {
ServantDataConfiguration.ServantDescriptor pbServant = getControllerConfiguration(DATABASE_ID, servantId);
controller = (Controller)initAllMaps(pbServant, false);
controller = (ControllerServant)initAllMaps(pbServant, false);
return controller;
} catch (Exception e) {
......
......@@ -20,9 +20,9 @@ package fr.ill.ics.nscclient.servant;
public class Controller extends Servant {
public class ControllerServant extends Servant {
public Controller(int databaseId, int servantId, ClientServantDescriptor descriptor) {
public ControllerServant(int databaseId, int servantId, ClientServantDescriptor descriptor) {
super(databaseId, servantId, descriptor);
}
......
......@@ -20,14 +20,14 @@ package fr.ill.ics.nscclient.servant;
public class Driver extends Servant {
public class DriverServant extends Servant {
public enum Mode {REAL, SIMULATED, PERFECT};
private Mode mode = Mode.REAL;
private Long channel;
public Driver(int databaseId, int servantId, ClientServantDescriptor descriptor) {
public DriverServant(int databaseId, int servantId, ClientServantDescriptor descriptor) {
super(databaseId, servantId, descriptor);
}
......
......@@ -21,7 +21,7 @@ package fr.ill.ics.nscclient.servant;
import java.util.Map;
import java.util.Set;
import fr.ill.ics.bridge.IController;
import fr.ill.ics.bridge.Controller;
import fr.ill.ics.bridge.ControllerManager;
import fr.ill.ics.bridge.listeners.ServerCommandStateChangeListener;
import fr.ill.ics.bridge.listeners.ServerProgressChangeListener;
......@@ -35,7 +35,7 @@ import fr.ill.ics.nscclient.dataprovider.PropertyDatabase;
import fr.ill.ics.nscclient.notification.DataNotificationClient;
public class Servant implements IController {
public class Servant implements Controller {
public class UnknownPropertyException extends Exception {};
public class UnknownCommandException extends Exception {};
......@@ -145,7 +145,7 @@ public class Servant implements IController {
return servantDescriptor.getName();
}
public IController getLinkedController() {
public Controller getLinkedController() {
return this;
}
......
......@@ -25,10 +25,10 @@ import java.util.Map;
import fr.ill.ics.bridge.scan.IParameterizableScan1D;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.nscclient.servant.ClientServantDescriptor;
import fr.ill.ics.nscclient.servant.Controller;
import fr.ill.ics.nscclient.servant.ControllerServant;
import fr.ill.ics.util.ConfigManager;
public class CorbaIcsParameterizableScan1D extends Controller implements IParameterizableScan1D {
public class CorbaIcsParameterizableScan1D extends ControllerServant implements IParameterizableScan1D {
private enum PropertyType {STRING, DOUBLE, LONG};
......
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