From 427fcfebeabe77a32159890395052bf1bdf09db7 Mon Sep 17 00:00:00 2001 From: Gwenaelle Abeille <gwenaelle.abeille@synchrotron-soleil.fr> Date: Tue, 8 Mar 2011 15:13:19 +0000 Subject: [PATCH] release --- pom.xml | 2 +- .../ArchivingManager/ArchivingManager.java | 44 +- .../Common/Watcher/AbsArchivingWatcher.java | 1411 +++++++++-------- src/main/java/HdbArchiver/HdbArchiver.java | 53 +- .../HdbArchivingWatcher.java | 119 +- src/main/java/TdbArchiver/TdbArchiver.java | 25 +- .../TdbArchivingWatcher.java | 125 +- 7 files changed, 850 insertions(+), 929 deletions(-) diff --git a/pom.xml b/pom.xml index 33aba86c..a4a205e8 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ <artifactId>hdbtdbArchivingServers</artifactId> <name>hdbtdbArchivingServers</name> - <version>2.2.13-SNAPSHOT</version> + <version>2.2.14</version> <scm> <connection>${scm.connection.svn.tango-cs}:archiving/server/hdbtdbArchivingServers</connection> diff --git a/src/main/java/ArchivingManager/ArchivingManager.java b/src/main/java/ArchivingManager/ArchivingManager.java index 60c3057a..bccc2b73 100644 --- a/src/main/java/ArchivingManager/ArchivingManager.java +++ b/src/main/java/ArchivingManager/ArchivingManager.java @@ -318,8 +318,7 @@ public class ArchivingManager extends DeviceImpl * The device version */ // ========================================================= - ArchivingManager(final DeviceClass cl, final String s, final String d, final String version) - throws DevFailed { + ArchivingManager(final DeviceClass cl, final String s, final String d, final String version) throws DevFailed { super(cl, s, d); m_version = version; init_device(); @@ -345,8 +344,7 @@ public class ArchivingManager extends DeviceImpl if (hdbName == null) { hdbManager.ArchivingConfigure(hdbUser, hdbPassword); } else { - hdbManager.ArchivingConfigure(hdbHost, hdbName, hdbUser, hdbPassword, - hdbRacConnection, false, false); + hdbManager.ArchivingConfigure(hdbHost, hdbName, hdbUser, hdbPassword, hdbRacConnection, false, false); } } catch (final ArchivingException e) { e.printStackTrace(); @@ -359,8 +357,7 @@ public class ArchivingManager extends DeviceImpl if (tdbName == null) { tdbManager.ArchivingConfigure(tdbUser, tdbPassword); } else { - tdbManager.ArchivingConfigure(tdbHost, tdbName, tdbUser, tdbPassword, - tdbRacConnection, false, false); + tdbManager.ArchivingConfigure(tdbHost, tdbName, tdbUser, tdbPassword, tdbRacConnection, false, false); } } catch (final ArchivingException e) { e.printStackTrace(); @@ -375,14 +372,11 @@ public class ArchivingManager extends DeviceImpl if ((al = hdbManager.getArchiverListSize() == 0 && tdbManager.getArchiverListSize() == 0) || (db = !hdbManager.is_db_connected() && !tdbManager.is_db_connected())) { set_state(DevState.FAULT); - set_status(device_name + " : DevState.FAULT" + "\r\n" - + (db ? " No database connected ! " + "\r\n" : "") + set_status(device_name + " : DevState.FAULT" + "\r\n" + (db ? " No database connected ! " + "\r\n" : "") + (al ? " No archiver available ! " + "\r\n" : "")); get_logger().error( - "ERROR : " + (db ? " - No database connected ! " : "") - + (al ? " - No archiver available ! " : "")); - } else if ((al = hdbManager.getArchiverListSize() == 0 - || tdbManager.getArchiverListSize() == 0) + "ERROR : " + (db ? " - No database connected ! " : "") + (al ? " - No archiver available ! " : "")); + } else if ((al = hdbManager.getArchiverListSize() == 0 || tdbManager.getArchiverListSize() == 0) || (db = !hdbManager.is_db_connected() || !tdbManager.is_db_connected())) { set_state(DevState.ALARM); set_status(device_name + " : DevState.ALARM" + "\r\n" @@ -416,8 +410,8 @@ public class ArchivingManager extends DeviceImpl if (Util._UseDb == false) { return; } - final String[] propnames = { "HdbHost", "HdbName", "TdbHost", "TdbName", "HdbUser", - "HdbPassword", "TdbUser", "TdbPassword", "HdbRacConnection", "TdbRacConnection" }; + final String[] propnames = { "HdbHost", "HdbName", "TdbHost", "TdbName", "HdbUser", "HdbPassword", "TdbUser", + "TdbPassword", "HdbRacConnection", "TdbRacConnection" }; // Call database and extract values // -------------------------------------------- @@ -653,8 +647,7 @@ public class ArchivingManager extends DeviceImpl final String reason = "Failed while executing ArchivingManager.archiving_configure() method..."; final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : "; - final ArchivingException e = new ArchivingException(message, reason, ErrSeverity.PANIC, - desc, ""); + final ArchivingException e = new ArchivingException(message, reason, ErrSeverity.PANIC, desc, ""); throw e.toTangoException(); } } @@ -758,8 +751,7 @@ public class ArchivingManager extends DeviceImpl set_status(device_name + " : DevState.RUNNING"); try { - final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig - .creationWithoutFullInformation(argin); + final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.creationWithoutFullInformation(argin); hdbManager.ArchivingStart(archivingMessConfig); } catch (final ArchivingException e) { e.printStackTrace(); @@ -877,8 +869,7 @@ public class ArchivingManager extends DeviceImpl // ---Add your Own code to control device here --- set_state(DevState.RUNNING); set_status(device_name + " : DevState.RUNNING"); - final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig - .creationWithoutFullInformation(argin); + final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.creationWithoutFullInformation(argin); try { tdbManager.ArchivingStart(archivingMessConfig); } catch (final ArchivingException e) { @@ -910,10 +901,11 @@ public class ArchivingManager extends DeviceImpl } catch (final ArchivingException e) { get_logger().warn(e.toString(), e); throw e.toTangoException(); + } finally { + set_state(DevState.ON); + set_status(device_name + " : DevState.ON"); + get_logger().info("Exiting archiving_stop_hdb()"); } - set_state(DevState.ON); - set_status(device_name + " : DevState.ON"); - get_logger().info("Exiting archiving_stop_hdb()"); } // ========================================================= @@ -1039,8 +1031,7 @@ public class ArchivingManager extends DeviceImpl // ---Add your Own code to control device here --- set_state(DevState.RUNNING); set_status(device_name + " : DevState.RUNNING"); - final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig - .creationWithoutFullInformation(argin); + final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.creationWithoutFullInformation(argin); try { hdbManager.ArchivingStopConf(archivingMessConfig.getAttributeList()); @@ -1159,8 +1150,7 @@ public class ArchivingManager extends DeviceImpl // ---Add your Own code to control device here --- set_state(DevState.RUNNING); set_status(device_name + " : DevState.RUNNING"); - final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig - .creationWithoutFullInformation(argin); + final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.creationWithoutFullInformation(argin); try { tdbManager.ArchivingStopConf(archivingMessConfig.getAttributeList()); archiving_start_tdb(argin); diff --git a/src/main/java/Common/Watcher/AbsArchivingWatcher.java b/src/main/java/Common/Watcher/AbsArchivingWatcher.java index df9c3fd1..5790defd 100644 --- a/src/main/java/Common/Watcher/AbsArchivingWatcher.java +++ b/src/main/java/Common/Watcher/AbsArchivingWatcher.java @@ -18,776 +18,789 @@ import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.control.safetyper import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.control.safetyperiod.SaferPeriodCalculatorFactory; import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.tools.Tools; -public abstract class AbsArchivingWatcher extends DeviceImpl implements - TangoConst, Warnable { - - // --------- Start of properties data members ---------- - - /** - * The minimum number of attributes in a control step. Not used in the - * current device implementation. <b>Default value : </b>10 - */ - private short minPacketSize = 10; - /** - * The maximum number of attributes in a control step. Not used in the - * current device implementation. <b>Default value : </b>100 - */ - private short maxPacketSize = 100; - /** - * Used to tell the device if it should diagnose KO archivers (archivers - * that have at least 1 KO attribute). If set to true, the archivers part of - * the generated control report will contain specific archiver information - * such as scalar load etc..<br> - * If set to false, those details will remain blank.<br> - * Setting the property to true will increase the database load. <b>Default - * value : </b>false - */ - private boolean doArchiverDiagnosis = false; - /** - * Used to tell the device if it should ask the archiver to retry archiving - * KO attributes. If set to true, the device automatically calls the - * HDBArchiver command "retryForAttributes" for KO attributes.<br> - * If set to false, it doesn't.<br> - * <b>Default value : </b>false - */ - private boolean doRetry = false; - /** - * Describes the device start-up sequence. If set to true, the device - * automatically starts controlling on initialisation; with default - * parameters (as if the "start" command was called)<br> - * If set to false, the device waits in standby after being initialised.<br> - * <b>Default value : </b>false - */ - private boolean doStartOnInitDevice = false; - /** - * The duration of a full control cycle in seconds. <b>Default value : - * </b>14400 (4 hours) +public abstract class AbsArchivingWatcher extends DeviceImpl implements TangoConst, Warnable { + + // --------- Start of properties data members ---------- + + /** + * The minimum number of attributes in a control step. Not used in the + * current device implementation. <b>Default value : </b>10 + */ + private short minPacketSize = 10; + /** + * The maximum number of attributes in a control step. Not used in the + * current device implementation. <b>Default value : </b>100 + */ + private short maxPacketSize = 100; + /** + * Used to tell the device if it should diagnose KO archivers (archivers + * that have at least 1 KO attribute). If set to true, the archivers part of + * the generated control report will contain specific archiver information + * such as scalar load etc..<br> + * If set to false, those details will remain blank.<br> + * Setting the property to true will increase the database load. <b>Default + * value : </b>false + */ + private boolean doArchiverDiagnosis = false; + /** + * Used to tell the device if it should ask the archiver to retry archiving + * KO attributes. If set to true, the device automatically calls the + * HDBArchiver command "retryForAttributes" for KO attributes.<br> + * If set to false, it doesn't.<br> + * <b>Default value : </b>false + */ + private boolean doRetry = false; + /** + * Describes the device start-up sequence. If set to true, the device + * automatically starts controlling on initialisation; with default + * parameters (as if the "start" command was called)<br> + * If set to false, the device waits in standby after being initialised.<br> + * <b>Default value : </b>false + */ + private boolean doStartOnInitDevice = false; + /** + * The duration of a full control cycle in seconds. <b>Default value : + * </b>14400 (4 hours) + */ + private int macroPeriod = 14400; + + /** + * Computer identifier on wich is settled the database DB. The identifier + * can be the computer name or its IP address. <br> + * <b>Default value : </b> hdb + */ + private String hdbHost; + /** + * Database name.<br> + * <b>Default value : </b> hdb + */ + private String hdbName; + + /** + * Computer identifier on wich is settled the database TDB. The identifier + * can be the computer name or its IP address. <br> + * <b>Default value : </b> tdb + */ + private String tdbHost; + + /** + * Database name.<br> + * <b>Default value : </b> tdb + */ + private String tdbName; + + /** + * User identifier (name) used to connect the database HDB. <br> + * <b>Default value : </b> hdb + */ + private String hdbUser; + /** + * User identifier (name) used to connect the database TDB.<br> + * <b>Default value : </b> tdb + */ + private String tdbUser; + /** + * Password used to connect the database HDB. <br> + * <b>Default value : </b> hdb + */ + private String hdbPwd; + /** + * Password used to connect the database TDB.<br> + * <b>Default value : </b> tdb + */ + private String tdbPwd; + + /** + * Describes the default safety period calculation method, which will be + * used if the default start command is called.<br> + * <b>Default value : </b> absolute/minutes/15 + */ + private String defaultSafetyPeriod = "absolute/minutes/15"; + + /** + * Defines whether the archiver will log to a diary. <b>Default value : + * </b>false + */ + private boolean hasDiary = false; + + /** + * The criticity threshold of the archiver's logging. Only messages with a + * criticity higher than this attribute will be logged to the diary. + * Possible values are: + * <UL> + * <LI>DEBUG + * <LI>INFO + * <LI>WARNING + * <LI>ERROR + * <LI>CRITIC + * </UL> + * <b>Default value : </b>DEBUG + */ + private String diaryLogLevel = "DEBUG"; + + /** + * The path of the diary logs. Don't include a filename, diary files are + * named automatically. + */ + private String diaryPath; + /** + * true if the ORACLE RAC connection is activated. This information is + * appended to all device's (or attributes) name. false otherwise.<br> + * <b>Default value : </b> false + */ + private boolean hdbRacConnection = false; + private boolean tdbRacConnection = false; + + /** + * It defines the minimum number of KO attributes which put the device in + * ALARM state <b>Default value : </b> 100 + */ + private short minNumberOfKoForAlarmState = 100; + // --------- End of properties data members ---------- + + // --------- Start of attributes data members ---------- + + protected IDBReader dbReader; + private String latestFaultMessage = ""; + private int faultsCounter = 0; + + // Add your own data members here + protected ILogger logger; + + // --------- End of attributes data members ---------- + + public AbsArchivingWatcher(DeviceClass arg0, String arg1) throws DevFailed { + super(arg0, arg1); + // TODO Auto-generated constructor stub + } + + public AbsArchivingWatcher(DeviceClass arg0, String arg1, String arg2) throws DevFailed { + super(arg0, arg1, arg2); + // TODO Auto-generated constructor stub + } + + @Override + public abstract void init_device() throws DevFailed; + + // A l'avenir faire une interface avec la WatcherClass pour pouvoir utiliser + // la m�thode + // get_class_property(string) directement + protected abstract DbDatum getClassProperty(String name); + + /* + * (non-Javadoc) + * + * @see archwatch.tools.Warnable#setStatus(java.lang.String) + */ + @Override + public void setStatus(String status) { + super.set_status(status); + } + + @Override + public void logIntoDiary(int level, Object o) { + /* + * if ( this.logger != null ) { this.logger.trace ( level , o ); } */ - private int macroPeriod = 14400; + this.logger.trace(level, o); + } + + @Override + /* + * (non-Javadoc) + * + * @see + * fr.soleil.TangoArchiving.ArchivingWatchApi.devicelink.Warnable#trace( + * java.lang.String, int) + */ + public void trace(String msg, int level) throws DevFailed { + switch (level) { + case Warnable.LOG_LEVEL_DEBUG: + get_logger().debug(msg); + break; + + case Warnable.LOG_LEVEL_INFO: + get_logger().info(msg); + break; + + case Warnable.LOG_LEVEL_WARN: + get_logger().warn(msg); + break; + + case Warnable.LOG_LEVEL_ERROR: + get_logger().error(msg); + break; + + case Warnable.LOG_LEVEL_FATAL: + get_logger().fatal(msg); + break; + + default: + Tools.throwDevFailed(new IllegalArgumentException( + "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " + + level + "instead.")); + } - /** - * Computer identifier on wich is settled the database DB. The identifier - * can be the computer name or its IP address. <br> - * <b>Default value : </b> hdb - */ - private String hdbHost; - /** - * Database name.<br> - * <b>Default value : </b> hdb - */ - private String hdbName; + } - /** - * Computer identifier on wich is settled the database TDB. The identifier - * can be the computer name or its IP address. <br> - * <b>Default value : </b> tdb - */ - private String tdbHost; + @Override + public void trace(String msg, Throwable t, int level) throws DevFailed { + switch (level) { + case Warnable.LOG_LEVEL_DEBUG: + get_logger().debug(msg, t); + break; - /** - * Database name.<br> - * <b>Default value : </b> tdb - */ - private String tdbName; + case Warnable.LOG_LEVEL_INFO: + get_logger().info(msg, t); + break; - /** - * User identifier (name) used to connect the database HDB. <br> - * <b>Default value : </b> hdb - */ - private String hdbUser; - /** - * User identifier (name) used to connect the database TDB.<br> - * <b>Default value : </b> tdb - */ - private String tdbUser; - /** - * Password used to connect the database HDB. <br> - * <b>Default value : </b> hdb - */ - private String hdbPwd; - /** - * Password used to connect the database TDB.<br> - * <b>Default value : </b> tdb - */ - private String tdbPwd; + case Warnable.LOG_LEVEL_WARN: + get_logger().warn(msg, t); + break; - /** - * Describes the default safety period calculation method, which will be - * used if the default start command is called.<br> - * <b>Default value : </b> absolute/minutes/15 - */ - private String defaultSafetyPeriod = "absolute/minutes/15"; + case Warnable.LOG_LEVEL_ERROR: + get_logger().error(msg, t); + break; - /** - * Defines whether the archiver will log to a diary. <b>Default value : - * </b>false - */ - private boolean hasDiary = false; - - /** - * The criticity threshold of the archiver's logging. Only messages with a - * criticity higher than this attribute will be logged to the diary. - * Possible values are: - * <UL> - * <LI>DEBUG - * <LI>INFO - * <LI>WARNING - * <LI>ERROR - * <LI>CRITIC - * </UL> - * <b>Default value : </b>DEBUG - */ - private String diaryLogLevel = "DEBUG"; + case Warnable.LOG_LEVEL_FATAL: + get_logger().fatal(msg, t); + break; - /** - * The path of the diary logs. Don't include a filename, diary files are - * named automatically. - */ - private String diaryPath; - /** - * true if the ORACLE RAC connection is activated. This information is - * appended to all device's (or attributes) name. false otherwise.<br> - * <b>Default value : </b> false - */ - private boolean hdbRacConnection = false; - private boolean tdbRacConnection = false; + default: + Tools.throwDevFailed(new IllegalArgumentException( + "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " + + level + "instead.")); + } - /** - * It defines the minimum number of KO attributes which put the device in - * ALARM state <b>Default value : </b> 100 - */ - private short minNumberOfKoForAlarmState = 100; - // --------- End of properties data members ---------- + } + + /** + * Overrides set_state so that formerState is stored when the device state + * changes + * + * @param _in + */ + @Override + public void set_state(DevState in) { + this.set_state((short) in.value()); + } + + /** + * Overrides set_state so that formerState is stored when the device state + * changes + * + * @param _state + */ + public void set_state(short _state) { + super.set_state(DevState.from_int(_state)); + + String _status = this.formatStatus(_state); + this.setStatus(_status); + } + + /* + * (non-Javadoc) + * + * @see archwatch.tools.WarnAble#warnAlarm() + */ + @Override + public void warnAlarm() { + if (this.get_state().value() == DevState._ALARM) { + return; + } - // --------- Start of attributes data members ---------- + this.set_state((short) DevState._ALARM); - protected IDBReader dbReader; - private String latestFaultMessage = ""; - private int faultsCounter = 0; + String message = "At :" + this.now(); + message += Tools.CRLF; + message += this.get_status(); - // Add your own data members here - protected ILogger logger; + this.setStatus(message); + } - // --------- End of attributes data members ---------- + /* + * (non-Javadoc) + * + * @see archwatch.strategy.delay.WarnAble#warnFault() + */ + @Override + public void warnFault(DevFailed t) { + System.out.println("CLA/ArchivingWatcher/warnFault"); - public AbsArchivingWatcher(DeviceClass arg0, String arg1) throws DevFailed { - super(arg0, arg1); - // TODO Auto-generated constructor stub - } + this.set_state((short) DevState._FAULT); - public AbsArchivingWatcher(DeviceClass arg0, String arg1, String arg2) - throws DevFailed { - super(arg0, arg1, arg2); - // TODO Auto-generated constructor stub - } + String faultMessage = "At :" + this.now(); + faultMessage += Tools.CRLF; + faultMessage += Tools.getCompleteMessage(t); + this.setLatestFaultMessage(faultMessage); - @Override - public abstract void init_device() throws DevFailed; + String message = this.get_status(); + message += Tools.CRLF; + message += faultMessage; - // A l'avenir faire une interface avec la WatcherClass pour pouvoir utiliser - // la m�thode - // get_class_property(string) directement - protected abstract DbDatum getClassProperty(String name); + this.setStatus(message); + } - /* - * (non-Javadoc) - * - * @see archwatch.tools.Warnable#setStatus(java.lang.String) - */ - @Override - public synchronized void setStatus(String status) { - super.set_status(status); + @Override + public void warnInit() { + switch (this.get_state().value()) { + case DevState._ALARM: + // do nothing + return; } - @Override - public void logIntoDiary(int level, Object o) { - /* - * if ( this.logger != null ) { this.logger.trace ( level , o ); } - */ - this.logger.trace(level, o); - } + this.set_state((short) DevState._INIT); - @Override - /* - * (non-Javadoc) - * - * @see - * fr.soleil.TangoArchiving.ArchivingWatchApi.devicelink.Warnable#trace( - * java.lang.String, int) - */ - public synchronized void trace(String msg, int level) throws DevFailed { - switch (level) { - case Warnable.LOG_LEVEL_DEBUG: - get_logger().debug(msg); - break; - - case Warnable.LOG_LEVEL_INFO: - get_logger().info(msg); - break; - - case Warnable.LOG_LEVEL_WARN: - get_logger().warn(msg); - break; - - case Warnable.LOG_LEVEL_ERROR: - get_logger().error(msg); - break; - - case Warnable.LOG_LEVEL_FATAL: - get_logger().fatal(msg); - break; - - default: - Tools - .throwDevFailed(new IllegalArgumentException( - "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " - + level + "instead.")); - } + String message = "At :" + this.now(); + message += Tools.CRLF; + message += this.get_status(); - } + this.setStatus(message); + } - @Override - public synchronized void trace(String msg, Throwable t, int level) - throws DevFailed { - switch (level) { - case Warnable.LOG_LEVEL_DEBUG: - get_logger().debug(msg, t); - break; - - case Warnable.LOG_LEVEL_INFO: - get_logger().info(msg, t); - break; - - case Warnable.LOG_LEVEL_WARN: - get_logger().warn(msg, t); - break; - - case Warnable.LOG_LEVEL_ERROR: - get_logger().error(msg, t); - break; - - case Warnable.LOG_LEVEL_FATAL: - get_logger().fatal(msg, t); - break; - - default: - Tools - .throwDevFailed(new IllegalArgumentException( - "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got " - + level + "instead.")); - } + @Override + public void warnOff() { + // this.formerState = DevState._OFF; - } + switch (this.get_state().value()) { + case DevState._ALARM: + // do nothing + return; - /** - * Overrides set_state so that formerState is stored when the device state - * changes - * - * @param _in - */ - public synchronized void set_state(DevState in) { - this.set_state((short) in.value()); + case DevState._FAULT: + // do nothing + return; } - /** - * Overrides set_state so that formerState is stored when the device state - * changes - * - * @param _state - */ - public synchronized void set_state(short _state) { - super.set_state(DevState.from_int(_state)); + this.set_state((short) DevState._OFF); - String _status = this.formatStatus(_state); - this.setStatus(_status); - } + String message = "At :" + this.now(); + message += Tools.CRLF; + message += this.get_status(); - /* - * (non-Javadoc) - * - * @see archwatch.tools.WarnAble#warnAlarm() - */ - @Override - public synchronized void warnAlarm() { - if (this.get_state().value() == DevState._ALARM) - return; + this.setStatus(message); + } - this.set_state((short) DevState._ALARM); - - String message = "At :" + this.now(); - message += Tools.CRLF; - message += this.get_status(); - - this.setStatus(message); - } + /* + * (non-Javadoc) + * + * @see archwatch.strategy.delay.Warnable#warn() + */ + @Override + public void warnOn() { + // this.formerState = DevState._ON; /* - * (non-Javadoc) - * - * @see archwatch.strategy.delay.WarnAble#warnFault() + * switch ( this.get_state().value() ) { case DevState._ALARM: //do + * nothing return; } */ - @Override - public synchronized void warnFault(DevFailed t) { - System.out.println("CLA/ArchivingWatcher/warnFault"); - - this.set_state((short) DevState._FAULT); - String faultMessage = "At :" + this.now(); - faultMessage += Tools.CRLF; - faultMessage += Tools.getCompleteMessage(t); - this.setLatestFaultMessage(faultMessage); - - String message = this.get_status(); - message += Tools.CRLF; - message += faultMessage; - - this.setStatus(message); + if (this.get_state().value() == DevState._ON) { + return; } - @Override - public synchronized void warnInit() { - switch (this.get_state().value()) { - case DevState._ALARM: - // do nothing - return; - } + this.dbReader = DBReaderFactory.getCurrentImpl(); + this.set_state((short) DevState._ON); - this.set_state((short) DevState._INIT); + String message = "At :" + this.now(); + message += Tools.CRLF; + message += this.get_status(); - String message = "At :" + this.now(); - message += Tools.CRLF; - message += this.get_status(); + this.setStatus(message); + } - this.setStatus(message); - } + @Override + public String get_status() { + String ret = super.get_status(); - @Override - public synchronized void warnOff() { - // this.formerState = DevState._OFF; + if (this.get_state().value() != DevState._FAULT) { + ret += this.getLatestFaultMessage(); + } - switch (this.get_state().value()) { - case DevState._ALARM: - // do nothing - return; + return ret; + } + + // ========================================================= + protected void initLatestFaultData() { + this.latestFaultMessage = ""; + this.faultsCounter = 0; + } + + // =================================================================== + /** + * Read the device properties from database. + */ + // =================================================================== + protected void get_device_property() throws DevFailed { + // Initialize your default values here. + // ------------------------------------------ + + // Read device properties from database.(Automatic code generation) + // ------------------------------------------------------------- + if (Util._UseDb == false) { + return; + } + String[] propnames = { "MinPacketSize", "MaxPacketSize", "DoArchiverDiagnosis", "DoRetry", + "DoStartOnInitDevice", "MacroPeriod", "HdbHost", "HdbName", "TdbHost", "TdbName", "HdbUser", "TdbUser", + "HdbPwd", "TdbPwd", "DefaultSafetyPeriod", "HasDiary", "DiaryPath", "DiaryLogLevel", + "HdbRacConnection", "TdbRacConnection", "MinNumberOfKoForAlarm" }; + + // Call database and extract values + // -------------------------------------------- + DbDatum[] dev_prop = get_db_device().get_property(propnames); + int i = -1; + // Extract MinPacketSize value + if (dev_prop[++i].is_empty() == false) { + minPacketSize = dev_prop[i].extractShort(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + minPacketSize = cl_prop.extractShort(); + } + } - case DevState._FAULT: - // do nothing - return; - } + // Extract MaxPacketSize value + if (dev_prop[++i].is_empty() == false) { + maxPacketSize = dev_prop[i].extractShort(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + maxPacketSize = cl_prop.extractShort(); + } + } - this.set_state((short) DevState._OFF); + // Extract DoArchiverDiagnosis value + if (dev_prop[++i].is_empty() == false) { + doArchiverDiagnosis = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + doArchiverDiagnosis = cl_prop.extractBoolean(); + } + } - String message = "At :" + this.now(); - message += Tools.CRLF; - message += this.get_status(); + // Extract DoRetry value + if (dev_prop[++i].is_empty() == false) { + doRetry = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + doRetry = cl_prop.extractBoolean(); + } + } - this.setStatus(message); + // Extract doStartOnInitDevice value + if (dev_prop[++i].is_empty() == false) { + doStartOnInitDevice = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + doStartOnInitDevice = cl_prop.extractBoolean(); + } } - /* - * (non-Javadoc) - * - * @see archwatch.strategy.delay.Warnable#warn() - */ - @Override - public synchronized void warnOn() { - // this.formerState = DevState._ON; + // Extract MacroPeriod value + if (dev_prop[++i].is_empty() == false) { + macroPeriod = dev_prop[i].extractLong(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + macroPeriod = cl_prop.extractLong(); + } + } + // Extract HDBHost value + if (dev_prop[++i].is_empty() == false) { + hdbHost = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hdbHost = cl_prop.extractString(); + } + } - /* - * switch ( this.get_state().value() ) { case DevState._ALARM: //do - * nothing return; } - */ + // Extract HDbName value + if (dev_prop[++i].is_empty() == false) { + hdbName = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hdbName = cl_prop.extractString(); + } + } - if (this.get_state().value() == DevState._ON) - return; + // Extract TDBHost value + if (dev_prop[++i].is_empty() == false) { + tdbHost = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + tdbHost = cl_prop.extractString(); + } + } - this.dbReader = DBReaderFactory.getCurrentImpl(); - this.set_state((short) DevState._ON); + // Extract TDbName value + if (dev_prop[++i].is_empty() == false) { + tdbName = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + tdbName = cl_prop.extractString(); + } + } - String message = "At :" + this.now(); - message += Tools.CRLF; - message += this.get_status(); + // Extract HdbUser value + if (dev_prop[++i].is_empty() == false) { + hdbUser = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hdbUser = cl_prop.extractString(); + } + } - this.setStatus(message); + // Extract TdbUser value + if (dev_prop[++i].is_empty() == false) { + tdbUser = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + tdbUser = cl_prop.extractString(); + } } - public String get_status() { - String ret = super.get_status(); + // Extract HdbPwd value + if (dev_prop[++i].is_empty() == false) { + hdbPwd = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hdbPwd = cl_prop.extractString(); + } + } - if (this.get_state().value() != DevState._FAULT) { - ret += this.getLatestFaultMessage(); - } + // Extract TdbPwd value + if (dev_prop[++i].is_empty() == false) { + tdbPwd = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + tdbPwd = cl_prop.extractString(); + } + } - return ret; + // Extract DefaultSafetyPeriod value + if (dev_prop[++i].is_empty() == false) { + defaultSafetyPeriod = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + defaultSafetyPeriod = cl_prop.extractString(); + } } - // ========================================================= - protected void initLatestFaultData() { - this.latestFaultMessage = ""; - this.faultsCounter = 0; + // Extract hasDiary value + if (dev_prop[++i].is_empty() == false) { + hasDiary = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hasDiary = cl_prop.extractBoolean(); + } } - // =================================================================== - /** - * Read the device properties from database. - */ - // =================================================================== - protected void get_device_property() throws DevFailed { - // Initialize your default values here. - // ------------------------------------------ - - // Read device properties from database.(Automatic code generation) - // ------------------------------------------------------------- - if (Util._UseDb == false) - return; - String[] propnames = { "MinPacketSize", "MaxPacketSize", - "DoArchiverDiagnosis", "DoRetry", "DoStartOnInitDevice", - "MacroPeriod", "HdbHost", "HdbName", "TdbHost", "TdbName", - "HdbUser", "TdbUser", "HdbPwd", "TdbPwd", - "DefaultSafetyPeriod", "HasDiary", "DiaryPath", - "DiaryLogLevel", "HdbRacConnection", "TdbRacConnection", - "MinNumberOfKoForAlarm" }; - - // Call database and extract values - // -------------------------------------------- - DbDatum[] dev_prop = get_db_device().get_property(propnames); - int i = -1; - // Extract MinPacketSize value - if (dev_prop[++i].is_empty() == false) - minPacketSize = dev_prop[i].extractShort(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - minPacketSize = cl_prop.extractShort(); - } - - // Extract MaxPacketSize value - if (dev_prop[++i].is_empty() == false) - maxPacketSize = dev_prop[i].extractShort(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - maxPacketSize = cl_prop.extractShort(); - } - - // Extract DoArchiverDiagnosis value - if (dev_prop[++i].is_empty() == false) - doArchiverDiagnosis = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - doArchiverDiagnosis = cl_prop.extractBoolean(); - } - - // Extract DoRetry value - if (dev_prop[++i].is_empty() == false) - doRetry = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - doRetry = cl_prop.extractBoolean(); - } - - // Extract doStartOnInitDevice value - if (dev_prop[++i].is_empty() == false) - doStartOnInitDevice = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - doStartOnInitDevice = cl_prop.extractBoolean(); - } - - // Extract MacroPeriod value - if (dev_prop[++i].is_empty() == false) - macroPeriod = dev_prop[i].extractLong(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - macroPeriod = cl_prop.extractLong(); - } - // Extract HDBHost value - if (dev_prop[++i].is_empty() == false) - hdbHost = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hdbHost = cl_prop.extractString(); - } - - // Extract HDbName value - if (dev_prop[++i].is_empty() == false) - hdbName = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hdbName = cl_prop.extractString(); - } - - // Extract TDBHost value - if (dev_prop[++i].is_empty() == false) - tdbHost = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - tdbHost = cl_prop.extractString(); - } - - // Extract TDbName value - if (dev_prop[++i].is_empty() == false) - tdbName = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - tdbName = cl_prop.extractString(); - } - - // Extract HdbUser value - if (dev_prop[++i].is_empty() == false) - hdbUser = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hdbUser = cl_prop.extractString(); - } - - // Extract TdbUser value - if (dev_prop[++i].is_empty() == false) - tdbUser = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - tdbUser = cl_prop.extractString(); - } - - // Extract HdbPwd value - if (dev_prop[++i].is_empty() == false) - hdbPwd = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hdbPwd = cl_prop.extractString(); - } - - // Extract TdbPwd value - if (dev_prop[++i].is_empty() == false) - tdbPwd = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - tdbPwd = cl_prop.extractString(); - } - - // Extract DefaultSafetyPeriod value - if (dev_prop[++i].is_empty() == false) - defaultSafetyPeriod = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - defaultSafetyPeriod = cl_prop.extractString(); - } - - // Extract hasDiary value - if (dev_prop[++i].is_empty() == false) - hasDiary = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hasDiary = cl_prop.extractBoolean(); - } - - // Extract diaryPath value - if (dev_prop[++i].is_empty() == false) - diaryPath = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - diaryPath = cl_prop.extractString(); - } - - // Extract diaryLogLevel value - if (dev_prop[++i].is_empty() == false) - diaryLogLevel = dev_prop[i].extractString(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - diaryLogLevel = cl_prop.extractString(); - } - - // Extract HdbRacConnection value - if (dev_prop[++i].is_empty() == false) - hdbRacConnection = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - hdbRacConnection = cl_prop.extractBoolean(); - } - - // Extract TdbRacConnection value - if (dev_prop[++i].is_empty() == false) - tdbRacConnection = dev_prop[i].extractBoolean(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - tdbRacConnection = cl_prop.extractBoolean(); - } - - // Extract minNumberOfKoForAlarmState value - if (dev_prop[++i].is_empty() == false) - minNumberOfKoForAlarmState = dev_prop[i].extractShort(); - else { - // Try to get value from class property - DbDatum cl_prop = getClassProperty(dev_prop[i].name); - if (cl_prop.is_empty() == false) - minNumberOfKoForAlarmState = cl_prop.extractShort(); - } - - get_logger().info("minPacketSize = " + minPacketSize); - get_logger().info("maxPacketSize = " + maxPacketSize); - get_logger().info("doArchiverDiagnosis = " + doArchiverDiagnosis); - get_logger().info("doRetry = " + doRetry); - get_logger().info("doStartOnInitDevice = " + doStartOnInitDevice); - get_logger().info("macroPeriod = " + macroPeriod); - get_logger().info("hdbHost = " + hdbHost); - get_logger().info("hdbName = " + hdbName); - get_logger().info("hdbUser = " + hdbUser); - get_logger().info("hdbPwd = " + hdbPwd); - get_logger().info("tdbHost = " + tdbHost); - get_logger().info("tdbName = " + tdbName); - get_logger().info("tdbUser = " + tdbUser); - get_logger().info("tdbPwd = " + tdbPwd); - get_logger().info("hasDiary = " + hasDiary); - get_logger().info("diaryPath = " + diaryPath); - get_logger().info("diaryLogLevel = " + diaryLogLevel); - get_logger().info("hdbRacConnection = " + hdbRacConnection); - get_logger().info("tdbRacConnection = " + tdbRacConnection); - get_logger().info( - "MinNumberOfKoForAlarmState = " + minNumberOfKoForAlarmState); - - // - // End of Automatic code generation - // ------------------------------------------------------------- + // Extract diaryPath value + if (dev_prop[++i].is_empty() == false) { + diaryPath = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + diaryPath = cl_prop.extractString(); + } + } + // Extract diaryLogLevel value + if (dev_prop[++i].is_empty() == false) { + diaryLogLevel = dev_prop[i].extractString(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + diaryLogLevel = cl_prop.extractString(); + } } - protected void initArchivingDataWatch() { - ArchivingWatch.setHDBHost(this.hdbHost); - ArchivingWatch.setHDBName(this.hdbName); - ArchivingWatch.setTDBHost(this.tdbHost); - ArchivingWatch.setTDBName(this.tdbName); - - ArchivingWatch.setHDBuser(this.hdbUser); - ArchivingWatch.setHDBpassword(this.hdbPwd); - ArchivingWatch.setTDBuser(this.tdbUser); - ArchivingWatch.setTDBpassword(this.tdbPwd); - ArchivingWatch.setMacroPeriod(this.macroPeriod); - ArchivingWatch.setDoArchiverDiagnosis(this.doArchiverDiagnosis); - ArchivingWatch.setDoRetry(this.doRetry); - ArchivingWatch.setDoStartOnInitDevice(this.doStartOnInitDevice); - ArchivingWatch.setDefaultSafetyPeriod(this.defaultSafetyPeriod); - ArchivingWatch.setHasDiary(this.hasDiary); - ArchivingWatch.setDiaryPath(this.diaryPath); - ArchivingWatch.setDiaryLogLevel(this.diaryLogLevel); - ArchivingWatch.setHDBRac(this.hdbRacConnection); - ArchivingWatch.setTDBRac(this.tdbRacConnection); - ArchivingWatch - .setMinNumberOfKoForAlarmState(this.minNumberOfKoForAlarmState); + // Extract HdbRacConnection value + if (dev_prop[++i].is_empty() == false) { + hdbRacConnection = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + hdbRacConnection = cl_prop.extractBoolean(); + } } - // ========================================================= - private String now() { - Timestamp now = new Timestamp(System.currentTimeMillis()); - return now + ""; + // Extract TdbRacConnection value + if (dev_prop[++i].is_empty() == false) { + tdbRacConnection = dev_prop[i].extractBoolean(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + tdbRacConnection = cl_prop.extractBoolean(); + } } - /** - * @param i - */ - private String formatStatus(int _state) { - ISaferPeriodCalculator saferPeriodCalculator = SaferPeriodCalculatorFactory - .getCurrentImpl(); - String currentModeDescription = saferPeriodCalculator == null ? "No description available" - : saferPeriodCalculator.getDescription(); - - String _status; - switch (_state) { - case DevState._ALARM: - _status = "Archiving problems have been detected."; - break; - - case DevState._FAULT: - _status = "This device isn't working properly."; - break; - - case DevState._INIT: - _status = "No control step has been completed yet. Please wait."; - break; - - case DevState._OFF: - _status = "This device is waiting."; - break; - - case DevState._ON: - _status = "This device is running normally."; - break; - - default: - _status = "Unknown"; - break; - } - - String ret = _status + Tools.CRLF + "Current mode: " - + currentModeDescription; - return ret; + // Extract minNumberOfKoForAlarmState value + if (dev_prop[++i].is_empty() == false) { + minNumberOfKoForAlarmState = dev_prop[i].extractShort(); + } else { + // Try to get value from class property + DbDatum cl_prop = getClassProperty(dev_prop[i].name); + if (cl_prop.is_empty() == false) { + minNumberOfKoForAlarmState = cl_prop.extractShort(); + } } - /** - * @param latestFaultMessage - * The latestFaultMessage to set. - */ - private void setLatestFaultMessage(String latestFaultMessage) { - this.latestFaultMessage = latestFaultMessage; - this.faultsCounter++; + get_logger().info("minPacketSize = " + minPacketSize); + get_logger().info("maxPacketSize = " + maxPacketSize); + get_logger().info("doArchiverDiagnosis = " + doArchiverDiagnosis); + get_logger().info("doRetry = " + doRetry); + get_logger().info("doStartOnInitDevice = " + doStartOnInitDevice); + get_logger().info("macroPeriod = " + macroPeriod); + get_logger().info("hdbHost = " + hdbHost); + get_logger().info("hdbName = " + hdbName); + get_logger().info("hdbUser = " + hdbUser); + get_logger().info("hdbPwd = " + hdbPwd); + get_logger().info("tdbHost = " + tdbHost); + get_logger().info("tdbName = " + tdbName); + get_logger().info("tdbUser = " + tdbUser); + get_logger().info("tdbPwd = " + tdbPwd); + get_logger().info("hasDiary = " + hasDiary); + get_logger().info("diaryPath = " + diaryPath); + get_logger().info("diaryLogLevel = " + diaryLogLevel); + get_logger().info("hdbRacConnection = " + hdbRacConnection); + get_logger().info("tdbRacConnection = " + tdbRacConnection); + get_logger().info("MinNumberOfKoForAlarmState = " + minNumberOfKoForAlarmState); + + // + // End of Automatic code generation + // ------------------------------------------------------------- + + } + + protected void initArchivingDataWatch() { + ArchivingWatch.setHDBHost(this.hdbHost); + ArchivingWatch.setHDBName(this.hdbName); + ArchivingWatch.setTDBHost(this.tdbHost); + ArchivingWatch.setTDBName(this.tdbName); + + ArchivingWatch.setHDBuser(this.hdbUser); + ArchivingWatch.setHDBpassword(this.hdbPwd); + ArchivingWatch.setTDBuser(this.tdbUser); + ArchivingWatch.setTDBpassword(this.tdbPwd); + ArchivingWatch.setMacroPeriod(this.macroPeriod); + ArchivingWatch.setDoArchiverDiagnosis(this.doArchiverDiagnosis); + ArchivingWatch.setDoRetry(this.doRetry); + ArchivingWatch.setDoStartOnInitDevice(this.doStartOnInitDevice); + ArchivingWatch.setDefaultSafetyPeriod(this.defaultSafetyPeriod); + ArchivingWatch.setHasDiary(this.hasDiary); + ArchivingWatch.setDiaryPath(this.diaryPath); + ArchivingWatch.setDiaryLogLevel(this.diaryLogLevel); + ArchivingWatch.setHDBRac(this.hdbRacConnection); + ArchivingWatch.setTDBRac(this.tdbRacConnection); + ArchivingWatch.setMinNumberOfKoForAlarmState(this.minNumberOfKoForAlarmState); + } + + // ========================================================= + private String now() { + Timestamp now = new Timestamp(System.currentTimeMillis()); + return now + ""; + } + + /** + * @param i + */ + private String formatStatus(int _state) { + ISaferPeriodCalculator saferPeriodCalculator = SaferPeriodCalculatorFactory.getCurrentImpl(); + String currentModeDescription = saferPeriodCalculator == null ? "No description available" + : saferPeriodCalculator.getDescription(); + + String _status; + switch (_state) { + case DevState._ALARM: + _status = "Archiving problems have been detected."; + break; + + case DevState._FAULT: + _status = "This device isn't working properly."; + break; + + case DevState._INIT: + _status = "No control step has been completed yet. Please wait."; + break; + + case DevState._OFF: + _status = "This device is waiting."; + break; + + case DevState._ON: + _status = "This device is running normally."; + break; + + default: + _status = "Unknown"; + break; } - /** - * @return Returns the latestFaultMessage. - */ - private String getLatestFaultMessage() { - if (this.latestFaultMessage == null - || this.latestFaultMessage.equals("")) { - return ""; - } else { - String ret = Tools.CRLF; - ret += Tools.CRLF; - ret += "Latest fault: "; - ret += Tools.CRLF; - ret += this.latestFaultMessage; - ret += Tools.CRLF; - ret += "Number of times the device has been in fault state: "; - ret += faultsCounter; - - return ret; - } + String ret = _status + Tools.CRLF + "Current mode: " + currentModeDescription; + return ret; + } + + /** + * @param latestFaultMessage + * The latestFaultMessage to set. + */ + private void setLatestFaultMessage(String latestFaultMessage) { + this.latestFaultMessage = latestFaultMessage; + this.faultsCounter++; + } + + /** + * @return Returns the latestFaultMessage. + */ + private String getLatestFaultMessage() { + if (this.latestFaultMessage == null || this.latestFaultMessage.equals("")) { + return ""; + } else { + String ret = Tools.CRLF; + ret += Tools.CRLF; + ret += "Latest fault: "; + ret += Tools.CRLF; + ret += this.latestFaultMessage; + ret += Tools.CRLF; + ret += "Number of times the device has been in fault state: "; + ret += faultsCounter; + + return ret; } + } } diff --git a/src/main/java/HdbArchiver/HdbArchiver.java b/src/main/java/HdbArchiver/HdbArchiver.java index a7b2710e..ccb3842b 100644 --- a/src/main/java/HdbArchiver/HdbArchiver.java +++ b/src/main/java/HdbArchiver/HdbArchiver.java @@ -374,6 +374,7 @@ import HdbArchiver.Collector.HdbCollector; import HdbArchiver.Collector.HdbCollectorFactory; import fr.esrf.Tango.DevError; import fr.esrf.Tango.DevFailed; +import fr.esrf.Tango.DevState; import fr.esrf.Tango.ErrSeverity; import fr.esrf.TangoApi.DbDatum; import fr.esrf.TangoDs.Attribute; @@ -690,14 +691,11 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { this.updateAMTTable = updateAMTTable; } + @Override public void run() { try { - triggerArchiving(archivingMessConfig.toArray(), updateAMTTable); } catch (final DevFailed devFailed) { - final String completeMessage = DBTools.getCompleteMessage(devFailed); - get_logger().error(completeMessage); - final StringBuilder b = new StringBuilder(); TangoStateUtils.setDisable(HdbArchiver.this, archivingStatus); } } @@ -1058,8 +1056,9 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { dbProxy.insertModeRecord(attributeLightMode); logger.trace(ILogger.LEVEL_INFO, "insertModeRecord - out"); } - - // update period in dbProxy, used in cmd retry_for_ko_attributes + + // update period in dbProxy, used in cmd + // retry_for_ko_attributes final int period = attributeLightMode.getMode().getModeP().getPeriod(); logger.trace(ILogger.LEVEL_INFO, attCompleteName + "'s period is " + period); dbProxy.setPeriodForAttribute(attCompleteName, period); @@ -1096,13 +1095,14 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { archivingException.addStack(message, reason, ErrSeverity.PANIC, desc, "", e); logger.trace(ILogger.LEVEL_ERROR, reason + " " + desc); archivingStatus.put(attCompleteName, false); + logger.trace(ILogger.LEVEL_INFO, "KO: " + attCompleteName); } } computeLoads(); TangoStateUtils.setOn(this, archivingStatus); if (!archivingException.getMessage().equals("")) { - logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf - out"); + logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf ERROR - out"); throw archivingException.toTangoException(); } @@ -1162,21 +1162,17 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { */ // ========================================================= public void stop_archive_conf(final String[] argin) throws DevFailed { - TangoStateUtils.isAllowed(this); - TangoStateUtils.setRunning(this); + // TangoStateUtils.isAllowed(this); + // TangoStateUtils.setRunning(this); try { - get_logger().info("Entering stop_archive_conf()"); - logger.trace(ILogger.LEVEL_INFO, "===> Entering stop_archive_conf()"); - + logger.trace(ILogger.LEVEL_INFO, "stop_archive_conf - in"); final Vector<AttributeLightMode> myConf = ArchivingManagerApiRef.stoppingVector(argin); for (int i = 0; i < myConf.size(); i++) { stop_archive_att(myConf.elementAt(i).toArray()); } - get_logger().info("Exiting stop_archive_conf()"); - logger.trace(ILogger.LEVEL_INFO, "===> Exiting stop_archive_conf()"); } finally { - TangoStateUtils.setOn(this, archivingStatus); + logger.trace(ILogger.LEVEL_INFO, "stop_archive_conf - out"); } } @@ -1698,16 +1694,14 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { // ========================================================= public void stop_archive_att(final String[] argin) throws DevFailed { TangoStateUtils.isAllowed(this); + boolean wasDisable = get_state().equals(DevState.DISABLE) ? true : false; TangoStateUtils.setRunning(this); - get_logger().info("Entering stop_archive_att()"); - logger.trace(ILogger.LEVEL_INFO, "===> Entering stop_archive_att()"); + logger.trace(ILogger.LEVEL_INFO, "stop_archive_att - in"); final AttributeLightMode attributeLightMode = AttributeLightMode.creationWithFullInformation(argin); HdbCollector hdbCollector = null; try { - logger - .trace(ILogger.LEVEL_INFO, "===> Attribute Name = " - + attributeLightMode.getAttribute_complete_name()); + logger.trace(ILogger.LEVEL_INFO, "attribute: " + attributeLightMode.getAttribute_complete_name()); dbProxy.updateModeRecord(attributeLightMode); @@ -1718,8 +1712,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { collectorFactory.destroy(attributeLightMode); } } else// should only happen when attempting to call stop_archive_att - // on a non-longer-reserved attribute of a formerly (ie. at - // the time the archiving was started) dedicated archiver. + // on a non-longer-reserved attribute of a formerly (ie. at + // the time the archiving was started) dedicated archiver. { final String msg = "HdbArchiver/stop_archive_att/getAttribute_complete_name|" + attributeLightMode.getAttribute_complete_name() @@ -1742,18 +1736,17 @@ public class HdbArchiver extends DeviceImpl implements TangoConst { e.printStackTrace(); throw e.toTangoException(); } finally { - logger.trace(ILogger.LEVEL_INFO, "===> Exiting stop_archive_att()"); - TangoStateUtils.setOn(this, archivingStatus); + computeLoads(); + if (wasDisable) { + TangoStateUtils.setDisable(this, archivingStatus); + } else { + TangoStateUtils.setOn(this, archivingStatus); + } + logger.trace(ILogger.LEVEL_INFO, "stop_archive_att - out"); } - get_logger().info("Exiting stop_archive_att()"); - } - // private void throwDevFailed() throws DevFailed { - // throw new DevFailed(); - // } - // ========================================================= /** * Execute command "StateDetailed" on device. This command returns a diff --git a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java index b80bb494..cb629d60 100644 --- a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java +++ b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java @@ -117,8 +117,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @param version * The device version */ - HdbArchivingWatcher(final DeviceClass cl, final String s, final String version) - throws DevFailed { + HdbArchivingWatcher(final DeviceClass cl, final String s, final String version) throws DevFailed { super(cl, s); m_version = version; init_device(); @@ -137,8 +136,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @param version * The device version */ - HdbArchivingWatcher(final DeviceClass cl, final String s, final String d, final String version) - throws DevFailed { + HdbArchivingWatcher(final DeviceClass cl, final String s, final String d, final String version) throws DevFailed { super(cl, s, d); m_version = version; init_device(); @@ -146,8 +144,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { @Override protected DbDatum getClassProperty(final String name) { - final HdbArchivingWatcherClass ds_class = (HdbArchivingWatcherClass) super - .get_device_class(); + final HdbArchivingWatcherClass ds_class = (HdbArchivingWatcherClass) super.get_device_class(); return ds_class.get_class_property(name); } @@ -212,9 +209,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { @Override public void read_attr_hardware(final Vector attr_list) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); - controlResult = _controlResult == null ? null : _controlResult.cloneControlResult(); + controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); } // =================================================================== @@ -234,13 +229,11 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // Switch on attribute name if (attr_name.equals("ArchivingHealth")) { // Add your own code here - final int code = controlResult == null ? ControlResult.NOT_READY : controlResult - .getCode(); + final int code = controlResult == null ? ControlResult.NOT_READY : controlResult.getCode(); attr.set_value((short) code); } else if (attr_name.equals("FormattedReport")) { // Add your own code here - final String report = controlResult == null ? ControlResult.EMPTY_REPORT - : controlResult.getReport(); + final String report = controlResult == null ? ControlResult.EMPTY_REPORT : controlResult.getReport(); final String[] res = new String[1]; res[0] = report; @@ -279,8 +272,8 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @return True if archiving works correctly for this attribute */ // ========================================================= - private boolean is_attribute_correctly_archived(final String argin, - final ControlResult _controlResult) throws DevFailed { + private boolean is_attribute_correctly_archived(final String argin, final ControlResult _controlResult) + throws DevFailed { if (_controlResult == null) { throw new DevFailed(HdbArchivingWatcher.getNotYetReadyError()); } @@ -335,8 +328,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ---Add your Own code to control device here --- if (argin == null || argin.length != 2) { - Tools.throwDevFailed(new IllegalArgumentException( - "Needs 2 int parameters: [ amount , type ]")); + Tools.throwDevFailed(new IllegalArgumentException("Needs 2 int parameters: [ amount , type ]")); } final int amount = argin[0]; @@ -407,8 +399,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_archivers_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_error_archivers(_controlResult); } @@ -451,8 +442,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this archiver */ // ========================================================= - private String[] get_errors_for_archiver(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_archiver(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; @@ -599,8 +589,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this domain. */ // ========================================================= - private String[] get_errors_for_domain(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_domain(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; @@ -673,15 +662,13 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this attribute name */ // ========================================================= - private String[] get_errors_for_attribute(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_attribute(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; } - final Map<String, ArchivingAttributeSubName> _errorAttributeSubNames = _controlResult - .getErrorSubAttributes(); + final Map<String, ArchivingAttributeSubName> _errorAttributeSubNames = _controlResult.getErrorSubAttributes(); if (_errorAttributeSubNames == null) { return empty; } @@ -724,8 +711,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String get_report_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); // ControlResult _controlResult = delayManager.getControlResult ( // IDelayManager.READ_ROLLOVER ); @@ -744,8 +730,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String get_report_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_report(_controlResult); } @@ -764,8 +749,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public boolean is_attribute_correctly_archived_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return is_attribute_correctly_archived(argin, _controlResult); } @@ -783,11 +767,9 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { * @return True if archiving works correctly for this attribute */ // ========================================================= - public boolean is_attribute_correctly_archived_latest_error(final String argin) - throws DevFailed { + public boolean is_attribute_correctly_archived_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return is_attribute_correctly_archived(argin, _controlResult); } @@ -805,8 +787,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_archivers_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_error_archivers(_controlResult); } @@ -825,8 +806,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_archiver_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_archiver(argin, _controlResult); } @@ -862,11 +842,9 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { } } } catch (final Exception df) { - logger.trace(ILogger.LEVEL_ERROR, - "get_all_archiving_attributes/error! VVVVVVVVVVVVVVVVV"); + logger.trace(ILogger.LEVEL_ERROR, "get_all_archiving_attributes/error! VVVVVVVVVVVVVVVVV"); logger.trace(ILogger.LEVEL_ERROR, df); - logger.trace(ILogger.LEVEL_ERROR, - "get_all_archiving_attributes/error! ^^^^^^^^^^^^^^^^^"); + logger.trace(ILogger.LEVEL_ERROR, "get_all_archiving_attributes/error! ^^^^^^^^^^^^^^^^^"); Tools.throwDevFailed(df); } return ret; @@ -886,8 +864,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_archiver_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_archiver(argin, _controlResult); } @@ -904,8 +881,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_domains_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_error_domains(_controlResult); } @@ -923,8 +899,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_domains_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_error_domains(_controlResult); } @@ -943,8 +918,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_domain_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_domain(argin, _controlResult); } @@ -963,8 +937,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_domain_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_domain(argin, _controlResult); } @@ -983,8 +956,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_attribute_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_attribute(argin, _controlResult); } @@ -1003,8 +975,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_attribute_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_attribute(argin, _controlResult); } @@ -1019,8 +990,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); return; } dbReader.startArchivingReport(); @@ -1039,8 +1009,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabaseReport(); } catch (final DevFailed e) { @@ -1075,8 +1044,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getAttributesCountOkOrKo(false); } catch (final ArchivingException e) { @@ -1095,8 +1063,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getAttributesCountOkOrKo(true); } catch (final ArchivingException e) { @@ -1115,8 +1082,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getKoAttributes(); @@ -1137,8 +1103,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getListOfPartitions(); @@ -1159,8 +1124,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } final String[] res = { "No Job Status" }; final String[] tmp = dbReader.getDatabase().getDbUtil().getListOfJobStatus(); @@ -1186,8 +1150,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } final String[] res = { "No Job Errors" }; final String[] tmp = dbReader.getDatabase().getDbUtil().getListOfJobErrors(); @@ -1214,8 +1177,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getFeedAliveProgression(); @@ -1237,8 +1199,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getKOAttrCountByDevice(); diff --git a/src/main/java/TdbArchiver/TdbArchiver.java b/src/main/java/TdbArchiver/TdbArchiver.java index d6924d51..2014f331 100644 --- a/src/main/java/TdbArchiver/TdbArchiver.java +++ b/src/main/java/TdbArchiver/TdbArchiver.java @@ -400,6 +400,7 @@ import TdbArchiver.Collector.DbProxy; import TdbArchiver.Collector.TdbCollector; import TdbArchiver.Collector.TdbCollectorFactory; import fr.esrf.Tango.DevFailed; +import fr.esrf.Tango.DevState; import fr.esrf.Tango.ErrSeverity; import fr.esrf.TangoApi.DbDatum; import fr.esrf.TangoDs.Attribute; @@ -715,12 +716,11 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { this.updateAMTTable = updateAMTTable; } + @Override public void run() { try { triggerArchiving(archivingMessConfig.toArray(), updateAMTTable); } catch (final DevFailed devFailed) { - final String completeMessage = DBTools.getCompleteMessage(devFailed); - get_logger().error(completeMessage); TangoStateUtils.setDisable(TdbArchiver.this, archivingStatus); } } @@ -756,7 +756,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { return; } final String[] propnames = { "DbHost", "DbName", "DbUser", "DbPassword", "RacConnection", "DsPath", "DbPath", - // "Cleaner", + // "Cleaner", "HasThreadedStartup", // "CleanOldFiles", // "HasNewExport", @@ -1005,8 +1005,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { logger.trace(ILogger.LEVEL_INFO, "managing " + attCompleteName); try { att_support = AttributeSupport.checkAttributeSupport(attCompleteName, - attributeLightMode.getData_type(), attributeLightMode.getData_format(), attributeLightMode - .getWritable()); + attributeLightMode.getData_type(), attributeLightMode.getData_format(), + attributeLightMode.getWritable()); if (att_support) { attributeLightMode.getMode().checkMode(false, attCompleteName); @@ -1037,6 +1037,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { } archivingStatus.put(attCompleteName, true); + logger.trace(ILogger.LEVEL_INFO, "OK: " + attCompleteName); } catch (final ArchivingException e) { try { collectorFactory.remove(attCompleteName); @@ -1050,6 +1051,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { hasToThrow = true; logger.trace(ILogger.LEVEL_ERROR, reason + " " + desc); archivingStatus.put(attCompleteName, false); + logger.trace(ILogger.LEVEL_INFO, "KO: " + attCompleteName); } } @@ -1058,7 +1060,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { TangoStateUtils.setOn(this, archivingStatus); if (hasToThrow) { - logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf - out"); + logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf ERROR - out"); throw archivingException.toTangoException(); } @@ -1164,6 +1166,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { // ========================================================= public void stop_archive_att(final String[] argin) throws DevFailed { TangoStateUtils.isAllowed(this); + boolean wasDisable = get_state().equals(DevState.DISABLE) ? true : false; TangoStateUtils.setRunning(this); get_logger().info("Entering stop_archive_att()"); @@ -1180,8 +1183,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { collectorFactory.destroy(attributeLightMode); } } else// should only happen when attempting to call stop_archive_att - // on a non-longer-reserved attribute of a formerly (ie. at - // the time the archiving was started) dedicated archiver. + // on a non-longer-reserved attribute of a formerly (ie. at + // the time the archiving was started) dedicated archiver. { final String msg = "TdbArchiver/stop_archive_att/getAttribute_complete_name|" + attributeLightMode.getAttribute_complete_name() @@ -1207,7 +1210,11 @@ public class TdbArchiver extends DeviceImpl implements TangoConst { throw e.toTangoException(); } finally { computeLoads(); - TangoStateUtils.setOn(this, archivingStatus); + if (wasDisable) { + TangoStateUtils.setDisable(this, archivingStatus); + } else { + TangoStateUtils.setOn(this, archivingStatus); + } } get_logger().info("Exiting stop_archive_att()"); diff --git a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java index afe2def6..57860126 100644 --- a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java +++ b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java @@ -117,8 +117,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @param version * The device version */ - TdbArchivingWatcher(final DeviceClass cl, final String s, final String version) - throws DevFailed { + TdbArchivingWatcher(final DeviceClass cl, final String s, final String version) throws DevFailed { super(cl, s); m_version = version; init_device(); @@ -137,8 +136,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @param version * The device version */ - TdbArchivingWatcher(final DeviceClass cl, final String s, final String d, final String version) - throws DevFailed { + TdbArchivingWatcher(final DeviceClass cl, final String s, final String d, final String version) throws DevFailed { super(cl, s, d); m_version = version; init_device(); @@ -147,8 +145,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // @Override protected DbDatum getClassProperty(final String name) { - final TdbArchivingWatcherClass ds_class = (TdbArchivingWatcherClass) super - .get_device_class(); + final TdbArchivingWatcherClass ds_class = (TdbArchivingWatcherClass) super.get_device_class(); return ds_class.get_class_property(name); } @@ -212,14 +209,8 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // =================================================================== @Override public void read_attr_hardware(final Vector attr_list) throws DevFailed { - if (get_state().value() != DevState._FAULT) { - final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); - controlResult = _controlResult == null ? null : _controlResult.cloneControlResult(); - } else { - controlResult = new ControlResult(); - } + final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); + controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); } // =================================================================== @@ -238,13 +229,11 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // Switch on attribute name if (attr_name.equals("ArchivingHealth")) { // Add your own code here - final int code = controlResult == null ? ControlResult.NOT_READY : controlResult - .getCode(); + final int code = controlResult == null ? ControlResult.NOT_READY : controlResult.getCode(); attr.set_value((short) code); } else if (attr_name.equals("FormattedReport")) { // Add your own code here - final String report = controlResult == null ? ControlResult.EMPTY_REPORT - : controlResult.getReport(); + final String report = controlResult == null ? ControlResult.EMPTY_REPORT : controlResult.getReport(); final String[] res = new String[1]; res[0] = report; @@ -283,8 +272,8 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @return True if archiving works correctly for this attribute */ // ========================================================= - private boolean is_attribute_correctly_archived(final String argin, - final ControlResult _controlResult) throws DevFailed { + private boolean is_attribute_correctly_archived(final String argin, final ControlResult _controlResult) + throws DevFailed { if (_controlResult == null) { throw new DevFailed(TdbArchivingWatcher.getNotYetReadyError()); } @@ -339,8 +328,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ---Add your Own code to control device here --- if (argin == null || argin.length != 2) { - Tools.throwDevFailed(new IllegalArgumentException( - "Needs 2 int parameters: [ amount , type ]")); + Tools.throwDevFailed(new IllegalArgumentException("Needs 2 int parameters: [ amount , type ]")); } final int amount = argin[0]; @@ -426,8 +414,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_archivers_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_error_archivers(_controlResult); } @@ -470,8 +457,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this archiver */ // ========================================================= - private String[] get_errors_for_archiver(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_archiver(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; @@ -618,8 +604,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this domain. */ // ========================================================= - private String[] get_errors_for_domain(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_domain(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; @@ -692,15 +677,13 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @return The list of KO attributes for this attribute name */ // ========================================================= - private String[] get_errors_for_attribute(final String argin, final ControlResult _controlResult) - throws DevFailed { + private String[] get_errors_for_attribute(final String argin, final ControlResult _controlResult) throws DevFailed { final String[] empty = new String[0]; if (_controlResult == null) { return empty; } - final Map<String, ArchivingAttributeSubName> _errorAttributeSubNames = _controlResult - .getErrorSubAttributes(); + final Map<String, ArchivingAttributeSubName> _errorAttributeSubNames = _controlResult.getErrorSubAttributes(); if (_errorAttributeSubNames == null) { return empty; } @@ -743,8 +726,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String get_report_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); // ControlResult _controlResult = delayManager.getControlResult ( // IDelayManager.READ_ROLLOVER ); @@ -763,8 +745,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String get_report_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_report(_controlResult); } @@ -783,8 +764,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public boolean is_attribute_correctly_archived_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return is_attribute_correctly_archived(argin, _controlResult); } @@ -802,11 +782,9 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { * @return True if archiving works correctly for this attribute */ // ========================================================= - public boolean is_attribute_correctly_archived_latest_error(final String argin) - throws DevFailed { + public boolean is_attribute_correctly_archived_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return is_attribute_correctly_archived(argin, _controlResult); } @@ -824,8 +802,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_archivers_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_error_archivers(_controlResult); } @@ -844,8 +821,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_archiver_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_archiver(argin, _controlResult); } @@ -864,8 +840,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_archiver_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_archiver(argin, _controlResult); } @@ -902,11 +877,9 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { } } } catch (final Exception e) { - logger.trace(ILogger.LEVEL_ERROR, - "get_all_archiving_attributes/error! VVVVVVVVVVVVVVVVV"); + logger.trace(ILogger.LEVEL_ERROR, "get_all_archiving_attributes/error! VVVVVVVVVVVVVVVVV"); logger.trace(ILogger.LEVEL_ERROR, e); - logger.trace(ILogger.LEVEL_ERROR, - "get_all_archiving_attributes/error! ^^^^^^^^^^^^^^^^^"); + logger.trace(ILogger.LEVEL_ERROR, "get_all_archiving_attributes/error! ^^^^^^^^^^^^^^^^^"); Tools.throwDevFailed(e); } @@ -925,8 +898,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_domains_current() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_error_domains(_controlResult); } @@ -944,8 +916,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_error_domains_latest_error() throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_error_domains(_controlResult); } @@ -964,8 +935,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_domain_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_domain(argin, _controlResult); } @@ -984,8 +954,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_domain_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_domain(argin, _controlResult); } @@ -1004,8 +973,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_attribute_current(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_ROLLOVER); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER); return get_errors_for_attribute(argin, _controlResult); } @@ -1024,8 +992,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // ========================================================= public String[] get_errors_for_attribute_latest_error(final String argin) throws DevFailed { final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl(); - final ControlResult _controlResult = delayManager - .getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); + final ControlResult _controlResult = delayManager.getControlResult(IDelayManager.READ_LATEST_BAD_CYCLE); return get_errors_for_attribute(argin, _controlResult); } @@ -1071,8 +1038,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // TODO Auto-generated method stub try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); return; } dbReader.startArchivingReport(); @@ -1091,8 +1057,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { // TODO Auto-generated method stub try { if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabaseReport(); } catch (final DevFailed e) { @@ -1127,8 +1092,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getAttributesCountOkOrKo(false); } catch (final ArchivingException e) { @@ -1147,8 +1111,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getAttributesCountOkOrKo(true); } catch (final ArchivingException e) { @@ -1167,8 +1130,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getKoAttributes(); @@ -1189,8 +1151,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getListOfPartitions(); @@ -1211,8 +1172,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } final String[] res = { "No Job Status" }; @@ -1239,8 +1199,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } final String[] res = { "No Job Errors" }; final String[] tmp = dbReader.getDatabase().getDbUtil().getListOfJobErrors(); @@ -1267,8 +1226,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getKOAttrCountByDevice(); @@ -1291,8 +1249,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher { try { if (dbReader.getDatabase().getType() == ConfigConst.TDB_MYSQL) { - Except.throw_exception("DATABASE_ERROR", "MySql Exception", - "MySql is not supported for this command "); + Except.throw_exception("DATABASE_ERROR", "MySql Exception", "MySql is not supported for this command "); } return dbReader.getDatabase().getDbUtil().getFeedAliveProgression(); -- GitLab