Package fr.soleil.salsa.exception

Examples of fr.soleil.salsa.exception.SalsaDeviceException


     */
    private synchronized DeviceProxy getScanServerProxy(String scanServerName)
            throws SalsaDeviceException {
        DeviceProxy scanServerProxy;
        if (scanServerName == null) {
            throw new SalsaDeviceException("Cannot connect to the scan server : name is null.");
        }
        else if (scanServerName.equals(serverNameCache)) {
            scanServerProxy = serverProxyCache;
        }
        else if (serverProxyCacheMap.containsKey(scanServerName)) {
            scanServerProxy = serverProxyCacheMap.get(scanServerName);
            serverProxyCache = scanServerProxy;
            serverNameCache = scanServerName;
        }
        else {
            try {
                scanServerProxy = new DeviceProxy(scanServerName);
                serverProxyCacheMap.put(scanServerName, scanServerProxy);
                serverProxyCache = scanServerProxy;
                serverNameCache = scanServerName;
            }
            catch (DevFailed e) {
                e.printStackTrace();
                String message = "Error : cannot connect to the scan server " + scanServerName
                        + ". Please check the preferences.";
                if (e.errors != null && e.errors.length > 0) {
                    message += " Details : " + e.errors[0].desc;
                }
                throw new SalsaDeviceException(message);
            }
        }
        return scanServerProxy;
    }
View Full Code Here


     * @param scanServerName
     */
    private synchronized void invalidateScanServerProxy(String scanServerName)
            throws SalsaDeviceException {
        if (scanServerName == null) {
            throw new SalsaDeviceException("Cannot invalidate the scan server : name is null.");
        }
        if (scanServerName.equals(serverNameCache)) {
            serverProxyCache = null;
            serverNameCache = null;
        }
View Full Code Here

                                "afterRunActionSensor");
                        afterRunActionSensor.insert(sensorPosition);
                        scanServerProxy.write_attribute(afterRunActionSensor);
                    }
                    else {
                        throw new SalsaDeviceException("Error : sensor " + sensor.getName()
                                + " is unknow on the scan server " + scanServerName + ".");
                    }
                }
            }

            if (actuator != null) {
                // We need the actuator position.
                String actuatorName = actuator.getName();
                if (actuatorName != null && !actuatorName.trim().equals("")) {
                    String[] actuatorsNamesArray = scanServerProxy.read_attribute("actuators")
                            .extractStringArray();
                    int actuatorPosition;
                    for (actuatorPosition = 0; actuatorPosition < actuatorsNamesArray.length; ++actuatorPosition) {
                        if (actuatorName.equals(actuatorsNamesArray[actuatorPosition])) {
                            break;
                        }
                    }
                    if (actuatorPosition < actuatorsNamesArray.length) {
                        DeviceAttribute afterRunActionActuator = new DeviceAttribute(
                                "afterRunActionActuator");
                        afterRunActionActuator.insert(actuatorPosition);
                        scanServerProxy.write_attribute(afterRunActionActuator);
                    }
                    else {
                        throw new SalsaDeviceException("Error : actuator " + actuator.getName()
                                + " is unknow on the scan server " + scanServerName + ".");
                    }
                }
            }

            scanServerProxy.command_inout("ExecuteAction");

        }
        catch (DevFailed e) {
            scanServerManager.invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot perform scan function : "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

                    startScan((IConfigEnergy) config, context);
                } else {
                    throw new SalsaScanConfigurationException("Cannot start scan because Scan type not supported.");
                }
            } else {
                throw new SalsaDeviceException("Cannot start scan because scanServerName in context is not defined");
            }
        } else {
            throw new SalsaScanConfigurationException("Cannot start scan because context is not defined.");
        }
    }
View Full Code Here

        if (scanConnectorTool1D != null) {
            scanConnectorTool1D.setDataRecorderPartialMode(dataRecorderPartialMode);
            scanConnectorTool1D.setDataRecorderEnable(dataRecorderEnable);
            scanConnectorTool1D.startScan(config, scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot start scan config1D " + config.getName()
                    + " because scanConnectorTool1D is not defined");
        }
    }
View Full Code Here

    public void loadScan(IConfig1D config, IContext context) throws SalsaDeviceException {
        String scanServerName = context.getScanServerName();
        if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
            scanConnectorTool1D = new ScanConnectorTool1D(scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot load scan config1D  " + config.getName() + " because "
                    + scanServerName + " device is down");
        }
    }
View Full Code Here

        if (scanConnectorTool2D != null) {
            scanConnectorTool2D.setDataRecorderPartialMode(dataRecorderPartialMode);
            scanConnectorTool2D.setDataRecorderEnable(dataRecorderEnable);
            scanConnectorTool2D.startScan(config, scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot start scan config2D  " + config.getName()
                    + " because scanConnectorTool2D is not defined");
        }
    }
View Full Code Here

    public void loadScan(IConfig2D config, IContext context) throws SalsaDeviceException {
        String scanServerName = context.getScanServerName();
        if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
            scanConnectorTool2D = new ScanConnectorTool2D(scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot load config2D  " + config.getName() + " because " + scanServerName
                    + " device is down");
        }
    }
View Full Code Here

        if (scanConnectorToolHCS != null) {
            scanConnectorToolHCS.setDataRecorderPartialMode(dataRecorderPartialMode);
            scanConnectorToolHCS.setDataRecorderEnable(dataRecorderEnable);
            scanConnectorToolHCS.startScan(config, scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot start scan configHCS  " + config.getName()
                    + " because scanConnectorToolHCS is not defined");
        }
    }
View Full Code Here

    public void loadScan(IConfigHCS config, IContext context) throws SalsaDeviceException {
        String scanServerName = context.getScanServerName();
        if (TangoDeviceHelper.isDeviceRunning(scanServerName)) {
            scanConnectorToolHCS = new ScanConnectorToolHCS(scanServerName);
        } else {
            throw new SalsaDeviceException("Cannot load configHCS  " + config.getName() + " because " + scanServerName
                    + " device is down");
        }
    }
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.exception.SalsaDeviceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.