diff --git a/.classpath b/.classpath
index 3f8b7611192bb9a494ade0d2bcc1d358f4d49ba4..bfbe1725010acc11dfee02824a4f84833ba28177 100644
--- a/.classpath
+++ b/.classpath
@@ -2,7 +2,6 @@
 <classpath>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
 	<classpathentry excluding="**" including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>
-	<classpathentry kind="src" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>
diff --git a/.project b/.project
index 8449a4332a46e89bafbf7654ef9fa21db72860c6..a4743907b8b54a7b2a121b98404e3a97a2bb4107 100644
--- a/.project
+++ b/.project
@@ -27,11 +27,4 @@
 		<nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
 		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
 	</natures>
-	<linkedResources>
-		<link>
-			<name>ArchivingConf</name>
-			<type>2</type>
-			<location>C:/SOLEIL_ROOT/tango-soleil-win32-5.5.8RC3/tango/bin/ArchivingConf</location>
-		</link>
-	</linkedResources>
 </projectDescription>
diff --git a/pom.xml b/pom.xml
index 25b09b537784a089addb167d69b167818b4daf2c..298773346519c421cc7116aca2def9c9808e5b57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
 	<artifactId>hdbtdbArchivingServers</artifactId>
 	<name>hdbtdbArchivingServers</name>
 
-	<version>2.2.15</version>
+	<version>2.3.1</version>
 
 	<scm>
 		<connection>${scm.connection.svn.tango-cs}:archiving/server/hdbtdbArchivingServers</connection>
@@ -42,6 +42,10 @@
 			<groupId>org.tango</groupId>
 			<artifactId>TangORB-javadao</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>org.tango</groupId>
+			<artifactId>JTangoCommons</artifactId>
+		</dependency>
 		<dependency>
 			<groupId>fr.esrf.atk</groupId>
 			<artifactId>ATKCore</artifactId>
diff --git a/src/main/java/Common/Archiver/Collector/ArchiverCollector.java b/src/main/java/Common/Archiver/Collector/ArchiverCollector.java
index 16c927ee8cb2cfa0146db4ff3db563f500c91b96..27f35bbbb1e108a17db61d0d9212d7855a5397ef 100644
--- a/src/main/java/Common/Archiver/Collector/ArchiverCollector.java
+++ b/src/main/java/Common/Archiver/Collector/ArchiverCollector.java
@@ -1,17 +1,29 @@
 package Common.Archiver.Collector;
 
+import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import fr.esrf.TangoDs.Util;
+import fr.esrf.tangoatk.core.AttributePolledList;
 import fr.esrf.tangoatk.core.ErrorEvent;
+import fr.esrf.tangoatk.core.IAttribute;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ScalarEvent;
 
 public abstract class ArchiverCollector {
+
+    /**
+     * This list is the list used by the refresher of the Collector
+     */
+    protected final AttributePolledList attributeList = new AttributePolledList();
+
     // This hashtable contains the mode counters by attribute
     private final Map<String, ModesCounters> attributeModeCounterMap = new HashMap<String, ModesCounters>();
     // Diary file
-    protected ILogger m_logger;
+    protected ILogger logger;
 
     /**
      * An ModeHandler is associated to each Collector to handle the archiving
@@ -19,19 +31,24 @@ public abstract class ArchiverCollector {
      */
     protected ModeHandler m_modeHandler;
 
+    /**
+     * This field represent the refreshing rate of the Collector
+     */
+    private boolean refreshing;
+
     public ArchiverCollector(ModeHandler modeHandler) {
 	m_modeHandler = modeHandler;
     }
 
     public void setDiaryLogger(ILogger _logger) {
-	this.m_logger = _logger;
+	this.logger = _logger;
     }
 
     /* Allows to indicate to the collector that a new attribute must be managed */
     protected synchronized void addAttribute(String name) {
 	String lower = name.toLowerCase();
 	if (attributeModeCounterMap.containsKey(lower)) {
-	    m_logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
+	    logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
 		    + "already exists in the map ==> Counter Re-init");
 	    attributeModeCounterMap.get(lower).init();
 	} else {
@@ -71,11 +88,121 @@ public abstract class ArchiverCollector {
 	    doArchive = m_modeHandler.isDataArchivable(mc, dataType, readValueObject, lastValueObject);
 	} catch (Exception e) {
 	    e.printStackTrace();
-	    this.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
+	    this.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
 		    + " with the value of " + attCompleteName);
 	}
 
 	return doArchive;
     }
 
+    /**
+     * Triggers the collecting action of this HdbCollector.
+     */
+    protected synchronized void startCollecting() {
+	if (!attributeList.isEmpty()) {
+	    if (!attributeList.isRefresherStarted()) {
+		attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
+		attributeList.setSynchronizedPeriod(true);
+		attributeList.startRefresher();
+		refreshing = true;
+		logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " start refresh for " + attributeList.getSize()
+			+ " attributes");
+	    } else {
+		// force a refresh for newly added attributes
+		attributeList.refresh();
+		logger.trace(ILogger.LEVEL_DEBUG, "FORCING refresh for " + this.getClass());
+	    }
+	}
+    }
+
+    /**
+     * Stops the collecting action of this TdbCollector.
+     */
+    protected synchronized void stopCollecting() {
+	try {
+	    logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " stop refresh on " + attributeList.getSize()
+		    + " attributes");
+	    attributeList.stopRefresher();
+	    refreshing = false;
+	} catch (final Exception e) {
+	    Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "TdbCollector.stopCollecting" + "\r\n"
+		    + "\t Reason : \t " + e.getClass().getName() + "\r\n" + "\t Description : \t " + e.getMessage()
+		    + "\r\n" + "\t Additional information : \t " + "" + "\r\n");
+	    e.printStackTrace();
+	}
+    }
+
+    /**
+     * Returns a boolean to know whether the attribute list is empty or not
+     * 
+     * @return A boolean to know whether the attribute list is empty or not
+     */
+    public boolean hasEmptyList() {
+	return attributeList.isEmpty();
+    }
+
+    public synchronized short[] loadAssessment() {
+	final short[] ret = new short[3];
+	final Enumeration<?> myAttList = attributeList.elements();
+	while (myAttList.hasMoreElements()) {
+	    final IAttribute nextAttr = (IAttribute) myAttList.nextElement();
+	    final int X = nextAttr.getMaxXDimension();
+	    final int Y = nextAttr.getMaxYDimension();
+
+	    short type = 0;
+	    if (X > 1) {
+		type++;
+	    }
+	    if (Y > 1) {
+		type++;
+	    }
+
+	    ret[type]++;
+	}
+
+	return ret;
+    }
+
+    public List<String> getAttributeList() {
+	final List<String> attributeListResult = new ArrayList<String>();
+	final Enumeration<?> myAttList = attributeList.elements();
+	while (myAttList.hasMoreElements()) {
+	    final IAttribute attr = (IAttribute) myAttList.nextElement();
+	    attributeListResult.add(attr.getName());
+	}
+	return attributeListResult;
+    }
+
+    public synchronized boolean isCollected(String attributeName) {
+	boolean isCollected = false;
+	final Enumeration<?> myAttList = attributeList.elements();
+	while (myAttList.hasMoreElements()) {
+	    final IAttribute attr = (IAttribute) myAttList.nextElement();
+	    if (attr.getName().equalsIgnoreCase(attributeName)) {
+		isCollected = true;
+		break;
+	    }
+	}
+	return isCollected;
+    }
+
+    public synchronized String assessment() {
+	final StringBuffer ass = new StringBuffer();
+	ass.append("Collector Reference : " + toString() + "\r\n");
+	ass.append("Activity (refreshing) : " + isRefreshing() + "\r\n");
+	ass.append("Mode : " + "\r\n" + m_modeHandler.getMode().toString() + "\r\n");
+	ass.append("Attribute list (" + attributeList.getSize() + "): " + "\r\n");
+	final Enumeration<?> myAttList = attributeList.elements();
+	int i = 1;
+	while (myAttList.hasMoreElements()) {
+	    final IAttribute iNumberScalar = (IAttribute) myAttList.nextElement();
+	    ass.append("\t" + i++ + "\t" + iNumberScalar.getName() + "\r\n");
+	}
+	return ass.toString();
+    }
+
+    public boolean isRefreshing() {
+	return refreshing;
+    }
+
 }
diff --git a/src/main/java/Common/Watcher/AbsArchivingWatcher.java b/src/main/java/Common/Watcher/AbsArchivingWatcher.java
index 729b49cff016403b540c2c67c2a31802d298cf9c..2171529cae3afc3378c88490840239bde86c9bfe 100644
--- a/src/main/java/Common/Watcher/AbsArchivingWatcher.java
+++ b/src/main/java/Common/Watcher/AbsArchivingWatcher.java
@@ -1,24 +1,41 @@
 package Common.Watcher;
 
-import java.sql.Timestamp;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.tango.utils.DevFailedUtils;
 
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
 import fr.esrf.TangoApi.DbDatum;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
 import fr.esrf.TangoDs.TangoConst;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
+import fr.soleil.commonarchivingapi.ArchivingTools.Diary.LoggerFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.ArchivingWatch;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.datasources.db.DBReaderFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.datasources.db.IDBReader;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.devicelink.Warnable;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.control.safetyperiod.ISaferPeriodCalculator;
-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 {
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Archiver;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ArchivingAttribute;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ControlResult;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Domain;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchiversComparator;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchivingAttributeComparator;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.DomainsComparator;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManager;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManagerFactory;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.delay.DelayManagerFactory;
+import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.delay.IDelayManager;
+
+public abstract class AbsArchivingWatcher extends DeviceImpl implements TangoConst {
 
     // --------- Start of properties data members ----------
 
@@ -155,275 +172,194 @@ public abstract class AbsArchivingWatcher extends DeviceImpl implements TangoCon
      * 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;
+    // private String latestFaultMessage = "";
+    // private int faultsCounter = 0;
 
     // Add your own data members here
     protected ILogger logger;
 
+    private LifeCycleManager lifeCycleManager;
+
+    private ControlResult controlResult;
+
     // --------- End of attributes data members ----------
 
+    protected LifeCycleManager getLifeCycleManager() {
+	return lifeCycleManager;
+    }
+
     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 ); }
-	 */
-	this.logger.trace(level, o);
-    }
-
-    @Override
-    /*
-     * (non-Javadoc)
+    /**
      * 
-     * @see
-     * fr.soleil.TangoArchiving.ArchivingWatchApi.devicelink.Warnable#trace(
-     * java.lang.String, int)
+     * @param type
+     *            LifeCycleManagerFactory.HDB_LIFE_CYCLE or
+     *            LifeCycleManagerFactory.TDB_LIFE_CYCLE
      */
-    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."));
-	}
-
+    protected void initLifeCycleManager(int type) {
+	lifeCycleManager = LifeCycleManagerFactory.getImpl(type);
+	lifeCycleManager.getAsThread().start();
+	startLoggingFactory();
     }
 
     @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;
-
-	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;
+    public abstract void init_device() throws DevFailed;
 
-	case Warnable.LOG_LEVEL_FATAL:
-	    get_logger().fatal(msg, t);
-	    break;
+    protected abstract DbDatum getClassProperty(String name);
 
-	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."));
-	}
+    private void startLoggingFactory() {
+	// System.out.println (
+	// "CLA/startLoggingFactory/this.device_name/"+this.device_name+"/hashCode/"+this.hashCode
+	// ()+"/this.hasDiary/"+this.hasDiary );
 
-    }
+	logger = LoggerFactory.getImpl(device_name, ArchivingWatch.getDiaryPath(), ArchivingWatch.isHasDiary());
+	logger.setTraceLevel(ArchivingWatch.getDiaryLogLevel());
 
-    /**
-     * 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
+     * @param result
+     * @return
      */
-    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;
+    protected String[] get_error_archivers(final ControlResult _controlResult) {
+	final String[] empty = new String[0];
+	if (_controlResult == null) {
+	    return empty;
 	}
 
-	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#warnFault()
-     */
-    @Override
-    public void warnFault(DevFailed t) {
-	System.out.println("CLA/ArchivingWatcher/warnFault");
+	final Map<String, Archiver> _errorArchivers = _controlResult.getErrorArchivers();
+	final String[] argout = new String[_errorArchivers.size()];
 
-	this.set_state((short) DevState._FAULT);
+	final List<Archiver> list = new ArrayList<Archiver>();
+	list.addAll(_errorArchivers.values());
+	Collections.sort(list, new ArchiversComparator());
+	final Iterator<Archiver> it = list.iterator();
 
-	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;
+	int i = 0;
+	while (it.hasNext()) {
+	    final Archiver key = it.next();
+	    argout[i] = key.getName();
+	    i++;
+	}
 
-	this.setStatus(message);
+	return argout;
     }
 
-    @Override
-    public void warnInit() {
-	switch (this.get_state().value()) {
-	case DevState._ALARM:
-	    // do nothing
-	    return;
+    protected String[] get_error_domains(final ControlResult _controlResult) throws DevFailed {
+	final String[] empty = new String[0];
+	if (_controlResult == null) {
+	    return empty;
 	}
 
-	this.set_state((short) DevState._INIT);
-
-	String message = "At :" + this.now();
-	message += Tools.CRLF;
-	message += this.get_status();
-
-	this.setStatus(message);
-    }
-
-    @Override
-    public void warnOff() {
-	// this.formerState = DevState._OFF;
+	final Map<String, Domain> _errorDomains = _controlResult.getErrorDomains();
+	final String[] argout = new String[_errorDomains.size()];
 
-	switch (this.get_state().value()) {
-	case DevState._ALARM:
-	    // do nothing
-	    return;
+	final List<Domain> list = new ArrayList<Domain>();
+	list.addAll(_errorDomains.values());
+	Collections.sort(list, new DomainsComparator());
+	final Iterator<Domain> it = list.iterator();
 
-	case DevState._FAULT:
-	    // do nothing
-	    return;
+	int i = 0;
+	while (it.hasNext()) {
+	    final Domain key = it.next();
+	    argout[i] = key.getName();
+	    i++;
 	}
 
-	this.set_state((short) DevState._OFF);
-
-	String message = "At :" + this.now();
-	message += Tools.CRLF;
-	message += this.get_status();
-
-	this.setStatus(message);
+	return argout;
     }
 
-    /*
-     * (non-Javadoc)
+    /**
+     * Lists KO attributes for this archiver
      * 
-     * @see archwatch.strategy.delay.Warnable#warn()
+     * @param argin
+     *            The name of the archiver
+     * @return The list of KO attributes for this archiver
      */
-    @Override
-    public void warnOn() {
-	// this.formerState = DevState._ON;
-
-	/*
-	 * switch ( this.get_state().value() ) { case DevState._ALARM: //do
-	 * nothing return; }
-	 */
+    protected String[] get_errors_for_archiver(final String argin, final ControlResult _controlResult) throws DevFailed {
+	final String[] empty = new String[0];
+	if (_controlResult == null) {
+	    return empty;
+	}
 
-	if (this.get_state().value() == DevState._ON) {
-	    return;
+	final Map<String, Archiver> _errorArchivers = _controlResult.getErrorArchivers();
+	if (_errorArchivers == null) {
+	    return empty;
 	}
 
-	this.dbReader = DBReaderFactory.getCurrentImpl();
-	this.set_state((short) DevState._ON);
+	final Archiver archiver = _errorArchivers.get(argin);
+	if (archiver == null) {
+	    return empty;
+	}
 
-	String message = "At :" + this.now();
-	message += Tools.CRLF;
-	message += this.get_status();
+	final Hashtable<String, ArchivingAttribute> _errorAttributes = archiver.getKOAttributes();
+	if (_errorAttributes == null) {
+	    return empty;
+	}
 
-	this.setStatus(message);
+	final String[] argout = new String[_errorAttributes.size()];
+	final List<ArchivingAttribute> list = new ArrayList<ArchivingAttribute>();
+	list.addAll(_errorAttributes.values());
+	Collections.sort(list, new ArchivingAttributeComparator());
+	final Iterator<ArchivingAttribute> it = list.iterator();
+	int i = 0;
+
+	while (it.hasNext()) {
+	    final ArchivingAttribute key = it.next();
+	    argout[i] = key.getCompleteName();
+	    i++;
+	}
+	return argout;
     }
 
-    @Override
-    public String get_status() {
-	String ret = super.get_status();
-
-	if (this.get_state().value() != DevState._FAULT) {
-	    ret += this.getLatestFaultMessage();
+    protected ControlResult updateControlResult() throws DevFailed {
+	final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl();
+	controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER);
+	if (controlResult == null) {
+	    Except.throw_exception("DEVICE_ ERROR", "cannot get archiving status", "read_attr_hardware");
 	}
-
-	return ret;
+	return controlResult;
     }
 
-    // =========================================================
-    protected void initLatestFaultData() {
-	this.latestFaultMessage = "";
-	this.faultsCounter = 0;
+    @Override
+    public DevState dev_state() throws DevFailed {
+	DevState state = DevState.INIT;
+	if (lifeCycleManager == null) {
+	    // System.out.println("INIT");
+	    // set_state(DevState.INIT);
+	    set_status("init in progress");
+	} else {
+	    state = lifeCycleManager.getTangoState();
+	    if (state.equals(DevState.FAULT)) {
+		Throwable lastError = lifeCycleManager.getLastError();
+		String message;
+		if (lastError instanceof DevFailed) {
+		    message = DevFailedUtils.toString((DevFailed) lastError);
+		} else {
+		    final StringWriter sw = new StringWriter();
+		    lastError.printStackTrace(new PrintWriter(sw));
+		    message = sw.toString();
+		}
+		set_status(message);
+	    } else {
+		state = super.dev_state();
+		final String report = controlResult == null ? ControlResult.EMPTY_REPORT : controlResult
+			.getReportHeader();
+		set_status(report);
+	    }
+	}
+	return state;
     }
 
     // ===================================================================
@@ -733,78 +669,4 @@ public abstract class AbsArchivingWatcher extends DeviceImpl implements TangoCon
 	// 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;
-	}
-
-	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/Collector/DbProxy.java b/src/main/java/HdbArchiver/Collector/DbProxy.java
index 904ec1db5d6ab49a0cc3147069aceb8329e309fd..4a8c2c7e0d10a9096f6ef5af0c7b5190d1642cc5 100644
--- a/src/main/java/HdbArchiver/Collector/DbProxy.java
+++ b/src/main/java/HdbArchiver/Collector/DbProxy.java
@@ -342,11 +342,6 @@ public class DbProxy implements IDbProxy {
 
     }
 
-    public void updateModeRecord(final AttributeLightMode attributeLightMode) throws ArchivingException {
-
-	manager.getDataBase().getMode().updateModeRecord(attributeLightMode.getAttribute_complete_name());
-    }
-
     public void updateModeRecord(final String att_name) throws ArchivingException {
 	manager.getDataBase().getMode().updateModeRecord(att_name);
     }
@@ -356,26 +351,13 @@ public class DbProxy implements IDbProxy {
     }
 
     public Vector<AttributeLightMode> getArchiverCurrentTasks(final String archiverName) throws ArchivingException {
-	Util.out4.println("DbProxy.getArchiverCurrentTasks");
-	// Vector<AttributeLightMode> archiverCurrentTasks = new
-	// Vector<AttributeLightMode>();
 	final boolean facility = manager.isM_Facility();
-
 	try {
 	    final Vector<AttributeLightMode> archiverCurrentTasks = manager
 		    .getDataBase()
 		    .getMode()
 		    .getArchiverCurrentTasks(
 			    (facility ? "//" + new Database().get_tango_host() + "/" : "") + archiverName);
-	    // System.out.println("Current Tasks - " +
-	    // archiverCurrentTasks.size() + ": ");
-	    // for (int i = 0; i < archiverCurrentTasks.size(); i++) {
-	    // final AttributeLightMode attributeLightMode =
-	    // archiverCurrentTasks.elementAt(i);
-	    // System.out.println("*******************     " + (i + 1)
-	    // + "     *******************");
-	    // System.out.println(attributeLightMode);
-	    // }
 	    return archiverCurrentTasks;
 	} catch (final DevFailed devFailed) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + GlobalConst.DBT_UNREACH_EXCEPTION;
diff --git a/src/main/java/HdbArchiver/Collector/HdbCollector.java b/src/main/java/HdbArchiver/Collector/HdbCollector.java
index 2cb43def930bc7738c3da6e10cf31ad256bec55c..56752fbf0a04d1b01ac8b1ff8717a1c5db635936 100644
--- a/src/main/java/HdbArchiver/Collector/HdbCollector.java
+++ b/src/main/java/HdbArchiver/Collector/HdbCollector.java
@@ -121,19 +121,15 @@
 package HdbArchiver.Collector;
 
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import Common.Archiver.Collector.ArchiverCollector;
 import HdbArchiver.HdbArchiver;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.TangoDs.Util;
-import fr.esrf.tangoatk.core.AttributePolledList;
 import fr.esrf.tangoatk.core.ErrorEvent;
-import fr.esrf.tangoatk.core.IAttribute;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingEvent;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingException;
@@ -142,16 +138,8 @@ import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.LimitedStack;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ScalarEvent;
 
 public abstract class HdbCollector extends ArchiverCollector {
-    /**
-     * This list is the list used by the refresher of the Collector
-     */
-    protected final AttributePolledList attributeList = new AttributePolledList();
-    /**
-     * This field represent the refreshing rate of the Collector
-     */
-    protected boolean refreshing;
 
-    protected boolean isFirstValue;
+    protected volatile Map<String, Boolean> isFirstValueList = new ConcurrentHashMap<String, Boolean>();
 
     /**
      * This parameter specify the number of time a Collector retry the archiving
@@ -182,17 +170,21 @@ public abstract class HdbCollector extends ArchiverCollector {
 
     public HdbCollector(final HdbModeHandler _modeHandler) {
 	super(_modeHandler);
-	isFirstValue = true;
     }
 
+    protected abstract void addSourceForPolling(final AttributeLightMode attributeLightMode) throws ArchivingException;
+
+    protected abstract void addSourceForEvents(final AttributeLightMode attributeLightMode) throws ArchivingException;
+
     /**
-     * Returns a boolean to know whether the attribute list is empty or not
+     * Removes an attribute from the list of the attributes for which is
+     * responsible this HdbCollector. If the attribute was registered for the
+     * archive events, we unsubscribe from it.
      * 
-     * @return A boolean to know whether the attribute list is empty or not
+     * @param attributeName
+     * @throws ArchivingException
      */
-    public boolean hasEmptyList() {
-	return attributeList.isEmpty();
-    }
+    public abstract void removeSource(String attributeName) throws ArchivingException;
 
     protected void setLastValue(final ScalarEvent scalarEvent, final Object lastValue) {
 	setLastTimestamp(scalarEvent);
@@ -211,7 +203,7 @@ public abstract class HdbCollector extends ArchiverCollector {
      */
 
     public void addSource(final AttributeLightMode attributeLightMode) throws ArchivingException {
-	isFirstValue = true;
+	isFirstValueList.put(attributeLightMode.getAttribute_complete_name().toLowerCase(), true);
 	if (HdbArchiver.isUseEvents) {
 	    addSourceForEvents(attributeLightMode);
 	} else {
@@ -219,56 +211,6 @@ public abstract class HdbCollector extends ArchiverCollector {
 	}
     }
 
-    protected abstract void addSourceForPolling(final AttributeLightMode attributeLightMode) throws ArchivingException;
-
-    protected abstract void addSourceForEvents(final AttributeLightMode attributeLightMode) throws ArchivingException;
-
-    /**
-     * Removes an attribute from the list of the attributes for which is
-     * responsible this HdbCollector. If the attribute was registered for the
-     * archive events, we unsubscribe from it.
-     * 
-     * @param attributeName
-     * @throws ArchivingException
-     */
-    public abstract void removeSource(String attributeName) throws ArchivingException;
-
-    /**
-     * Triggers the collecting action of this HdbCollector.
-     */
-    public synchronized void startCollecting() {
-	if (!attributeList.isEmpty()) {
-	    if (attributeList.size() == 1) {
-		attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
-		attributeList.setSynchronizedPeriod(true);
-		attributeList.startRefresher();
-		refreshing = true;
-	    } else {
-		// force a refresh for newly added attributes
-		attributeList.refresh();
-	    }
-	}
-    }
-
-    /**
-     * Stops the collecting action of this HdbCollector.
-     */
-    public synchronized void stopCollecting() {
-	Util.out4.println("HdbCollector.stopCollecting");
-	m_logger.trace(ILogger.LEVEL_INFO, "HdbCollector.stopCollecting");
-	try {
-	    if (attributeList.isEmpty()) {
-		attributeList.stopRefresher();
-		refreshing = false;
-	    }
-	} catch (final Exception e) {
-	    Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "HdbCollector.stopCollecting" + "\r\n"
-		    + "\t Reason : \t " + "UNKNOWN_ERROR" + "\r\n" + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \t " + "" + "\r\n");
-	    e.printStackTrace();
-	}
-    }
-
     public void errorChange(final ErrorEvent errorEvent) {
 	final long temp = System.currentTimeMillis();
 	Util.out4.println("\n" + this.getClass().toString() + " (" + temp + ")" + "\n\t Source \t : "
@@ -277,25 +219,6 @@ public abstract class HdbCollector extends ArchiverCollector {
 
     }
 
-    public synchronized String assessment() {
-	final StringBuffer ass = new StringBuffer();
-	ass.append("Collector Reference : " + toString() + "\r\n");
-	ass.append("Activity (refreshing) : " + isRefreshing() + "\r\n");
-	ass.append("Mode : " + "\r\n" + m_modeHandler.getMode().toString() + "\r\n");
-	ass.append("Attribute list (" + attributeList.getSize() + "): " + "\r\n");
-	final Enumeration myAttList = attributeList.elements();
-	int i = 1;
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute iNumberScalar = (IAttribute) myAttList.nextElement();
-	    ass.append("\t" + i++ + "\t" + iNumberScalar.getName() + "\r\n");
-	}
-	return ass.toString();
-    }
-
-    public boolean isRefreshing() {
-	return refreshing;
-    }
-
     protected void setLastTimestamp(final ArchivingEvent scalarEvent) {
 	if (scalarEvent != null) {
 	    final String name = scalarEvent.getAttribute_complete_name();
@@ -325,7 +248,7 @@ public abstract class HdbCollector extends ArchiverCollector {
 
 	final long newTime = archivingEvent.getTimeStamp();
 	if (newTime == 0) {
-	    m_logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
+	    logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
 		    + " - tableName: " + archivingEvent.getTable_name());
 	    return false;
 	}
@@ -335,10 +258,10 @@ public abstract class HdbCollector extends ArchiverCollector {
 	    return true;
 	}
 
-	final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, m_logger);
-	final boolean isValidDate = lastTimestampStack.validateDate(newTime, m_logger);
+	final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, logger);
+	final boolean isValidDate = lastTimestampStack.validateDate(newTime, logger);
 	if (isAlreadyRegisteredDate || !isValidDate) {
-	    m_logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
+	    logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
 		    + " - timestamp: " + new Timestamp(newTime));
 	    return false;
 	}
@@ -346,38 +269,6 @@ public abstract class HdbCollector extends ArchiverCollector {
 	return true;
     }
 
-    public synchronized short[] loadAssessment() {
-	final short[] ret = new short[3];
-	final Enumeration myAttList = attributeList.elements();
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute nextAttr = (IAttribute) myAttList.nextElement();
-	    final int X = nextAttr.getMaxXDimension();
-	    final int Y = nextAttr.getMaxYDimension();
-
-	    short type = 0;
-	    if (X > 1) {
-		type++;
-	    }
-	    if (Y > 1) {
-		type++;
-	    }
-
-	    ret[type]++;
-	}
-
-	return ret;
-    }
-
-    public List<String> getAttributeList() {
-	final List<String> attributeListResult = new ArrayList<String>();
-	final Enumeration<?> myAttList = attributeList.elements();
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute attr = (IAttribute) myAttList.nextElement();
-	    attributeListResult.add(attr.getName());
-	}
-	return attributeListResult;
-    }
-
     public void setDbProxy(final DbProxy _dbProxy) {
 	dbProxy = _dbProxy;
     }
diff --git a/src/main/java/HdbArchiver/Collector/HdbCollectorFactory.java b/src/main/java/HdbArchiver/Collector/HdbCollectorFactory.java
index 94083f50b6d950297721a689f40e9442ca0e1ea3..575850a3a84f7859c3c2c4a9efe2e7a71886c322 100644
--- a/src/main/java/HdbArchiver/Collector/HdbCollectorFactory.java
+++ b/src/main/java/HdbArchiver/Collector/HdbCollectorFactory.java
@@ -171,6 +171,17 @@ public class HdbCollectorFactory {
 	return tableCollector.get(superMode);
     }
 
+    public HdbCollector get(final String attributeName) {
+	HdbCollector result = null;
+	for (HdbCollector collector : tableCollector.values()) {
+	    if (collector.isCollected(attributeName)) {
+		result = collector;
+		break;
+	    }
+	}
+	return result;
+    }
+
     /**
      * This method create a new HdbCollector instance if required associated to
      * an attribute. In this method, attributes are not grouped by mode.
@@ -450,7 +461,7 @@ public class HdbCollectorFactory {
 	for (final Map.Entry<SuperMode, HdbCollector> entry : tableCollector.entrySet()) {
 	    final SuperMode mode = entry.getKey();
 	    final HdbCollector collector = entry.getValue();
-	    if (collector.getAttributeList().contains(attributeName)) {
+	    if (collector.isCollected(attributeName)) {
 		collector.removeSource(attributeName);
 	    }
 	    if (collector.hasEmptyList()) {
diff --git a/src/main/java/HdbArchiver/Collector/image/Image_RO.java b/src/main/java/HdbArchiver/Collector/image/Image_RO.java
index 2fd94e06cfc5d58d01e53e4ddb288de3af04bd4f..66efdac48cabc5474f699a303bd48b3e4a41d2d1 100644
--- a/src/main/java/HdbArchiver/Collector/image/Image_RO.java
+++ b/src/main/java/HdbArchiver/Collector/image/Image_RO.java
@@ -203,8 +203,8 @@ public class Image_RO extends HdbCollector implements IImageListener {
 	    super.setLastTimestamp(snapImageEvent_RO);
 	} catch (final Exception e) {
 	    final String message = "Problem (ArchivingException) storing Image_RO value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
diff --git a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar.java b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar.java
index 2fa92d05717a5db946c3cf945a1e3cc5a9dad263..3fd0732113c1d2348bc235ae8c0f2588ea827937 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar.java
@@ -130,7 +130,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	evtAdaptHMap = new HashMap<Device, TangoEventsAdapter>();
     }
 
-    /* synchronized */@Override
+    @Override
     public synchronized void removeSource(final String attributeName) throws ArchivingException {
 	Util.out2.println("BooleanScalar.removeSource");
 
@@ -143,20 +143,18 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	     * while ( ( IBooleanScalar ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IBooleanScalar attribute = (IBooleanScalar) attributeList.get(attributeName);
 	    if (attribute != null) {
 		attribute.removeBooleanScalarListener(this);
 		attribute.removeErrorListener(this);
 		attributeList.remove(attributeName);
-
+		isFirstValueList.remove(attributeName.toLowerCase());
 		// informs the mother class that one new attribute must be
 		// removed
 		removeAttribute(attributeName);
 		removeTimestamps(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -165,6 +163,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName()
 		    + ".removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -175,6 +175,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 
 	    final String attName = attributeLightMode.getAttribute_complete_name();
 	    if (attName != null) {
+		stopCollecting();
 		final IBooleanScalar attribute = (IBooleanScalar) attributeList.add(attName);
 		attribute.addBooleanScalarListener(this);
 		attribute.addErrorListener(this);
@@ -183,12 +184,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 		// informs the mother class that one new attribute must be
 		// managed
 		addAttribute(attName);
-		m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
-		startCollecting();
+		logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
 
-	    } else {
-		m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
-			+ attributeLightMode);
 	    }
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
@@ -203,6 +200,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -361,14 +360,14 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -382,8 +381,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	    setLastValue(scalarEvent, scalarEvent.getReadValue());
 	} catch (final Exception e) {
 	    final String message = "Problem storing BooleanScalar value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
@@ -414,13 +413,13 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_BOOLEAN, getWritableValue()),
 		    DEFAULT_TRY_NUMBER);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RO.java b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RO.java
index f1d3cc499965999f494a117c2e25325d5c839995..cd343da0bcbd5fda93196598a1568f1dfb9f1d50 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RO.java
@@ -139,8 +139,8 @@ public class BooleanScalar_RO extends BooleanScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in BooleanScalar_RO/booleanScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
 
     }
diff --git a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RW.java b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RW.java
index 575de2184a67c48b4c9ecf051869acf47bc5b47d..3d7d714deed6c6ffdfeb551c5d95fde835480008 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RW.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_RW.java
@@ -143,8 +143,8 @@ public class BooleanScalar_RW extends BooleanScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in BooleanScalar_RW/booleanScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
 
     }
diff --git a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_WO.java b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_WO.java
index 576ab682368d83a30b580107369c15f0e51bf2e9..0035c3a64fa6c8368c35e007b89dd97b027f675c 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_WO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/BooleanScalar_WO.java
@@ -124,8 +124,8 @@ public class BooleanScalar_WO extends BooleanScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in BooleanScalar_WO/booleanScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
     }
 
diff --git a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar.java b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar.java
index f7c32989fd1616d37abf502c8d67689731fa1a2b..b29b4e3c4ff4b574783cce0adfd0799be105d6e7 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar.java
@@ -176,7 +176,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
     public synchronized void removeSource(final String attributeName) throws ArchivingException {
 	Util.out2.println("NumberScalar.removeSource");
 
-	m_logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
+	logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
 		+ attributeName);
 
 	if (HdbArchiver.isUseEvents) {
@@ -188,20 +188,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	     * while ( ( INumberScalar ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final INumberScalar attribute = (INumberScalar) attributeList.get(attributeName);
 	    if (attribute != null) {
 		attribute.removeNumberScalarListener(this);
 		attribute.removeErrorListener(this);
 		attributeList.remove(attributeName);
-		m_logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
+		isFirstValueList.remove(attributeName.toLowerCase());
+		logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
 		// informs the mother class that one new attribute must be
 		// removed
 		removeAttribute(attributeName);
 		removeTimestamps(attributeName);
-		if (attributeList.isEmpty()) {
-		    m_logger.trace(ILogger.LEVEL_INFO, "===> StopCollecting is requested ");
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -211,8 +209,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 		    + ".removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
 	} finally {
-	    m_logger.trace(ILogger.LEVEL_INFO, "===> Exiting " + this.getClass().getSimpleName() + ".removeSource for "
-		    + attributeName);
+	    startCollecting();
 	}
     }
 
@@ -223,6 +220,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	    final String attName = attributeLightMode.getAttribute_complete_name();
 	    if (attName != null) {
 		INumberScalar attribute = null;
+		stopCollecting();
 		attribute = (INumberScalar) attributeList.add(attName);
 		attribute.addNumberScalarListener(this);
 		attribute.addErrorListener(this);
@@ -231,11 +229,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 		// informs the mother class that one new attribute must be
 		// managed
 		addAttribute(attName);
-		m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
-		startCollecting();
-	    } else {
-		m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
-			+ attributeLightMode);
+		logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
 	    }
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
@@ -249,6 +243,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -419,17 +415,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	    scalarEvent.avoidUnderFlow();
 
 	    boolean doArchive = false;
-	    if (isFirstValue) {
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
+
 		}
 	    }
 
@@ -441,8 +438,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	} catch (final Exception e) {
 	    e.printStackTrace();
 	    final String message = "Problem storing NumberScalar value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
@@ -473,7 +470,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	/* Must be change because the number scalar are not only double */
 	try {
@@ -481,7 +478,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
 		    getNullValueScalarEvent(errorEvent, ((AAttribute) errorEvent.getSource()).getTangoDataType(),
 			    getWritableValue()), tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RO.java b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RO.java
index b08efa283acc53889d648599569a5252b4e2a12f..9f44bfd6b61c3e76b8ae6a4eda73f1bb8c751f2c 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RO.java
@@ -157,8 +157,8 @@ public class NumberScalar_RO extends NumberScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in NumberScalar_RO/numberScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
 
     }
diff --git a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RW.java b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RW.java
index e2bc2b63a1cb71fe96d40ff5c02987b8990ff1ba..25cb3d6dc9b1926d2fd50c46e555fac2ac2d08ca 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RW.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_RW.java
@@ -182,8 +182,8 @@ public class NumberScalar_RW extends NumberScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in NumberScalar_RW/numberScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
 
     }
diff --git a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_WO.java b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_WO.java
index c5b53be73c66d21dbee8a3cf7fb81f2df9f73a9d..03dbd68354f8fdde35298260ffbccded9212ec8e 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_WO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/NumberScalar_WO.java
@@ -140,8 +140,8 @@ public class NumberScalar_WO extends NumberScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in NumberScalar_RW/numberScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
     }
 
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StateScalar.java b/src/main/java/HdbArchiver/Collector/scalar/StateScalar.java
index a65a3bcf3386884397c543d6f335520d1841a34e..401792d1f2ce8ffe377365e8819df4e909b14451 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StateScalar.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StateScalar.java
@@ -80,19 +80,18 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	     * while ( ( IDevStateScalar ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IDevStateScalar attribute = (IDevStateScalar) attributeList.get(attributeName);
 	    if (attribute != null) {
 		attribute.removeDevStateScalarListener(this);
 		attribute.removeErrorListener(this);
 		attributeList.remove(attributeName);
+		isFirstValueList.remove(attributeName.toLowerCase());
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
 		// informs the mother class that one new attribute must be
 		// removed
 		removeAttribute(attributeName);
 		removeTimestamps(attributeName);
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -101,6 +100,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName()
 		    + ".removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -114,6 +115,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 		// ==
 		// null )
 		// {
+		stopCollecting();
 		IDevStateScalar attribute = null;
 		attribute = (IDevStateScalar) attributeList.add(attName);
 
@@ -123,11 +125,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 		// informs the mother class that one new attribute must be
 		// managed
 		addAttribute(attName);
-		m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
-		startCollecting();
-	    } else {
-		m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
-			+ attributeLightMode);
+		logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
 	    }
 
 	} catch (final ConnectionException e) {
@@ -143,6 +141,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -300,15 +300,15 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -322,8 +322,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	    setLastValue(scalarEvent, scalarEvent.getReadValue());
 	} catch (final Exception e) {
 	    final String message = "Problem storing StateScalar value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
@@ -358,13 +358,13 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STATE, getWritableValue()),
 		    tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StateScalar_RO.java b/src/main/java/HdbArchiver/Collector/scalar/StateScalar_RO.java
index e324e0c998a43d12f97e71a4252381df9a6c92e0..d1faeab0ce41f0605cca3e3ad141b9c88da29469 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StateScalar_RO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StateScalar_RO.java
@@ -104,8 +104,8 @@ public class StateScalar_RO extends StateScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in StateScalar_RO/devStateScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
     }
 
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StringScalar.java b/src/main/java/HdbArchiver/Collector/scalar/StringScalar.java
index 72a6154eb69428023190eeebc1df2da03203dd35..d11e826d69713d8ad08012296395f3e68579e0bd 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StringScalar.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StringScalar.java
@@ -82,19 +82,18 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	     * while ( ( IStringScalar ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IStringScalar attribute = (IStringScalar) attributeList.get(attributeName);
 	    if (attribute != null) {
 		attribute.removeStringScalarListener(this);
 		attribute.removeErrorListener(this);
 		attributeList.remove(attributeName);
+		isFirstValueList.remove(attributeName.toLowerCase());
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
 		// informs the mother class that one new attribute must be
 		// removed
 		removeAttribute(attributeName);
 		removeTimestamps(attributeName);
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -103,6 +102,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName()
 		    + ".removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -113,6 +114,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	try {
 	    final String attName = attributeLightMode.getAttribute_complete_name();
 	    if (attName != null) {
+		stopCollecting();
 		IStringScalar attribute = null;
 		attribute = (IStringScalar) attributeList.add(attName);
 
@@ -122,11 +124,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 		// informs the mother class that one new attribute must be
 		// managed
 		addAttribute(attName);
-		m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
-		startCollecting();
-	    } else {
-		m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
-			+ attributeLightMode);
+		logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
 	    }
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
@@ -141,6 +139,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -304,15 +304,15 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -326,8 +326,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	    setLastValue(scalarEvent, scalarEvent.getReadValue());
 	} catch (final Exception e) {
 	    final String message = "Problem storing StringScalar value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
@@ -357,13 +357,13 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STRING, getWritableValue()),
 		    tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RO.java b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RO.java
index 377865edbe21fa897abc500623f94ff74cb36726..b3bc30a5ade064774052085fe6ffeab8b6a6fe96 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RO.java
@@ -102,8 +102,8 @@ public class StringScalar_RO extends StringScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in StringScalar_RO/stringScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
 
     }
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RW.java b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RW.java
index 78bcc06c4cc130159f4f144e05a176312c98c13c..5db2cfd42429f6de8974e3ae26046673150ddee5 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RW.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_RW.java
@@ -105,8 +105,8 @@ public class StringScalar_RW extends StringScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in StringScalar_RW/stringScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
     }
 
diff --git a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_WO.java b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_WO.java
index 889db320b669ffc0aafca0df587664e92b577f7a..ffc6cc6c2ae35793920b225e0f284a2a2eec5d98 100644
--- a/src/main/java/HdbArchiver/Collector/scalar/StringScalar_WO.java
+++ b/src/main/java/HdbArchiver/Collector/scalar/StringScalar_WO.java
@@ -96,8 +96,8 @@ public class StringScalar_WO extends StringScalar {
 	    processEventScalar(scalarEvent, tryNumber);
 
 	    final String message = "Problem in StringScalar_WO/stringScalarChange";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, exE);
 	}
     }
 
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RO.java b/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RO.java
index 119fbf39b4bdefa322f554df8574cc169f9444e1..c7c20000049b3f10ec0fc6be20335810ecf9fc03 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RO.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RO.java
@@ -156,6 +156,7 @@ public class BooleanSpectrum_RO extends HdbCollector implements IBooleanSpectrum
 	     * while ( ( IBooleanSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IBooleanSpectrum attribute = (IBooleanSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
 
@@ -165,9 +166,6 @@ public class BooleanSpectrum_RO extends HdbCollector implements IBooleanSpectrum
 		attributeList.remove(attributeName);
 		removeTimestamps(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -175,6 +173,8 @@ public class BooleanSpectrum_RO extends HdbCollector implements IBooleanSpectrum
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing BooleanSpectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -182,19 +182,21 @@ public class BooleanSpectrum_RO extends HdbCollector implements IBooleanSpectrum
     protected synchronized void addSourceForPolling(final AttributeLightMode attributeLightMode)
 	    throws ArchivingException {
 	try {
+	    stopCollecting();
 	    final IBooleanSpectrum attribute = (IBooleanSpectrum) attributeList.add(attributeLightMode
 		    .getAttribute_complete_name());
 	    attribute.addBooleanSpectrumListener(this);
 	    attribute.addErrorListener(this);
 	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
 		    + " was hired to the Collector list...");
-	    startCollecting();
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -474,8 +476,8 @@ public class BooleanSpectrum_RO extends HdbCollector implements IBooleanSpectrum
 	    super.setLastTimestamp(snapSpectrumEvent_RO);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing BooleanSpectrum_RO value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RW.java b/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RW.java
index 18be8e8d3f025790712930871ff9033e0b6ee6bc..7c254b2d7f990810f215249496ffec395d381418 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RW.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/BooleanSpectrum_RW.java
@@ -84,6 +84,7 @@ public class BooleanSpectrum_RW extends HdbCollector implements IBooleanSpectrum
 	     * while ( ( IBooleanSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IBooleanSpectrum attribute = (IBooleanSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
 
@@ -92,9 +93,6 @@ public class BooleanSpectrum_RW extends HdbCollector implements IBooleanSpectrum
 		removeTimestamps(attributeName);
 		attributeList.remove(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -102,6 +100,8 @@ public class BooleanSpectrum_RW extends HdbCollector implements IBooleanSpectrum
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -109,20 +109,21 @@ public class BooleanSpectrum_RW extends HdbCollector implements IBooleanSpectrum
     protected synchronized void addSourceForPolling(final AttributeLightMode attributeLightMode)
 	    throws ArchivingException {
 	try {
-
+	    stopCollecting();
 	    final IBooleanSpectrum attribute = (IBooleanSpectrum) attributeList.add(attributeLightMode
 		    .getAttribute_complete_name());
 	    attribute.addBooleanSpectrumListener(this);
 	    attribute.addErrorListener(this);
 	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
 		    + " was hired to the Collector list...");
-	    startCollecting();
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -410,8 +411,8 @@ public class BooleanSpectrum_RW extends HdbCollector implements IBooleanSpectrum
 	    super.setLastTimestamp(snapSpectrumEvent_RW);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing BooleanSpectrum_RW value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    Util.out4.println("BooleanSpectrumEvent_RW.processEventSpectrum/ArchivingException");
 
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RO.java b/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RO.java
index dde45450c37b9e72e83b2e673be80fa43de6e629..68dd050a7a551273d91a4315eaaec31e4c8b2c10 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RO.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RO.java
@@ -159,6 +159,7 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
 	     * while ( ( INumberSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final INumberSpectrum attribute = (INumberSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
 
@@ -167,9 +168,6 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
 		removeTimestamps(attributeName);
 		attributeList.remove(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -177,6 +175,8 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing NumberSpectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -184,10 +184,7 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
     protected synchronized void addSourceForPolling(final AttributeLightMode attributeLightMode)
 	    throws ArchivingException {
 	try {
-	    // while ( ( INumberSpectrum )
-	    // attributeList.get(attributeLightMode.getAttribute_complete_name())
-	    // == null )
-	    // {
+	    stopCollecting();
 	    final INumberSpectrum attribute = (INumberSpectrum) attributeList.add(attributeLightMode
 		    .getAttribute_complete_name());
 	    attribute.addSpectrumListener(this);
@@ -195,14 +192,14 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
 	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
 		    + " was hired to the Collector list...");
 
-	    startCollecting();
-	    // }
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing NumberSpectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -551,8 +548,8 @@ public class NumberSpectrum_RO extends HdbCollector implements ISpectrumListener
 	    super.setLastTimestamp(snapSpectrumEvent_RO);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing NumberSpectrum_RO value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RW.java b/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RW.java
index cd0ee6bc0582c377e07dc7a3b203f640344a4c55..4fec5b6a87bf01e0111821bfa3c1785777fcd494 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RW.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/NumberSpectrum_RW.java
@@ -84,24 +84,24 @@ public class NumberSpectrum_RW extends HdbCollector implements ISpectrumListener
 	     * while ( ( INumberSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final INumberSpectrum attribute = (INumberSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
-
 		attribute.removeSpectrumListener(this);
 		attribute.removeErrorListener(this);
 		removeTimestamps(attributeName);
 		attributeList.remove(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
+
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
 		    + "' from sources";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -113,19 +113,21 @@ public class NumberSpectrum_RW extends HdbCollector implements ISpectrumListener
 	    // attributeList.get(attributeLightMode.getAttribute_complete_name())
 	    // == null )
 	    // {
+	    stopCollecting();
 	    final INumberSpectrum attribute = (INumberSpectrum) attributeList.add(attributeLightMode
 		    .getAttribute_complete_name());
 	    attribute.addSpectrumListener(this);
 	    attribute.addErrorListener(this);
 	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
 		    + " was hired to the Collector list...");
-	    startCollecting();
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -468,8 +470,8 @@ public class NumberSpectrum_RW extends HdbCollector implements ISpectrumListener
 	    super.setLastTimestamp(snapSpectrumEvent_RW);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing NumberSpectrum_RW value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    Util.out4.println("SpectrumEvent_RW.processEventSpectrum/ArchivingException");
 
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RO.java b/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RO.java
index 498f3e60ab94ba2a7e206433dac9f3be85018aa4..de3aa796ecea3fa1b57e883b482bb3248040d17c 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RO.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RO.java
@@ -156,17 +156,14 @@ public class StringSpectrum_RO extends HdbCollector implements IStringSpectrumLi
 	     * while ( ( IStringSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IStringSpectrum attribute = (IStringSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
-
 		attribute.removeListener(this);
 		attribute.removeErrorListener(this);
 		removeTimestamps(attributeName);
 		attributeList.remove(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -174,6 +171,8 @@ public class StringSpectrum_RO extends HdbCollector implements IStringSpectrumLi
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -181,20 +180,21 @@ public class StringSpectrum_RO extends HdbCollector implements IStringSpectrumLi
     protected synchronized void addSourceForPolling(final AttributeLightMode attributeLightMode)
 	    throws ArchivingException {
 	try {
-
+	    stopCollecting();
 	    final IStringSpectrum attribute = (IStringSpectrum) attributeList.add(attributeLightMode
 		    .getAttribute_complete_name());
 	    attribute.addListener(this);
 	    attribute.addErrorListener(this);
 	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
 		    + " was hired to the Collector list...");
-	    startCollecting();
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -466,8 +466,8 @@ public class StringSpectrum_RO extends HdbCollector implements IStringSpectrumLi
 	    super.setLastTimestamp(snapSpectrumEvent_RO);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing StringSpectrum_RO value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    try_number--;
 	    if (try_number > 0) {
diff --git a/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RW.java b/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RW.java
index e51bc567acb0de549715b9f136b2e1d10fc9db7e..f8f968c9c438446dda0dbcf730376b360128722e 100644
--- a/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RW.java
+++ b/src/main/java/HdbArchiver/Collector/spectrum/StringSpectrum_RW.java
@@ -84,6 +84,7 @@ public class StringSpectrum_RW extends HdbCollector implements IStringSpectrumLi
 	     * while ( ( IStringSpectrum ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IStringSpectrum attribute = (IStringSpectrum) attributeList.get(attributeName);
 	    if (attribute != null) {
 
@@ -92,9 +93,6 @@ public class StringSpectrum_RW extends HdbCollector implements IStringSpectrumLi
 		removeTimestamps(attributeName);
 		attributeList.remove(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
-		}
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -102,27 +100,30 @@ public class StringSpectrum_RW extends HdbCollector implements IStringSpectrumLi
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
     @Override
     protected void addSourceForPolling(final AttributeLightMode attributeLightMode) throws ArchivingException {
 	try {
-	    synchronized (attributeList) {
-		final IStringSpectrum attribute = (IStringSpectrum) attributeList.add(attributeLightMode
-			.getAttribute_complete_name());
-		attribute.addListener(this);
-		attribute.addErrorListener(this);
-		Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
-			+ " was hired to the Collector list...");
-		startCollecting();
-	    }
+	    stopCollecting();
+	    final IStringSpectrum attribute = (IStringSpectrum) attributeList.add(attributeLightMode
+		    .getAttribute_complete_name());
+	    attribute.addListener(this);
+	    attribute.addErrorListener(this);
+	    Util.out4.println("\t The attribute named " + attributeLightMode.getAttribute_complete_name()
+		    + " was hired to the Collector list...");
+
 	} catch (final ConnectionException e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing Spectrum_RO.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -400,8 +401,8 @@ public class StringSpectrum_RW extends HdbCollector implements IStringSpectrumLi
 	    super.setLastTimestamp(snapSpectrumEvent_RW);
 	} catch (final ArchivingException e) {
 	    final String message = "Problem (ArchivingException) storing StringSpectrum_RW value";
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, message);
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, e);
+	    super.logger.trace(ILogger.LEVEL_ERROR, message);
+	    super.logger.trace(ILogger.LEVEL_ERROR, e);
 
 	    Util.out4.println("StringSpectrumEvent_RW.processEventSpectrum/ArchivingException");
 
diff --git a/src/main/java/HdbArchiver/HdbArchiver.java b/src/main/java/HdbArchiver/HdbArchiver.java
index 101d3ffe0bc4c58a19b72bf11b4e90a9f00dff53..10f1f61c87a139c8fe7e5a5202601ae8bb30fc88 100644
--- a/src/main/java/HdbArchiver/HdbArchiver.java
+++ b/src/main/java/HdbArchiver/HdbArchiver.java
@@ -361,20 +361,22 @@ package HdbArchiver;
 import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Map;
+import java.util.Set;
 import java.util.Vector;
+import java.util.concurrent.Executors;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 import HdbArchiver.Collector.DbProxy;
 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;
@@ -542,7 +544,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
     public static final short NA = 10;
     public static final short SUCCEEDED = 20;
     public static final short FAILED = 30;
-    private final Map<String, Boolean> archivingStatus = new HashMap<String, Boolean>();
+    private final Set<String> koAttributes = new HashSet<String>();
+    private final Set<String> okAttributes = new HashSet<String>();
 
     private ILogger logger;
     private String dbSchema;
@@ -616,8 +619,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 	attr_image_charge_read = 0;
 	attr_spectrum_charge_read = 0;
 	attr_scalar_charge_read = 0;
-	archivingStatus.clear();
-
+	koAttributes.clear();
+	okAttributes.clear();
 	get_logger().info("DbHost = " + dbHost);
 	get_logger().info("DbName = " + dbName);
 	get_logger().info("dbUser = " + dbUser);
@@ -640,26 +643,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 	    get_logger().error("ERROR : Database unconnected !!");
 	} else {
 	    setControlMode(safetyPeriod);
-	    try {
-		final Vector<AttributeLightMode> myCurrentTasks = dbProxy.getArchiverCurrentTasks(device_name);
-		if (myCurrentTasks.size() > 0) {
-		    final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.basicObjectCreation();
-		    for (final AttributeLightMode attributeLightMode : myCurrentTasks) {
-			archivingMessConfig.add(attributeLightMode);
-		    }
-		    launchStartArchivingTask(archivingMessConfig, false, false);
-		} else {
-		    TangoStateUtils.setOn(this, archivingStatus);
-		}
-	    } catch (final ArchivingException e) {
-		TangoStateUtils.setFault(this, e.getMessage());
-		get_logger().error(e.toString());
-		Util.out2.println(e.toString());
-	    } catch (final DevFailed devFailed) {
-		final String message = DBTools.getCompleteMessage(devFailed);
-		get_logger().error(message);
-		TangoStateUtils.setFault(this, message);
-	    }
+	    // start archiving in a thread
+	    Executors.newSingleThreadExecutor().submit(new InitDeviceTask());
 	}
     }
 
@@ -683,6 +668,33 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 	}
     }
 
+    private class InitDeviceTask implements Runnable {
+	@Override
+	public void run() {
+
+	    Vector<AttributeLightMode> myCurrentTasks = null;
+	    try {
+		myCurrentTasks = dbProxy.getArchiverCurrentTasks(device_name);
+	    } catch (ArchivingException e) {
+		logger.trace(ILogger.LEVEL_ERROR, "cannot getArchiverCurrentTasks " + e);
+		TangoStateUtils.setFault(HdbArchiver.this, e.getMessage());
+	    }
+
+	    try {
+		if (myCurrentTasks != null && myCurrentTasks.size() > 0) {
+		    final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.basicObjectCreation();
+		    for (final AttributeLightMode attributeLightMode : myCurrentTasks) {
+			archivingMessConfig.add(attributeLightMode);
+		    }
+		    triggerArchiving(archivingMessConfig.toArray(), false);
+		}
+	    } catch (final DevFailed devFailed) {
+	    } finally {
+		TangoStateUtils.updateState(HdbArchiver.this, koAttributes, okAttributes);
+	    }
+	}
+    }
+
     private class StartArchivingRunnable implements Runnable {
 
 	private final ArchivingMessConfig archivingMessConfig;
@@ -698,11 +710,17 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 	    try {
 		triggerArchiving(archivingMessConfig.toArray(), updateAMTTable);
 	    } catch (final DevFailed devFailed) {
-		TangoStateUtils.setDisable(HdbArchiver.this, archivingStatus);
+	    } finally {
+		TangoStateUtils.updateState(HdbArchiver.this, koAttributes, okAttributes);
 	    }
+
 	}
     }
 
+    public String[] getKOAttributes() {
+	return koAttributes.toArray(new String[koAttributes.size()]);
+    }
+
     /**
      * @param safetyPeriod2
      */
@@ -1003,9 +1021,11 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
     // =========================================================
     public void trigger_archive_conf(final String[] argin) throws DevFailed {
 	TangoStateUtils.isAllowed(this);
-	TangoStateUtils.setRunning(this);
-	triggerArchiving(argin, true);
-
+	try {
+	    triggerArchiving(argin, true);
+	} finally {
+	    TangoStateUtils.updateState(this, koAttributes, okAttributes);
+	}
     }
 
     private void triggerArchiving(final String[] argin, final boolean updateAMTTable) throws DevFailed {
@@ -1111,7 +1131,8 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 		    // --------------------------------------------------------------------------//
 
 		}
-		archivingStatus.put(attCompleteName, true);
+		okAttributes.add(attCompleteName.toLowerCase());
+		koAttributes.remove(attCompleteName.toLowerCase());
 		logger.trace(ILogger.LEVEL_INFO, "OK: " + attCompleteName);
 	    } catch (final ArchivingException e) {
 		try {
@@ -1120,17 +1141,24 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 		}
 		e.printStackTrace();
 		final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : ";
-		final String reason = "Failed while executing HdbArchiver.trigger_archive_conf method";
-		final String desc = "impossible to start " + attCompleteName;
-		archivingException.addStack(message, reason, ErrSeverity.PANIC, desc, "", e);
-		logger.trace(ILogger.LEVEL_ERROR, reason + " " + desc);
-		archivingStatus.put(attCompleteName, false);
+		archivingException.addStack(message, e);
+		logger.trace(ILogger.LEVEL_ERROR, e);
+		koAttributes.add(attCompleteName.toLowerCase());
+		okAttributes.remove(attCompleteName.toLowerCase());
 		logger.trace(ILogger.LEVEL_INFO, "KO: " + attCompleteName);
+	    } catch (Exception e) {
+		try {
+		    collectorFactory.remove(attCompleteName);
+		} catch (final ArchivingException e1) {
+		}
+		koAttributes.add(attCompleteName.toLowerCase());
+		okAttributes.remove(attCompleteName.toLowerCase());
+		e.printStackTrace();
+		logger.trace(ILogger.LEVEL_ERROR, "KO " + attCompleteName + " unexpected " + e);
 	    }
 	}
 
 	computeLoads();
-	TangoStateUtils.setOn(this, archivingStatus);
 	if (!archivingException.getMessage().equals("")) {
 	    logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf ERROR - out");
 	    throw archivingException.toTangoException();
@@ -1726,57 +1754,35 @@ 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);
 	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: " + attributeLightMode.getAttribute_complete_name());
-
-	    dbProxy.updateModeRecord(attributeLightMode);
-
-	    hdbCollector = collectorFactory.get(attributeLightMode);
-	    if (hdbCollector != null) {
-		hdbCollector.removeSource(attributeLightMode.getAttribute_complete_name());
-		if (!hdbCollector.isRefreshing()) {
-		    collectorFactory.destroy(attributeLightMode);
+	    String attributeName = argin[0];
+	    // final AttributeLightMode attributeLightMode =
+	    // AttributeLightMode.creationWithFullInformation(argin);
+	    logger.trace(ILogger.LEVEL_INFO, "attribute: " + attributeName);
+	    if (koAttributes.contains(attributeName.toLowerCase())
+		    || okAttributes.contains(attributeName.toLowerCase())) {
+		// stop only if attribute is managed by this archiver
+		dbProxy.updateModeRecord(attributeName);
+		HdbCollector hdbCollector = collectorFactory.get(attributeName);
+		if (hdbCollector != null) {
+		    hdbCollector.removeSource(attributeName);
 		}
-	    } 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.
-	    {
-		final String msg = "HdbArchiver/stop_archive_att/getAttribute_complete_name|"
-			+ attributeLightMode.getAttribute_complete_name()
-			+ "| The collector is missing. 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.";
-		logger.trace(ILogger.LEVEL_ERROR, msg);
-
-		/*
-		 * String message = "Attempt to get a missing collector!";
-		 * String reason =
-		 * "Missing collector for attribute: "+attributeLightMode
-		 * .getAttribute_complete_name(); String desc =
-		 * "Failed while executing HdbArchiver.stop_archive_att"; throw
-		 * new ArchivingException(message , reason , ErrSeverity.PANIC ,
-		 * desc , "");
-		 */
+		koAttributes.remove(attributeName.toLowerCase());
+		okAttributes.remove(attributeName.toLowerCase());
+	    } else {
+		DevFailedUtils.throwDevFailed(attributeName + " is not archived by this device");
 	    }
-	    archivingStatus.remove(attributeLightMode.getAttribute_complete_name());
 	} catch (final ArchivingException e) {
 	    logger.trace(ILogger.LEVEL_ERROR, e);
 	    e.printStackTrace();
 	    throw e.toTangoException();
 	} finally {
 	    computeLoads();
-	    if (wasDisable) {
-		TangoStateUtils.setDisable(this, archivingStatus);
-	    } else {
-		TangoStateUtils.setOn(this, archivingStatus);
-	    }
+	    TangoStateUtils.updateState(this, koAttributes, okAttributes);
 	    logger.trace(ILogger.LEVEL_INFO, "stop_archive_att - out");
 	}
-
     }
 
     // =========================================================
@@ -1793,7 +1799,7 @@ public class HdbArchiver extends DeviceImpl implements TangoConst {
 
 	// ---Add your Own code to control device here ---
 	final StringBuffer stringBuffer = new StringBuffer();
-	stringBuffer.append(TangoStateUtils.statusToString(archivingStatus));
+	stringBuffer.append(TangoStateUtils.statusToString(koAttributes, okAttributes));
 	stringBuffer.append(collectorFactory.factoryAssessment());
 
 	argout = stringBuffer.toString();
diff --git a/src/main/java/HdbArchiver/HdbArchiverClass.java b/src/main/java/HdbArchiver/HdbArchiverClass.java
index 9f0b4ddfb95be976673e7785ea69dd67bfed5517..04d32899aa5120bd11b18202cf55bb8e6d2e067b 100644
--- a/src/main/java/HdbArchiver/HdbArchiverClass.java
+++ b/src/main/java/HdbArchiver/HdbArchiverClass.java
@@ -77,304 +77,301 @@ import fr.esrf.TangoDs.Attr;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandOut;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Mode.ShortPeriodAttributesManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingException;
 
 public class HdbArchiverClass extends DeviceClass implements TangoConst {
 
-	/**
-	 * HdbArchiverClass class instance (it is a singleton).
-	 */
-	private static HdbArchiverClass _instance = null;
-
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = null;
-
-	// --------- Start of properties data members ----------
-
-	/**
-	 * Computer identifier on wich is settled the database HDB. The identifier
-	 * can be the computer name or its IP address. <br>
-	 * <b>Default value : </b> localhost
-	 */
-	String dbHost;
-	/**
-	 * Database name.<br>
-	 * <b>Default value : </b> hdb
-	 */
-	String dbName;
-	/**
-	 * true if the 'facility' information is appended to all device's (or
-	 * attributes) name. false otherwise.<br>
-	 * <b>Default value : </b> false
-	 */
-	boolean facility;
-
-	/**
-	 * 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
-	 */
-	boolean RacConnection;
-
-	// --------- End of properties data members ----------
-
-	// ===================================================================
-	//
-	// method : instance()
-	//
-	// description : static method to retrieve the HdbArchiverClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static HdbArchiverClass instance() {
-		if (_instance == null) {
-			System.err.println("HdbArchiverClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
-	}
-
-	// ===================================================================
-	//
-	// method : Init()
-	//
-	// description : static method to create/retrieve the HdbArchiverClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static synchronized HdbArchiverClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			try {
-				// First call to this method.
-				// It initializes the short period attributes map
-				ShortPeriodAttributesManager.getShortPeriodAttributes();
-			} catch (ArchivingException e) {
-				e.printStackTrace();
-				throw new DevFailed();
-			}
-			_instance = new HdbArchiverClass(class_name);
-		}
-		return _instance;
-	}
-
-	// ===================================================================
-	//
-	// method : HdbArchiverClass()
-	//
-	// description : constructor for the HdbArchiverClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected HdbArchiverClass(String name) throws DevFailed {
-		super(name);
-
-		Util.out2.println("Entering HdbArchiverClass constructor");
-		write_class_property();
-		get_class_property();
-
-		Util.out2.println("Leaving HdbArchiverClass constructor");
-	}
-
-	// ===================================================================
-	//
-	// method : command_factory()
-	//
-	// description : Create the command object(s) and store them in the
-	// command list
-	// ===================================================================
-	@Override
-	public void command_factory() {
-		command_list.addElement(new GetErrorDomainsInternal("GetErrorDomainsInternal", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
-				"The list of all domains that have at least one attribute not correctly archiving", DispLevel.OPERATOR));
-
-		command_list.addElement(new GetErrorsForDomainInternal("GetErrorsForDomainInternal", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The domain name",
-				"The list of all KO attributes for this domain", DispLevel.OPERATOR));
-
-		command_list.addElement(new GetErrorsForAttributeInternal("GetErrorsForAttributeInternal", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute name (NOT the complete name)",
-				"The list of all KO attributes sharing this name", DispLevel.OPERATOR));
-
-		command_list.addElement(new IsAttributeCorrectlyArchivedInternal("IsAttributeCorrectlyArchivedInternal", Tango_DEV_STRING, Tango_DEV_BOOLEAN, "The complete name of the attribute",
-				"True if this attribute is archiving correctly", DispLevel.OPERATOR));
-
-		command_list.addElement(new RetryForKOAttributes("RetryForKOAttributes", Tango_DEV_VOID, Tango_DEV_SHORT, "",
-				"A return code, can be either: 10 (the archiver isn't in charge of any attribute, or they are all correctly archiving) 20 (the retry succeeded) or 30 (the retry failed)",
-				DispLevel.OPERATOR));
-
-		command_list.addElement(new RetryForAll("RetryForAll", Tango_DEV_VOID, Tango_DEV_SHORT, "",
-				"A return code, can be either: 10 (the archiver isn't in charge of any attribute) 20 (the retry succeeded) or 30 (the retry failed)", DispLevel.OPERATOR));
-
-		command_list.addElement(new RetryForAttributesCmd("RetryForAttributes", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT, "The complete names of the attributes",
-				"A return code, can be either: 10 (the archiver isn't in charge of any of the specified attributes) 20 (the retry succeeded) or 30 (the retry failed)", DispLevel.OPERATOR));
-
-		command_list.addElement(new RetryForAttributeCmd("RetryForAttribute", Tango_DEV_STRING, Tango_DEV_SHORT, "The complete name of the attribute",
-				"A return code, can be either: 10 (the archiver isn't in charge of the specified attribute) 20 (the retry succeeded) or 30 (the retry failed)", DispLevel.OPERATOR));
-
-		command_list.addElement(new TriggerArchiveConfCmd("TriggerArchiveConf", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The group of attributes to archive", "", DispLevel.OPERATOR));
-		command_list.addElement(new TriggerArchiveAttCmd("TriggerArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The attribute to archive", "", DispLevel.OPERATOR));
-		command_list.addElement(new TriggerArchiveAttCheckCmd("TriggerArchiveAttCheck", Tango_DEV_STRING, Tango_DEV_VOID, "The name of the attribute to archive", "", DispLevel.OPERATOR));
-		command_list.addElement(new StopArchiveConfCmd("StopArchiveConf", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The group of attributes", "", DispLevel.OPERATOR));
-		command_list.addElement(new StopArchiveAttCmd("StopArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "the attribute on witch archiving must be stopped", "", DispLevel.OPERATOR));
-		command_list.addElement(new StateDetailedClass("StateDetailed", Tango_DEV_VOID, Tango_DEV_STRING, "", "The detailed state", DispLevel.EXPERT));
-
-		// add polling if any
-		/*
-		 * for (int i = 0; i < command_list.size(); i++) { // Command cmd = (
-		 * Command ) command_list.elementAt(i); }
-		 */
+    /**
+     * HdbArchiverClass class instance (it is a singleton).
+     */
+    private static HdbArchiverClass _instance = null;
+
+    /**
+     * Class properties array.
+     */
+    private final DbDatum[] cl_prop = null;
+
+    // --------- Start of properties data members ----------
+
+    /**
+     * Computer identifier on wich is settled the database HDB. The identifier
+     * can be the computer name or its IP address. <br>
+     * <b>Default value : </b> localhost
+     */
+    String dbHost;
+    /**
+     * Database name.<br>
+     * <b>Default value : </b> hdb
+     */
+    String dbName;
+    /**
+     * true if the 'facility' information is appended to all device's (or
+     * attributes) name. false otherwise.<br>
+     * <b>Default value : </b> false
+     */
+    boolean facility;
+
+    /**
+     * 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
+     */
+    boolean RacConnection;
+
+    // --------- End of properties data members ----------
+
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the HdbArchiverClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static HdbArchiverClass instance() {
+	if (_instance == null) {
+	    System.err.println("HdbArchiverClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
-
-	// ===================================================================
-	//
-	// method : device_factory()
-	//
-	// description : Create the device object(s) and store them in the
-	// device list
-	//
-	// argument : in : String[] devlist : The device name list
-	//
-	// ===================================================================
-	@Override
-	public void device_factory(String[] devlist) throws DevFailed {
-		String device_version = ResourceBundle.getBundle("application").getString("project.version");
-
-		for (int i = 0; i < devlist.length; i++) {
-			// Util.out4.println("Device name : " + devlist[ i ]);
-
-			// Create device and add it into the device list
-			// ----------------------------------------------
-
-			device_list.addElement(new HdbArchiver(this, devlist[i], device_version));
-
-			// Export device to the outside world
-			// ----------------------------------------------
-			if (Util._UseDb == true)
-				export_device(((DeviceImpl) (device_list.elementAt(i))));
-			else
-				export_device(((DeviceImpl) (device_list.elementAt(i))), devlist[i]);
-		}
-	}
-
-	// =============================================================================
-	//
-	// Method: attribute_factory(Vector att_list)
-	//
-	// =============================================================================
-	@Override
-	public void attribute_factory(Vector att_list) throws DevFailed {
-		// Attribute : scalar_charge
-		Attr scalar_charge = new Attr("scalar_charge", Tango_DEV_SHORT, AttrWriteType.READ);
-		att_list.addElement(scalar_charge);
-
-		// Attribute : spectrum_charge
-		Attr spectrum_charge = new Attr("spectrum_charge", Tango_DEV_SHORT, AttrWriteType.READ);
-		att_list.addElement(spectrum_charge);
-
-		// Attribute : image_charge
-		Attr image_charge = new Attr("image_charge", Tango_DEV_SHORT, AttrWriteType.READ);
-		att_list.addElement(image_charge);
-
-		// Attribute : version
-		Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
-		att_list.addElement(version);
-
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the HdbArchiverClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static synchronized HdbArchiverClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    try {
+		// First call to this method.
+		// It initializes the short period attributes map
+		ShortPeriodAttributesManager.getShortPeriodAttributes();
+	    } catch (ArchivingException e) {
+		e.printStackTrace();
+		throw new DevFailed();
+	    }
+	    _instance = new HdbArchiverClass(class_name);
 	}
-
-	// ===================================================================
-	/**
-	 * Get the class property for specified name.
-	 * 
-	 * @param name
-	 *            The property name.
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : HdbArchiverClass()
+    //
+    // description : constructor for the HdbArchiverClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected HdbArchiverClass(String name) throws DevFailed {
+	super(name);
+
+	Util.out2.println("Entering HdbArchiverClass constructor");
+	write_class_property();
+	get_class_property();
+
+	Util.out2.println("Leaving HdbArchiverClass constructor");
+    }
+
+    // ===================================================================
+    //
+    // method : command_factory()
+    //
+    // description : Create the command object(s) and store them in the
+    // command list
+    // ===================================================================
+    @Override
+    public void command_factory() {
+	command_list
+		.addElement(new GetErrorDomainsInternal("GetErrorDomainsInternal", Tango_DEV_VOID,
+			Tango_DEVVAR_STRINGARRAY, "",
+			"The list of all domains that have at least one attribute not correctly archiving",
+			DispLevel.OPERATOR));
+
+	command_list.addElement(new GetErrorsForDomainInternal("GetErrorsForDomainInternal", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The domain name", "The list of all KO attributes for this domain",
+		DispLevel.OPERATOR));
+
+	command_list.addElement(new GetErrorsForAttributeInternal("GetErrorsForAttributeInternal", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute name (NOT the complete name)",
+		"The list of all KO attributes sharing this name", DispLevel.OPERATOR));
+
+	command_list.addElement(new IsAttributeCorrectlyArchivedInternal("IsAttributeCorrectlyArchivedInternal",
+		Tango_DEV_STRING, Tango_DEV_BOOLEAN, "The complete name of the attribute",
+		"True if this attribute is archiving correctly", DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new RetryForKOAttributes(
+			"RetryForKOAttributes",
+			Tango_DEV_VOID,
+			Tango_DEV_SHORT,
+			"",
+			"A return code, can be either: 10 (the archiver isn't in charge of any attribute, or they are all correctly archiving) 20 (the retry succeeded) or 30 (the retry failed)",
+			DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new RetryForAll(
+			"RetryForAll",
+			Tango_DEV_VOID,
+			Tango_DEV_SHORT,
+			"",
+			"A return code, can be either: 10 (the archiver isn't in charge of any attribute) 20 (the retry succeeded) or 30 (the retry failed)",
+			DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new RetryForAttributesCmd(
+			"RetryForAttributes",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_SHORT,
+			"The complete names of the attributes",
+			"A return code, can be either: 10 (the archiver isn't in charge of any of the specified attributes) 20 (the retry succeeded) or 30 (the retry failed)",
+			DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new RetryForAttributeCmd(
+			"RetryForAttribute",
+			Tango_DEV_STRING,
+			Tango_DEV_SHORT,
+			"The complete name of the attribute",
+			"A return code, can be either: 10 (the archiver isn't in charge of the specified attribute) 20 (the retry succeeded) or 30 (the retry failed)",
+			DispLevel.OPERATOR));
+
+	command_list.addElement(new TriggerArchiveConfCmd("TriggerArchiveConf", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_VOID, "The group of attributes to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new TriggerArchiveAttCmd("TriggerArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"The attribute to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new TriggerArchiveAttCheckCmd("TriggerArchiveAttCheck", Tango_DEV_STRING,
+		Tango_DEV_VOID, "The name of the attribute to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new StopArchiveConfCmd("StopArchiveConf", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"The group of attributes", "", DispLevel.OPERATOR));
+	command_list.addElement(new StopArchiveAttCmd("StopArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"the attribute on witch archiving must be stopped", "", DispLevel.OPERATOR));
+	command_list.addElement(new StateDetailedClass("StateDetailed", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The detailed state", DispLevel.EXPERT));
+	command_list.addElement(new TemplCommandOut("GetKOAttributes", "getKOAttributes"));
+	// add polling if any
+	/*
+	 * for (int i = 0; i < command_list.size(); i++) { // Command cmd = (
+	 * Command ) command_list.elementAt(i); }
 	 */
-	// ===================================================================
-	public DbDatum get_class_property(String name) {
-		for (int i = 0; i < cl_prop.length; i++)
-			if (cl_prop[i].name.equals(name))
-				return cl_prop[i];
-		// if not found, return an empty DbDatum
-		return new DbDatum(name);
+    }
+
+    // ===================================================================
+    //
+    // method : device_factory()
+    //
+    // description : Create the device object(s) and store them in the
+    // device list
+    //
+    // argument : in : String[] devlist : The device name list
+    //
+    // ===================================================================
+    @Override
+    public void device_factory(String[] devlist) throws DevFailed {
+	String device_version = ResourceBundle.getBundle("application").getString("project.version");
+
+	for (int i = 0; i < devlist.length; i++) {
+	    // Util.out4.println("Device name : " + devlist[ i ]);
+
+	    // Create device and add it into the device list
+	    // ----------------------------------------------
+
+	    device_list.addElement(new HdbArchiver(this, devlist[i], device_version));
+
+	    // Export device to the outside world
+	    // ----------------------------------------------
+	    if (Util._UseDb == true) {
+		export_device(((DeviceImpl) device_list.elementAt(i)));
+	    } else {
+		export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
+	    }
+	}
+    }
+
+    // =============================================================================
+    //
+    // Method: attribute_factory(Vector att_list)
+    //
+    // =============================================================================
+    @Override
+    public void attribute_factory(Vector att_list) throws DevFailed {
+	// Attribute : scalar_charge
+	Attr scalar_charge = new Attr("scalar_charge", Tango_DEV_SHORT, AttrWriteType.READ);
+	att_list.addElement(scalar_charge);
+
+	// Attribute : spectrum_charge
+	Attr spectrum_charge = new Attr("spectrum_charge", Tango_DEV_SHORT, AttrWriteType.READ);
+	att_list.addElement(spectrum_charge);
+
+	// Attribute : image_charge
+	Attr image_charge = new Attr("image_charge", Tango_DEV_SHORT, AttrWriteType.READ);
+	att_list.addElement(image_charge);
+
+	// Attribute : version
+	Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
+	att_list.addElement(version);
+
+    }
+
+    // ===================================================================
+    /**
+     * Get the class property for specified name.
+     * 
+     * @param name
+     *            The property name.
+     * @throws DevFailed
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) throws DevFailed {
+	DbDatum[] classProps = get_db_class().get_property(new String[] { name });
+	return classProps[0];
+    }
+
+    // ===================================================================
+    /**
+     * Read the class properties from database.
+     */
+    // ===================================================================
+    public void get_class_property() throws DevFailed {
+
+    }
+
+    // ===================================================================
+    /**
+     * Set class description as property in database
+     */
+    // ===================================================================
+    private void write_class_property() throws DevFailed {
+	// First time, check if database used
+	// --------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
 	}
 
-	// ===================================================================
-	/**
-	 * Read the class properties from database.
-	 */
-	// ===================================================================
-	public void get_class_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
-
-		// Read class properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = { "DbHost", "DbName", "Facility", "RacConnection" };
-
-		// Call database and extract values
-		// --------------------------------------------
-		cl_prop = get_db_class().get_property(propnames);
-		int i = -1;
-		// Extract DbHost value
-		if (cl_prop[++i].is_empty() == false)
-			dbHost = cl_prop[i].extractString();
-		else
-			cl_prop[i].insert(dbHost);
-
-		// Extract DbName value
-		if (cl_prop[++i].is_empty() == false)
-			dbName = cl_prop[i].extractString();
-		else
-			cl_prop[i].insert(dbName);
-
-		// Extract Facility value
-		if (cl_prop[++i].is_empty() == false)
-			facility = cl_prop[i].extractBoolean();
-		else
-			cl_prop[i].insert(facility);
-
-		// Extract RacConnection value
-		if (cl_prop[++i].is_empty() == false)
-			RacConnection = cl_prop[i].extractBoolean();
-		else
-			cl_prop[i].insert(RacConnection);
-
-		// End of Automatic code generation
-		// -------------------------------------------------------------
+	// Prepeare DbDatum
+	// --------------------------------------------
+	DbDatum[] data = new DbDatum[2];
+	data[0] = new DbDatum("ProjectTitle");
+	data[0].insert("Tango Device Server");
 
-	}
+	data[1] = new DbDatum("Description");
+	data[1].insert("Device of Archiving system");
 
-	// ===================================================================
-	/**
-	 * Set class description as property in database
-	 */
-	// ===================================================================
-	private void write_class_property() throws DevFailed {
-		// First time, check if database used
-		// --------------------------------------------
-		if (Util._UseDb == false)
-			return;
-
-		// Prepeare DbDatum
-		// --------------------------------------------
-		DbDatum[] data = new DbDatum[2];
-		data[0] = new DbDatum("ProjectTitle");
-		data[0].insert("Tango Device Server");
-
-		data[1] = new DbDatum("Description");
-		data[1].insert("Device of Archiving system");
-
-		// Call database and and values
-		// --------------------------------------------
-		get_db_class().put_property(data);
-	}
+	// Call database and and values
+	// --------------------------------------------
+	get_db_class().put_property(data);
+    }
 
 }
diff --git a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java
index bae74a001ad85966a2d4b81dc46a1d93283b7067..4ede8907802364e11fefb02e64133d0afe57242e 100644
--- a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java
+++ b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcher.java
@@ -1,5 +1,7 @@
 package HdbArchivingWatcher;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -15,27 +17,29 @@ import fr.esrf.Tango.DevError;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
 import fr.esrf.Tango.ErrSeverity;
+import fr.esrf.TangoApi.ApiUtil;
 import fr.esrf.TangoApi.DbDatum;
+import fr.esrf.TangoApi.DeviceData;
+import fr.esrf.TangoApi.DeviceProxy;
+import fr.esrf.TangoApi.Group.Group;
+import fr.esrf.TangoApi.Group.GroupCmdReply;
+import fr.esrf.TangoApi.Group.GroupCmdReplyList;
 import fr.esrf.TangoDs.Attribute;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.Except;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
-import fr.soleil.commonarchivingapi.ArchivingTools.Diary.LoggerFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.ConfigConst;
+import fr.soleil.hdbtdbArchivingApi.ArchivingManagerApi.HdbArchivingManagerApiRef;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Mode.Mode;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingException;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.ArchivingWatch;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Archiver;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ArchivingAttribute;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ArchivingAttributeSubName;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ControlResult;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ControlResultLine;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Domain;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ModeData;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchiversComparator;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchivingAttributeComparator;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.DomainsComparator;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManagerFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.control.safetyperiod.SaferPeriodCalculatorFactory;
@@ -95,13 +99,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 
     // Add your own data members here
     private ControlResult controlResult;
-    private final int readType = IDelayManager.READ_ROLLOVER;
-
-    // private ControlResultLineComparator linesComparator;
-    private ArchiversComparator archiversComparator;
-    private DomainsComparator domainsComparator;
-    // private ArchivingAttributeSubNamesComparator
-    // archivingAttributeSubNamesComparator;
     private ArchivingAttributeComparator archivingAttributeComparator;
 
     // --------------------------------------
@@ -160,27 +157,8 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	// Initialise variables to default values
 	super.initArchivingDataWatch();
 
-	LifeCycleManagerFactory.setWatcherToWarn(this);
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
-		.getImpl(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
-	final Thread watcherThread = lifeCycleManager.getAsThread();
-
-	startLoggingFactory();
-
-	// this.linesComparator = new ControlResultLineComparator ();
-	archiversComparator = new ArchiversComparator();
-	domainsComparator = new DomainsComparator();
-	// this.archivingAttributeSubNamesComparator = new
-	// ArchivingAttributeSubNamesComparator ();
+	initLifeCycleManager(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
 	archivingAttributeComparator = new ArchivingAttributeComparator();
-
-	watcherThread.start();
-
-	super.initLatestFaultData();
-
-	if (!ArchivingWatch.isDoStartOnInitDevice()) {
-	    warnOff();
-	}
     }
 
     // =========================================================
@@ -194,6 +172,34 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
     }
 
     // ===================================================================
+    /**
+     * ask all archivers for their KO attributes
+     * 
+     * @return
+     * @throws DevFailed
+     */
+    public String[] getKOAttributesFromArchivers(boolean doRetry) throws DevFailed {
+	List<String> archiversStatus = new ArrayList<String>();
+	String[] archiverNames = ApiUtil.get_db_obj().get_device_exported_for_class(
+		HdbArchivingManagerApiRef.classDevice);
+	Group group = new Group("archivers");
+	group.add(archiverNames);
+	GroupCmdReplyList replies = group.command_inout("GetKOAttributes", true);
+	for (Object reply : replies) {
+	    GroupCmdReply r = (GroupCmdReply) reply;
+	    try {
+		DeviceData result = r.get_data();
+		String archiverStatus = r.dev_name() + " " + Arrays.toString(result.extractStringArray());
+		archiversStatus.add(archiverStatus);
+		if (doRetry) {
+		    new DeviceProxy(r.dev_name()).command_inout_asynch("RetryForAttribute", result, true);
+		}
+	    } catch (DevFailed e) {
+		archiversStatus.add(r.dev_name() + " ERROR");
+	    }
+	}
+	return archiversStatus.toArray(new String[archiversStatus.size()]);
+    }
 
     // ===================================================================
     /**
@@ -207,12 +213,8 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      */
     // ===================================================================
     @Override
-    public void read_attr_hardware(final Vector attr_list) throws DevFailed {
-	final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl();
-	controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER);
-	if (controlResult == null) {
-	    Except.throw_exception("DEVICE_ ERROR", "cannot get archiving status", "read_attr_hardware");
-	}
+    public void read_attr_hardware(@SuppressWarnings("rawtypes") final Vector attr_list) throws DevFailed {
+	controlResult = updateControlResult();
     }
 
     // ===================================================================
@@ -304,8 +306,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering start()");
 
 	// ---Add your Own code to control device here ---
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	lifeCycleManager.startProcessing();
+	getLifeCycleManager().startProcessing();
 	// ---END
 
 	get_logger().info("Exiting start()");
@@ -379,8 +380,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering stop()");
 
 	// ---Add your Own code to control device here ---
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	lifeCycleManager.stopProcessing();
+	getLifeCycleManager().stopProcessing();
 	// this.warnOff ();
 	// ---END
 
@@ -404,96 +404,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	return get_error_archivers(_controlResult);
     }
 
-    /**
-     * @param result
-     * @return
-     */
-    private String[] get_error_archivers(final ControlResult _controlResult) {
-	final String[] empty = new String[0];
-	if (_controlResult == null) {
-	    return empty;
-	}
-
-	final Map _errorArchivers = _controlResult.getErrorArchivers();
-	final String[] argout = new String[_errorArchivers.size()];
-
-	final List list = new Vector();
-	list.addAll(_errorArchivers.values());
-	Collections.sort(list, archiversComparator);
-	final Iterator it = list.iterator();
-
-	int i = 0;
-	while (it.hasNext()) {
-	    final Archiver key = (Archiver) it.next();
-	    argout[i] = key.getName();
-	    i++;
-	}
-
-	return argout;
-    }
-
-    // =========================================================
-    /**
-     * Execute command "GetErrorsForArchiver" on device. Lists KO attributes for
-     * this archiver
-     * 
-     * @param argin
-     *            The name of the archiver
-     * @return The list of KO attributes for this archiver
-     */
-    // =========================================================
-    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;
-	}
-
-	final Map<String, Archiver> _errorArchivers = _controlResult.getErrorArchivers();
-	if (_errorArchivers == null) {
-	    return empty;
-	}
-
-	final Archiver archiver = _errorArchivers.get(argin);
-	if (archiver == null) {
-	    return empty;
-	}
-
-	final Hashtable _errorAttributes = archiver.getKOAttributes();
-	if (_errorAttributes == null) {
-	    return empty;
-	}
-
-	final String[] argout = new String[_errorAttributes.size()];
-	final List list = new Vector();
-	list.addAll(_errorAttributes.values());
-	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
-	int i = 0;
-
-	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
-	    argout[i] = key.getCompleteName();
-	    i++;
-	}
-	// -----------------END
-	return argout;
-    }
-
-    // =========================================================
-    /**
-     * Execute command "Reset" on device. Notifies the device that the last
-     * alarm (should it exist) was taken into account by the user.
-     * 
-     */
-    // =========================================================
-    // public synchronized void reset() throws DevFailed
-    // {
-    // get_logger().info("Entering reset()");
-    // // ---Add your Own code to control device here ---
-    // this.goBackToFormerState ();
-    // get_logger().info("Exiting reset()");
-    // }
-
     // =========================================================
     /**
      * Execute command "Reset" on device. This is used after a KO control cycle
@@ -509,14 +419,16 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	    // do nothing
 	    return;
 	}
-
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	final boolean isProcessing = lifeCycleManager.isProcessing();
-	if (isProcessing) {
-	    this.set_state((short) DevState._ON);
-	} else {
-	    this.set_state((short) DevState._OFF);
-	}
+	// lifeCycleManager =
+	// LifeCycleManagerFactory.getImpl(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
+	initLifeCycleManager(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
+	// lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
+	// final boolean isProcessing = lifeCycleManager.isProcessing();
+	// if (isProcessing) {
+	// this.set_state(DevState.ON);
+	// } else {
+	// this.set_state(DevState.OFF);
+	// }
 
 	get_logger().info("Exiting reset()");
     }
@@ -530,8 +442,7 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering restart()");
 
 	// complete stop
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
-		.getImpl(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
+	LifeCycleManager lifeCycleManager = getLifeCycleManager();
 	lifeCycleManager.stopProcessing();
 
 	final Thread watcherThread = lifeCycleManager.getAsThread();
@@ -545,40 +456,9 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	// restarting
 	init_device();
 
-	final boolean isProcessing = lifeCycleManager.isProcessing();
-	if (isProcessing) {
-	    this.set_state((short) DevState._ON);
-	} else {
-	    this.set_state((short) DevState._OFF);
-	}
-
 	get_logger().info("Exiting restart()");
     }
 
-    private String[] get_error_domains(final ControlResult _controlResult) throws DevFailed {
-	final String[] empty = new String[0];
-	if (_controlResult == null) {
-	    return empty;
-	}
-
-	final Map<String, Domain> _errorDomains = _controlResult.getErrorDomains();
-	final String[] argout = new String[_errorDomains.size()];
-
-	final List list = new Vector();
-	list.addAll(_errorDomains.values());
-	Collections.sort(list, domainsComparator);
-	final Iterator it = list.iterator();
-
-	int i = 0;
-	while (it.hasNext()) {
-	    final Domain key = (Domain) it.next();
-	    argout[i] = key.getName();
-	    i++;
-	}
-
-	return argout;
-    }
-
     // =========================================================
     /**
      * Execute command "GetErrorsForDomain" on device. Lists KO attributes for
@@ -605,21 +485,21 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	    return empty;
 	}
 
-	final Hashtable _errorAttributes = domain.getKOAttributes();
+	final Hashtable<String, ArchivingAttribute> _errorAttributes = domain.getKOAttributes();
 	if (_errorAttributes == null) {
 	    return empty;
 	}
 
 	final String[] argout = new String[_errorAttributes.size()];
 
-	final List list = new Vector();
+	final List<ArchivingAttribute> list = new Vector<ArchivingAttribute>();
 	list.addAll(_errorAttributes.values());
 	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
+	final Iterator<ArchivingAttribute> it = list.iterator();
 
 	int i = 0;
 	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
+	    final ArchivingAttribute key = it.next();
 	    argout[i] = key.getCompleteName();
 	    i++;
 	}
@@ -627,31 +507,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	return argout;
     }
 
-    // =========================================================
-    /**
-     * Execute command "SetMode" on device. Choose a mode. Must be one of those
-     * predefined modes: READ_LATEST_COMPLETE_CYCLE = 10
-     * READ_LATEST_COMPLETE_CYCLE_AUTO = 11 READ_LATEST_COMPLETE_STEP = 20
-     * READ_LATEST_ADDITION = 30 READ_LATEST_BAD_CYCLE = 40
-     * 
-     * @param argin
-     *            The mode
-     */
-    // =========================================================
-    /*
-     * public synchronized void set_mode(short argin) throws DevFailed {
-     * get_logger().info("Entering set_mode()");
-     * 
-     * // ---Add your Own code to control device here --- IDelayManager
-     * delayManager = DelayManagerFactory.getCurrentImpl (); try {
-     * delayManager.setReadType ( argin ); this.readType = argin; } catch (
-     * IllegalArgumentException iae ) { DevFailed devFailed = new DevFailed ();
-     * devFailed.initCause ( iae ); throw iae; }
-     * //------------------------------------------------
-     * 
-     * get_logger().info("Exiting set_mode()"); }
-     */
-
     // =========================================================
     /**
      * Execute command "GetErrorsForAttribute" on device. Returns the list of KO
@@ -678,21 +533,21 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	    return empty;
 	}
 
-	final Hashtable _errorAttributes = attributeSubName.getKOAttributes();
+	final Hashtable<String, ArchivingAttribute> _errorAttributes = attributeSubName.getKOAttributes();
 	if (_errorAttributes == null) {
 	    return empty;
 	}
 
 	final String[] argout = new String[_errorAttributes.size()];
 
-	final List list = new Vector();
+	final List<ArchivingAttribute> list = new Vector<ArchivingAttribute>();
 	list.addAll(_errorAttributes.values());
 	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
+	final Iterator<ArchivingAttribute> it = list.iterator();
 
 	int i = 0;
 	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
+	    final ArchivingAttribute key = it.next();
 	    argout[i] = key.getCompleteName();
 	    i++;
 	}
@@ -712,9 +567,6 @@ 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);
-	// ControlResult _controlResult = delayManager.getControlResult (
-	// IDelayManager.READ_ROLLOVER );
-
 	return get_report(_controlResult);
     }
 
@@ -986,8 +838,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher Archiving Report
      */
     public void start_archiving_report() throws DevFailed {
-	// 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 ");
@@ -995,7 +845,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	    }
 	    dbReader.startArchivingReport();
 	} catch (final DevFailed e) {
-	    // TODO Auto-generated catch block
 	    e.printStackTrace();
 	}
     }
@@ -1005,8 +854,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher database Report
      */
     public String[] get_database_report() throws DevFailed {
-	// 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 ");
@@ -1024,7 +871,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher attributes count
      */
     public int get_current_archiving_attributes_count() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    return dbReader.getDatabase().getMode().getCurrentArchivedAttCount();
@@ -1040,7 +886,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher KO attributes count
      */
     public int get_ko_attributes_count() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1059,7 +904,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher OK attributes count
      */
     public int get_ok_attributes_count() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1078,7 +922,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher list of ko attributes
      */
     public String[] get_ko_attributes() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1099,7 +942,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher list of oracle databse partitions
      */
     public String[] get_partitions() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1120,7 +962,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher list of job status
      */
     public String[] get_job_status() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1146,7 +987,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return Watcher list of oracle databse partitions
      */
     public String[] get_job_errors() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1173,7 +1013,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return
      */
     public int get_feedalive_progression_level() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1195,7 +1034,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
      * @return
      */
     public String[] get_ko_attributes_count_by_device() throws DevFailed {
-	// TODO Auto-generated method stub
 
 	try {
 	    if (dbReader.getDatabase().getType() == ConfigConst.HDB_MYSQL) {
@@ -1244,18 +1082,6 @@ public class HdbArchivingWatcher extends AbsArchivingWatcher {
 	System.exit(-1);
     }
 
-    private void startLoggingFactory() {
-	// System.out.println (
-	// "CLA/startLoggingFactory/this.device_name/"+this.device_name+"/hashCode/"+this.hashCode
-	// ()+"/this.hasDiary/"+this.hasDiary );
-
-	final ILogger _logger = LoggerFactory.getImpl(device_name, ArchivingWatch.getDiaryPath(),
-		ArchivingWatch.isHasDiary());
-	_logger.setTraceLevel(ArchivingWatch.getDiaryLogLevel());
-
-	logger = _logger;
-    }
-
     @Override
     public void delete_device() throws DevFailed {
 	// TODO Auto-generated method stub
diff --git a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcherClass.java b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcherClass.java
index 21d2cbcd445794a9991d252e19d835675e105a86..d0ab11ff06a2cf64230784db3deae131f9188348 100644
--- a/src/main/java/HdbArchivingWatcher/HdbArchivingWatcherClass.java
+++ b/src/main/java/HdbArchivingWatcher/HdbArchivingWatcherClass.java
@@ -95,6 +95,7 @@ import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.SpectrumAttr;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandInOut;
 import fr.esrf.TangoDs.UserDefaultAttrProp;
 import fr.esrf.TangoDs.Util;
 
@@ -265,6 +266,8 @@ public class HdbArchivingWatcherClass extends DeviceClass implements TangoConst
 	command_list.addElement(new GetFeedAliveProgressionClass("GetFeedAliveProgression", Tango_DEV_VOID,
 		Tango_DEV_LONG, "", "Percentage of the feedalive execution ", DispLevel.OPERATOR));
 
+	command_list.addElement(new TemplCommandInOut("GetKOAttributesFromArchivers", "getKOAttributesFromArchivers",
+		"do a retry", "the list of ko per archiver"));
 	// add polling if any
 	/*
 	 * for (int i = 0; i < command_list.size(); i++) { Command cmd =
diff --git a/src/main/java/HdbExtractor/ExtractBetweenDatesClass.java b/src/main/java/HdbExtractor/ExtractBetweenDatesClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..ef1d1547f3049de33ec7fd8e13a24fb757d36b9f
--- /dev/null
+++ b/src/main/java/HdbExtractor/ExtractBetweenDatesClass.java
@@ -0,0 +1,155 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/archiving/HdbExtractor/ExtractBetweenDatesClass.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               HdbExtractor class.
+//
+// $Author: chinkumo $
+//
+// $Revision: 1.3 $
+//
+// $Log: ExtractBetweenDatesClass.java,v $
+// Revision 1.3  2005/11/29 16:17:37  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.2  2005/11/15 13:45:51  chinkumo
+// ...
+//
+// Revision 1.1  2005/09/09 10:03:21  chinkumo
+// First commit !
+// (Dynamic attribut release)
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author: chinkumo $
+ * @version	$Revision: 1.3 $
+ */
+package HdbExtractor;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: Retrieves data beetwen two dates, for a given scalar
+ * attribute. Create a dynamic attribute, retrieve data from database and
+ * prepare result for attribute_history call.
+ */
+
+public class ExtractBetweenDatesClass extends Command implements TangoConst {
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param out
+     *            argout type
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out) {
+	super(name, in, out);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out, final String in_comments,
+	    final String out_comments) {
+	super(name, in, out, in_comments, out_comments);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     * @param level
+     *            The command display type OPERATOR or EXPERT
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out, final String in_comments,
+	    final String out_comments, final DispLevel level) {
+	super(name, in, out, in_comments, out_comments, level);
+    }
+
+    // ===============================================================
+    /**
+     * return the result of the device's command.
+     */
+    // ===============================================================
+    @Override
+    public Any execute(final DeviceImpl device, final Any in_any) throws DevFailed {
+	Util.out2.println("ExtractBetweenDatesClass.execute(): arrived");
+	final String[] argin = extract_DevVarStringArray(in_any);
+
+	if (!(device instanceof HdbExtractor)) {
+	    Except.throw_exception("DEVICE_ERROR", "Device parameter is not instance of HdbExtractor", "HdbExtractor");
+	}
+
+	return insert(((HdbExtractor) device).extractBetweenDates(argin));
+    }
+
+    // ===============================================================
+    /**
+     * Check if it is allowed to execute the command.
+     */
+    // ===============================================================
+    @Override
+    public boolean is_allowed(final DeviceImpl device, final Any data_in) {
+	// End of Generated Code
+
+	// Re-Start of Generated Code
+	return true;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:/cvsroot/tango-cs/tango/jserver/archiving/HdbExtractor/
+ * ExtractBetweenDatesClass.java,v $
+ */
diff --git a/src/main/java/HdbExtractor/HdbExtractor.java b/src/main/java/HdbExtractor/HdbExtractor.java
index 628594782ecdb8ea08ef208e78a5f5da6f51fb65..af836ce80fbd96434973237bf9b102393402a7c5 100644
--- a/src/main/java/HdbExtractor/HdbExtractor.java
+++ b/src/main/java/HdbExtractor/HdbExtractor.java
@@ -134,12 +134,14 @@ import java.util.StringTokenizer;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 import HdbExtractor.Proxy.DbProxy;
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
+import fr.esrf.Tango.DevVarDoubleStringArray;
 import fr.esrf.Tango.DevVarLongStringArray;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoApi.DbDatum;
@@ -153,6 +155,7 @@ import fr.esrf.TangoDs.SpectrumAttr;
 import fr.esrf.TangoDs.TangoConst;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Tools.DbData;
+import fr.soleil.commonarchivingapi.ArchivingTools.Tools.NullableTimedData;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.ConfigConst;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.DataBaseManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.DataBaseUtils.DbUtils;
@@ -1229,7 +1232,7 @@ public class HdbExtractor extends DeviceImpl
      */
     // =========================================================
     public double get_att_data_avg(final String argin) throws DevFailed {
-	double argout = 0;
+	double argout;
 
 	get_logger().info("Entering get_att_data_avg()");
 
@@ -1243,6 +1246,69 @@ public class HdbExtractor extends DeviceImpl
 	return argout;
     }
 
+    /**
+     * Get the newest inserted value for an attribute. Returns READ part only
+     * 
+     * @param attributeName
+     *            the attribute name
+     * @return timestamp; values
+     * @throws DevFailed
+     */
+    public String getNewestValue(final String attributeName) throws DevFailed {
+	String argout = "";
+	get_logger().info("Entering getNewestValue");
+	try {
+	    DbData data = dbProxy.getDataBase().getExtractor().getDataGetters().getNewestValue(attributeName);
+	    if (data.getData_timed() != null && data.getData_timed()[0] != null) {
+		argout = Long.toString(data.getData_timed()[0].time) + "; ";
+		Object value = data.getData_timed()[0].value[0];
+		argout = argout + value.toString();
+	    } else {
+		DevFailedUtils.throwDevFailed("no data found for " + attributeName);
+	    }
+	} catch (final ArchivingException e) {
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting getNewestValue");
+	return argout;
+    }
+
+    /**
+     * Get the nearest value and timestamp of an attribute for a given
+     * timestamp. Returns READ part only
+     * 
+     * @param argin
+     *            [attributeName, timestamp]. timestamp format is DD-MM-YYYY
+     *            HH24:MI:SS
+     * @return timestamp; values
+     * @throws DevFailed
+     */
+    public String getNearestValue(final String[] argin) throws DevFailed {
+	String argout = "";
+	get_logger().info("Entering getNewestValue");
+	if (argin.length != 2) {
+	    DevFailedUtils.throwDevFailed("input must be of size 2 [attributeName, timestamp] ");
+	}
+	String attributeName = argin[0];
+	String timestamp = argin[1];
+	try {
+	    DbData data2 = dbProxy.getDataBase().getExtractor().getDataGetters()
+		    .getNearestValue(attributeName, timestamp);
+	    if (data2.getData_timed() != null && data2.getData_timed()[0] != null) {
+		argout = Long.toString(data2.getData_timed()[0].time) + "; ";
+		Object value = data2.getData_timed()[0].value[0];
+		argout = argout + value.toString();
+	    } else {
+		DevFailedUtils.throwDevFailed("no data found for " + attributeName);
+	    }
+	} catch (final ArchivingException e) {
+	    e.printStackTrace();
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting getNewestValue");
+	return argout;
+    }
+
     // =========================================================
     /**
      * Execute command "GetAttDataAvgBetweenDates" on device. Returns the
@@ -1320,6 +1386,48 @@ public class HdbExtractor extends DeviceImpl
 	return argout;
     }
 
+    /**
+     * Extract an attribute's data for HDB
+     * 
+     * @param argin
+     *            The attribute's name, the beginning date (DD-MM-YYYY
+     *            HH24:MI:SS) and the ending date (DD-MM-YYYY HH24:MI:SS)
+     * @return Long: the timestamps , String: values (read values only
+     * @throws DevFailed
+     */
+    public DevVarDoubleStringArray extractBetweenDates(final String[] argin) throws DevFailed {
+	DevVarDoubleStringArray argout = null;
+
+	get_logger().info("Entering get_att_data_between_dates()");
+
+	// ---Add your Own code to control device here ---
+	if (argin.length != 3) {
+	    Except.throw_exception("CONFIGURATION_ERROR", "Wrong number of parameters",
+		    "HdbExtractor.get_att_scalar_data_beetween_dates");
+	} else {
+	    try {
+		// Get data from db.
+		final DbData dbData = dbProxy.getDataBase().getExtractor().getDataGettersBetweenDates()
+			.getAttDataBetweenDates(argin, SamplingType.getSamplingType(SamplingType.ALL));
+		NullableTimedData[] tuples = dbData.getData_timed();
+		double[] timeStamps = new double[tuples.length];
+		String[] values = new String[tuples.length];
+		for (int i = 0; i < tuples.length; i++) {
+		    timeStamps[i] = tuples[i].time;
+		    values[i] = tuples[i].value[0].toString();
+		}
+		argout = new DevVarDoubleStringArray(timeStamps, values);
+	    } catch (final ArchivingException e) {
+
+		e.printStackTrace();
+		throw e.toTangoException();
+	    }
+	}
+	get_logger().info("Exiting get_att_data_between_dates()");
+
+	return argout;
+    }
+
     // =========================================================
     /**
      * Execute command "GetAttDataBetweenDates" on device. Retrieves data
@@ -1797,7 +1905,6 @@ public class HdbExtractor extends DeviceImpl
 	double argout = 0;
 
 	get_logger().info("Entering get_att_data_min()");
-
 	// ---Add your Own code to control device here ---
 	try {
 	    argout = dbProxy.getDataBase().getExtractor().getMinMaxAvgGetters().getAttDataMin(argin);
diff --git a/src/main/java/HdbExtractor/HdbExtractorClass.java b/src/main/java/HdbExtractor/HdbExtractorClass.java
index 279dcce230526f883a49fbfd4ac4894fd0edfe5d..54fe26ebd3e67fb25b89a0c929d319080b1740b6 100644
--- a/src/main/java/HdbExtractor/HdbExtractorClass.java
+++ b/src/main/java/HdbExtractor/HdbExtractorClass.java
@@ -78,324 +78,464 @@ import fr.esrf.TangoDs.Attr;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandInOut;
 import fr.esrf.TangoDs.Util;
 
 public class HdbExtractorClass extends DeviceClass implements TangoConst {
-	/**
-	 * HdbExtractorClass class instance (it is a singleton).
-	 */
-	private static HdbExtractorClass _instance = null;
+    /**
+     * HdbExtractorClass class instance (it is a singleton).
+     */
+    private static HdbExtractorClass _instance = null;
 
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = null;
+    /**
+     * Class properties array.
+     */
+    private DbDatum[] cl_prop = null;
 
-	// --------- Start of properties data members ----------
+    // --------- Start of properties data members ----------
 
-	// --------- End of properties data members ----------
+    // --------- End of properties data members ----------
 
-	// ===================================================================
-	//
-	// method : instance()
-	//
-	// description : static method to retrieve the HdbExtractorClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static synchronized HdbExtractorClass instance() {
-		if (_instance == null) {
-			System.err.println("HdbExtractorClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the HdbExtractorClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static synchronized HdbExtractorClass instance() {
+	if (_instance == null) {
+	    System.err.println("HdbExtractorClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : Init()
-	//
-	// description : static method to create/retrieve the HdbExtractorClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static HdbExtractorClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			_instance = new HdbExtractorClass(class_name);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the HdbExtractorClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static HdbExtractorClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    _instance = new HdbExtractorClass(class_name);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : HdbExtractorClass()
-	//
-	// description : constructor for the HdbExtractorClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected HdbExtractorClass(String name) throws DevFailed {
-		super(name);
+    // ===================================================================
+    //
+    // method : HdbExtractorClass()
+    //
+    // description : constructor for the HdbExtractorClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected HdbExtractorClass(String name) throws DevFailed {
+	super(name);
 
-		Util.out2.println("Entering HdbExtractorClass constructor");
-		write_class_property();
-		get_class_property();
+	Util.out2.println("Entering HdbExtractorClass constructor");
+	write_class_property();
+	get_class_property();
 
-		Util.out2.println("Leaving HdbExtractorClass constructor");
-	}
+	Util.out2.println("Leaving HdbExtractorClass constructor");
+    }
 
-	// ===================================================================
-	//
-	// method : command_factory()
-	//
-	// description : Create the command object(s) and store them in the
-	// command list
-	// ===================================================================
-	@Override
-	public void command_factory() {
-		command_list.addElement(new GetMinTimeClass("GetMinTime", Tango_DEV_STRING, Tango_DEV_STRING, "The attribute to search", "The earliest value's timestamp", DispLevel.OPERATOR));
-		command_list.addElement(new GetMaxTimeClass("GetMaxTime", Tango_DEV_STRING, Tango_DEV_STRING, "The attribute to search", "The latest value's timestamp", DispLevel.OPERATOR));
-		command_list.addElement(new GetInfoClass("GetInfo", Tango_DEV_VOID, Tango_DEV_STRING, "", "The informations that characterize the database", DispLevel.OPERATOR));
-		command_list.addElement(new GetHostClass("GetHost", Tango_DEV_VOID, Tango_DEV_STRING, "", "The connected database host identifier.", DispLevel.OPERATOR));
-		command_list.addElement(new GetUserClass("GetUser", Tango_DEV_VOID, Tango_DEV_STRING, "", "The current user's name used for the connection.", DispLevel.OPERATOR));
-		command_list.addElement(new GetConnectionStateClass("GetConnectionState", Tango_DEV_VOID, Tango_DEV_BOOLEAN, "", "The connection state", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDefinitionDataClass("GetAttDefinitionData", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"Differents definition informations for the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttPropertiesDataClass("GetAttPropertiesData", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"An array containing the differents properties for the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttIdClass("GetAttId", Tango_DEV_STRING, Tango_DEV_SHORT, "The attribute's name", "The HDB's ID that characterize the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameAllClass("GetAttNameAll", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The whole list of the attributes registered in HDB", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameFacilityClass("GetAttNameFacility", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
-				"The whole list of the attributes registered in HDB, and that belong to the current facility.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameFilterFormatClass("GetAttNameFilterFormat", Tango_DEV_SHORT, Tango_DEVVAR_STRINGARRAY, "A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
-				"The filtered list of attributes registered in HDB.  The filtering is made according to the given format [0 -> scalar - 1 -> spectrum - 2 -> image]", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttNameFilterTypeClass(
-						"GetAttNameFilterType",
-						Tango_DEV_SHORT,
-						Tango_DEVVAR_STRINGARRAY,
-						"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						"The filtered list of attributes registered in HDB.  The filtering is made according to the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						DispLevel.OPERATOR));
-		command_list.addElement(new GetAttCountAllClass("GetAttCountAll", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The total number of attributes defined in HDB", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttCountFilterFormatClass("GetAttCountFilterFormat", Tango_DEV_SHORT, Tango_DEV_SHORT, "A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
-				"The total number of attributes defined in HDB with the given format [0 -> scalar - 1 -> spectrum - 2 -> image]", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttCountFilterTypeClass("GetAttCountFilterType", Tango_DEV_SHORT, Tango_DEV_SHORT,
-						"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						"The total number of attributes defined in HDB with the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						DispLevel.OPERATOR));
-		command_list.addElement(new GetDomainsClass("GetDomains", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered domains", DispLevel.OPERATOR));
-		command_list.addElement(new GetDomainsCountClass("GetDomainsCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct registered domains.", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesClass("GetFamilies", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered families", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesCountClass("GetFamiliesCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct registered families.", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesByDomainClass("GetFamiliesByDomain", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The given domain", "The registered families for the given domain",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesByDomainCountClass("GetFamiliesByDomainCount", Tango_DEV_STRING, Tango_DEV_SHORT, "A domain name",
-				"The number of distinct registered families for a given domain.", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersClass("GetMembers", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered members", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersCountClass("GetMembersCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct members.", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersByDomainFamilyClass("GetMembersByDomainFamily", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_STRINGARRAY, "The given domain and family",
-				"The registered members for the given domain and family", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersByDomainFamilyCountClass("GetMembersByDomainFamilyCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT, "A domain name, a family name",
-				"The number of distinct registered members for the given domain and family.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttributesByDomainFamilyMembersCountClass("GetAttributesByDomainFamilyMembersCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT,
-				"A domain name, a family name, a member name.", "The number of registered the attributes for a given  domain, family, member.", DispLevel.OPERATOR));
-		command_list.addElement(new GetCurrentArchivedAttClass("GetCurrentArchivedAtt", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The list of attributes that are being archived",
-				DispLevel.OPERATOR));
-		command_list.addElement(new IsArchivedClass("IsArchived", Tango_DEV_STRING, Tango_DEV_BOOLEAN, "The attribute's name", "true if the given attribute is being archived", DispLevel.OPERATOR));
-		command_list.addElement(new GetArchivingModeClass("GetArchivingMode", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"The archiving mode used for the specified attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataClass("GetAttData", Tango_DEV_STRING, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataCountClass("GetAttDataCount", Tango_DEV_STRING, Tango_DEV_LONG, "An attribute name.", "The number of the data archieved for an attribute.",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataAvgClass("GetAttDataAvg", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The average of the values generated by the attribute",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataAvgBetweenDatesClass("GetAttDataAvgBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"The average value generated by the given attribute and between the two given dates. ", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesClass("GetAttDataBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesSamplingClass("GetAttDataBetweenDatesSampling", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS), and the sampling type (ALL, SECOND, MINUTE, HOUR, DAY)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesCountClass("GetAttDataBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the beginning (YYYY-MM-DD HH24:MI:SS) date and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data beetwen two dates and, for a given scalar attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanClass("GetAttDataInfOrSupThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit and the upper limit", "String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanCountClass("GetAttDataInfOrSupThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit and the upper limit", "The number of scalar data lower than the given value x OR higher than the given value y.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanBetweenDatesClass("GetAttDataInfOrSupThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanBetweenDatesCountClass("GetAttDataInfOrSupThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of scalar data lower than the given value x OR higher than the given value y, beetwen two dates and for the specified attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanClass("GetAttDataInfThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the upper limit",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanCountClass("GetAttDataInfThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name and the  upper limit.",
-				"The number of scalar data lower than the given value and for the specified attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanBetweenDatesClass("GetAttDataInfThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanBetweenDatesCountClass("GetAttDataInfThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS). ",
-				"The number data lower than the given value x, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataLastNClass("GetAttDataLastN", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the number of wished data",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttDataMaxClass("GetAttDataMax", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The biggest value generated by the attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataMaxBetweenDatesClass("GetAttDataMaxBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)", "The biggest value generated between the two given dates.",
-				DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttDataMinClass("GetAttDataMin", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The smallest value generated by the attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataMinBetweenDatesClass("GetAttDataMinBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"The smallest scalar value generated by the given attribute and between the two given dates.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanClass("GetAttDataSupThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the  lower limit",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanCountClass("GetAttDataSupThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name and the  lower limit.",
-				"The number of data higher than the given value.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanClass("GetAttDataSupAndInfThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit and the upper limit", "String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanCountClass("GetAttDataSupAndInfThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit and the upper limit", "The data that are highter than the given value x AND lower than the given value y.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanBetweenDatesClass("GetAttDataSupAndInfThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanBetweenDatesCountClass("GetAttDataSupAndInfThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data higher than the given value x, (AND) lower than the given value y, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanBetweenDatesClass("GetAttDataSupThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanBetweenDatesCountClass("GetAttDataSupThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the beginning date  (YYYY-MM-DD HH24:MI:SS) and the ending date  (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data higher than the given value y, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new RemoveDynamicAttributeClass("RemoveDynamicAttribute", Tango_DEV_STRING, Tango_DEV_VOID, "The HdbExtractor dynamic attribute's name", "", DispLevel.OPERATOR));
-		command_list.addElement(new RemoveDynamicAttributesClass("RemoveDynamicAttributes", Tango_DEV_VOID, Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttFullNameClass("GetAttFullName", Tango_DEV_SHORT, Tango_DEV_STRING, "The id of an attribute", "The full name of this attribute", DispLevel.OPERATOR));
+    // ===================================================================
+    //
+    // method : command_factory()
+    //
+    // description : Create the command object(s) and store them in the
+    // command list
+    // ===================================================================
+    @Override
+    public void command_factory() {
+	command_list.addElement(new GetMinTimeClass("GetMinTime", Tango_DEV_STRING, Tango_DEV_STRING,
+		"The attribute to search", "The earliest value's timestamp", DispLevel.OPERATOR));
+	command_list.addElement(new GetMaxTimeClass("GetMaxTime", Tango_DEV_STRING, Tango_DEV_STRING,
+		"The attribute to search", "The latest value's timestamp", DispLevel.OPERATOR));
+	command_list.addElement(new GetInfoClass("GetInfo", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The informations that characterize the database", DispLevel.OPERATOR));
+	command_list.addElement(new GetHostClass("GetHost", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The connected database host identifier.", DispLevel.OPERATOR));
+	command_list.addElement(new GetUserClass("GetUser", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The current user's name used for the connection.", DispLevel.OPERATOR));
+	command_list.addElement(new GetConnectionStateClass("GetConnectionState", Tango_DEV_VOID, Tango_DEV_BOOLEAN,
+		"", "The connection state", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDefinitionDataClass("GetAttDefinitionData", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"Differents definition informations for the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttPropertiesDataClass("GetAttPropertiesData", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"An array containing the differents properties for the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttIdClass("GetAttId", Tango_DEV_STRING, Tango_DEV_SHORT,
+		"The attribute's name", "The HDB's ID that characterize the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttNameAllClass("GetAttNameAll", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The whole list of the attributes registered in HDB", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttNameFacilityClass("GetAttNameFacility", Tango_DEV_VOID,
+		Tango_DEVVAR_STRINGARRAY, "",
+		"The whole list of the attributes registered in HDB, and that belong to the current facility.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttNameFilterFormatClass(
+			"GetAttNameFilterFormat",
+			Tango_DEV_SHORT,
+			Tango_DEVVAR_STRINGARRAY,
+			"A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			"The filtered list of attributes registered in HDB.  The filtering is made according to the given format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttNameFilterTypeClass(
+			"GetAttNameFilterType",
+			Tango_DEV_SHORT,
+			Tango_DEVVAR_STRINGARRAY,
+			"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			"The filtered list of attributes registered in HDB.  The filtering is made according to the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttCountAllClass("GetAttCountAll", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The total number of attributes defined in HDB", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttCountFilterFormatClass(
+			"GetAttCountFilterFormat",
+			Tango_DEV_SHORT,
+			Tango_DEV_SHORT,
+			"A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			"The total number of attributes defined in HDB with the given format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttCountFilterTypeClass(
+			"GetAttCountFilterType",
+			Tango_DEV_SHORT,
+			Tango_DEV_SHORT,
+			"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			"The total number of attributes defined in HDB with the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetDomainsClass("GetDomains", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered domains", DispLevel.OPERATOR));
+	command_list.addElement(new GetDomainsCountClass("GetDomainsCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct registered domains.", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesClass("GetFamilies", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered families", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesCountClass("GetFamiliesCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct registered families.", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesByDomainClass("GetFamiliesByDomain", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The given domain", "The registered families for the given domain",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesByDomainCountClass("GetFamiliesByDomainCount", Tango_DEV_STRING,
+		Tango_DEV_SHORT, "A domain name", "The number of distinct registered families for a given domain.",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersClass("GetMembers", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered members", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersCountClass("GetMembersCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct members.", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersByDomainFamilyClass("GetMembersByDomainFamily", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_STRINGARRAY, "The given domain and family",
+		"The registered members for the given domain and family", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersByDomainFamilyCountClass("GetMembersByDomainFamilyCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT, "A domain name, a family name",
+		"The number of distinct registered members for the given domain and family.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttributesByDomainFamilyMembersCountClass(
+		"GetAttributesByDomainFamilyMembersCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT,
+		"A domain name, a family name, a member name.",
+		"The number of registered the attributes for a given  domain, family, member.", DispLevel.OPERATOR));
+	command_list.addElement(new GetCurrentArchivedAttClass("GetCurrentArchivedAtt", Tango_DEV_VOID,
+		Tango_DEVVAR_STRINGARRAY, "", "The list of attributes that are being archived", DispLevel.OPERATOR));
+	command_list.addElement(new IsArchivedClass("IsArchived", Tango_DEV_STRING, Tango_DEV_BOOLEAN,
+		"The attribute's name", "true if the given attribute is being archived", DispLevel.OPERATOR));
+	command_list.addElement(new GetArchivingModeClass("GetArchivingMode", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"The archiving mode used for the specified attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataClass("GetAttData", Tango_DEV_STRING, Tango_DEVVAR_LONGSTRINGARRAY,
+		"The attribute's name", "String  : The new created dynamic attribute name, Long : the number of data.",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataCountClass("GetAttDataCount", Tango_DEV_STRING, Tango_DEV_LONG,
+		"An attribute name.", "The number of the data archieved for an attribute.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataAvgClass("GetAttDataAvg", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The average of the values generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataAvgBetweenDatesClass(
+			"GetAttDataAvgBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The average value generated by the given attribute and between the two given dates. ",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesClass(
+			"GetAttDataBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesSamplingClass(
+			"GetAttDataBetweenDatesSampling",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS), and the sampling type (ALL, SECOND, MINUTE, HOUR, DAY)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesCountClass(
+			"GetAttDataBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the beginning (YYYY-MM-DD HH24:MI:SS) date and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data beetwen two dates and, for a given scalar attribute.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfOrSupThanClass("GetAttDataInfOrSupThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the lower limit and the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfOrSupThanCountClass("GetAttDataInfOrSupThanCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name, the lower limit and the upper limit",
+		"The number of scalar data lower than the given value x OR higher than the given value y.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfOrSupThanBetweenDatesClass(
+			"GetAttDataInfOrSupThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfOrSupThanBetweenDatesCountClass(
+			"GetAttDataInfOrSupThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of scalar data lower than the given value x OR higher than the given value y, beetwen two dates and for the specified attribute.",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfThanClass("GetAttDataInfThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfThanCountClass("GetAttDataInfThanCount", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_LONG, "The attribute's name and the  upper limit.",
+		"The number of scalar data lower than the given value and for the specified attribute.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfThanBetweenDatesClass(
+			"GetAttDataInfThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfThanBetweenDatesCountClass(
+			"GetAttDataInfThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS). ",
+			"The number data lower than the given value x, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataLastNClass("GetAttDataLastN", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the number of wished data",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataMaxClass("GetAttDataMax", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The biggest value generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataMaxBetweenDatesClass(
+			"GetAttDataMaxBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The biggest value generated between the two given dates.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataMinClass("GetAttDataMin", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The smallest value generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataMinBetweenDatesClass(
+			"GetAttDataMinBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The smallest scalar value generated by the given attribute and between the two given dates.",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupThanClass("GetAttDataSupThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the  lower limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupThanCountClass("GetAttDataSupThanCount", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_LONG, "The attribute's name and the  lower limit.",
+		"The number of data higher than the given value.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupAndInfThanClass("GetAttDataSupAndInfThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the lower limit and the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupAndInfThanCountClass("GetAttDataSupAndInfThanCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name, the lower limit and the upper limit",
+		"The data that are highter than the given value x AND lower than the given value y.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupAndInfThanBetweenDatesClass(
+			"GetAttDataSupAndInfThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupAndInfThanBetweenDatesCountClass(
+			"GetAttDataSupAndInfThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data higher than the given value x, (AND) lower than the given value y, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupThanBetweenDatesClass(
+			"GetAttDataSupThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupThanBetweenDatesCountClass(
+			"GetAttDataSupThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the beginning date  (YYYY-MM-DD HH24:MI:SS) and the ending date  (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data higher than the given value y, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list.addElement(new RemoveDynamicAttributeClass("RemoveDynamicAttribute", Tango_DEV_STRING,
+		Tango_DEV_VOID, "The HdbExtractor dynamic attribute's name", "", DispLevel.OPERATOR));
+	command_list.addElement(new RemoveDynamicAttributesClass("RemoveDynamicAttributes", Tango_DEV_VOID,
+		Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttFullNameClass("GetAttFullName", Tango_DEV_SHORT, Tango_DEV_STRING,
+		"The id of an attribute", "The full name of this attribute", DispLevel.OPERATOR));
+	command_list.addElement(new TemplCommandInOut("GetNewestValue", "getNewestValue", "attribute name",
+		"timestamp; values"));
+	command_list.addElement(new TemplCommandInOut("GetNearestValue", "getNearestValue",
+		"[attributeName, timestamp]. timestamp format is DD-MM-YYYY HH24:MI:SS", "timestamp; values"));
+	command_list.addElement(new ExtractBetweenDatesClass("ExtractBetweenDates", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_DOUBLESTRINGARRAY,
+		"[attributeName,start date, end date]. dates format is DD-MM-YYYY HH24:MI:SS",
+		"long: timestamp; string :values"));
 
-		// add polling if any
-		/*
-		 * for (int i = 0; i < command_list.size(); i++) { // Command cmd = (
-		 * Command ) command_list.elementAt(i); }
-		 */
-	}
+	// add polling if any
+	/*
+	 * for (int i = 0; i < command_list.size(); i++) { // Command cmd = (
+	 * Command ) command_list.elementAt(i); }
+	 */
+    }
 
-	// =============================================================================
-	//
-	// Method: attribute_factory(Vector att_list)
-	//
-	// =============================================================================
-	@Override
-	public void attribute_factory(Vector att_list) throws DevFailed {
-		// Attribute : version
-		Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
-		att_list.addElement(version);
-	}
+    // =============================================================================
+    //
+    // Method: attribute_factory(Vector att_list)
+    //
+    // =============================================================================
+    @Override
+    public void attribute_factory(Vector att_list) throws DevFailed {
+	// Attribute : version
+	Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
+	att_list.addElement(version);
+    }
 
-	// ===================================================================
-	//
-	// method : device_factory()
-	//
-	// description : Create the device object(s) and store them in the
-	// device list
-	//
-	// argument : in : String[] devlist : The device name list
-	//
-	// ===================================================================
-	@Override
-	public void device_factory(String[] devlist) throws DevFailed {
-		String device_version = ResourceBundle.getBundle("application").getString("project.version");
-		for (int i = 0; i < devlist.length; i++) {
-			// Util.out4.println("Device name : " + devlist[ i ]);
+    // ===================================================================
+    //
+    // method : device_factory()
+    //
+    // description : Create the device object(s) and store them in the
+    // device list
+    //
+    // argument : in : String[] devlist : The device name list
+    //
+    // ===================================================================
+    @Override
+    public void device_factory(String[] devlist) throws DevFailed {
+	String device_version = ResourceBundle.getBundle("application").getString("project.version");
+	for (int i = 0; i < devlist.length; i++) {
+	    // Util.out4.println("Device name : " + devlist[ i ]);
 
-			// Create device and add it into the device list
-			// ----------------------------------------------
-			device_list.addElement(new HdbExtractor(this, devlist[i], device_version));
+	    // Create device and add it into the device list
+	    // ----------------------------------------------
+	    device_list.addElement(new HdbExtractor(this, devlist[i], device_version));
 
-			// Export device to the outside world
-			// ----------------------------------------------
-			if (Util._UseDb == true)
-				export_device(((DeviceImpl) (device_list.elementAt(i))));
-			else
-				export_device(((DeviceImpl) (device_list.elementAt(i))), devlist[i]);
-		}
+	    // Export device to the outside world
+	    // ----------------------------------------------
+	    if (Util._UseDb == true) {
+		export_device(((DeviceImpl) device_list.elementAt(i)));
+	    } else {
+		export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
+	    }
 	}
+    }
 
-	// ===================================================================
-	/**
-	 * Get the class property for specified name.
-	 * 
-	 * @param name
-	 *            The property name.
-	 */
-	// ===================================================================
-	public DbDatum get_class_property(String name) {
-		for (int i = 0; i < cl_prop.length; i++)
-			if (cl_prop[i].name.equals(name))
-				return cl_prop[i];
-		// if not found, return an empty DbDatum
-		return new DbDatum(name);
+    // ===================================================================
+    /**
+     * Get the class property for specified name.
+     * 
+     * @param name
+     *            The property name.
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) {
+	for (int i = 0; i < cl_prop.length; i++) {
+	    if (cl_prop[i].name.equals(name)) {
+		return cl_prop[i];
+	    }
 	}
+	// if not found, return an empty DbDatum
+	return new DbDatum(name);
+    }
 
-	// ===================================================================
-	/**
-	 * Read the class properties from database.
-	 */
-	// ===================================================================
-	public void get_class_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
+    // ===================================================================
+    /**
+     * Read the class properties from database.
+     */
+    // ===================================================================
+    public void get_class_property() throws DevFailed {
+	// Initialize your default values here.
+	// ------------------------------------------
 
-		// Read class properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = {};
+	// Read class properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
+	}
+	String[] propnames = {};
 
-		// Call database and extract values
-		// --------------------------------------------
-		cl_prop = get_db_class().get_property(propnames);
+	// Call database and extract values
+	// --------------------------------------------
+	cl_prop = get_db_class().get_property(propnames);
 
-		// End of Automatic code generation
-		// -------------------------------------------------------------
+	// End of Automatic code generation
+	// -------------------------------------------------------------
 
-	}
+    }
 
-	// ===================================================================
-	/**
-	 * Set class description as property in database
-	 */
-	// ===================================================================
-	private void write_class_property() throws DevFailed {
-		// First time, check if database used
-		// --------------------------------------------
-		if (Util._UseDb == false)
-			return;
+    // ===================================================================
+    /**
+     * Set class description as property in database
+     */
+    // ===================================================================
+    private void write_class_property() throws DevFailed {
+	// First time, check if database used
+	// --------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
+	}
 
-		// Prepeare DbDatum
-		// --------------------------------------------
-		DbDatum[] data = new DbDatum[2];
-		data[0] = new DbDatum("ProjectTitle");
-		data[0].insert("Tango Device Server");
+	// Prepeare DbDatum
+	// --------------------------------------------
+	DbDatum[] data = new DbDatum[2];
+	data[0] = new DbDatum("ProjectTitle");
+	data[0].insert("Tango Device Server");
 
-		data[1] = new DbDatum("Description");
-		data[1].insert("A DServer used for historical database's extractions.");
+	data[1] = new DbDatum("Description");
+	data[1].insert("A DServer used for historical database's extractions.");
 
-		// Call database and and values
-		// --------------------------------------------
-		get_db_class().put_property(data);
-	}
+	// Call database and and values
+	// --------------------------------------------
+	get_db_class().put_property(data);
+    }
 
 }
diff --git a/src/main/java/TdbArchiver/Collector/DbProxy.java b/src/main/java/TdbArchiver/Collector/DbProxy.java
index 6a48b6b67b0920aa4f1b818cfec85df34606cb8b..23cd6598646bffe5e234514bec5839462908a005 100644
--- a/src/main/java/TdbArchiver/Collector/DbProxy.java
+++ b/src/main/java/TdbArchiver/Collector/DbProxy.java
@@ -69,9 +69,12 @@ package TdbArchiver.Collector;
 
 import java.util.Vector;
 
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoApi.Database;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
+import fr.soleil.commonarchivingapi.ArchivingTools.Tools.GlobalConst;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.ConfigConst;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.DataBaseManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.TDBDataBaseManager;
@@ -166,11 +169,7 @@ public class DbProxy {
 		tableName, writable);
     }
 
-    public Vector<AttributeLightMode> getArchiverCurrentTasks(final String archiverName) // throws
-    // ArchivingException
-    // , DevFailed
-    {
-	// System.out.println("DbProxy.getArchiverCurrentTasks");
+    public Vector<AttributeLightMode> getArchiverCurrentTasks(final String archiverName) throws ArchivingException {
 	Vector<AttributeLightMode> archiverCurrentTasks;
 	final boolean facility = manager.getFacility();
 	try {
@@ -179,31 +178,20 @@ public class DbProxy {
 		    .getMode()
 		    .getArchiverCurrentTasks(
 			    (facility ? "//" + new Database().get_tango_host() + "/" : "") + archiverName);
-	    System.out.println("Current Tasks (" + archiverCurrentTasks.size() + "): .... \n\r\t");
-	    for (int i = 0; i < archiverCurrentTasks.size(); i++) {
-		final AttributeLightMode attributeLightMode = archiverCurrentTasks.elementAt(i);
-		System.out.println(">>>>>>>>>>>>\t" + i + "\t<<<<<<<<<<<<");
-		System.out.println("attributeLightMode.toString() : \r\n" + attributeLightMode.toString() + "\r\n");
-	    }
-	    return archiverCurrentTasks;
+	} catch (final DevFailed devFailed) {
+	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + GlobalConst.DBT_UNREACH_EXCEPTION;
+	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
+	    final String desc = "Failed while executing DbProxy.getArchiverCurrentTasks() method...";
+	    throw new ArchivingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
 	}
-	/*
-	 * catch ( ArchivingException e ) { System.err.println("ERROR !! " +
-	 * "\r\n" + "\t Origin : \t " + "DbProxy.getArchiverCurrentTasks" +
-	 * "\r\n" + "\t Reason : \t " + e.getClass().getName() + "\r\n" +
-	 * "\t Description : \t " + e.getMessage() + "\r\n" +
-	 * "\t Additional information : \t " + "Unable to get current tasks..."
-	 * + "\r\n"); throw e; } catch ( DevFailed devFailed ) {
-	 * Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " +
-	 * "DbProxy.getArchiverCurrentTasks" + "\r\n" + "\t Reason : \t " +
-	 * "UNKNOWN_ERROR" + "\r\n" + "\t Description : \t " +
-	 * devFailed.getMessage() + "\r\n" + "\t Additional information : \t " +
-	 * "" + "\r\n"); throw devFailed; }
-	 */
-	catch (final Exception e) {
-	    e.printStackTrace();
-	    return null;
+	System.out.println("Current Tasks (" + archiverCurrentTasks.size() + "): .... \n\r\t");
+	for (int i = 0; i < archiverCurrentTasks.size(); i++) {
+	    final AttributeLightMode attributeLightMode = archiverCurrentTasks.elementAt(i);
+	    System.out.println(">>>>>>>>>>>>\t" + i + "\t<<<<<<<<<<<<");
+	    System.out.println("attributeLightMode.toString() : \r\n" + attributeLightMode.toString() + "\r\n");
 	}
+	return archiverCurrentTasks;
+
     }
 
     public void deleteOldRecords(final long time, final String[] attributeList) throws ArchivingException {
diff --git a/src/main/java/TdbArchiver/Collector/TdbCollector.java b/src/main/java/TdbArchiver/Collector/TdbCollector.java
index 6c57a31191bf693cfe8d207be2b7eddb7e874425..d734bc86830c9ffab4fc26507a14cbb7ca170ba6 100644
--- a/src/main/java/TdbArchiver/Collector/TdbCollector.java
+++ b/src/main/java/TdbArchiver/Collector/TdbCollector.java
@@ -147,22 +147,18 @@ package TdbArchiver.Collector;
 
 import java.io.IOException;
 import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import Common.Archiver.Collector.ArchiverCollector;
 import TdbArchiver.Collector.Tools.FileTools;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoDs.Util;
-import fr.esrf.tangoatk.core.AttributePolledList;
 import fr.esrf.tangoatk.core.ConnectionException;
 import fr.esrf.tangoatk.core.ErrorEvent;
-import fr.esrf.tangoatk.core.IAttribute;
 import fr.esrf.tangoatk.core.IEntity;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
 import fr.soleil.commonarchivingapi.ArchivingTools.Tools.GlobalConst;
@@ -177,14 +173,7 @@ import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.SpectrumEvent_RW;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.Warnable;
 
 public abstract class TdbCollector extends ArchiverCollector {
-    /**
-     * This list is the list used by the refresher of the Collector
-     */
-    private final AttributePolledList attributeList = new AttributePolledList();
-    /**
-     * This field represent the refreshing state of the Collector
-     */
-    protected boolean refreshing;
+
     /**
      * A file is associated to each archived attribute. We them must keep a the
      * association (attribute name / corresponding file )
@@ -194,11 +183,8 @@ public abstract class TdbCollector extends ArchiverCollector {
      * This parameter specify the number of time a Collector retry the archiving
      * of an attribute event
      */
-    // protected static int tryNumber = 1;
     protected final static int DEFAULT_TRY_NUMBER = 2;
 
-    protected KeepingThread keepingThread;
-
     protected long keepingPeriod;
 
     private final Map<String, LimitedStack> lastTimestampStacks = new HashMap<String, LimitedStack>();
@@ -209,7 +195,7 @@ public abstract class TdbCollector extends ArchiverCollector {
      */
     private final Map<String, Object> lastValueHashtable = new HashMap<String, Object>();
 
-    protected boolean isFirstValue;
+    protected volatile Map<String, Boolean> isFirstValueList = new ConcurrentHashMap<String, Boolean>();
     protected Warnable warnable;
 
     protected DbProxy dbProxy;
@@ -224,7 +210,6 @@ public abstract class TdbCollector extends ArchiverCollector {
 	    final AttrWriteType writableType) {
 	super(_modeHandler);
 	this.writableType = writableType;
-	isFirstValue = true;
 	m_currentDbPath = currentDbPath;
 	m_currentDsPath = currentDsPath;
     }
@@ -233,15 +218,6 @@ public abstract class TdbCollector extends ArchiverCollector {
 	return writableType;
     }
 
-    /**
-     * Returns a boolean to know wheather the attribute list is empty or not
-     * 
-     * @return A boolean to know wheather the attribute list is empty or not
-     */
-    public boolean hasEmptyList() {
-	return attributeList.isEmpty();
-    }
-
     protected void setLastValue(final ScalarEvent scalarEvent, final Object lastValue) {
 	setLastTimestamp(scalarEvent);
 	lastValueHashtable.put(scalarEvent.getAttribute_complete_name(), lastValue);
@@ -261,6 +237,7 @@ public abstract class TdbCollector extends ArchiverCollector {
     public synchronized void addSource(final AttributeLightMode attributeLightMode, final int attributePerFile)
 	    throws ArchivingException {
 	try {
+	    stopCollecting();
 	    final String attName = attributeLightMode.getAttribute_complete_name();
 	    final IEntity attribute = attributeList.add(attName);
 	    addListeners(attribute);
@@ -271,23 +248,17 @@ public abstract class TdbCollector extends ArchiverCollector {
 	    addAttribute(attName);
 	    // Verify that the recording file exists
 	    final String table_name = dbProxy.getDataBase().getDbUtil().getTableName(attName);
-	    if (filesNames.get(attName) == null) {
+	    if (filesNames.get(attName.toLowerCase()) == null) {
 		final FileTools myFile = new FileTools(attName, table_name, attributeLightMode.getData_format(),
 			attributeLightMode.getWritable(), attributeLightMode.getMode().getTdbSpec().getExportPeriod(),
-			super.m_logger, dbProxy, m_currentDsPath, m_currentDbPath);
+			super.logger, dbProxy, m_currentDsPath, m_currentDbPath);
 		myFile.setAttributePerFile(attributePerFile);
-		filesNames.put(attName, myFile);
+		filesNames.put(attName.toLowerCase(), myFile);
 	    }
 
-	    isFirstValue = true;
-	    startCollecting();
-
-	    if (attributeList.get(attName) == null) {
-		super.m_logger.trace(ILogger.LEVEL_WARNING, "addSource/The first add test failed for attribute|"
-			+ attName);
-	    }
+	    isFirstValueList.put(attName.toLowerCase(), true);
 	} catch (final ConnectionException e) {
-	    super.m_logger.trace(ILogger.LEVEL_WARNING, e);
+	    super.logger.trace(ILogger.LEVEL_WARNING, e);
 
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
 		    + attributeLightMode.getAttribute_complete_name() + "' as source";
@@ -295,9 +266,11 @@ public abstract class TdbCollector extends ArchiverCollector {
 	    final String desc = "Failed while executing BooleanScalar.addSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_WARNING,
+	    super.logger.trace(ILogger.LEVEL_WARNING,
 		    "Unexpected exception during addSource:" + attributeLightMode.getAttribute_complete_name());
-	    super.m_logger.trace(ILogger.LEVEL_WARNING, e);
+	    super.logger.trace(ILogger.LEVEL_WARNING, e);
+	} finally {
+	    startCollecting();
 	}
     }
 
@@ -318,10 +291,11 @@ public abstract class TdbCollector extends ArchiverCollector {
 	     * while ( ( IBooleanScalar ) attributeList.get(attributeName) !=
 	     * null ) {
 	     */
+	    stopCollecting();
 	    final IEntity attribute = attributeList.get(attributeName);
 	    if (attribute != null) {
 		removeListeners(attribute);
-
+		isFirstValueList.remove(attributeName.toLowerCase());
 		attributeList.remove(attributeName);
 
 		// informs the mother class that one new attribute must be
@@ -330,13 +304,9 @@ public abstract class TdbCollector extends ArchiverCollector {
 		removeTimestamps(attributeName);
 		Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
 		if (closeFile) {
-		    filesNames.get(attributeName).closeFile();
-		    filesNames.remove(attributeName);
-		}
-		if (attributeList.isEmpty()) {
-		    stopCollecting();
+		    filesNames.get(attributeName.toLowerCase()).closeFile();
+		    filesNames.remove(attributeName.toLowerCase());
 		}
-
 	    }
 	} catch (final Exception e) {
 	    final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
@@ -344,81 +314,38 @@ public abstract class TdbCollector extends ArchiverCollector {
 	    final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
 	    final String desc = "Failed while executing BooleanScalar.removeSource() method...";
 	    throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
+	} finally {
+	    startCollecting();
 	}
     }
 
     public abstract void removeListeners(IEntity attribute) throws ArchivingException;
 
     public String exportFile2Db(final String attributeName) throws IOException, ArchivingException {
-	m_logger.trace(ILogger.LEVEL_DEBUG, "XXXXXXX FORCING export for " + attributeName);
-	final String result = filesNames.get(attributeName).switchFile();
-	m_logger.trace(ILogger.LEVEL_DEBUG, "Export forced done for " + attributeName + " - " + result);
+	logger.trace(ILogger.LEVEL_DEBUG, "XXXXXXX FORCING export for " + attributeName);
+	final String result = filesNames.get(attributeName.toLowerCase()).switchFile();
+	logger.trace(ILogger.LEVEL_DEBUG, "Export forced done for " + attributeName + " - " + result);
 	return result;
     }
 
     protected void processFileScalar(final ScalarEvent scalarEvent) throws ArchivingException {
 	String attrName = scalarEvent.getAttribute_complete_name();
-	filesNames.get(attrName).processEventScalar(scalarEvent);
+	filesNames.get(attrName.toLowerCase()).processEventScalar(scalarEvent);
     }
 
     protected void processFileSpectrum(final SpectrumEvent_RO spectrumEvent) throws ArchivingException {
 	String attrName = spectrumEvent.getAttribute_complete_name();
-	filesNames.get(attrName).processEventSpectrum(spectrumEvent);
+	filesNames.get(attrName.toLowerCase()).processEventSpectrum(spectrumEvent);
     }
 
     protected void processFileSpectrum(final SpectrumEvent_RW spectrumEvent) throws ArchivingException {
 	String attrName = spectrumEvent.getAttribute_complete_name();
-	filesNames.get(attrName).processEventSpectrum(spectrumEvent);
+	filesNames.get(attrName.toLowerCase()).processEventSpectrum(spectrumEvent);
     }
 
     protected void processFileImage(final ImageEvent_RO imageEvent) throws ArchivingException {
 	String attrName = imageEvent.getAttribute_complete_name();
-	filesNames.get(attrName).processEventImage(imageEvent);
-    }
-
-    /**
-     * Triggers the collecting action of this TdbCollector.
-     */
-    public synchronized void startCollecting() {
-	if (!attributeList.isEmpty()) {
-	    if (attributeList.size() == 1) {
-		attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
-		attributeList.setSynchronizedPeriod(true);
-		// force a refresh for newly added attributes
-		m_logger.trace(ILogger.LEVEL_DEBUG, "start refresh for " + this.getClass());
-		attributeList.startRefresher();
-		refreshing = true;
-		if (keepingThread != null) {
-		    keepingThread.start();
-		}
-	    } else {
-		// force a refresh for newly added attributes
-		m_logger.trace(ILogger.LEVEL_DEBUG, "FORCING refresh for " + this.getClass());
-		attributeList.refresh();
-	    }
-	}
-    }
-
-    /**
-     * Stops the collecting action of this TdbCollector.
-     */
-    public synchronized void stopCollecting() {
-	Util.out4.println("TdbCollector.stopCollecting");
-	try {
-	    if (attributeList.isEmpty()) {
-		attributeList.stopRefresher();
-		if (keepingThread != null) {
-		    keepingThread.destroy();
-		    keepingThread = null;
-		}
-		refreshing = false;
-	    }
-	} catch (final Exception e) {
-	    Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "TdbCollector.stopCollecting" + "\r\n"
-		    + "\t Reason : \t " + e.getClass().getName() + "\r\n" + "\t Description : \t " + e.getMessage()
-		    + "\r\n" + "\t Additional information : \t " + "" + "\r\n");
-	    e.printStackTrace();
-	}
+	filesNames.get(attrName.toLowerCase()).processEventImage(imageEvent);
     }
 
     public void errorChange(final ErrorEvent errorEvent) {
@@ -429,86 +356,6 @@ public abstract class TdbCollector extends ArchiverCollector {
 
     }
 
-    public synchronized String assessment() {
-	final StringBuffer ass = new StringBuffer();
-	ass.append("Collector Reference : " + toString() + "\r\n");
-	ass.append("Activity (refreshing) : " + isRefreshing() + "\r\n");
-	ass.append("Mode : " + "\r\n" + m_modeHandler.getMode().toString() + "\r\n");
-	ass.append("Attribute list (" + attributeList.getSize() + "): " + "\r\n");
-	final Enumeration myAttList = attributeList.elements();
-	int i = 1;
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute iNumberScalar = (IAttribute) myAttList.nextElement();
-	    ass.append("\t" + i++ + "\t" + iNumberScalar.getName() + "\r\n");
-	}
-	return ass.toString();
-    }
-
-    public boolean isRefreshing() {
-	return refreshing;
-    }
-
-    private class KeepingThread extends Thread {
-	long keeping_time = m_modeHandler.getMode().getTdbSpec().getKeepingPeriod();
-	long sleeping_time = 10 * 60 * 1000; // Deletes records every 10 minutes
-	String state = "NOT RUNNING";
-
-	public KeepingThread() {
-	    super("KeepingThread");
-	}
-
-	public void activate(final boolean b) {
-	    if (b) {
-		state = "RUNNING";
-	    } else {
-		state = "NOT RUNNING";
-	    }
-	}
-
-	/**
-	 * This method is called by the system to give a Thread a chance to
-	 * clean up before it actually exits.
-	 */
-	@Override
-	public void destroy() {
-	    System.out.println("KeepingThread.destroy");
-	    activate(false);
-	    interrupt();
-	}
-
-	@Override
-	public void run() {
-	    System.out.println("KeepingThread.run");
-	    state = "RUNNING";
-	    while (state.equals("RUNNING")) {
-		try {
-		    sleep(sleeping_time);
-		} catch (final InterruptedException e) {
-		    activate(false);
-		    /*
-		     * System.err.println( "Reason :         Unknown !!!" +
-		     * "\r\n" +
-		     * "Description : The thread does not want to sleep !!" +
-		     * "\r\n" + "Origin :            KeepingThread.run");
-		     * e.printStackTrace();
-		     */
-		}
-		Util.out4.println("KeepingThread.run : Getting attribute list...");
-		final AttributePolledList tmpAttributeList = attributeList;
-		final String[] m_attributeList = new String[tmpAttributeList.size()];
-		for (int i = 0; i < m_attributeList.length; i++) {
-		    m_attributeList[i] = ((IEntity) tmpAttributeList.getElementAt(i)).getName();
-		}
-		try {
-		    Util.out4.println("KeepingThread.run : Sending the attribute list to the database...");
-		    dbProxy.deleteOldRecords(keeping_time, m_attributeList);
-		} catch (final ArchivingException e) {
-		    Util.out2.println(e.toString());
-		}
-	    }
-	}
-    }
-
     protected void setLastTimestamp(final ArchivingEvent scalarEvent) {
 	if (scalarEvent != null) {
 	    final String name = scalarEvent.getAttribute_complete_name();
@@ -538,7 +385,7 @@ public abstract class TdbCollector extends ArchiverCollector {
 
 	final long newTime = scalarEvent.getTimeStamp();
 	if (newTime == 0) {
-	    m_logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
+	    logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
 		    + " - tableName: " + scalarEvent.getTable_name());
 	    return false;
 	}
@@ -549,24 +396,25 @@ public abstract class TdbCollector extends ArchiverCollector {
 	    return true;
 	}
 
-	final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, m_logger);
+	final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, logger);
 	// System.out.println (
 	// "isDataArchivableTimestampWise/isAlreadyRegisteredDate/"+isAlreadyRegisteredDate);
 	if (isAlreadyRegisteredDate) {
-	    m_logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
+	    logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
 		    + " - timestamp: " + new Timestamp(newTime));
 	    return false;
 	}
-	final boolean isValidRegisteredDate = lastTimestampStack.validateDate(newTime, m_logger);
+	final boolean isValidRegisteredDate = lastTimestampStack.validateDate(newTime, logger);
 	// System.out.println (
 	// "isDataArchivableTimestampWise/isAlreadyRegisteredDate/"+isAlreadyRegisteredDate);
 
 	if (!isValidRegisteredDate) {
-	    m_logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - not ValidRegisteredDate - attribute: " + name
+	    logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - not ValidRegisteredDate - attribute: " + name
 		    + " - timestamp: " + new Timestamp(newTime));
 	    return false;
 	}
-
+	// m_logger.trace(ILogger.LEVEL_DEBUG, name + " timestamp OK: " + new
+	// Timestamp(newTime));
 	// System.out.println ( "isDataArchivableTimestampWise/name/3");
 	return true;
     }
@@ -575,39 +423,7 @@ public abstract class TdbCollector extends ArchiverCollector {
 	warnable = _warnable;
     }
 
-    public synchronized short[] loadAssessment() {
-	final short[] ret = new short[3];
-	final Enumeration<?> myAttList = attributeList.elements();
-	// int i = 1;
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute nextAttr = (IAttribute) myAttList.nextElement();
-	    final int X = nextAttr.getMaxXDimension();
-	    final int Y = nextAttr.getMaxYDimension();
-
-	    short type = 0;
-	    if (X > 1) {
-		type++;
-	    }
-	    if (Y > 1) {
-		type++;
-	    }
-
-	    ret[type]++;
-	}
-	return ret;
-    }
-
     public void setDbProxy(final DbProxy _dbProxy) {
 	dbProxy = _dbProxy;
     }
-
-    public List<String> getAttributeList() {
-	final List<String> attributeListResult = new ArrayList<String>();
-	final Enumeration<?> myAttList = attributeList.elements();
-	while (myAttList.hasMoreElements()) {
-	    final IAttribute attr = (IAttribute) myAttList.nextElement();
-	    attributeListResult.add(attr.getName());
-	}
-	return attributeListResult;
-    }
 }
\ No newline at end of file
diff --git a/src/main/java/TdbArchiver/Collector/TdbCollectorFactory.java b/src/main/java/TdbArchiver/Collector/TdbCollectorFactory.java
index 3003d7a79afbbffd09f1f6081d402acb31f39455..71295acd2195f05b44af191850f331e1c9770c08 100644
--- a/src/main/java/TdbArchiver/Collector/TdbCollectorFactory.java
+++ b/src/main/java/TdbArchiver/Collector/TdbCollectorFactory.java
@@ -172,6 +172,17 @@ public class TdbCollectorFactory {
 	return collector;
     }
 
+    public TdbCollector get(final String attributeName) {
+	TdbCollector result = null;
+	for (TdbCollector collector : tableCollector.values()) {
+	    if (collector.isCollected(attributeName)) {
+		result = collector;
+		break;
+	    }
+	}
+	return result;
+    }
+
     /**
      * This method create a new TdbCollector instance if required associated to
      * an attribute. In this method, attributes are not grouped by mode.
diff --git a/src/main/java/TdbArchiver/Collector/scalar/BooleanScalar.java b/src/main/java/TdbArchiver/Collector/scalar/BooleanScalar.java
index b49a7ca94ae6988d9224e4689507deaa9da22e5c..fc736b7e4b232f44ad7ecdba0d46e57d1a963bc9 100644
--- a/src/main/java/TdbArchiver/Collector/scalar/BooleanScalar.java
+++ b/src/main/java/TdbArchiver/Collector/scalar/BooleanScalar.java
@@ -165,7 +165,7 @@ public class BooleanScalar extends TdbCollector implements IBooleanScalarListene
 	} else {
 	    final String message = "event is null or empty: " + event;
 	    System.err.println(message);
-	    m_logger.trace(ILogger.LEVEL_ERROR, message);
+	    logger.trace(ILogger.LEVEL_ERROR, message);
 	}
     }
 
@@ -177,14 +177,14 @@ public class BooleanScalar extends TdbCollector implements IBooleanScalarListene
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + "Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + "Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -223,14 +223,14 @@ public class BooleanScalar extends TdbCollector implements IBooleanScalarListene
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(
 		    getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_BOOLEAN, getWritableValue().value()),
 		    tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/TdbArchiver/Collector/scalar/NumberScalar.java b/src/main/java/TdbArchiver/Collector/scalar/NumberScalar.java
index e514bc00ca806905ce36fdbc30a22cdb8bc6324e..b1993a8785d1b40c382b53ff57423989324e4832 100644
--- a/src/main/java/TdbArchiver/Collector/scalar/NumberScalar.java
+++ b/src/main/java/TdbArchiver/Collector/scalar/NumberScalar.java
@@ -206,14 +206,14 @@ public class NumberScalar extends TdbCollector implements INumberScalarListener
 	    scalarEvent.avoidUnderFlow();
 
 	    boolean doArchive = false;
-	    if (isFirstValue) {
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -354,7 +354,7 @@ public class NumberScalar extends TdbCollector implements INumberScalarListener
 	} else {
 	    final String message = "event is null or empty: " + event;
 	    System.err.println(message);
-	    m_logger.trace(ILogger.LEVEL_ERROR, message);
+	    logger.trace(ILogger.LEVEL_ERROR, message);
 	}
     }
 
@@ -365,14 +365,14 @@ public class NumberScalar extends TdbCollector implements INumberScalarListener
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(
 		    getNullValueScalarEvent(errorEvent, ((AAttribute) errorEvent.getSource()).getTangoDataType(),
 			    getWritableValue().value()), tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/TdbArchiver/Collector/scalar/StateScalar.java b/src/main/java/TdbArchiver/Collector/scalar/StateScalar.java
index 130ca90296df312c2be49cc3b7a6642015b0167c..faf55bee535fff2a13c59f4aef17c6bbb55927aa 100644
--- a/src/main/java/TdbArchiver/Collector/scalar/StateScalar.java
+++ b/src/main/java/TdbArchiver/Collector/scalar/StateScalar.java
@@ -55,14 +55,14 @@ public class StateScalar extends TdbCollector implements IDevStateScalarListener
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + "first value, forcing archiving");
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -136,7 +136,7 @@ public class StateScalar extends TdbCollector implements IDevStateScalarListener
 	} else {
 	    final String message = "event is null or empty: " + event;
 	    System.err.println(message);
-	    m_logger.trace(ILogger.LEVEL_ERROR, message);
+	    logger.trace(ILogger.LEVEL_ERROR, message);
 	}
     }
 
@@ -146,14 +146,14 @@ public class StateScalar extends TdbCollector implements IDevStateScalarListener
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(
 		    getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STATE, getWritableValue().value()),
 		    DEFAULT_TRY_NUMBER);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/TdbArchiver/Collector/scalar/StringScalar.java b/src/main/java/TdbArchiver/Collector/scalar/StringScalar.java
index 473aa0ab6ba4741d4127432174950170b1fc0f34..d320b71cbb4f7d1002618cb955bd75edc7daff83 100644
--- a/src/main/java/TdbArchiver/Collector/scalar/StringScalar.java
+++ b/src/main/java/TdbArchiver/Collector/scalar/StringScalar.java
@@ -73,15 +73,15 @@ public class StringScalar extends TdbCollector implements IStringScalarListener
 	String attributeName = scalarEvent.getAttribute_complete_name();
 	try {
 	    boolean doArchive = false;
-	    if (isFirstValue) {
-		m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
+	    if (isFirstValueList.get(attributeName.toLowerCase())) {
 		doArchive = true;
-		isFirstValue = false;
+		isFirstValueList.put(attributeName.toLowerCase(), false);
+		logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
 	    } else {
 
 		final ModesCounters mc = getModeCounter(attributeName);
 		if (mc == null) {
-		    m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
+		    logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
 		} else {
 		    doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
 			    getLastValue(scalarEvent), attributeName);
@@ -147,7 +147,7 @@ public class StringScalar extends TdbCollector implements IStringScalarListener
 	} else {
 	    final String message = "event is null or empty: " + event;
 	    System.err.println(message);
-	    m_logger.trace(ILogger.LEVEL_ERROR, message);
+	    logger.trace(ILogger.LEVEL_ERROR, message);
 	}
 
     }
@@ -159,14 +159,14 @@ public class StringScalar extends TdbCollector implements IStringScalarListener
 	final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
 		+ errorEvent.getSource().toString();
 	Util.out3.println(errorMess);
-	super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
+	super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
 
 	try {
 	    processEventScalar(
 		    getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STRING, getWritableValue().value()),
 		    tryNumber);
 	} catch (final Exception e) {
-	    super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+	    super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
 		    + ".errorChange : during processEventScalar creation execp : " + e);
 	    e.printStackTrace();
 	}
diff --git a/src/main/java/TdbArchiver/TdbArchiver.java b/src/main/java/TdbArchiver/TdbArchiver.java
index 745373804b2d0b4b78539e69ad29b68092fcbbe4..a070bc3506dcea887db89a7a794ebcb7b6fd83d6 100644
--- a/src/main/java/TdbArchiver/TdbArchiver.java
+++ b/src/main/java/TdbArchiver/TdbArchiver.java
@@ -388,19 +388,20 @@ package TdbArchiver;
 import java.io.IOException;
 import java.sql.Timestamp;
 import java.util.Enumeration;
-import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Hashtable;
-import java.util.Map;
+import java.util.Set;
 import java.util.Vector;
+import java.util.concurrent.Executors;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 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;
@@ -569,7 +570,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
     public static final short FAILED = 30;
 
     private ILogger logger;
-    private final Map<String, Boolean> archivingStatus = new HashMap<String, Boolean>();
+    private final Set<String> koAttributes = new HashSet<String>();
+    private final Set<String> okAttributes = new HashSet<String>();
     private String dbSchema;
 
     // --------------------------------------
@@ -626,8 +628,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	attr_image_charge_read = 0;
 	attr_spectrum_charge_read = 0;
 	attr_scalar_charge_read = 0;
-	archivingStatus.clear();
-
+	koAttributes.clear();
+	okAttributes.clear();
 	get_logger().info("dbHost = " + dbHost);
 	get_logger().info("dbName = " + dbName);
 
@@ -652,24 +654,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	    TangoStateUtils.setFault(this, "database connection error");
 	    get_logger().error("ERROR : Database unconnected !!");
 	} else {
-	    try {
-		final Vector<AttributeLightMode> myCurrentTasks = dbProxy.getArchiverCurrentTasks(device_name);
-		if (myCurrentTasks != null && myCurrentTasks.size() > 0) {
-		    final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.basicObjectCreation();
-		    for (int i = 0; i < myCurrentTasks.size(); i++) {
-			archivingMessConfig.add(myCurrentTasks.elementAt(i));
-		    }
-
-		    final boolean forceThreadedMode = false;
-		    startArchiving(archivingMessConfig, forceThreadedMode, false);
-		} else {
-		    TangoStateUtils.setOn(this, archivingStatus);
-		}
-	    } catch (final DevFailed devFailed) {
-		final String message = DBTools.getCompleteMessage(devFailed);
-		get_logger().error(message);
-		TangoStateUtils.setFault(this, message);
-	    }
+	    Executors.newSingleThreadExecutor().submit(new InitDeviceTask());
 	}
     }
 
@@ -708,6 +693,31 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	}
     }
 
+    private class InitDeviceTask implements Runnable {
+	@Override
+	public void run() {
+	    Vector<AttributeLightMode> myCurrentTasks = null;
+	    try {
+		myCurrentTasks = dbProxy.getArchiverCurrentTasks(device_name);
+	    } catch (ArchivingException e) {
+		logger.trace(ILogger.LEVEL_ERROR, "cannot getArchiverCurrentTasks " + e);
+		TangoStateUtils.setFault(TdbArchiver.this, e.getMessage());
+	    }
+	    try {
+		if (myCurrentTasks != null && myCurrentTasks.size() > 0) {
+		    final ArchivingMessConfig archivingMessConfig = ArchivingMessConfig.basicObjectCreation();
+		    for (final AttributeLightMode attributeLightMode : myCurrentTasks) {
+			archivingMessConfig.add(attributeLightMode);
+		    }
+		    triggerArchiving(archivingMessConfig.toArray(), false);
+		}
+	    } catch (final DevFailed devFailed) {
+	    } finally {
+		TangoStateUtils.updateState(TdbArchiver.this, koAttributes, okAttributes);
+	    }
+	}
+    }
+
     private class StartArchivingRunnable implements Runnable {
 	private final ArchivingMessConfig archivingMessConfig;
 	private final boolean updateAMTTable;
@@ -722,7 +732,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	    try {
 		triggerArchiving(archivingMessConfig.toArray(), updateAMTTable);
 	    } catch (final DevFailed devFailed) {
-		TangoStateUtils.setDisable(TdbArchiver.this, archivingStatus);
+	    } finally {
+		TangoStateUtils.updateState(TdbArchiver.this, koAttributes, okAttributes);
 	    }
 	}
     }
@@ -950,6 +961,10 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	get_logger().info("In always_executed_hook method()");
     }
 
+    public String[] getKOAttributes() {
+	return koAttributes.toArray(new String[koAttributes.size()]);
+    }
+
     // ===================================================================
     /**
      * Method called by the read_attributes CORBA operation to set internal
@@ -994,7 +1009,11 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
     public void trigger_archive_conf(final String[] argin) throws DevFailed {
 
 	TangoStateUtils.isAllowed(this);
-	triggerArchiving(argin, true);
+	try {
+	    triggerArchiving(argin, true);
+	} finally {
+	    TangoStateUtils.updateState(this, koAttributes, okAttributes);
+	}
     }
 
     private void triggerArchiving(final String[] argin, final boolean updateAMTTable) throws DevFailed {
@@ -1049,7 +1068,8 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 		    }
 
 		}
-		archivingStatus.put(attCompleteName, true);
+		okAttributes.add(attCompleteName.toLowerCase());
+		koAttributes.remove(attCompleteName.toLowerCase());
 		logger.trace(ILogger.LEVEL_INFO, "OK: " + attCompleteName);
 	    } catch (final ArchivingException e) {
 		try {
@@ -1058,20 +1078,26 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 		}
 		e.printStackTrace();
 		final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : ";
-		final String reason = "Failed while executing TdbArchiver.trigger_archive_conf() method...";
-		final String desc = "impossible to start " + attCompleteName;
-		archivingException.addStack(message, reason, ErrSeverity.PANIC, desc, "", e);
+		archivingException.addStack(message, e);
 		hasToThrow = true;
-		logger.trace(ILogger.LEVEL_ERROR, reason + " " + desc);
-		archivingStatus.put(attCompleteName, false);
+		logger.trace(ILogger.LEVEL_ERROR, e);
+		koAttributes.add(attCompleteName.toLowerCase());
+		okAttributes.remove(attCompleteName.toLowerCase());
 		logger.trace(ILogger.LEVEL_INFO, "KO: " + attCompleteName);
+	    } catch (Exception e) {
+		try {
+		    collectorFactory.remove(attCompleteName);
+		} catch (final ArchivingException e1) {
+		}
+		e.printStackTrace();
+		koAttributes.add(attCompleteName.toLowerCase());
+		okAttributes.remove(attCompleteName.toLowerCase());
+		logger.trace(ILogger.LEVEL_ERROR, "KO " + attCompleteName + " unexpected " + e);
 	    }
 	}
 
 	computeLoads();
 
-	TangoStateUtils.setOn(this, archivingStatus);
-
 	if (hasToThrow) {
 	    logger.trace(ILogger.LEVEL_INFO, "trigger_archive_conf ERROR - out");
 	    throw archivingException.toTangoException();
@@ -1179,55 +1205,34 @@ 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()");
-
-	final AttributeLightMode attributeLightMode = AttributeLightMode.creationWithFullInformation(argin);
-	TdbCollector tdbCollector = null;
+	logger.trace(ILogger.LEVEL_INFO, "stop_archive_att - in");
 	try {
-	    dbProxy.updateModeRecord(attributeLightMode);
-
-	    tdbCollector = collectorFactory.get(attributeLightMode);
-
-	    if (tdbCollector != null) {
-		tdbCollector.removeSource(attributeLightMode.getAttribute_complete_name(), true);
-		if (!tdbCollector.isRefreshing()) {
-		    collectorFactory.destroy(attributeLightMode);
+	    String attributeName = argin[0];
+	    // final AttributeLightMode attributeLightMode =
+	    // AttributeLightMode.creationWithFullInformation(argin);
+	    logger.trace(ILogger.LEVEL_INFO, "attribute: " + attributeName);
+	    if (koAttributes.contains(attributeName.toLowerCase())
+		    || okAttributes.contains(attributeName.toLowerCase())) {
+		// stop only if attribute is managed by this archiver
+		dbProxy.updateModeRecord(attributeName);
+		TdbCollector tdbCollector = collectorFactory.get(attributeName);
+		if (tdbCollector != null) {
+		    tdbCollector.removeSource(attributeName, false);
 		}
-	    } 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.
-	    {
-		final String msg = "TdbArchiver/stop_archive_att/getAttribute_complete_name|"
-			+ attributeLightMode.getAttribute_complete_name()
-			+ "| The collector is missing. 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.";
-		logger.trace(ILogger.LEVEL_ERROR, msg);
-
-		/*
-		 * String message = "Attempt to get a missing collector!";
-		 * String reason =
-		 * "Missing collector for attribute: "+attributeLightMode
-		 * .getAttribute_complete_name(); String desc =
-		 * "Failed while executing TdbArchiver.stop_archive_att"; throw
-		 * new ArchivingException(message , reason , ErrSeverity.PANIC ,
-		 * desc , "");
-		 */
+		koAttributes.remove(attributeName.toLowerCase());
+		okAttributes.remove(attributeName.toLowerCase());
+	    } else {
+		DevFailedUtils.throwDevFailed(attributeName + " is not archived by this device");
 	    }
-	    archivingStatus.remove(attributeLightMode.getAttribute_complete_name());
 	} catch (final ArchivingException e) {
-	    logWarningAboutRiskySettingOfStateBackToOn("StopArchiveAtt", e);
-
-	    get_logger().error(e.toString());
-	    Util.out2.println(e.toString());
+	    logger.trace(ILogger.LEVEL_ERROR, e);
+	    e.printStackTrace();
 	    throw e.toTangoException();
 	} finally {
 	    computeLoads();
-	    if (wasDisable) {
-		TangoStateUtils.setDisable(this, archivingStatus);
-	    } else {
-		TangoStateUtils.setOn(this, archivingStatus);
-	    }
+	    TangoStateUtils.updateState(this, koAttributes, okAttributes);
+	    logger.trace(ILogger.LEVEL_INFO, "stop_archive_att - out");
 	}
 
 	get_logger().info("Exiting stop_archive_att()");
@@ -1297,7 +1302,7 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 
 	// ---Add your Own code to control device here ---
 	final StringBuffer stringBuffer = new StringBuffer();
-	stringBuffer.append(TangoStateUtils.statusToString(archivingStatus));
+	stringBuffer.append(TangoStateUtils.statusToString(koAttributes, okAttributes));
 	stringBuffer.append(collectorFactory.factoryAssessment());
 	argout = stringBuffer.toString();
 	get_logger().info("Exiting state_detailed()");
@@ -1313,21 +1318,17 @@ public class TdbArchiver extends DeviceImpl implements TangoConst {
 	try {
 	    final Util tg = Util.init(argv, "TdbArchiver");
 	    tg.server_init();
-
 	    System.out.println("Ready to accept request");
-
 	    tg.server_run();
 	} catch (final OutOfMemoryError ex) {
 	    System.err.println("Can't allocate memory !!!!");
 	    System.err.println("Exiting");
 	} catch (final UserException ex) {
 	    Except.print_exception(ex);
-
 	    System.err.println("Received a CORBA user exception");
 	    System.err.println("Exiting");
 	} catch (final SystemException ex) {
 	    Except.print_exception(ex);
-
 	    System.err.println("Received a CORBA system exception");
 	    System.err.println("Exiting");
 	}
diff --git a/src/main/java/TdbArchiver/TdbArchiverClass.java b/src/main/java/TdbArchiver/TdbArchiverClass.java
index 2387cab6e9ba47999a25405632e3fd27aa88c839..1a232140f7da0cf8f9027041e545ade53fd2d518 100644
--- a/src/main/java/TdbArchiver/TdbArchiverClass.java
+++ b/src/main/java/TdbArchiver/TdbArchiverClass.java
@@ -69,6 +69,7 @@ import fr.esrf.TangoDs.Attr;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandOut;
 import fr.esrf.TangoDs.Util;
 
 public class TdbArchiverClass extends DeviceClass implements TangoConst {
@@ -80,7 +81,7 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
     /**
      * Class properties array.
      */
-    private DbDatum[] cl_prop = null;
+    private final DbDatum[] cl_prop = null;
 
     // --------- Start of properties data members ----------
 
@@ -185,26 +186,21 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
 			"A return code, can be either: 10 (the archiver isn't in charge of the specified attribute) 20 (the retry succeeded) or 30 (the retry failed)",
 			DispLevel.OPERATOR));
 
-	command_list.addElement(new TriggerArchiveConfCmd("TriggerArchiveConf",
-		Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The group of attributes to archive", "",
-		DispLevel.OPERATOR));
-	command_list.addElement(new TriggerArchiveAttCmd("TriggerArchiveAtt",
-		Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The attribute to archive", "",
-		DispLevel.OPERATOR));
-	command_list.addElement(new TriggerArchiveAttCheckCmd("TriggerArchiveAttCheck",
-		Tango_DEV_STRING, Tango_DEV_VOID, "The name of the attribute to archive", "",
-		DispLevel.OPERATOR));
-	command_list.addElement(new StopArchiveConfCmd("StopArchiveConf", Tango_DEVVAR_STRINGARRAY,
-		Tango_DEV_VOID, "The group of attributes", "", DispLevel.OPERATOR));
-	command_list.addElement(new StopArchiveAttCmd("StopArchiveAtt", Tango_DEVVAR_STRINGARRAY,
-		Tango_DEV_VOID, "the attribute on witch archiving must be stopped", "",
-		DispLevel.OPERATOR));
-	command_list.addElement(new ExportData2DbCmd("ExportData2Db", Tango_DEVVAR_STRINGARRAY,
-		Tango_DEV_VOID, "the attribute from witch  data are expected.", "",
-		DispLevel.OPERATOR));
-	command_list.addElement(new StateDetailedClass("StateDetailed", Tango_DEV_VOID,
-		Tango_DEV_STRING, "", "The detailed state", DispLevel.EXPERT));
-
+	command_list.addElement(new TriggerArchiveConfCmd("TriggerArchiveConf", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_VOID, "The group of attributes to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new TriggerArchiveAttCmd("TriggerArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"The attribute to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new TriggerArchiveAttCheckCmd("TriggerArchiveAttCheck", Tango_DEV_STRING,
+		Tango_DEV_VOID, "The name of the attribute to archive", "", DispLevel.OPERATOR));
+	command_list.addElement(new StopArchiveConfCmd("StopArchiveConf", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"The group of attributes", "", DispLevel.OPERATOR));
+	command_list.addElement(new StopArchiveAttCmd("StopArchiveAtt", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"the attribute on witch archiving must be stopped", "", DispLevel.OPERATOR));
+	command_list.addElement(new ExportData2DbCmd("ExportData2Db", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"the attribute from witch  data are expected.", "", DispLevel.OPERATOR));
+	command_list.addElement(new StateDetailedClass("StateDetailed", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The detailed state", DispLevel.EXPERT));
+	command_list.addElement(new TemplCommandOut("GetKOAttributes", "getKOAttributes"));
 	// add polling if any
 	/*
 	 * for (int i = 0; i < command_list.size(); i++) { Command cmd =
@@ -224,8 +220,7 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
     // ===================================================================
     @Override
     public void device_factory(final String[] devlist) throws DevFailed {
-	final String device_version = ResourceBundle.getBundle("application").getString(
-		"project.version");
+	final String device_version = ResourceBundle.getBundle("application").getString("project.version");
 	for (int i = 0; i < devlist.length; i++) {
 	    // Util.out4.println("Device name : " + devlist[ i ]);
 
@@ -255,8 +250,7 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
 	att_list.addElement(scalar_charge);
 
 	// Attribute : spectrum_charge
-	final Attr spectrum_charge = new Attr("spectrum_charge", Tango_DEV_SHORT,
-		AttrWriteType.READ);
+	final Attr spectrum_charge = new Attr("spectrum_charge", Tango_DEV_SHORT, AttrWriteType.READ);
 	att_list.addElement(spectrum_charge);
 
 	// Attribute : image_charge
@@ -275,16 +269,12 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
      * 
      * @param name
      *            The property name.
+     * @throws DevFailed
      */
     // ===================================================================
-    public DbDatum get_class_property(final String name) {
-	for (final DbDatum element : cl_prop) {
-	    if (element.name.equals(name)) {
-		return element;
-	    }
-	}
-	// if not found, return an empty DbDatum
-	return new DbDatum(name);
+    public DbDatum get_class_property(final String name) throws DevFailed {
+	DbDatum[] classProps = get_db_class().get_property(new String[] { name });
+	return classProps[0];
     }
 
     // ===================================================================
@@ -293,42 +283,6 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
      */
     // ===================================================================
     public void get_class_property() throws DevFailed {
-	// Initialize your default values here.
-	// ------------------------------------------
-
-	// Read class properties from database.(Automatic code generation)
-	// -------------------------------------------------------------
-	if (Util._UseDb == false) {
-	    return;
-	}
-	final String[] propnames = { "DbHost", "DbName", "RacConnection", "AttributePerFile" };
-
-	// Call database and extract values
-	// --------------------------------------------
-	cl_prop = get_db_class().get_property(propnames);
-	int i = -1;
-	// Extract DbHost value
-	if (cl_prop[++i].is_empty() == false) {
-	    dbHost = cl_prop[i].extractString();
-	} else {
-	    cl_prop[i].insert(dbHost);
-	}
-
-	// Extract DbName value
-	if (cl_prop[++i].is_empty() == false) {
-	    dbName = cl_prop[i].extractString();
-	} else {
-	    cl_prop[i].insert(dbName);
-	}
-	// Extract RacConnection value
-	if (cl_prop[++i].is_empty() == false) {
-	    RacConnection = cl_prop[i].extractBoolean();
-	} else {
-	    cl_prop[i].insert(RacConnection);
-	}
-
-	// End of Automatic code generation
-	// -------------------------------------------------------------
 
     }
 
@@ -351,8 +305,7 @@ public class TdbArchiverClass extends DeviceClass implements TangoConst {
 	data[0].insert("Tango Device Server");
 
 	data[1] = new DbDatum("Description");
-	data[1]
-		.insert("Tis project defines the Tango DServer in charge of the intermediate archiving service.");
+	data[1].insert("Tis project defines the Tango DServer in charge of the intermediate archiving service.");
 
 	// Call database and and values
 	// --------------------------------------------
diff --git a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java
index d45c2fa636249a32468425477eb7efba8880862d..8a6225d14bd3ce0b70649105f826dfe68610a617 100644
--- a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java
+++ b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcher.java
@@ -1,5 +1,7 @@
 package TdbArchivingWatcher;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -15,27 +17,29 @@ import fr.esrf.Tango.DevError;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
 import fr.esrf.Tango.ErrSeverity;
+import fr.esrf.TangoApi.ApiUtil;
 import fr.esrf.TangoApi.DbDatum;
+import fr.esrf.TangoApi.DeviceData;
+import fr.esrf.TangoApi.DeviceProxy;
+import fr.esrf.TangoApi.Group.Group;
+import fr.esrf.TangoApi.Group.GroupCmdReply;
+import fr.esrf.TangoApi.Group.GroupCmdReplyList;
 import fr.esrf.TangoDs.Attribute;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.Except;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Diary.ILogger;
-import fr.soleil.commonarchivingapi.ArchivingTools.Diary.LoggerFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.ConfigConst;
+import fr.soleil.hdbtdbArchivingApi.ArchivingManagerApi.TdbArchivingManagerApiRef;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Mode.Mode;
 import fr.soleil.hdbtdbArchivingApi.ArchivingTools.Tools.ArchivingException;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.ArchivingWatch;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Archiver;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ArchivingAttribute;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ArchivingAttributeSubName;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ControlResult;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ControlResultLine;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.Domain;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.ModeData;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchiversComparator;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.ArchivingAttributeComparator;
-import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.dto.comparators.DomainsComparator;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.lifecycle.LifeCycleManagerFactory;
 import fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.strategy.control.safetyperiod.SaferPeriodCalculatorFactory;
@@ -91,18 +95,12 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
     protected short[] attr_ArchivingHealth_read = new short[1];
     protected String[] attr_FormattedReport_read = new String[10000];
 
-    // private ControlResultLineComparator linesComparator;
-    private ArchiversComparator archiversComparator;
-    private DomainsComparator domainsComparator;
-    // private ArchivingAttributeSubNamesComparator
-    // archivingAttributeSubNamesComparator;
     private ArchivingAttributeComparator archivingAttributeComparator;
 
     // --------- End of attributes data members ----------
 
     // Add your own data members here
     private ControlResult controlResult;
-    private final int readType = IDelayManager.READ_ROLLOVER;
 
     // --------------------------------------
 
@@ -161,27 +159,38 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	// Initialise variables to default values
 	super.initArchivingDataWatch();
 
-	LifeCycleManagerFactory.setWatcherToWarn(this);
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
-		.getImpl(LifeCycleManagerFactory.TDB_LIFE_CYCLE);
-	final Thread watcherThread = lifeCycleManager.getAsThread();
-
-	startLoggingFactory();
-
-	// this.linesComparator = new ControlResultLineComparator ();
-	archiversComparator = new ArchiversComparator();
-	domainsComparator = new DomainsComparator();
-	// this.archivingAttributeSubNamesComparator = new
-	// ArchivingAttributeSubNamesComparator ();
 	archivingAttributeComparator = new ArchivingAttributeComparator();
+	initLifeCycleManager(LifeCycleManagerFactory.TDB_LIFE_CYCLE);
+    }
 
-	watcherThread.start();
-
-	if (!ArchivingWatch.isDoStartOnInitDevice())// this.doStartOnInitDevice
-	// )
-	{
-	    warnOff();
+    /**
+     * ask all archivers for their KO attributes
+     * 
+     * @return
+     * @throws DevFailed
+     */
+    public String[] getKOAttributesFromArchivers(boolean doRetry) throws DevFailed {
+
+	List<String> archiversStatus = new ArrayList<String>();
+	String[] archiverNames = ApiUtil.get_db_obj().get_device_exported_for_class(
+		TdbArchivingManagerApiRef.classDevice);
+	Group group = new Group("archivers");
+	group.add(archiverNames);
+	GroupCmdReplyList replies = group.command_inout("GetKOAttributes", true);
+	for (Object reply : replies) {
+	    GroupCmdReply r = (GroupCmdReply) reply;
+	    try {
+		DeviceData result = r.get_data();
+		String archiverStatus = r.dev_name() + " " + Arrays.toString(result.extractStringArray());
+		archiversStatus.add(archiverStatus);
+		if (doRetry) {
+		    new DeviceProxy(r.dev_name()).command_inout_asynch("RetryForAttribute", result, true);
+		}
+	    } catch (DevFailed e) {
+		archiversStatus.add(r.dev_name() + " ERROR");
+	    }
 	}
+	return archiversStatus.toArray(new String[archiversStatus.size()]);
     }
 
     // =========================================================
@@ -208,12 +217,8 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
      */
     // ===================================================================
     @Override
-    public void read_attr_hardware(final Vector attr_list) throws DevFailed {
-	final IDelayManager delayManager = DelayManagerFactory.getCurrentImpl();
-	controlResult = delayManager.getControlResult(IDelayManager.READ_ROLLOVER);
-	if (controlResult == null) {
-	    Except.throw_exception("DEVICE_ ERROR", "cannot get archiving status", "read_attr_hardware");
-	}
+    public void read_attr_hardware(@SuppressWarnings("rawtypes") final Vector attr_list) throws DevFailed {
+	controlResult = updateControlResult();
     }
 
     // ===================================================================
@@ -235,7 +240,6 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	    attr.set_value((short) code);
 	} else if (attr_name.equals("FormattedReport")) {
 	    final String report = controlResult == null ? ControlResult.EMPTY_REPORT : controlResult.getReport();
-
 	    final String[] res = new String[1];
 	    res[0] = report;
 	    attr.set_value(res, 1);
@@ -309,8 +313,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering start()");
 
 	// ---Add your Own code to control device here ---
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	lifeCycleManager.startProcessing();
+	getLifeCycleManager().startProcessing();
 	// ---END
 
 	get_logger().info("Exiting start()");
@@ -384,29 +387,13 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering stop()");
 
 	// ---Add your Own code to control device here ---
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	lifeCycleManager.stopProcessing();
+	getLifeCycleManager().stopProcessing();
 	// this.warnOff ();
 	// ---END
 
 	get_logger().info("Exiting stop()");
     }
 
-    /*
-     * private void goBackToFormerState () { System.out.println (
-     * "CLA/ArchivingWatcher/goBackToFormerState!!!!!!!!!!!!!!!" ); //if (
-     * !this.get_state().get )
-     * 
-     * if ( this.formerState != DevState._UNKNOWN ) { System.out.println (
-     * "CLA/ArchivingWatcher/goBackToFormerState/this.formerState/"
-     * +this.formerState
-     * +"/DevState._ALARM/"+DevState._ALARM+"/DevState._ON/"+DevState
-     * ._ON+"/DevState._OFF/"+DevState._OFF); this.set_state ( (short)
-     * this.formerState ); } else { System.out.println (
-     * "CLA/ArchivingWatcher/goBackToFormerState/ON"); this.set_state (
-     * DevState.ON ); } }
-     */
-
     // =========================================================
     /**
      * Execute command "GetErrorArchiversCurrent" on device. Lists the archivers
@@ -424,96 +411,6 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	return get_error_archivers(_controlResult);
     }
 
-    /**
-     * @param result
-     * @return
-     */
-    private String[] get_error_archivers(final ControlResult _controlResult) {
-	final String[] empty = new String[0];
-	if (_controlResult == null) {
-	    return empty;
-	}
-
-	final Map _errorArchivers = _controlResult.getErrorArchivers();
-	final String[] argout = new String[_errorArchivers.size()];
-
-	final List list = new Vector();
-	list.addAll(_errorArchivers.values());
-	Collections.sort(list, archiversComparator);
-	final Iterator it = list.iterator();
-
-	int i = 0;
-	while (it.hasNext()) {
-	    final Archiver key = (Archiver) it.next();
-	    argout[i] = key.getName();
-	    i++;
-	}
-
-	return argout;
-    }
-
-    // =========================================================
-    /**
-     * Execute command "GetErrorsForArchiver" on device. Lists KO attributes for
-     * this archiver
-     * 
-     * @param argin
-     *            The name of the archiver
-     * @return The list of KO attributes for this archiver
-     */
-    // =========================================================
-    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;
-	}
-
-	final Map<String, Archiver> _errorArchivers = _controlResult.getErrorArchivers();
-	if (_errorArchivers == null) {
-	    return empty;
-	}
-
-	final Archiver archiver = _errorArchivers.get(argin);
-	if (archiver == null) {
-	    return empty;
-	}
-
-	final Hashtable _errorAttributes = archiver.getKOAttributes();
-	if (_errorAttributes == null) {
-	    return empty;
-	}
-
-	final String[] argout = new String[_errorAttributes.size()];
-	final List list = new Vector();
-	list.addAll(_errorAttributes.values());
-	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
-	int i = 0;
-
-	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
-	    argout[i] = key.getCompleteName();
-	    i++;
-	}
-	// -----------------END
-	return argout;
-    }
-
-    // =========================================================
-    /**
-     * Execute command "Reset" on device. Notifies the device that the last
-     * alarm (should it exist) was taken into account by the user.
-     * 
-     */
-    // =========================================================
-    // public synchronized void reset() throws DevFailed
-    // {
-    // get_logger().info("Entering reset()");
-    // // ---Add your Own code to control device here ---
-    // this.goBackToFormerState ();
-    // get_logger().info("Exiting reset()");
-    // }
-
     // =========================================================
     /**
      * Execute command "Reset" on device. This is used after a KO control cycle
@@ -529,15 +426,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	    // do nothing
 	    return;
 	}
-
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory.getCurrentImpl();
-	final boolean isProcessing = lifeCycleManager.isProcessing();
-	if (isProcessing) {
-	    this.set_state((short) DevState._ON);
-	} else {
-	    this.set_state((short) DevState._OFF);
-	}
-
+	initLifeCycleManager(LifeCycleManagerFactory.HDB_LIFE_CYCLE);
 	get_logger().info("Exiting reset()");
     }
 
@@ -550,8 +439,7 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	get_logger().info("Entering restart()");
 
 	// complete stop
-	final LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
-		.getImpl(LifeCycleManagerFactory.TDB_LIFE_CYCLE);
+	final LifeCycleManager lifeCycleManager = getLifeCycleManager();
 	lifeCycleManager.stopProcessing();
 
 	final Thread watcherThread = lifeCycleManager.getAsThread();
@@ -564,41 +452,9 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 
 	// restarting
 	init_device();
-
-	final boolean isProcessing = lifeCycleManager.isProcessing();
-	if (isProcessing) {
-	    this.set_state((short) DevState._ON);
-	} else {
-	    this.set_state((short) DevState._OFF);
-	}
-
 	get_logger().info("Exiting restart()");
     }
 
-    private String[] get_error_domains(final ControlResult _controlResult) throws DevFailed {
-	final String[] empty = new String[0];
-	if (_controlResult == null) {
-	    return empty;
-	}
-
-	final Map<String, Domain> _errorDomains = _controlResult.getErrorDomains();
-	final String[] argout = new String[_errorDomains.size()];
-
-	final List list = new Vector();
-	list.addAll(_errorDomains.values());
-	Collections.sort(list, domainsComparator);
-	final Iterator it = list.iterator();
-
-	int i = 0;
-	while (it.hasNext()) {
-	    final Domain key = (Domain) it.next();
-	    argout[i] = key.getName();
-	    i++;
-	}
-
-	return argout;
-    }
-
     // =========================================================
     /**
      * Execute command "GetErrorsForDomain" on device. Lists KO attributes for
@@ -625,21 +481,21 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	    return empty;
 	}
 
-	final Hashtable _errorAttributes = domain.getKOAttributes();
+	final Hashtable<String, ArchivingAttribute> _errorAttributes = domain.getKOAttributes();
 	if (_errorAttributes == null) {
 	    return empty;
 	}
 
 	final String[] argout = new String[_errorAttributes.size()];
 
-	final List list = new Vector();
+	final List<ArchivingAttribute> list = new Vector<ArchivingAttribute>();
 	list.addAll(_errorAttributes.values());
 	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
+	final Iterator<ArchivingAttribute> it = list.iterator();
 
 	int i = 0;
 	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
+	    final ArchivingAttribute key = it.next();
 	    argout[i] = key.getCompleteName();
 	    i++;
 	}
@@ -647,31 +503,6 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	return argout;
     }
 
-    // =========================================================
-    /**
-     * Execute command "SetMode" on device. Choose a mode. Must be one of those
-     * predefined modes: READ_LATEST_COMPLETE_CYCLE = 10
-     * READ_LATEST_COMPLETE_CYCLE_AUTO = 11 READ_LATEST_COMPLETE_STEP = 20
-     * READ_LATEST_ADDITION = 30 READ_LATEST_BAD_CYCLE = 40
-     * 
-     * @param argin
-     *            The mode
-     */
-    // =========================================================
-    /*
-     * public synchronized void set_mode(short argin) throws DevFailed {
-     * get_logger().info("Entering set_mode()");
-     * 
-     * // ---Add your Own code to control device here --- IDelayManager
-     * delayManager = DelayManagerFactory.getCurrentImpl (); try {
-     * delayManager.setReadType ( argin ); this.readType = argin; } catch (
-     * IllegalArgumentException iae ) { DevFailed devFailed = new DevFailed ();
-     * devFailed.initCause ( iae ); throw iae; }
-     * //------------------------------------------------
-     * 
-     * get_logger().info("Exiting set_mode()"); }
-     */
-
     // =========================================================
     /**
      * Execute command "GetErrorsForAttribute" on device. Returns the list of KO
@@ -698,21 +529,21 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 	    return empty;
 	}
 
-	final Hashtable _errorAttributes = attributeSubName.getKOAttributes();
+	final Hashtable<String, ArchivingAttribute> _errorAttributes = attributeSubName.getKOAttributes();
 	if (_errorAttributes == null) {
 	    return empty;
 	}
 
 	final String[] argout = new String[_errorAttributes.size()];
 
-	final List list = new Vector();
+	final List<ArchivingAttribute> list = new Vector<ArchivingAttribute>();
 	list.addAll(_errorAttributes.values());
 	Collections.sort(list, archivingAttributeComparator);
-	final Iterator it = list.iterator();
+	final Iterator<ArchivingAttribute> it = list.iterator();
 
 	int i = 0;
 	while (it.hasNext()) {
-	    final ArchivingAttribute key = (ArchivingAttribute) it.next();
+	    final ArchivingAttribute key = it.next();
 	    argout[i] = key.getCompleteName();
 	    i++;
 	}
@@ -1269,18 +1100,6 @@ public class TdbArchivingWatcher extends AbsArchivingWatcher {
 
     // =========================================================
 
-    private void startLoggingFactory() {
-	// System.out.println (
-	// "CLA/startLoggingFactory/this.device_name/"+this.device_name+"/hashCode/"+this.hashCode
-	// ()+"/this.hasDiary/"+this.hasDiary );
-
-	final ILogger _logger = LoggerFactory.getImpl(device_name, ArchivingWatch.getDiaryPath(),
-		ArchivingWatch.isHasDiary());
-	_logger.setTraceLevel(ArchivingWatch.getDiaryLogLevel());
-
-	logger = _logger;
-    }
-
     @Override
     public void delete_device() throws DevFailed {
 	// TODO Auto-generated method stub
diff --git a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcherClass.java b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcherClass.java
index 4db2386365be324e724f6a64ff0fd07c525459c4..b97c3f1bfa9a28e2e4afa4288a53287531fa5124 100644
--- a/src/main/java/TdbArchivingWatcher/TdbArchivingWatcherClass.java
+++ b/src/main/java/TdbArchivingWatcher/TdbArchivingWatcherClass.java
@@ -92,6 +92,7 @@ import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.SpectrumAttr;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandInOut;
 import fr.esrf.TangoDs.UserDefaultAttrProp;
 import fr.esrf.TangoDs.Util;
 
@@ -263,6 +264,8 @@ public class TdbArchivingWatcherClass extends DeviceClass implements TangoConst
 
 	command_list.addElement(new GetFeedAliveProgressionClass("GetFeedAliveProgression", Tango_DEV_VOID,
 		Tango_DEV_LONG, "", "Percentage of the feedalive execution ", DispLevel.OPERATOR));
+	command_list.addElement(new TemplCommandInOut("GetKOAttributesFromArchivers", "getKOAttributesFromArchivers",
+		"do a retry", "the list of ko per archiver"));
 
 	// add polling if any
 	/*
diff --git a/src/main/java/TdbExtractor/ExtractBetweenDatesClass.java b/src/main/java/TdbExtractor/ExtractBetweenDatesClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..b31b03d410c3e4ada646cec812339e8a65c3c225
--- /dev/null
+++ b/src/main/java/TdbExtractor/ExtractBetweenDatesClass.java
@@ -0,0 +1,155 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/archiving/HdbExtractor/ExtractBetweenDatesClass.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               HdbExtractor class.
+//
+// $Author: chinkumo $
+//
+// $Revision: 1.3 $
+//
+// $Log: ExtractBetweenDatesClass.java,v $
+// Revision 1.3  2005/11/29 16:17:37  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.2  2005/11/15 13:45:51  chinkumo
+// ...
+//
+// Revision 1.1  2005/09/09 10:03:21  chinkumo
+// First commit !
+// (Dynamic attribut release)
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author: chinkumo $
+ * @version	$Revision: 1.3 $
+ */
+package TdbExtractor;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: Retrieves data beetwen two dates, for a given scalar
+ * attribute. Create a dynamic attribute, retrieve data from database and
+ * prepare result for attribute_history call.
+ */
+
+public class ExtractBetweenDatesClass extends Command implements TangoConst {
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param out
+     *            argout type
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out) {
+	super(name, in, out);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out, final String in_comments,
+	    final String out_comments) {
+	super(name, in, out, in_comments, out_comments);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class ExtractBetweenDatesClass
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     * @param level
+     *            The command display type OPERATOR or EXPERT
+     */
+    // ===============================================================
+    public ExtractBetweenDatesClass(final String name, final int in, final int out, final String in_comments,
+	    final String out_comments, final DispLevel level) {
+	super(name, in, out, in_comments, out_comments, level);
+    }
+
+    // ===============================================================
+    /**
+     * return the result of the device's command.
+     */
+    // ===============================================================
+    @Override
+    public Any execute(final DeviceImpl device, final Any in_any) throws DevFailed {
+	Util.out2.println("ExtractBetweenDatesClass.execute(): arrived");
+	final String[] argin = extract_DevVarStringArray(in_any);
+
+	if (!(device instanceof TdbExtractor)) {
+	    Except.throw_exception("DEVICE_ERROR", "Device parameter is not instance of HdbExtractor", "HdbExtractor");
+	}
+
+	return insert(((TdbExtractor) device).extractBetweenDates(argin));
+    }
+
+    // ===============================================================
+    /**
+     * Check if it is allowed to execute the command.
+     */
+    // ===============================================================
+    @Override
+    public boolean is_allowed(final DeviceImpl device, final Any data_in) {
+	// End of Generated Code
+
+	// Re-Start of Generated Code
+	return true;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:/cvsroot/tango-cs/tango/jserver/archiving/HdbExtractor/
+ * ExtractBetweenDatesClass.java,v $
+ */
diff --git a/src/main/java/TdbExtractor/TdbExtractor.java b/src/main/java/TdbExtractor/TdbExtractor.java
index 9086f5effa74b35ef89fa725e29f63aacf87326d..a0fa57a7dfabe82d6c8005f7efd54562a59ae240 100644
--- a/src/main/java/TdbExtractor/TdbExtractor.java
+++ b/src/main/java/TdbExtractor/TdbExtractor.java
@@ -171,6 +171,7 @@ import java.util.StringTokenizer;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 import TdbExtractor.Proxy.DbProxy;
 import fr.esrf.Tango.AttrDataFormat;
@@ -178,6 +179,7 @@ import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.DevError;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
+import fr.esrf.Tango.DevVarDoubleStringArray;
 import fr.esrf.Tango.DevVarLongStringArray;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoApi.DbDatum;
@@ -191,6 +193,7 @@ import fr.esrf.TangoDs.SpectrumAttr;
 import fr.esrf.TangoDs.TangoConst;
 import fr.esrf.TangoDs.Util;
 import fr.soleil.commonarchivingapi.ArchivingTools.Tools.DbData;
+import fr.soleil.commonarchivingapi.ArchivingTools.Tools.NullableTimedData;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.ConfigConst;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.DataBaseManager;
 import fr.soleil.hdbtdbArchivingApi.ArchivingApi.TDBDataBaseManager;
@@ -1219,6 +1222,69 @@ public class TdbExtractor extends DeviceImpl
 	 */
     }
 
+    /**
+     * Get the newest inserted value for an attribute. Returns READ part only
+     * 
+     * @param attributeName
+     *            the attribute name
+     * @return timestamp; values
+     * @throws DevFailed
+     */
+    public String getNewestValue(final String attributeName) throws DevFailed {
+	String argout = "";
+	get_logger().info("Entering getNewestValue");
+	try {
+	    DbData data = dbProxy.getDataBase().getExtractor().getDataGetters().getNewestValue(attributeName);
+	    if (data.getData_timed() != null && data.getData_timed()[0] != null) {
+		argout = Long.toString(data.getData_timed()[0].time) + "; ";
+		Object value = data.getData_timed()[0].value[0];
+		argout = argout + value.toString();
+	    } else {
+		DevFailedUtils.throwDevFailed("no data found for " + attributeName);
+	    }
+	} catch (final ArchivingException e) {
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting getNewestValue");
+	return argout;
+    }
+
+    /**
+     * Get the nearest value and timestamp of an attribute for a given
+     * timestamp. Returns READ part only
+     * 
+     * @param argin
+     *            [attributeName, timestamp]. timestamp format is DD-MM-YYYY
+     *            HH24:MI:SS
+     * @return timestamp; values
+     * @throws DevFailed
+     */
+    public String getNearestValue(final String[] argin) throws DevFailed {
+	String argout = "";
+	get_logger().info("Entering getNewestValue");
+	if (argin.length != 2) {
+	    DevFailedUtils.throwDevFailed("input must be of size 2 [attributeName, timestamp] ");
+	}
+	String attributeName = argin[0];
+	String timestamp = argin[1];
+	try {
+	    DbData data2 = dbProxy.getDataBase().getExtractor().getDataGetters()
+		    .getNearestValue(attributeName, timestamp);
+	    if (data2.getData_timed() != null && data2.getData_timed()[0] != null) {
+		argout = Long.toString(data2.getData_timed()[0].time) + "; ";
+		Object value = data2.getData_timed()[0].value[0];
+		argout = argout + value.toString();
+	    } else {
+		DevFailedUtils.throwDevFailed("no data found for " + attributeName);
+	    }
+	} catch (final ArchivingException e) {
+	    e.printStackTrace();
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting getNewestValue");
+	return argout;
+    }
+
     // =========================================================
     /**
      * Execute command "GetAttDataCount" on device. Returns the number of the
@@ -1440,6 +1506,48 @@ public class TdbExtractor extends DeviceImpl
 	return argout;
     }
 
+    /**
+     * Extract an attribute's data for TDB
+     * 
+     * @param argin
+     *            The attribute's name, the beginning date (DD-MM-YYYY
+     *            HH24:MI:SS) and the ending date (DD-MM-YYYY HH24:MI:SS)
+     * @return Long: the timestamps , String: values (read values only
+     * @throws DevFailed
+     */
+    public DevVarDoubleStringArray extractBetweenDates(final String[] argin) throws DevFailed {
+	DevVarDoubleStringArray argout = null;
+
+	get_logger().info("Entering get_att_data_between_dates()");
+
+	// ---Add your Own code to control device here ---
+	if (argin.length != 3) {
+	    Except.throw_exception("CONFIGURATION_ERROR", "Wrong number of parameters",
+		    "HdbExtractor.get_att_scalar_data_beetween_dates");
+	} else {
+	    try {
+		// Get data from db.
+		final DbData dbData = dbProxy.getDataBase().getExtractor().getDataGettersBetweenDates()
+			.getAttDataBetweenDates(argin, SamplingType.getSamplingType(SamplingType.ALL));
+		NullableTimedData[] tuples = dbData.getData_timed();
+		double[] timeStamps = new double[tuples.length];
+		String[] values = new String[tuples.length];
+		for (int i = 0; i < tuples.length; i++) {
+		    timeStamps[i] = tuples[i].time;
+		    values[i] = tuples[i].value[0].toString();
+		}
+		argout = new DevVarDoubleStringArray(timeStamps, values);
+	    } catch (final ArchivingException e) {
+
+		e.printStackTrace();
+		throw e.toTangoException();
+	    }
+	}
+	get_logger().info("Exiting get_att_data_between_dates()");
+
+	return argout;
+    }
+
     // =========================================================
     /**
      * Execute command "GetAttDataBetweenDatesCount" on device. Returns the
@@ -2439,13 +2547,19 @@ public class TdbExtractor extends DeviceImpl
 	}
 
 	// And fill buffer with database's data
-
-	if (_2value) {
-	    final DbData[] dbDatas = dbData.splitDbData();
-	    tg_1.fill_attr_polling_buffer(this, random_name_1, dbDatas[0].getDataAsTimedAttrData());
-	    tg_2.fill_attr_polling_buffer(this, random_name_2, dbDatas[1].getDataAsTimedAttrData());
-	} else {
-	    tg_1.fill_attr_polling_buffer(this, random_name_1, dbData.getDataAsTimedAttrData());
+	try {
+	    if (_2value) {
+		final DbData[] dbDatas = dbData.splitDbData();
+		tg_1.fill_attr_polling_buffer(this, random_name_1, dbDatas[0].getDataAsTimedAttrData());
+		tg_2.fill_attr_polling_buffer(this, random_name_2, dbDatas[1].getDataAsTimedAttrData());
+	    } else {
+		tg_1.fill_attr_polling_buffer(this, random_name_1, dbData.getDataAsTimedAttrData());
+	    }
+	} catch (Exception e) {
+	    // FIXME java.lang.ArrayIndexOutOfBoundsException thrown when some
+	    // data are empty.
+	    e.printStackTrace();
+	    System.out.println("ERROR when filling data polling buffer, may be empty");
 	}
 
 	final DevVarLongStringArray argout = new DevVarLongStringArray();
diff --git a/src/main/java/TdbExtractor/TdbExtractorClass.java b/src/main/java/TdbExtractor/TdbExtractorClass.java
index cb51a6a2c3fbef015c6adbc3eb889dfc8e875f3a..a50400684f820523d67c391303cc3cdae8f31857 100644
--- a/src/main/java/TdbExtractor/TdbExtractorClass.java
+++ b/src/main/java/TdbExtractor/TdbExtractorClass.java
@@ -91,326 +91,465 @@ import fr.esrf.TangoDs.Attr;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
 import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandInOut;
 import fr.esrf.TangoDs.Util;
 
 public class TdbExtractorClass extends DeviceClass implements TangoConst {
-	/**
-	 * TdbExtractorClass class instance (it is a singleton).
-	 */
-	private static TdbExtractorClass _instance = null;
+    /**
+     * TdbExtractorClass class instance (it is a singleton).
+     */
+    private static TdbExtractorClass _instance = null;
 
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = null;
+    /**
+     * Class properties array.
+     */
+    private DbDatum[] cl_prop = null;
 
-	// --------- Start of properties data members ----------
+    // --------- Start of properties data members ----------
 
-	// --------- End of properties data members ----------
+    // --------- End of properties data members ----------
 
-	// ===================================================================
-	//
-	// method : instance()
-	//
-	// description : static method to retrieve the TdbExtractorClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static TdbExtractorClass instance() {
-		if (_instance == null) {
-			System.err.println("TdbExtractorClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the TdbExtractorClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static TdbExtractorClass instance() {
+	if (_instance == null) {
+	    System.err.println("TdbExtractorClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : Init()
-	//
-	// description : static method to create/retrieve the TdbExtractorClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static synchronized TdbExtractorClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			_instance = new TdbExtractorClass(class_name);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the TdbExtractorClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static synchronized TdbExtractorClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    _instance = new TdbExtractorClass(class_name);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : TdbExtractorClass()
-	//
-	// description : constructor for the TdbExtractorClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected TdbExtractorClass(String name) throws DevFailed {
-		super(name);
+    // ===================================================================
+    //
+    // method : TdbExtractorClass()
+    //
+    // description : constructor for the TdbExtractorClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected TdbExtractorClass(String name) throws DevFailed {
+	super(name);
 
-		Util.out2.println("Entering TdbExtractorClass constructor");
-		write_class_property();
-		get_class_property();
-
-		Util.out2.println("Leaving TdbExtractorClass constructor");
-	}
+	Util.out2.println("Entering TdbExtractorClass constructor");
+	write_class_property();
+	get_class_property();
 
-	// ===================================================================
-	//
-	// method : command_factory()
-	//
-	// description : Create the command object(s) and store them in the
-	// command list
-	// ===================================================================
-	@Override
-	public void command_factory() {
-		command_list.addElement(new GetMinTimeClass("GetMinTime", Tango_DEV_STRING, Tango_DEV_STRING, "The attribute to search", "The earliest value's timestamp", DispLevel.OPERATOR));
-		command_list.addElement(new GetMaxTimeClass("GetMaxTime", Tango_DEV_STRING, Tango_DEV_STRING, "The attribute to search", "The latest value's timestamp", DispLevel.OPERATOR));
-		command_list.addElement(new GetInfoClass("GetInfo", Tango_DEV_VOID, Tango_DEV_STRING, "", "The informations that characterize the database", DispLevel.OPERATOR));
-		command_list.addElement(new GetHostClass("GetHost", Tango_DEV_VOID, Tango_DEV_STRING, "", "The connected database host identifier.", DispLevel.OPERATOR));
-		command_list.addElement(new GetUserClass("GetUser", Tango_DEV_VOID, Tango_DEV_STRING, "", "The current user's name used for the connection.", DispLevel.OPERATOR));
-		command_list.addElement(new GetConnectionStateClass("GetConnectionState", Tango_DEV_VOID, Tango_DEV_BOOLEAN, "", "The connection state", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDefinitionDataClass("GetAttDefinitionData", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"Differents definition informations for the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttPropertiesDataClass("GetAttPropertiesData", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"An array containing the differents properties for the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttIdClass("GetAttId", Tango_DEV_STRING, Tango_DEV_SHORT, "The attribute's name", "The TDB's ID that characterize the given attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameAllClass("GetAttNameAll", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The whole list of the attributes registered in TDB", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameFacilityClass("GetAttNameFacility", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
-				"The whole list of the attributes registered in TDB, and that belong to the current facility.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttNameFilterFormatClass("GetAttNameFilterFormat", Tango_DEV_SHORT, Tango_DEVVAR_STRINGARRAY, "A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
-				"The filtered list of attributes registered in TDB.  The filtering is made according to the given format [0 -> scalar - 1 -> spectrum - 2 -> image]", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttNameFilterTypeClass(
-						"GetAttNameFilterType",
-						Tango_DEV_SHORT,
-						Tango_DEVVAR_STRINGARRAY,
-						"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						"The filtered list of attributes registered in TDB.  The filtering is made according to the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						DispLevel.OPERATOR));
-		command_list.addElement(new GetAttCountAllClass("GetAttCountAll", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The total number of attributes defined in TDB", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttCountFilterFormatClass("GetAttCountFilterFormat", Tango_DEV_SHORT, Tango_DEV_SHORT, "A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
-				"The total number of attributes defined in TDB with the given format [0 -> scalar - 1 -> spectrum - 2 -> image]", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttCountFilterTypeClass("GetAttCountFilterType", Tango_DEV_SHORT, Tango_DEV_SHORT,
-						"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						"The total number of attributes defined in TDB with the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
-						DispLevel.OPERATOR));
-		command_list.addElement(new GetDomainsClass("GetDomains", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered domains", DispLevel.OPERATOR));
-		command_list.addElement(new GetDomainsCountClass("GetDomainsCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct registered domains.", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesClass("GetFamilies", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered families", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesCountClass("GetFamiliesCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct registered families.", DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesByDomainClass("GetFamiliesByDomain", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The given domain", "The registered families for the given domain",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetFamiliesByDomainCountClass("GetFamiliesByDomainCount", Tango_DEV_STRING, Tango_DEV_SHORT, "A domain name",
-				"The number of distinct registered families for a given domain.", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersClass("GetMembers", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The registered members", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersCountClass("GetMembersCount", Tango_DEV_VOID, Tango_DEV_SHORT, "", "The number of distinct members.", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersByDomainFamilyClass("GetMembersByDomainFamily", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_STRINGARRAY, "The given domain and family",
-				"The registered members for the given domain and family", DispLevel.OPERATOR));
-		command_list.addElement(new GetMembersByDomainFamilyCountClass("GetMembersByDomainFamilyCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT, "A domain name, a family name",
-				"The number of distinct registered members for the given domain and family.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttributesByDomainFamilyMembersCountClass("GetAttributesByDomainFamilyMembersCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT,
-				"A domain name, a family name, a member name.", "The number of registered the attributes for a given  domain, family, member.", DispLevel.OPERATOR));
-		command_list.addElement(new GetCurrentArchivedAttClass("GetCurrentArchivedAtt", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "", "The list of attributes that are being archived",
-				DispLevel.OPERATOR));
-		command_list.addElement(new IsArchivedClass("IsArchived", Tango_DEV_STRING, Tango_DEV_BOOLEAN, "The attribute's name", "true if the given attribute is being archived", DispLevel.OPERATOR));
-		command_list.addElement(new GetArchivingModeClass("GetArchivingMode", Tango_DEV_STRING, Tango_DEVVAR_STRINGARRAY, "The attribute's name",
-				"The archiving mode used for the specified attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataClass("GetAttData", Tango_DEV_STRING, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataCountClass("GetAttDataCount", Tango_DEV_STRING, Tango_DEV_LONG, "An attribute name.", "The number of the data archieved for an attribute.",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataAvgClass("GetAttDataAvg", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The average of the values generated by the attribute",
-				DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataAvgBetweenDatesClass("GetAttDataAvgBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"The average value generated by the given attribute and between the two given dates. ", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesClass("GetAttDataBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesSamplingClass("GetAttDataBetweenDatesSampling", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS), and the sampling type (ALL, SECOND, MINUTE, HOUR, DAY)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataBetweenDatesCountClass("GetAttDataBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the beginning (YYYY-MM-DD HH24:MI:SS) date and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data beetwen two dates and, for a given scalar attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanClass("GetAttDataInfOrSupThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit and the upper limit", "String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanCountClass("GetAttDataInfOrSupThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit and the upper limit", "The number of scalar data lower than the given value x OR higher than the given value y.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanBetweenDatesClass("GetAttDataInfOrSupThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfOrSupThanBetweenDatesCountClass("GetAttDataInfOrSupThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of scalar data lower than the given value x OR higher than the given value y, beetwen two dates and for the specified attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanClass("GetAttDataInfThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the upper limit",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanCountClass("GetAttDataInfThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name and the  upper limit.",
-				"The number of scalar data lower than the given value and for the specified attribute.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanBetweenDatesClass("GetAttDataInfThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataInfThanBetweenDatesCountClass("GetAttDataInfThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS). ",
-				"The number data lower than the given value x, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataLastNClass("GetAttDataLastN", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the number of wished data",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttDataMaxClass("GetAttDataMax", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The biggest value generated by the attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataMaxBetweenDatesClass("GetAttDataMaxBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)", "The biggest value generated between the two given dates.",
-				DispLevel.OPERATOR));
-		command_list
-				.addElement(new GetAttDataMinClass("GetAttDataMin", Tango_DEV_STRING, Tango_DEV_DOUBLE, "The attribute's name", "The smallest value generated by the attribute", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataMinBetweenDatesClass("GetAttDataMinBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEV_DOUBLE,
-				"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"The smallest scalar value generated by the given attribute and between the two given dates.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanClass("GetAttDataSupThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the  lower limit",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanCountClass("GetAttDataSupThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name and the  lower limit.",
-				"The number of data higher than the given value.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanClass("GetAttDataSupAndInfThan", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit and the upper limit", "String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanCountClass("GetAttDataSupAndInfThanCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit and the upper limit", "The data that are highter than the given value x AND lower than the given value y.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanBetweenDatesClass("GetAttDataSupAndInfThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupAndInfThanBetweenDatesCountClass("GetAttDataSupAndInfThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data higher than the given value x, (AND) lower than the given value y, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanBetweenDatesClass("GetAttDataSupThanBetweenDates", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGSTRINGARRAY,
-				"The attribute's name, the lower limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
-				"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttDataSupThanBetweenDatesCountClass("GetAttDataSupThanBetweenDatesCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
-				"The attribute's name, the lower limit, the beginning date  (YYYY-MM-DD HH24:MI:SS) and the ending date  (YYYY-MM-DD HH24:MI:SS).",
-				"The number of data higher than the given value y, and beetwen two dates (date_1 & date_2).", DispLevel.OPERATOR));
-		command_list.addElement(new RemoveDynamicAttributeClass("RemoveDynamicAttribute", Tango_DEV_STRING, Tango_DEV_VOID, "The TDBExtractor dynamic attribute's name", "", DispLevel.OPERATOR));
-		command_list.addElement(new RemoveDynamicAttributesClass("RemoveDynamicAttributes", Tango_DEV_VOID, Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
-		command_list.addElement(new GetAttFullNameClass("GetAttFullName", Tango_DEV_SHORT, Tango_DEV_STRING, "The id of an attribute", "The full name of this attribute", DispLevel.OPERATOR));
+	Util.out2.println("Leaving TdbExtractorClass constructor");
+    }
 
-		// add polling if any
-		/*
-		 * for (int i = 0; i < command_list.size(); i++) { Command cmd =
-		 * (Command) command_list.elementAt(i); }
-		 */
-	}
+    // ===================================================================
+    //
+    // method : command_factory()
+    //
+    // description : Create the command object(s) and store them in the
+    // command list
+    // ===================================================================
+    @Override
+    public void command_factory() {
+	command_list.addElement(new GetMinTimeClass("GetMinTime", Tango_DEV_STRING, Tango_DEV_STRING,
+		"The attribute to search", "The earliest value's timestamp", DispLevel.OPERATOR));
+	command_list.addElement(new GetMaxTimeClass("GetMaxTime", Tango_DEV_STRING, Tango_DEV_STRING,
+		"The attribute to search", "The latest value's timestamp", DispLevel.OPERATOR));
+	command_list.addElement(new GetInfoClass("GetInfo", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The informations that characterize the database", DispLevel.OPERATOR));
+	command_list.addElement(new GetHostClass("GetHost", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The connected database host identifier.", DispLevel.OPERATOR));
+	command_list.addElement(new GetUserClass("GetUser", Tango_DEV_VOID, Tango_DEV_STRING, "",
+		"The current user's name used for the connection.", DispLevel.OPERATOR));
+	command_list.addElement(new GetConnectionStateClass("GetConnectionState", Tango_DEV_VOID, Tango_DEV_BOOLEAN,
+		"", "The connection state", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDefinitionDataClass("GetAttDefinitionData", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"Differents definition informations for the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttPropertiesDataClass("GetAttPropertiesData", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"An array containing the differents properties for the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttIdClass("GetAttId", Tango_DEV_STRING, Tango_DEV_SHORT,
+		"The attribute's name", "The TDB's ID that characterize the given attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttNameAllClass("GetAttNameAll", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The whole list of the attributes registered in TDB", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttNameFacilityClass("GetAttNameFacility", Tango_DEV_VOID,
+		Tango_DEVVAR_STRINGARRAY, "",
+		"The whole list of the attributes registered in TDB, and that belong to the current facility.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttNameFilterFormatClass(
+			"GetAttNameFilterFormat",
+			Tango_DEV_SHORT,
+			Tango_DEVVAR_STRINGARRAY,
+			"A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			"The filtered list of attributes registered in TDB.  The filtering is made according to the given format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttNameFilterTypeClass(
+			"GetAttNameFilterType",
+			Tango_DEV_SHORT,
+			Tango_DEVVAR_STRINGARRAY,
+			"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			"The filtered list of attributes registered in TDB.  The filtering is made according to the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttCountAllClass("GetAttCountAll", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The total number of attributes defined in TDB", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttCountFilterFormatClass(
+			"GetAttCountFilterFormat",
+			Tango_DEV_SHORT,
+			Tango_DEV_SHORT,
+			"A format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			"The total number of attributes defined in TDB with the given format [0 -> scalar - 1 -> spectrum - 2 -> image]",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttCountFilterTypeClass(
+			"GetAttCountFilterType",
+			Tango_DEV_SHORT,
+			Tango_DEV_SHORT,
+			"A type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			"The total number of attributes defined in TDB with the given type [2 -> Tango::DevShort | 3 -> Tango::DevLong | 5 -> Tango::DevDouble and 8 -> Tango::DevString]",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetDomainsClass("GetDomains", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered domains", DispLevel.OPERATOR));
+	command_list.addElement(new GetDomainsCountClass("GetDomainsCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct registered domains.", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesClass("GetFamilies", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered families", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesCountClass("GetFamiliesCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct registered families.", DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesByDomainClass("GetFamiliesByDomain", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The given domain", "The registered families for the given domain",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetFamiliesByDomainCountClass("GetFamiliesByDomainCount", Tango_DEV_STRING,
+		Tango_DEV_SHORT, "A domain name", "The number of distinct registered families for a given domain.",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersClass("GetMembers", Tango_DEV_VOID, Tango_DEVVAR_STRINGARRAY, "",
+		"The registered members", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersCountClass("GetMembersCount", Tango_DEV_VOID, Tango_DEV_SHORT, "",
+		"The number of distinct members.", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersByDomainFamilyClass("GetMembersByDomainFamily", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_STRINGARRAY, "The given domain and family",
+		"The registered members for the given domain and family", DispLevel.OPERATOR));
+	command_list.addElement(new GetMembersByDomainFamilyCountClass("GetMembersByDomainFamilyCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT, "A domain name, a family name",
+		"The number of distinct registered members for the given domain and family.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttributesByDomainFamilyMembersCountClass(
+		"GetAttributesByDomainFamilyMembersCount", Tango_DEVVAR_STRINGARRAY, Tango_DEV_SHORT,
+		"A domain name, a family name, a member name.",
+		"The number of registered the attributes for a given  domain, family, member.", DispLevel.OPERATOR));
+	command_list.addElement(new GetCurrentArchivedAttClass("GetCurrentArchivedAtt", Tango_DEV_VOID,
+		Tango_DEVVAR_STRINGARRAY, "", "The list of attributes that are being archived", DispLevel.OPERATOR));
+	command_list.addElement(new IsArchivedClass("IsArchived", Tango_DEV_STRING, Tango_DEV_BOOLEAN,
+		"The attribute's name", "true if the given attribute is being archived", DispLevel.OPERATOR));
+	command_list.addElement(new GetArchivingModeClass("GetArchivingMode", Tango_DEV_STRING,
+		Tango_DEVVAR_STRINGARRAY, "The attribute's name",
+		"The archiving mode used for the specified attribute", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataClass("GetAttData", Tango_DEV_STRING, Tango_DEVVAR_LONGSTRINGARRAY,
+		"The attribute's name", "String  : The new created dynamic attribute name, Long : the number of data.",
+		DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataCountClass("GetAttDataCount", Tango_DEV_STRING, Tango_DEV_LONG,
+		"An attribute name.", "The number of the data archieved for an attribute.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataAvgClass("GetAttDataAvg", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The average of the values generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataAvgBetweenDatesClass(
+			"GetAttDataAvgBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The average value generated by the given attribute and between the two given dates. ",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesClass(
+			"GetAttDataBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesSamplingClass(
+			"GetAttDataBetweenDatesSampling",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS), and the sampling type (ALL, SECOND, MINUTE, HOUR, DAY)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataBetweenDatesCountClass(
+			"GetAttDataBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the beginning (YYYY-MM-DD HH24:MI:SS) date and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data beetwen two dates and, for a given scalar attribute.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfOrSupThanClass("GetAttDataInfOrSupThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the lower limit and the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfOrSupThanCountClass("GetAttDataInfOrSupThanCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name, the lower limit and the upper limit",
+		"The number of scalar data lower than the given value x OR higher than the given value y.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfOrSupThanBetweenDatesClass(
+			"GetAttDataInfOrSupThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfOrSupThanBetweenDatesCountClass(
+			"GetAttDataInfOrSupThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of scalar data lower than the given value x OR higher than the given value y, beetwen two dates and for the specified attribute.",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfThanClass("GetAttDataInfThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataInfThanCountClass("GetAttDataInfThanCount", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_LONG, "The attribute's name and the  upper limit.",
+		"The number of scalar data lower than the given value and for the specified attribute.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfThanBetweenDatesClass(
+			"GetAttDataInfThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataInfThanBetweenDatesCountClass(
+			"GetAttDataInfThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS). ",
+			"The number data lower than the given value x, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataLastNClass("GetAttDataLastN", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the number of wished data",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataMaxClass("GetAttDataMax", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The biggest value generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataMaxBetweenDatesClass(
+			"GetAttDataMaxBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The biggest value generated between the two given dates.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataMinClass("GetAttDataMin", Tango_DEV_STRING, Tango_DEV_DOUBLE,
+		"The attribute's name", "The smallest value generated by the attribute", DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataMinBetweenDatesClass(
+			"GetAttDataMinBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_DOUBLE,
+			"The attribute's name, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"The smallest scalar value generated by the given attribute and between the two given dates.",
+			DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupThanClass("GetAttDataSupThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name and the  lower limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupThanCountClass("GetAttDataSupThanCount", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEV_LONG, "The attribute's name and the  lower limit.",
+		"The number of data higher than the given value.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupAndInfThanClass("GetAttDataSupAndInfThan", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_LONGSTRINGARRAY, "The attribute's name, the lower limit and the upper limit",
+		"String  : The new created dynamic attribute name, Long : the number of data.", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttDataSupAndInfThanCountClass("GetAttDataSupAndInfThanCount",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG, "The attribute's name, the lower limit and the upper limit",
+		"The data that are highter than the given value x AND lower than the given value y.",
+		DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupAndInfThanBetweenDatesClass(
+			"GetAttDataSupAndInfThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupAndInfThanBetweenDatesCountClass(
+			"GetAttDataSupAndInfThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the upper limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data higher than the given value x, (AND) lower than the given value y, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupThanBetweenDatesClass(
+			"GetAttDataSupThanBetweenDates",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEVVAR_LONGSTRINGARRAY,
+			"The attribute's name, the lower limit, the beginning date (YYYY-MM-DD HH24:MI:SS) and the ending date (YYYY-MM-DD HH24:MI:SS)",
+			"String  : The new created dynamic attribute name, Long : the number of data.",
+			DispLevel.OPERATOR));
+	command_list
+		.addElement(new GetAttDataSupThanBetweenDatesCountClass(
+			"GetAttDataSupThanBetweenDatesCount",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_LONG,
+			"The attribute's name, the lower limit, the beginning date  (YYYY-MM-DD HH24:MI:SS) and the ending date  (YYYY-MM-DD HH24:MI:SS).",
+			"The number of data higher than the given value y, and beetwen two dates (date_1 & date_2).",
+			DispLevel.OPERATOR));
+	command_list.addElement(new RemoveDynamicAttributeClass("RemoveDynamicAttribute", Tango_DEV_STRING,
+		Tango_DEV_VOID, "The TDBExtractor dynamic attribute's name", "", DispLevel.OPERATOR));
+	command_list.addElement(new RemoveDynamicAttributesClass("RemoveDynamicAttributes", Tango_DEV_VOID,
+		Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
+	command_list.addElement(new GetAttFullNameClass("GetAttFullName", Tango_DEV_SHORT, Tango_DEV_STRING,
+		"The id of an attribute", "The full name of this attribute", DispLevel.OPERATOR));
+	command_list.addElement(new TemplCommandInOut("GetNewestValue", "getNewestValue", "attribute name",
+		"timestamp; values"));
+	command_list.addElement(new TemplCommandInOut("GetNearestValue", "getNearestValue",
+		"[attributeName, timestamp]. timestamp format is DD-MM-YYYY HH24:MI:SS", "timestamp; values"));
+	command_list.addElement(new ExtractBetweenDatesClass("ExtractBetweenDates", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_DOUBLESTRINGARRAY,
+		"[attributeName,start date, end date]. dates format is DD-MM-YYYY HH24:MI:SS",
+		"long: timestamp; string :values"));
+	// add polling if any
+	/*
+	 * for (int i = 0; i < command_list.size(); i++) { Command cmd =
+	 * (Command) command_list.elementAt(i); }
+	 */
+    }
 
-	// =============================================================================
-	//
-	// Method: attribute_factory(Vector att_list)
-	//
-	// =============================================================================
-	@Override
-	public void attribute_factory(Vector att_list) throws DevFailed {
-		// Attribute : version
-		Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
-		att_list.addElement(version);
-	}
+    // =============================================================================
+    //
+    // Method: attribute_factory(Vector att_list)
+    //
+    // =============================================================================
+    @Override
+    public void attribute_factory(Vector att_list) throws DevFailed {
+	// Attribute : version
+	Attr version = new Attr("version", Tango_DEV_STRING, AttrWriteType.READ);
+	att_list.addElement(version);
+    }
 
-	// ===================================================================
-	//
-	// method : device_factory()
-	//
-	// description : Create the device object(s) and store them in the
-	// device list
-	//
-	// argument : in : String[] devlist : The device name list
-	//
-	// ===================================================================
-	@Override
-	public void device_factory(String[] devlist) throws DevFailed {
-		String device_version = ResourceBundle.getBundle("application").getString("project.version");
+    // ===================================================================
+    //
+    // method : device_factory()
+    //
+    // description : Create the device object(s) and store them in the
+    // device list
+    //
+    // argument : in : String[] devlist : The device name list
+    //
+    // ===================================================================
+    @Override
+    public void device_factory(String[] devlist) throws DevFailed {
+	String device_version = ResourceBundle.getBundle("application").getString("project.version");
 
-		for (int i = 0; i < devlist.length; i++) {
-			// Util.out4.println("Device name : " + devlist[ i ]);
+	for (int i = 0; i < devlist.length; i++) {
+	    // Util.out4.println("Device name : " + devlist[ i ]);
 
-			// Create device and add it into the device list
-			// ----------------------------------------------
-			device_list.addElement(new TdbExtractor(this, devlist[i], device_version));
+	    // Create device and add it into the device list
+	    // ----------------------------------------------
+	    device_list.addElement(new TdbExtractor(this, devlist[i], device_version));
 
-			// Export device to the outside world
-			// ----------------------------------------------
-			if (Util._UseDb == true)
-				export_device(((DeviceImpl) (device_list.elementAt(i))));
-			else
-				export_device(((DeviceImpl) (device_list.elementAt(i))), devlist[i]);
-		}
+	    // Export device to the outside world
+	    // ----------------------------------------------
+	    if (Util._UseDb == true) {
+		export_device(((DeviceImpl) device_list.elementAt(i)));
+	    } else {
+		export_device(((DeviceImpl) device_list.elementAt(i)), devlist[i]);
+	    }
 	}
+    }
 
-	// ===================================================================
-	/**
-	 * Get the class property for specified name.
-	 * 
-	 * @param name
-	 *            The property name.
-	 */
-	// ===================================================================
-	public DbDatum get_class_property(String name) {
-		for (int i = 0; i < cl_prop.length; i++)
-			if (cl_prop[i].name.equals(name))
-				return cl_prop[i];
-		// if not found, return an empty DbDatum
-		return new DbDatum(name);
+    // ===================================================================
+    /**
+     * Get the class property for specified name.
+     * 
+     * @param name
+     *            The property name.
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) {
+	for (int i = 0; i < cl_prop.length; i++) {
+	    if (cl_prop[i].name.equals(name)) {
+		return cl_prop[i];
+	    }
 	}
+	// if not found, return an empty DbDatum
+	return new DbDatum(name);
+    }
 
-	// ===================================================================
-	/**
-	 * Read the class properties from database.
-	 */
-	// ===================================================================
-	public void get_class_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
+    // ===================================================================
+    /**
+     * Read the class properties from database.
+     */
+    // ===================================================================
+    public void get_class_property() throws DevFailed {
+	// Initialize your default values here.
+	// ------------------------------------------
 
-		// Read class properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = {};
+	// Read class properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
+	}
+	String[] propnames = {};
 
-		// Call database and extract values
-		// --------------------------------------------
-		cl_prop = get_db_class().get_property(propnames);
-		int i = -1;
+	// Call database and extract values
+	// --------------------------------------------
+	cl_prop = get_db_class().get_property(propnames);
+	int i = -1;
 
-		// End of Automatic code generation
-		// -------------------------------------------------------------
+	// End of Automatic code generation
+	// -------------------------------------------------------------
 
-	}
+    }
 
-	// ===================================================================
-	/**
-	 * Set class description as property in database
-	 */
-	// ===================================================================
-	private void write_class_property() throws DevFailed {
-		// First time, check if database used
-		// --------------------------------------------
-		if (Util._UseDb == false)
-			return;
+    // ===================================================================
+    /**
+     * Set class description as property in database
+     */
+    // ===================================================================
+    private void write_class_property() throws DevFailed {
+	// First time, check if database used
+	// --------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
+	}
 
-		// Prepeare DbDatum
-		// --------------------------------------------
-		DbDatum[] data = new DbDatum[2];
-		data[0] = new DbDatum("ProjectTitle");
-		data[0].insert("Tango Device Server");
+	// Prepeare DbDatum
+	// --------------------------------------------
+	DbDatum[] data = new DbDatum[2];
+	data[0] = new DbDatum("ProjectTitle");
+	data[0].insert("Tango Device Server");
 
-		data[1] = new DbDatum("Description");
-		data[1].insert("A DServer used for temporary database's extractions.");
+	data[1] = new DbDatum("Description");
+	data[1].insert("A DServer used for temporary database's extractions.");
 
-		// Call database and and values
-		// --------------------------------------------
-		get_db_class().put_property(data);
-	}
+	// Call database and and values
+	// --------------------------------------------
+	get_db_class().put_property(data);
+    }
 
 }
diff --git a/src/main/java/fr/soleil/archiving/utils/TangoStateUtils.java b/src/main/java/fr/soleil/archiving/utils/TangoStateUtils.java
index de9f717ec8ef6a81d9562d2d9b15b57d2e12a3b7..a233af21412fec880305a8918de6310ee43467ed 100644
--- a/src/main/java/fr/soleil/archiving/utils/TangoStateUtils.java
+++ b/src/main/java/fr/soleil/archiving/utils/TangoStateUtils.java
@@ -1,7 +1,6 @@
 package fr.soleil.archiving.utils;
 
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Set;
 
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
@@ -16,37 +15,42 @@ public class TangoStateUtils {
 	device.set_status(msg);
     }
 
-    public static void setDisable(final DeviceImpl device,
-	    final Map<String, Boolean> archivingStatus) {
-	device.set_state(DevState.DISABLE);
-	device.set_status(statusToString(archivingStatus));
-    }
-
     public static void setRunning(final DeviceImpl device) {
 	device.set_state(DevState.RUNNING);
 	device.set_status("Starting archiving");
     }
 
-    public static void setOn(final DeviceImpl device, final Map<String, Boolean> archivingStatus) {
-	device.set_state(DevState.ON);
-	device.set_status(statusToString(archivingStatus));
+    public static void updateState(final DeviceImpl device, Set<String> koAttributes, Set<String> okAttributes) {
+
+	if (koAttributes.isEmpty() && okAttributes.isEmpty()) {
+	    device.set_state(DevState.OFF);
+	    device.set_status("No attributes to archive");
+	} else if (!koAttributes.isEmpty()) {
+	    device.set_state(DevState.DISABLE);
+	    device.set_status(statusToString(koAttributes, okAttributes));
+	} else {
+	    device.set_state(DevState.ON);
+	    device.set_status(statusToString(koAttributes, okAttributes));
+	}
     }
 
     public static void isAllowed(final DeviceImpl device) throws DevFailed {
-	if (device.get_state().equals(DevState.FAULT)
-		|| device.get_state().equals(DevState.RUNNING)) {
-	    Except.throw_exception("NOT_ALLOWED", "action is not allowed while device is in "
+	if (device.get_state().equals(DevState.FAULT) || device.get_state().equals(DevState.RUNNING)) {
+	    Except.throw_exception("NOT_ALLOWED", "action is not allowed while device is "
 		    + TangoConst.Tango_DevStateName[device.get_state().value()], "isAllowed");
 	}
     }
 
-    public static String statusToString(final Map<String, Boolean> archivingStatus) {
-	final StringBuilder b = new StringBuilder();
-	for (final Entry<String, Boolean> entry : archivingStatus.entrySet()) {
-	    b.append(entry.getKey());
-	    b.append(":");
-	    b.append(entry.getValue() ? "OK\n" : "KO\n");
+    public static String statusToString(Set<String> koAttributes, Set<String> okAttributes) {
+	final StringBuilder sb = new StringBuilder("- KO [");
+	for (String koS : koAttributes) {
+	    sb.append("\n").append(koS);
+	}
+	sb.append("]\n- OK [");
+	for (String okS : okAttributes) {
+	    sb.append("\n").append(okS);
 	}
-	return b.toString();
+	sb.append("]");
+	return sb.toString();
     }
 }
diff --git a/src/test/resources/log4j.xml b/src/test/resources/log4j.xml
deleted file mode 100644
index 89b5ee06f20b4ddccc50bd5fe1182d96a67c88a8..0000000000000000000000000000000000000000
--- a/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- An example log4j configuration xml file for log4jdbc -->
-<!-- Logging levels are:                                  -->
-<!-- DEBUG < INFO < WARN < ERROR < FATAL                  -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <appender name="stdout-appender" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %c{1}: %m%n"/>
-    </layout>
-  </appender>
-
-  <appender name="sql-appender" class="org.apache.log4j.FileAppender">
-    <param name="File" value="./logs/sql.log"/>
-    <param name="Append" value="false"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="-----&gt; %d{yyyy-MM-dd HH:mm:ss.SSS} &lt;%t&gt; %m%n%n"/>
-    </layout>
-  </appender>
-
-  <appender name="sql-timing-appender" class="org.apache.log4j.FileAppender">
-    <param name="File" value="./logs/sqltiming.log"/>
-    <param name="Append" value="false"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="-----&gt; %d{yyyy-MM-dd HH:mm:ss.SSS} %m%n%n"/>
-    </layout>
-  </appender>
-
-  <appender name="jdbc-appender" class="org.apache.log4j.FileAppender">
-    <param name="File" value="./logs/jdbc.log"/>
-    <param name="Append" value="false"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n"/>
-    </layout>
-  </appender>
-
-  <appender name="jdbc-connection" class="org.apache.log4j.FileAppender">
-    <param name="File" value="./logs/connection.log"/>
-    <param name="Append" value="false"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n"/>
-    </layout>
-  </appender>
-
-  <!--
-       The Following 5 logs can be turned on and off while the server is running
-       LIVE in order to trace the SQL and/or all JDBC coming out of the application.
-
-       To turn a log on, set the level value to INFO or DEBUG (to see class name and
-       line number information in the log)  The DEBUG setting is much more inefficient
-       but the output is much more useful.
-
-       To turn off JDBC logging completely, you must set all 5 logs to a level higher 
-       than ERROR (FATAL is suggested.)
-  -->
-
-  <!-- log SQL (pre-execution) plus exceptions caused by SQL -->
-  <logger name="jdbc.sqlonly" additivity="false">
-    <level value="debug"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-
-  <!-- log SQL with timing information, post execution -->
-  <logger name="jdbc.sqltiming" additivity="false">
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-
-  <!-- only use the two logs below to trace ALL JDBC information,
-       NOTE:  This can be very voluminous!  -->
-
-  <!-- log all jdbc calls except ResultSet calls -->
-  <logger name="jdbc.audit" additivity="false">
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-
-  <!-- log the jdbc ResultSet calls -->
-  <logger name="jdbc.resultset" additivity="false">
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-  
-  <!-- log connection open/close events and dump of all open connection numbers -->
-  <logger name="jdbc.connection" additivity="false">
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-
-  <!-- this log is for internal debugging of log4jdbc, itself -->
-  <!-- debug logging for log4jdbc itself -->
-  <logger name="log4jdbc.debug" additivity="false">
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </logger>
-
-  <!-- by default, log everything to the console with a level of WARN or higher -->
-  <root>
-    <level value="error"/>
-    <appender-ref ref="stdout-appender"/>
-  </root>
-</log4j:configuration>
\ No newline at end of file