Package fr.soleil.salsa.exception

Examples of fr.soleil.salsa.exception.SalsaDeviceException


     * @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


                    timebasesFile));
            return suggestions;
        }
        catch (DevFailed e) {
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot get suggestions : " + e.getMessage(), e);
        }
    }
View Full Code Here

            return result;
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot read scan status informations : "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

                    throw new RuntimeException("Scan type not implemented yet");
            }
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            throw new SalsaDeviceException(e);
        }
    }
View Full Code Here

            scanServerProxy.command_inout("Abort");
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot stop the scan : " + e.getMessage(), e);
        }
    }
View Full Code Here

            scanServerProxy.command_inout("Pause");
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot pause the scan : " + e.getMessage(), e);
        }
    }
View Full Code Here

            scanServerProxy.command_inout("Resume");
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot resume the scan : " + e.getMessage(), e);
        }
    }
View Full Code Here

            historicStringArray = AttributeHelper.extractToStringArray(historicAttribute);
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot read the historic : " + e.getMessage(),
                    e);
        }
        // The historic attribute on the scan server is an array of strings that contains the scan
        // historic.
        // Each record is made of 5 string in the array.
        // - the first one is the period,
        // - the second one is the type,
        // - the third one is the message,
        // - we do not use the last two.
        // So we are going to parse the attribute per set of 5 to build a list of HistoricRecord.
        int recordsNumber = historicStringArray.length / 5;
        int stopIndex = 5 * recordsNumber; // This has the advantage over historicStringArray.length
        // that we have a guaranteed multiple of 5.
        String periodAsString;
        Double period;
        String type;
        String message;
        HistoricRecord record;
        List<HistoricRecord> recordsList = new ArrayList<HistoricRecord>();
        for (int index = 0; index < stopIndex; index += 5) {
            periodAsString = historicStringArray[index];
            type = historicStringArray[index + 1];
            message = historicStringArray[index + 2];
            try {
                period = periodFormat.parse(periodAsString).doubleValue();
            }
            catch (ParseException e) {
                e.printStackTrace();
                throw new SalsaDeviceException("Error : cannot parse period \"" + periodAsString
                        + "\" when reading the historic : " + e.getMessage(), e);
            }
            record = new HistoricRecord();
            record.setPeriod(period);
            record.setType(type);
View Full Code Here

            scanServerProxy.command_inout("ClearHistoric");
        }
        catch (DevFailed e) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot read the historic : " + e.getMessage(),
                    e);
        }
    }
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) {
            invalidateScanServerProxy(scanServerName);
            e.printStackTrace();
            throw new SalsaDeviceException("Error : cannot perform scan function : "
                    + e.getMessage(), e);
        }
    }
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.