From 21f45de9d615089a24be6e0623b8668be02884a3 Mon Sep 17 00:00:00 2001
From: Gwenaelle Abeille <gwenaelle.abeille@synchrotron-soleil.fr>
Date: Mon, 19 Dec 2011 10:11:49 +0000
Subject: [PATCH] release

---
 .classpath                                    |    7 +-
 .project                                      |    6 +-
 pom.xml                                       |   13 +-
 src/main/java/SnapArchiver/SnapArchiver.java  |  706 ++++---
 .../java/SnapArchiver/SnapArchiverClass.java  |  457 +++--
 .../TriggerLaunchSnapShotCmd.java             |   61 +-
 .../grouplink/UsePluginBuilder.java           |  240 ++-
 .../SnapExtractor/GetSnapValuesClass.java     |  109 +
 .../java/SnapExtractor/SnapExtractor.java     | 1789 ++++++++---------
 .../SnapExtractor/SnapExtractorClass.java     |  426 ++--
 .../java/SnapManager/LaunchSnapShotCmd.java   |  161 +-
 src/main/java/SnapManager/SnapManager.java    | 1180 ++++++-----
 .../java/SnapManager/SnapManagerClass.java    |  551 ++---
 src/main/resources/beansBeamline.xml          |  104 -
 src/main/resources/beansBeamlineSrv1.xml      |  104 -
 src/main/resources/beansPHOBOS.xml            |  103 -
 src/main/resources/beansRCM.xml               |  104 -
 src/main/resources/beans_Orion.xml            |    8 +-
 src/main/resources/log4j.properties           |    4 +-
 .../java/SnapArchiver/SnapArchiverTest.java   |  117 +-
 .../java/SnapManager/SnapManagerTest.java     |  369 ++--
 21 files changed, 3149 insertions(+), 3470 deletions(-)
 create mode 100644 src/main/java/SnapExtractor/GetSnapValuesClass.java
 delete mode 100644 src/main/resources/beansBeamline.xml
 delete mode 100644 src/main/resources/beansBeamlineSrv1.xml
 delete mode 100644 src/main/resources/beansPHOBOS.xml
 delete mode 100644 src/main/resources/beansRCM.xml

diff --git a/.classpath b/.classpath
index a951880..bc46178 100644
--- a/.classpath
+++ b/.classpath
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry kind="src" path="src/test/java"/>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
 	<classpathentry kind="src" path="src/main/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<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="lib" path="/snapArchivingApi/configuration"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/.project b/.project
index 697f322..9a527a1 100644
--- a/.project
+++ b/.project
@@ -11,19 +11,19 @@
 			</arguments>
 		</buildCommand>
 		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<name>org.eclipse.jdt.core.javabuilder</name>
 			<arguments>
 			</arguments>
 		</buildCommand>
 		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
 			<arguments>
 			</arguments>
 		</buildCommand>
 	</buildSpec>
 	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
 	</natures>
 </projectDescription>
diff --git a/pom.xml b/pom.xml
index 567864d..0e2dc5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
 
 	<groupId>fr.soleil.deviceservers</groupId>
 	<artifactId>snapArchivingServers</artifactId>
-	<version>1.5.9-SNAPSHOT</version>
+	<version>1.6.3</version>
 	<name>snapArchivingServers</name>
 
 	<scm>
@@ -42,22 +42,21 @@
 	</build>
 	<dependencies>
 		<dependency>
-			<groupId>fr.esrf.tango</groupId>
+			<groupId>org.tango</groupId>
 			<artifactId>TangORB</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>fr.esrf.atk</groupId>
-			<artifactId>ATKCore</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>fr.soleil.lib</groupId>
 			<artifactId>snapArchivingApi</artifactId>
 		</dependency>
-
 		<dependency>
 			<groupId>log4j</groupId>
 			<artifactId>log4j</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>org.tango</groupId>
+			<artifactId>JTangoClientLang</artifactId>
+		</dependency>
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
diff --git a/src/main/java/SnapArchiver/SnapArchiver.java b/src/main/java/SnapArchiver/SnapArchiver.java
index 234f592..a97879a 100644
--- a/src/main/java/SnapArchiver/SnapArchiver.java
+++ b/src/main/java/SnapArchiver/SnapArchiver.java
@@ -96,10 +96,18 @@
 
 package SnapArchiver;
 
-import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 import SnapArchiver.grouplink.UsePluginBuilder;
 import fr.esrf.Tango.DevFailed;
@@ -116,13 +124,14 @@ import fr.soleil.snapArchivingApi.SnapManagerApi.SnapManagerApi;
 import fr.soleil.snapArchivingApi.SnapshotingApi.ConfigConst;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManager;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManagerFactory;
+import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 
 /**
  * Class Description: Device of Snapshoting system
- *
+ * 
  * @author $Author: pierrejoseph $
  * @version $Revision: 1.18 $
  */
@@ -134,335 +143,424 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 // --------- End of States Description ----------
 public class SnapArchiver extends DeviceImpl
 /* WithShutdownRunnable */implements TangoConst {
-	protected int state;
-	protected SnapshotPersistenceManager manager;
-	private String m_version;
-
-	// --------- Start of attributes data members ----------
-
-	// --------- End of attributes data members ----------
-
-	// --------- 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;
-	// /**
-	// * Database schema name.<br>
-	// * <b>Default value : </b> snap
-	// */
-	// String dbSchema;
-
-	/**
-	 * User identifier (name) used to connect the database for snapshots. <br>
-	 * <b>Default value : </b> archiver
-	 */
-	String dbUser;
-	/**
-	 * Password used to connect the database for snapshots. <br>
-	 * <b>Default value : </b> archiver
-	 */
-	String dbPassword;
-	/**
-	 * The name of the spring beans file <br>
-	 * <b>Default value : </b> beans.xml
-	 */
-	String beansFileName;
-
-	// --------- End of properties data members ----------
-
-	// Add your own data members here
-	// private DataBaseAPI snapDb;
-
-	// CLA
-	// private Hashtable collectorsForSnapshots = new Hashtable();
-
-	// --------------------------------------
-
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapArchiver(DeviceClass cl, String s, String version) throws DevFailed {
-		super(cl, s);
-		m_version = version;
-		init_device();
-	}
-
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param d
-	 *            Device description.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapArchiver(DeviceClass cl, String s, String d, String version)
-			throws DevFailed {
-		super(cl, s, d);
-		m_version = version;
-		init_device();
+    protected int state;
+    protected SnapshotPersistenceManager manager;
+    private final String m_version;
+
+    // --------- Start of attributes data members ----------
+
+    // --------- End of attributes data members ----------
+
+    // --------- 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;
+    // /**
+    // * Database schema name.<br>
+    // * <b>Default value : </b> snap
+    // */
+    // String dbSchema;
+
+    /**
+     * User identifier (name) used to connect the database for snapshots. <br>
+     * <b>Default value : </b> archiver
+     */
+    String dbUser;
+    /**
+     * Password used to connect the database for snapshots. <br>
+     * <b>Default value : </b> archiver
+     */
+    String dbPassword;
+    /**
+     * The name of the spring beans file <br>
+     * <b>Default value : </b> beans.xml
+     */
+    String beansFileName;
+
+    private final ExecutorService executorService = Executors.newSingleThreadExecutor();
+    private final Map<Short, Future<Short>> snapshotResults = new HashMap<Short, Future<Short>>();
+    private String dbHost;
+    private String dbName;
+    private String dbSchema;
+    private String isRac;
+
+    // --------- End of properties data members ----------
+
+    // Add your own data members here
+    // private DataBaseAPI snapDb;
+
+    // CLA
+    // private Hashtable collectorsForSnapshots = new Hashtable();
+
+    // --------------------------------------
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapArchiver(DeviceClass cl, String s, String version) throws DevFailed {
+
+	super(cl, s);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param d
+     *            Device description.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapArchiver(DeviceClass cl, String s, String d, String version) throws DevFailed {
+	super(cl, s, d);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Initialize the device.
+     */
+    // =========================================================
+    @Override
+    public void init_device() throws DevFailed {
+	System.out.println("SnapArchiver() create " + device_name);
+	// Initialise variables to default values
+	// -------------------------------------------
+
+	get_device_property();
+	try {
+	    SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac);
+	    SnapshotPersistenceManagerFactory factory = SnapshotPersistenceManagerFactory.getInstance();
+	    manager = factory.getManager(beansFileName, dbUser, dbPassword);
+	    set_state(DevState.ON);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    set_state(DevState.FAULT);
+	    set_status(e.toString());
 	}
 
-	// =========================================================
-	/**
-	 * Initialize the device.
-	 */
-	// =========================================================
-	public void init_device() throws DevFailed {
-		System.out.println("SnapArchiver() create " + device_name);
-
-		// Initialise variables to default values
-		// -------------------------------------------
-		get_device_property();
-		try {
-			// Db connexion est elle vraiment utile ?
-			SnapManagerApi.SnapshotingConfigure(dbUser, dbPassword);
-			SnapshotPersistenceManagerFactory factory = SnapshotPersistenceManagerFactory
-					.getInstance(this.beansFileName);
-			manager = factory.getManager();
-
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		}
+    }
 
-		set_state(DevState.ON);
+    // ===================================================================
+    /**
+     * Read the device properties from database.
+     */
+    // ===================================================================
+    private void get_device_property() throws DevFailed {
+	// Initialize your default values here.
+	// ------------------------------------------
+	dbUser = "";
+	dbPassword = "";
+	beansFileName = ConfigConst.default_sabeansfilename;
+	dbHost = "";
+	dbName = "";
+	dbSchema = "";
+	isRac = "";
+	// Read device properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
 	}
 
-	// ===================================================================
-	/**
-	 * Read the device properties from database.
-	 */
-	// ===================================================================
-	private void get_device_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
-		dbUser = ConfigConst.default_sauser;
-		dbPassword = ConfigConst.default_sapasswd;
-		beansFileName = ConfigConst.default_sabeansfilename;
-
-		// Read device properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-
-		String[] propnames = { "DbUser", "DbPassword", "BeansFileName" };
-
-		// Call database and extract values
-		// --------------------------------------------
-		DbDatum[] dev_prop = get_db_device().get_property(propnames);
-		SnapArchiverClass ds_class = (SnapArchiverClass) get_device_class();
-		int i = -1;
-		// Extract DbUser value
-		if (dev_prop[++i].is_empty() == false)
-			dbUser = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				dbUser = cl_prop.extractString();
-		}
+	String[] propnames = { "DbUser", "DbPassword", "BeansFileName", "DbHost", "DbName", "DbSchema", "IsRac" };
+
+	// Call database and extract values
+	// --------------------------------------------
+	DbDatum[] dev_prop = get_db_device().get_property(propnames);
+	SnapArchiverClass ds_class = (SnapArchiverClass) get_device_class();
+	int i = -1;
+	// Extract DbUser value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbUser = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbUser = cl_prop.extractString();
+	    }
+	}
 
-		// Extract DbPassword value
-		if (dev_prop[++i].is_empty() == false)
-			dbPassword = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				dbPassword = cl_prop.extractString();
-		}
+	// Extract DbPassword value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbPassword = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbPassword = cl_prop.extractString();
+	    }
+	}
 
-		// Extract BeansFileName value
-		if (dev_prop[++i].is_empty() == false)
-			beansFileName = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				beansFileName = cl_prop.extractString();
-		}
-		// End of Automatic code generation
-		// -------------------------------------------------------------
+	// Extract BeansFileName value
+	if (dev_prop[++i].is_empty() == false) {
+	    beansFileName = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		beansFileName = cl_prop.extractString();
+	    }
+	}
+	// Extract DbHost value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbHost = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbHost = cl_prop.extractString();
+	    }
+	}
+	// Extract DbName value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbName = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbName = cl_prop.extractString();
+	    }
+	}
 
+	// Extract DbSchema value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbSchema = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbSchema = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Method always executed before command execution.
-	 */
-	// =========================================================
-	public void always_executed_hook() {
-		// get_logger().info("In always_executed_hook method()");
+	// Extract IsRac value
+	if (dev_prop[++i].is_empty() == false) {
+	    isRac = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		isRac = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "TriggerLaunchSnapShot" on device. This command is used
-	 * to trigger a snapShot. All informations concerning the snapshot will be
-	 * retrieved with the identifier parameter.
-	 *
-	 * @param argin
-	 *            The snapshot associated context's identifier.
-	 * @throws SnapshotingException
-	 */
-	// =========================================================
-	public synchronized short trigger_launch_snap_shot(short argin)
-			throws DevFailed {
-		// Timestamp startDate = new Timestamp(System.currentTimeMillis());
-		get_logger().info("Entering trigger_launch_snap_shot()");
-
-		// ---Add your Own code to control device here ---
-		SnapShot snapShot = null;
-		short snapId = -1;
-
-		try {
-			snapShot = SnapManagerApi.registerSnapShot((int) argin);
-			if (snapShot == null) {
-				Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
-						"SnapArchiver.TriggerLaunchSnapshot");
-			}
-
-			snapId = (short) snapShot.getId_snap();
-			// For each attribute of the object 'Snapshot', a snapshot is
-			// triggered...
-			ArrayList attributeList = snapShot.getAttribute_List();
-
-			UsePluginBuilder builder = new UsePluginBuilder(snapId, manager);
-			UsePlugin group = builder.build(attributeList);
-			group.execute();
-			group.getMessages();
-			// Map<String, String> messages = group.getMessages();
-		} catch (SnapshotingException e) {
-			e.printStackTrace();
-			Util.out2
-					.println("Exception received during TriggerLaunchSnapshot : "
-							+ e.toString());
-			throw e.toTangoException();
-		} catch (DevFailed e) {
-			throw e;
-		} catch (Exception e) {
-			Util.out2
-					.println("Unknown Exception is received during TriggerLaunchSnapshot : "
-							+ e.toString());
-			Except.throw_exception("ERROR", "Unknown Exception + "
-					+ e.toString(), "SnapArchiver.TriggerLaunchSnapshot");
+	// End of Automatic code generation
+	// -------------------------------------------------------------
 
-		}
+    }
 
-		return snapId;
+    // =========================================================
+    /**
+     * Method always executed before command execution.
+     */
+    // =========================================================
+    @Override
+    public void always_executed_hook() {
+	// get_logger().info("In always_executed_hook method()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "TriggerLaunchSnapShot" on device. This command is used
+     * to trigger a snapShot. All informations concerning the snapshot will be
+     * retrieved with the identifier parameter.
+     * 
+     * @param argin
+     *            The snapshot associated context's identifier.
+     * @throws SnapshotingException
+     */
+    // =========================================================
+    public void trigger_launch_snap_shot(short argin) throws DevFailed {
+	if (get_state().equals(DevState.RUNNING)) {
+	    DevFailedUtils.throwDevFailed("STATE_ERROR", "snapshot alreadly in progress");
 	}
+	set_state(DevState.RUNNING);
+	get_logger().info("Entering trigger_launch_snap_shot()");
+	Future<Short> snapshotResult = executorService.submit(new SnapshotTask(argin));
+	snapshotResults.put(argin, snapshotResult);
+
+    }
+
+    /**
+     * Command
+     * 
+     * @param argin
+     *            the context ID
+     * @return
+     * @throws DevFailed
+     */
+    public short getSnapShotResult(short argin) throws DevFailed {
+	short result = -1;
+	try {
+	    Future<Short> snap = snapshotResults.get(argin);
+	    if (snap != null) {
+		result = snapshotResults.get(argin).get();
+	    }
+	} catch (InterruptedException e) {
+	    DevFailedUtils.throwDevFailed(e);
+	} catch (ExecutionException e) {
+	    if (e.getCause() instanceof DevFailed) {
+		throw (DevFailed) e.getCause();
+	    } else {
+		DevFailedUtils.throwDevFailed(e.getCause());
+	    }
+	}
+	return result;
+    }
 
-	// =========================================================
-	/**
-	 * Execute command "CreateNewContext" on device. This command is used to
-	 * register a snapShot context. All informations concerning the snapshot
-	 * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext) are
-	 * passed through an array (DEVVAR_STRINGARRAY).
-	 *
-	 * @param argin
-	 *            All the informations usefull to create a context ,Snapshot
-	 *            pattern).
-	 */
-	// =========================================================
-	public synchronized void create_new_context(String[] argin)
-			throws DevFailed {
-		get_logger().info("Entering create_new_context()");
-
-		// ---Add your Own code to control device here ---
-		SnapContext snapContext = new SnapContext(argin);
-		try {
-			SnapManagerApi.createContext(snapContext);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		}
-		get_logger().info("Exiting create_new_context()");
+    private class SnapshotTask implements Callable<Short> {
+	private final short contextID;
+
+	public SnapshotTask(short contextID) {
+	    this.contextID = contextID;
 	}
 
-	// ===================================================================
-	/**
-	 * Method called by the read_attributes CORBA operation to set internal
-	 * attribute value.
-	 *
-	 * @param attr
-	 *            reference to the Attribute object
-	 */
-	// ===================================================================
-	public synchronized void read_attr(Attribute attr) throws DevFailed {
-		String attr_name = attr.get_name();
-		get_logger().info("In read_attr for attribute " + attr_name);
-
-		// Switch on attribute name
-		// ---------------------------------
-		if (attr_name == "version") {
-			// Add your own code here
-			attr.set_value(m_version);
+	@Override
+	public Short call() throws Exception {
+	    short snapId = -1;
+
+	    try {
+		SnapShot snapShot = SnapManagerApi.registerSnapShot(contextID);
+		if (snapShot == null) {
+		    Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapshot");
 		}
+		snapId = (short) snapShot.getId_snap();
+		// For each attribute of the object 'Snapshot', a snapshot is
+		// triggered...
+		List<SnapAttributeExtract> attributeList = snapShot.getAttribute_List();
+		UsePluginBuilder builder = new UsePluginBuilder(snapId, manager);
+		UsePlugin group = builder.build(attributeList);
+		group.execute();
+		group.getMessages();
+		// Map<String, String> messages = group.getMessages();
+	    } catch (SnapshotingException e) {
+		e.printStackTrace();
+		Util.out2.println("Exception received during TriggerLaunchSnapshot : " + e.toString());
+		throw e.toTangoException();
+	    } finally {
+		SnapArchiver.this.set_state(DevState.ON);
+	    }
+
+	    return snapId;
 	}
 
-	// =========================================================
-	/**
-	 * main part for the device server class
-	 */
-	// =========================================================
-	public static void main(String[] argv) {
-		try {
-			Util tg = Util.init(argv, "SnapArchiver");
-			tg.server_init();
-
-			System.out.println("Ready to accept request");
-
-			tg.server_run();
-		} catch (OutOfMemoryError ex) {
-			System.err.println("Can't allocate memory !!!!");
-			System.err.println("Exiting");
-		} catch (UserException ex) {
-			Except.print_exception(ex);
-
-			System.err.println("Received a CORBA user exception");
-			System.err.println("Exiting");
-		} catch (SystemException ex) {
-			Except.print_exception(ex);
-
-			System.err.println("Received a CORBA system exception");
-			System.err.println("Exiting");
-		}
+    }
+
+    // =========================================================
+    /**
+     * Execute command "CreateNewContext" on device. This command is used to
+     * register a snapShot context. All informations concerning the snapshot
+     * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext) are
+     * passed through an array (DEVVAR_STRINGARRAY).
+     * 
+     * @param argin
+     *            All the informations usefull to create a context ,Snapshot
+     *            pattern).
+     */
+    // =========================================================
+    public void create_new_context(String[] argin) throws DevFailed {
+	get_logger().info("Entering create_new_context()");
+
+	// ---Add your Own code to control device here ---
+	SnapContext snapContext = new SnapContext(argin);
+	try {
+	    SnapManagerApi.createContext(snapContext);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting create_new_context()");
+    }
+
+    // ===================================================================
+    /**
+     * Method called by the read_attributes CORBA operation to set internal
+     * attribute value.
+     * 
+     * @param attr
+     *            reference to the Attribute object
+     */
+    // ===================================================================
+    @Override
+    public void read_attr(Attribute attr) throws DevFailed {
+	String attr_name = attr.get_name();
+	get_logger().info("In read_attr for attribute " + attr_name);
+
+	// Switch on attribute name
+	// ---------------------------------
+	if (attr_name == "version") {
+	    // Add your own code here
+	    attr.set_value(m_version);
+	}
+    }
 
-		System.exit(-1);
+    // =========================================================
+    /**
+     * main part for the device server class
+     */
+    // =========================================================
+    public static void main(String[] argv) {
+	try {
+	    Util tg = Util.init(argv, "SnapArchiver");
+	    tg.server_init();
+
+	    System.out.println("Ready to accept request");
+
+	    tg.server_run();
+	} catch (OutOfMemoryError ex) {
+	    System.err.println("Can't allocate memory !!!!");
+	    System.err.println("Exiting");
+	} catch (UserException ex) {
+	    Except.print_exception(ex);
+
+	    System.err.println("Received a CORBA user exception");
+	    System.err.println("Exiting");
+	} catch (SystemException ex) {
+	    Except.print_exception(ex);
+
+	    System.err.println("Received a CORBA system exception");
+	    System.err.println("Exiting");
 	}
-	/**
+
+	System.exit(-1);
+    }
+
+    /**
      *
      */
 
-	@Override
-	public void delete_device() throws DevFailed {
-		// TODO Auto-generated method stub
+    @Override
+    public void delete_device() throws DevFailed {
 
-	}
+	snapshotResults.clear();
+
+    }
 }
 
 // --------------------------------------------------------------------------
diff --git a/src/main/java/SnapArchiver/SnapArchiverClass.java b/src/main/java/SnapArchiver/SnapArchiverClass.java
index ec4d46e..bed164e 100644
--- a/src/main/java/SnapArchiver/SnapArchiverClass.java
+++ b/src/main/java/SnapArchiver/SnapArchiverClass.java
@@ -58,6 +58,7 @@
 
 package SnapArchiver;
 
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.Vector;
 
@@ -66,268 +67,266 @@ import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DispLevel;
 import fr.esrf.TangoApi.DbDatum;
 import fr.esrf.TangoDs.Attr;
-import fr.esrf.TangoDs.Command;
 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 SnapArchiverClass extends DeviceClass implements TangoConst {
-	/**
-	 * SnapArchiverClass class instance (it is a singleton).
-	 */
-	private static SnapArchiverClass _instance = null;
+    /**
+     * SnapArchiverClass class instance (it is a singleton).
+     */
+    private static SnapArchiverClass _instance = null;
 
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = 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;
-	// /**
-	// * Database schema name.<br> <b>Default value : </b> snap
-	// */
-	// String dbSchema;
-	//
-	// //--------- End of properties data members ----------
-	//
+    // //--------- 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;
+    // /**
+    // * Database schema name.<br> <b>Default value : </b> snap
+    // */
+    // String dbSchema;
+    //
+    // //--------- End of properties data members ----------
+    //
 
-	// ===================================================================
-	//
-	// method : instance()
-	//
-	// description : static method to retrieve the SnapArchiverClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static SnapArchiverClass instance() {
-		if (_instance == null) {
-			System.err.println("SnapArchiverClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the SnapArchiverClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static SnapArchiverClass instance() {
+	if (_instance == null) {
+	    System.err.println("SnapArchiverClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : Init()
-	//
-	// description : static method to create/retrieve the SnapArchiverClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static SnapArchiverClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			_instance = new SnapArchiverClass(class_name);
-		}
-		return _instance;
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the SnapArchiverClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static SnapArchiverClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    _instance = new SnapArchiverClass(class_name);
 	}
+	return _instance;
+    }
 
-	// ===================================================================
-	//
-	// method : SnapArchiverClass()
-	//
-	// description : constructor for the SnapArchiverClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected SnapArchiverClass(String name) throws DevFailed {
-		super(name);
+    // ===================================================================
+    //
+    // method : SnapArchiverClass()
+    //
+    // description : constructor for the SnapArchiverClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected SnapArchiverClass(String name) throws DevFailed {
+	super(name);
 
-		Util.out2.println("Entering SnapArchiverClass constructor");
-		write_class_property();
-		get_class_property();
+	Util.out2.println("Entering SnapArchiverClass constructor");
+	write_class_property();
+	get_class_property();
 
-		Util.out2.println("Leaving SnapArchiverClass constructor");
-	}
+	Util.out2.println("Leaving SnapArchiverClass constructor");
+    }
 
-	// =============================================================================
-	//
-	// Method: attribute_factory(Vector att_list)
-	//
-	// =============================================================================
-	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 : command_factory()
-	//
-	// description : Create the command object(s) and store them in the
-	// command list
-	// ===================================================================
-	public void command_factory() {
-		command_list.addElement(new TriggerLaunchSnapShotCmd(
-				"TriggerLaunchSnapShot",
-				Tango_DEV_SHORT,
-				Tango_DEV_SHORT,
-				"The snapshot associated context's identifier.",
-				"The new snapshot identifier.",
-				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 TriggerLaunchSnapShotCmd("TriggerLaunchSnapShot", Tango_DEV_SHORT, Tango_DEV_VOID,
+		"The snapshot associated context's identifier", "", DispLevel.OPERATOR));
 
-		command_list
-				.addElement(new CreateNewContextCmd(
-						"CreateNewContext",
-						Tango_DEVVAR_STRINGARRAY,
-						Tango_DEV_VOID,
-						"All the informations usefull to create a context ,Snapshot pattern).",
-						"", DispLevel.OPERATOR));
+	command_list.addElement(new TemplCommandInOut("GetSnapShotResult", "getSnapShotResult",
+		"The snapshot associated context's identifier", "The new snapshot identifier", DispLevel.OPERATOR));
 
-		// add polling if any
-		for (int i = 0; i < command_list.size(); i++) {
-			Command cmd = (Command) command_list.elementAt(i);
-		}
-	}
+	command_list.addElement(new CreateNewContextCmd("CreateNewContext", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID,
+		"All the informations usefull to create a context ,Snapshot pattern).", "", DispLevel.OPERATOR));
+    }
 
-	// ===================================================================
-	//
-	// method : device_factory()
-	//
-	// description : Create the device object(s) and store them in the
-	// device list
-	//
-	// argument : in : String[] devlist : The device name list
-	//
-	// ===================================================================
-	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 = "unkown";
+	try {
+	    device_version = ResourceBundle.getBundle("application").getString("project.version");
+	} catch (MissingResourceException e) {
+	}
 
-		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 SnapArchiver(this, devlist[i],
-					device_version));
+	    // Create device and add it into the device list
+	    // ----------------------------------------------
+	    device_list.addElement(new SnapArchiver(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.
+     * @throws DevFailed
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) throws DevFailed {
+	// for (int i = 0; i < cl_prop.length; i++) {
+	// if (cl_prop[i].name.equals(name)) {
+	// return cl_prop[i];
+	// }
+	// }
+	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 {
-		// 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)
-		// Read class properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = {};
+	// Read class properties from database.(Automatic code generation)
+	// 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
-		//
-		// //-------------------------------------------------------------
-		// if ( Util._UseDb == false )
-		// return;
-		// String[] propnames = {
-		// "DbHost",
-		// "DbName",
-		// "DbSchema"
-		// };
-		//
-		// // 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 DbSchema value
-		// if ( cl_prop[ ++i ].is_empty() == false )
-		// dbSchema = cl_prop[ i ].extractString();
-		// else
-		// cl_prop[ i ].insert(dbSchema);
-		//
-		// // End of Automatic code generation
-		// //-------------------------------------------------------------
+	// End of Automatic code generation
+	//
+	// //-------------------------------------------------------------
+	// if ( Util._UseDb == false )
+	// return;
+	// String[] propnames = {
+	// "DbHost",
+	// "DbName",
+	// "DbSchema"
+	// };
+	//
+	// // 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 DbSchema value
+	// if ( cl_prop[ ++i ].is_empty() == false )
+	// dbSchema = cl_prop[ i ].extractString();
+	// else
+	// cl_prop[ i ].insert(dbSchema);
+	//
+	// // 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("Device of Snapshoting system");
+	data[1] = new DbDatum("Description");
+	data[1].insert("Device of Snapshoting 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/SnapArchiver/TriggerLaunchSnapShotCmd.java b/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java
index 4b5baa2..06152dd 100644
--- a/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java
+++ b/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java
@@ -12,35 +12,36 @@ import fr.esrf.TangoDs.Util;
 
 public class TriggerLaunchSnapShotCmd extends Command implements TangoConst {
 
-	public TriggerLaunchSnapShotCmd(String arg0, int arg1, int arg2) {
-		super(arg0, arg1, arg2);
-		// TODO Auto-generated constructor stub
-	}
-
-	public TriggerLaunchSnapShotCmd(String name, int in, int out,
-			String in_comments, String out_comments) {
-		super(name, in, out, in_comments, out_comments);
-	}
-
-	public TriggerLaunchSnapShotCmd(String name, int in, int out,
-			String in_comments, String out_comments, DispLevel level) {
-		super(name, in, out, in_comments, out_comments, level);
-	}
-
-	@Override
-	public Any execute(DeviceImpl arg0, Any in_any) throws DevFailed {
-		Util.out2.println("TriggerLaunchSnapShotCmd.execute(): arrived");
-		short argin = extract_DevShort(in_any);
-		if (argin < 0) {
-			Util.out2.println("Invalid Context ID");
-			Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
-					"SnapArchiver.TriggerLaunchSnapShot");
-		}
-
-		return insert(((SnapArchiver) (arg0)).trigger_launch_snap_shot(argin));
-	}
-
-	public boolean is_allowed(DeviceImpl device, Any data_in) {
-		return true;
+    public TriggerLaunchSnapShotCmd(String arg0, int arg1, int arg2) {
+	super(arg0, arg1, arg2);
+	// TODO Auto-generated constructor stub
+    }
+
+    public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) {
+	super(name, in, out, in_comments, out_comments);
+    }
+
+    public TriggerLaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments,
+	    DispLevel level) {
+	super(name, in, out, in_comments, out_comments, level);
+    }
+
+    @Override
+    public Any execute(DeviceImpl arg0, Any in_any) throws DevFailed {
+	Util.out2.println("TriggerLaunchSnapShotCmd.execute(): arrived");
+	short argin = extract_DevShort(in_any);
+	if (argin < 0) {
+	    Util.out2.println("Invalid Context ID");
+	    Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapShot");
 	}
+	((SnapArchiver) arg0).trigger_launch_snap_shot(argin);
+	return insert();
+	// return insert(((SnapArchiver)
+	// (arg0)).trigger_launch_snap_shot(argin));
+    }
+
+    @Override
+    public boolean is_allowed(DeviceImpl device, Any data_in) {
+	return true;
+    }
 }
diff --git a/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java b/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java
index f2d15ec..666fa2c 100644
--- a/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java
+++ b/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java
@@ -26,11 +26,12 @@ package SnapArchiver.grouplink;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.Vector;
 
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.TangoApi.DeviceProxy;
@@ -43,143 +44,128 @@ import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.PersistencePlu
 import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.context.PluginContext;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManager;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.context.SnapshotPersistenceContext;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeLight;
+import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 
 public class UsePluginBuilder {
-	private static final String TANGO_SEPARATOR = "/";
-	private Map<String, Integer> attributeIds;
-
-	private int snapId;
-	private SnapshotPersistenceManager manager;
-
-	public UsePluginBuilder(int _snapId, SnapshotPersistenceManager _manager) {
-		this.snapId = _snapId;
-		this.manager = _manager;
+    private static final String TANGO_SEPARATOR = "/";
+    private Map<String, Integer> attributeIds;
+
+    private final int snapId;
+    private final SnapshotPersistenceManager manager;
+
+    public UsePluginBuilder(int _snapId, SnapshotPersistenceManager _manager) {
+	this.snapId = _snapId;
+	this.manager = _manager;
+    }
+
+    // public UsePlugin build ( List <INamedAttribute> attributeList ) throws
+    // DevFailed
+    public UsePlugin build(List<SnapAttributeExtract> attributeList) throws DevFailed {
+	attributeIds = new HashMap<String, Integer>(attributeList.size());
+	Map<String, Collection<String>> deviceToAttributes = new Hashtable<String, Collection<String>>();
+
+	// SORT ATTRIBUTES BY DEVICE
+	for (SnapAttributeExtract attribute : attributeList) {
+	    String completeName = attribute.getAttribute_complete_name();
+	    String[] parsedName = this.parseName(completeName);
+	    int attributeId = attribute.getId_att();
+	    attributeIds.put(completeName, attributeId);
+	    String deviceName = parsedName[0];
+	    String attributeName = parsedName[1];
+
+	    Collection<String> attributesForThisDevice = deviceToAttributes.get(deviceName);
+	    if (attributesForThisDevice == null) {
+		attributesForThisDevice = new ArrayList<String>();
+		deviceToAttributes.put(deviceName, attributesForThisDevice);
+	    }
+	    attributesForThisDevice.add(attributeName);
 	}
-
-	// public UsePlugin build ( List <INamedAttribute> attributeList ) throws
-	// DevFailed
-	public UsePlugin build(ArrayList attributeList) throws DevFailed {
-		Iterator it = attributeList.iterator();
-		attributeIds = new Hashtable<String, Integer>(attributeList.size());
-		Map<String, Collection<String>> deviceToAttributes = new Hashtable<String, Collection<String>>();
-
-		// SORT ATTRIBUTES BY DEVICE
-		while (it.hasNext()) {
-			// SnapAttributeExtract nextAttribute = (SnapAttributeExtract)
-			// it.next ();
-			Object nextObject = it.next();
-			// System.out.println("UsePluginBuilder/build/nextObject/"+nextObject.getClass().toString());
-			SnapAttributeLight nextAttribute = (SnapAttributeLight) nextObject;
-			String completeName = nextAttribute.getAttribute_complete_name();
-			String[] parsedName = this.parseName(completeName);
-
-			int attributeId = nextAttribute.getAttribute_id();
-			attributeIds.put(completeName, attributeId);
-
-			String deviceName = parsedName[0];
-			String attributeName = parsedName[1];
-
-			Collection<String> attributesForThisDevice = deviceToAttributes
-					.get(deviceName);
-			if (attributesForThisDevice == null) {
-				attributesForThisDevice = new Vector<String>();
-				deviceToAttributes.put(deviceName, attributesForThisDevice);
-			}
-			attributesForThisDevice.add(attributeName);
-		}
-		// traceDeviceToAttributes ( deviceToAttributes );
-
-		// BUILD THE PROXIES AND ATTRIBUTES LIST
-		Target[] devices = new Target[deviceToAttributes.size()];
-
-		String[][] attributes = new String[deviceToAttributes.size()][];
-		Iterator<String> it2 = deviceToAttributes.keySet().iterator();
-		int i = 0;
-
-		while (it2.hasNext()) {
-			String nextDevice = it2.next();
-			try {
-				devices[i] = TargetFactory
-						.getTarget(new DeviceProxy(nextDevice));
-
-				Collection<String> attributesForThisDevice = deviceToAttributes
-						.get(nextDevice);
-				Iterator<String> it3 = attributesForThisDevice.iterator();
-				attributes[i] = new String[attributesForThisDevice.size()];
-				int j = 0;
-				while (it3.hasNext()) {
-					String nextAttribute = it3.next();
-					attributes[i][j] = nextAttribute;
-					j++;
-				}
-
-				i++;
-			} catch (DevFailed e) {
-				e.printStackTrace();
-				Util.out2.println(e.toString());
-				Util.out2.println("Failed to reach the device: " + nextDevice);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-
+	// traceDeviceToAttributes ( deviceToAttributes );
+
+	// BUILD THE PROXIES AND ATTRIBUTES LIST
+	Target[] devices = new Target[deviceToAttributes.size()];
+
+	String[][] attributes = new String[deviceToAttributes.size()][];
+	Iterator<String> it2 = deviceToAttributes.keySet().iterator();
+	int i = 0;
+
+	while (it2.hasNext()) {
+	    String nextDevice = it2.next();
+	    try {
+		System.out.println("snap device " + nextDevice);
+		devices[i] = TargetFactory.getTarget(new DeviceProxy(nextDevice));
+
+		Collection<String> attributesForThisDevice = deviceToAttributes.get(nextDevice);
+		System.out.println("snap attributes " + attributesForThisDevice);
+		Iterator<String> it3 = attributesForThisDevice.iterator();
+		attributes[i] = new String[attributesForThisDevice.size()];
+		int j = 0;
+		while (it3.hasNext()) {
+		    String nextAttribute = it3.next();
+		    attributes[i][j] = nextAttribute;
+		    j++;
 		}
 
-		UsePlugin ret = new UsePluginImpl(devices, attributes,
-				new PersistencePlugin());
+		i++;
+	    } catch (DevFailed e) {
+		e.printStackTrace();
+		System.out.println("Failed to reach the device: " + nextDevice);
+	    } catch (Exception e) {
+		e.printStackTrace();
+	    }
 
-		SnapshotPersistenceContext persistenceContext = new SnapshotPersistenceContext(
-				this.snapId, attributeIds);
-		persistenceContext.setManager(this.manager);
-		PluginContext context = new PluginContext();
-		context.setPersistenceContext(persistenceContext);
-		ret.setPluginContext(context);
-
-		return ret;
 	}
 
-	private void traceDeviceToAttributes(
-			Hashtable<String, Collection<String>> deviceToAttributes) {
-		Iterator<String> keys = deviceToAttributes.keySet().iterator();
-
-		System.out.println("traceDeviceToAttributes VVVVVVVVVVVVVVVVVVVVVVV");
-		while (keys.hasNext()) {
-			String nextDevice = keys.next();
-
-			System.out.println("      " + nextDevice + "  VVVVVVVVVVVVVV");
-			Collection<String> attributesForThisDevice = deviceToAttributes
-					.get(nextDevice);
-			Iterator<String> attrs = attributesForThisDevice.iterator();
-			while (attrs.hasNext()) {
-				String nextAttr = attrs.next();
-				System.out.println("              " + nextAttr);
-			}
-			System.out.println("      " + nextDevice + "  ^^^^^^^^^^^^^^");
-		}
-		System.out.println("traceDeviceToAttributes ^^^^^^^^^^^^^^^^^^^^^^^^");
-	}
+	UsePlugin ret = new UsePluginImpl(devices, attributes, new PersistencePlugin());
 
-	private String[] parseName(String completeName) {
-		String[] ret = new String[2];
-		StringTokenizer st = new StringTokenizer(completeName, TANGO_SEPARATOR);
-		StringBuffer buff = new StringBuffer();
+	SnapshotPersistenceContext persistenceContext = new SnapshotPersistenceContext(this.snapId, attributeIds);
+	persistenceContext.setManager(this.manager);
+	PluginContext context = new PluginContext();
+	context.setPersistenceContext(persistenceContext);
+	ret.setPluginContext(context);
 
-		buff.append(st.nextToken());
-		buff.append(TANGO_SEPARATOR);
-		buff.append(st.nextToken());
-		buff.append(TANGO_SEPARATOR);
-		buff.append(st.nextToken());
+	return ret;
+    }
 
-		ret[0] = buff.toString();
-		ret[1] = st.nextToken();
-		return ret;
-	}
+    private void traceDeviceToAttributes(Hashtable<String, Collection<String>> deviceToAttributes) {
+	Iterator<String> keys = deviceToAttributes.keySet().iterator();
+
+	System.out.println("traceDeviceToAttributes VVVVVVVVVVVVVVVVVVVVVVV");
+	while (keys.hasNext()) {
+	    String nextDevice = keys.next();
 
-	/**
-	 * @return the attributeIds
-	 */
-	public Map<String, Integer> getAttributeIds() {
-		return this.attributeIds;
+	    System.out.println("      " + nextDevice + "  VVVVVVVVVVVVVV");
+	    Collection<String> attributesForThisDevice = deviceToAttributes.get(nextDevice);
+	    Iterator<String> attrs = attributesForThisDevice.iterator();
+	    while (attrs.hasNext()) {
+		String nextAttr = attrs.next();
+		System.out.println("              " + nextAttr);
+	    }
+	    System.out.println("      " + nextDevice + "  ^^^^^^^^^^^^^^");
 	}
+	System.out.println("traceDeviceToAttributes ^^^^^^^^^^^^^^^^^^^^^^^^");
+    }
+
+    private String[] parseName(String completeName) {
+	String[] ret = new String[2];
+	StringTokenizer st = new StringTokenizer(completeName, TANGO_SEPARATOR);
+	StringBuffer buff = new StringBuffer();
+
+	buff.append(st.nextToken());
+	buff.append(TANGO_SEPARATOR);
+	buff.append(st.nextToken());
+	buff.append(TANGO_SEPARATOR);
+	buff.append(st.nextToken());
+
+	ret[0] = buff.toString();
+	ret[1] = st.nextToken();
+	return ret;
+    }
+
+    /**
+     * @return the attributeIds
+     */
+    public Map<String, Integer> getAttributeIds() {
+	return this.attributeIds;
+    }
 }
diff --git a/src/main/java/SnapExtractor/GetSnapValuesClass.java b/src/main/java/SnapExtractor/GetSnapValuesClass.java
new file mode 100644
index 0000000..2a89ca4
--- /dev/null
+++ b/src/main/java/SnapExtractor/GetSnapValuesClass.java
@@ -0,0 +1,109 @@
+/**
+ * 
+ */
+package SnapExtractor;
+
+import java.util.Arrays;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DevState;
+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;
+
+/**
+ * @author AYADI
+ * 
+ */
+public class GetSnapValuesClass extends Command implements TangoConst {
+
+    /**
+     * @param s
+     * @param in
+     * @param out
+     * @param level
+     */
+    public GetSnapValuesClass(String s, int in, int out, DispLevel level) {
+	super(s, in, out, level);
+	// TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param s
+     * @param in
+     * @param out
+     * @param in_desc
+     * @param out_desc
+     * @param level
+     */
+    public GetSnapValuesClass(String s, int in, int out, String in_desc, String out_desc, DispLevel level) {
+	super(s, in, out, in_desc, out_desc, level);
+	// TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param s
+     * @param in
+     * @param out
+     * @param in_desc
+     * @param out_desc
+     */
+    public GetSnapValuesClass(String s, int in, int out, String in_desc, String out_desc) {
+	super(s, in, out, in_desc, out_desc);
+	// TODO Auto-generated constructor stub
+    }
+
+    public GetSnapValuesClass(String s, int in, int out) {
+	super(s, in, out);
+	// TODO Auto-generated constructor stub
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see fr.esrf.TangoDs.Command#execute(fr.esrf.TangoDs.DeviceImpl,
+     * org.omg.CORBA.Any)
+     */
+    @Override
+    public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
+	String[] in = extract_DevVarStringArray(in_any);
+	int snapID = -1;
+	boolean readValues = true;
+	try {
+	    snapID = Integer.parseInt(in[0]);
+	    if (snapID < 0) {
+		Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID", "SnapExtractor.GetSnapValues");
+	    }
+	    readValues = Boolean.parseBoolean(in[1]);
+	} catch (Exception e) {
+	    Except.throw_exception("INPUT_ERROR", "Invalid Snapshot ID or readValues", "SnapExtractor.GetSnapValues");
+	}
+
+	String[] attrNames = Arrays.copyOfRange(in, 2, in.length);
+	return insert(((SnapExtractor) device).getSnapValues(snapID, readValues, attrNames));
+
+    }
+
+    // ===============================================================
+    /**
+     * Check if it is allowed to execute the command.
+     */
+    // ===============================================================
+    @Override
+    public boolean is_allowed(DeviceImpl device, Any data_in) {
+	if (device.get_state() == DevState.OFF || device.get_state() == DevState.INIT
+		|| device.get_state() == DevState.FAULT || device.get_state() == DevState.EXTRACT
+		|| device.get_state() == DevState.UNKNOWN) {
+	    // End of Generated Code
+
+	    // Re-Start of Generated Code
+	    return false;
+	}
+	return true;
+    }
+
+}
diff --git a/src/main/java/SnapExtractor/SnapExtractor.java b/src/main/java/SnapExtractor/SnapExtractor.java
index 483c0e7..779316c 100644
--- a/src/main/java/SnapExtractor/SnapExtractor.java
+++ b/src/main/java/SnapExtractor/SnapExtractor.java
@@ -90,6 +90,7 @@ package SnapExtractor;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
+import org.tango.utils.DevFailedUtils;
 
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
@@ -113,11 +114,10 @@ import fr.soleil.snapArchivingApi.SnapExtractorApi.convert.IConverter;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.datasources.db.ISnapReader;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.datasources.db.SnapReaderFactory;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.devicelink.Warnable;
-import fr.soleil.snapArchivingApi.SnapExtractorApi.lifecycle.LifeCycleManager;
-import fr.soleil.snapArchivingApi.SnapExtractorApi.lifecycle.LifeCycleManagerFactory;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.naming.DynamicAttributeNamerFactory;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.naming.IDynamicAttributeNamer;
 import fr.soleil.snapArchivingApi.SnapExtractorApi.tools.Tools;
+import fr.soleil.snapArchivingApi.SnapManagerApi.SnapManagerApi;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 
@@ -125,7 +125,7 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
  * Class Description: This device is in charge of extracting snapshots from the
  * SNAP database. It can look up the snapshots for a given context, and extract
  * those snapshots.
- *
+ * 
  * @author $Author: soleilarc $
  * @version $Revision: 1.16 $
  */
@@ -138,1001 +138,938 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 // --------- End of States Description ----------
 
 public class SnapExtractor extends DeviceImpl
-		/* WithShutdownRunnable */implements TangoConst, Warnable {
-	protected int state;
-	private String m_version;
-
-	// --------- Start of attributes data members ----------
-	private int id = 0;
-	// --------- End of attributes data members ----------
-
-	// --------- Start of properties data members ----------
-
-	/**
-	 * User identifier (name) used to connect the database SNAP. <br>
-	 * <b>Default value : </b> snap
-	 */
-	String snapUser;
-	/**
-	 * Password used to connect the database SNAP. <br>
-	 * <b>Default value : </b> snap
-	 */
-	String snapPassword;
-
-	// --------- End of properties data members ----------
-
-	// Add your own data members here
-	protected int formerState = DevState._UNKNOWN;
-
-	// --------------------------------------
-
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapExtractor(DeviceClass cl, String s, String version) throws DevFailed {
-		super(cl, s);
-		m_version = version;
-		init_device();
+/* WithShutdownRunnable */implements TangoConst {
+    protected int state;
+    private final String m_version;
+
+    // --------- Start of attributes data members ----------
+    private int id = 0;
+    // --------- End of attributes data members ----------
+
+    // --------- Start of properties data members ----------
+
+    /**
+     * User identifier (name) used to connect the database SNAP. <br>
+     * <b>Default value : </b> snap
+     */
+    String snapUser;
+    /**
+     * Password used to connect the database SNAP. <br>
+     * <b>Default value : </b> snap
+     */
+    String snapPassword;
+
+    // --------- End of properties data members ----------
+
+    // Add your own data members here
+    protected int formerState = DevState._UNKNOWN;
+
+    private String dbHost;
+    private String dbName;
+    private String dbSchema;
+    private String isRac;
+    private ISnapReader snapReader;
+
+    // --------------------------------------
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapExtractor(DeviceClass cl, String s, String version) throws DevFailed {
+	super(cl, s);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param d
+     *            Device description.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapExtractor(DeviceClass cl, String s, String d, String version) throws DevFailed {
+	super(cl, s, d);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Initialize the device.
+     */
+    // =========================================================
+    @Override
+    public void init_device() throws DevFailed {
+	System.out.println("SnapExtractor() create " + device_name);
+
+	// Initialise variables to default values
+	get_device_property();
+	// LifeCycleManagerFactory.setUser(this.snapUser);
+	// LifeCycleManagerFactory.setPassword(this.snapPassword);
+	// LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
+	// .getImpl(LifeCycleManagerFactory.DEFAULT_LIFE_CYCLE);
+	// lifeCycleManager.setWatcherToWarn(this);
+	//
+	// Thread apiThread = lifeCycleManager.getAsThread();
+	// apiThread.start();
+	// -------------------------------------------
+	try {
+	    // Snap Database connection
+	    SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, snapUser, snapPassword, isRac);
+	    snapReader = SnapReaderFactory.getImpl(SnapReaderFactory.REAL);
+	    snapReader.openConnection();
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
 	}
 
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param d
-	 *            Device description.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapExtractor(DeviceClass cl, String s, String d, String version)
-			throws DevFailed {
-		super(cl, s, d);
-		m_version = version;
-		init_device();
+	set_state(DevState.ON);
+    }
+
+    // =========================================================
+    /**
+     * Execute command "RemoveDynamicAttribute" on device. Remove the dynamic
+     * attribute specified by its name argin.
+     * 
+     * @param argin
+     *            The dynamic attribute's name
+     */
+    // =========================================================
+    public void remove_dyn_attr(String argin) throws DevFailed {
+	get_logger().info("Entering remove_dynamic_attribute()");
+
+	// ---Add your Own code to control device here ---
+	// Remove prop for the attribute
+	String[] obj_to_del = new String[3];
+	obj_to_del[0] = device_name;
+	obj_to_del[1] = "attribute";
+	obj_to_del[2] = argin;
+	Util tg = Util.instance();
+	tg.get_dserver_device().rem_obj_polling(obj_to_del, false);
+
+	// Remove the attribute
+	remove_attribute(argin);
+	get_logger().info("Exiting remove_dynamic_attribute()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "RemoveDynamicAttributes" on device. Remove the dynamic
+     * attributes specified by the names list.
+     * 
+     * @param argin
+     *            The dynamic attributes names
+     */
+    // =========================================================
+    public void remove_dyn_attrs(String[] argin) throws DevFailed {
+	get_logger().info("Entering remove_dyn_attrs()");
+
+	// ---Add your Own code to control device here ---
+	// Remove prop for the attribute
+	if (argin == null) {
+	    return;
 	}
 
-	// =========================================================
-	/**
-	 * Initialize the device.
-	 */
-	// =========================================================
-	public synchronized void init_device() throws DevFailed {
-		System.out.println("SnapExtractor() create " + device_name);
-
-		// Initialise variables to default values
-		get_device_property();
-		LifeCycleManagerFactory.setUser(this.snapUser);
-		LifeCycleManagerFactory.setPassword(this.snapPassword);
-		LifeCycleManager lifeCycleManager = LifeCycleManagerFactory
-				.getImpl(LifeCycleManagerFactory.DEFAULT_LIFE_CYCLE);
-		lifeCycleManager.setWatcherToWarn(this);
-
-		Thread apiThread = lifeCycleManager.getAsThread();
-		apiThread.start();
-		// -------------------------------------------
-		set_state(DevState.ON);
-	}
-
-	// =========================================================
-	/**
-	 * Execute command "RemoveDynamicAttribute" on device. Remove the dynamic
-	 * attribute specified by its name argin.
-	 *
-	 * @param argin
-	 *            The dynamic attribute's name
-	 */
-	// =========================================================
-	public void remove_dyn_attr(String argin) throws DevFailed {
-		get_logger().info("Entering remove_dynamic_attribute()");
-
-		// ---Add your Own code to control device here ---
-		// Remove prop for the attribute
+	for (int i = 0; i < argin.length; i++) {
+	    try {
 		String[] obj_to_del = new String[3];
+
 		obj_to_del[0] = device_name;
 		obj_to_del[1] = "attribute";
-		obj_to_del[2] = argin;
+		obj_to_del[2] = argin[i];
+
 		Util tg = Util.instance();
 		tg.get_dserver_device().rem_obj_polling(obj_to_del, false);
 
 		// Remove the attribute
-		remove_attribute(argin);
-		get_logger().info("Exiting remove_dynamic_attribute()");
-	}
-
-	// =========================================================
-	/**
-	 * Execute command "RemoveDynamicAttributes" on device. Remove the dynamic
-	 * attributes specified by the names list.
-	 *
-	 * @param argin
-	 *            The dynamic attributes names
-	 */
-	// =========================================================
-	public void remove_dyn_attrs(String[] argin) throws DevFailed {
-		get_logger().info("Entering remove_dyn_attrs()");
-
-		// ---Add your Own code to control device here ---
-		// Remove prop for the attribute
-		if (argin == null) {
-			return;
-		}
-
-		for (int i = 0; i < argin.length; i++) {
-			try {
-				String[] obj_to_del = new String[3];
-
-				obj_to_del[0] = device_name;
-				obj_to_del[1] = "attribute";
-				obj_to_del[2] = argin[i];
+		this.remove_attribute(argin[i]);
+	    } catch (Throwable t) {
+		Tools.printIfDevFailed(t);
 
-				Util tg = Util.instance();
-				tg.get_dserver_device().rem_obj_polling(obj_to_del, false);
-
-				// Remove the attribute
-				this.remove_attribute(argin[i]);
-			} catch (Throwable t) {
-				Tools.printIfDevFailed(t);
-
-				continue;
-			}
-		}
-
-		get_logger().info("Exiting remove_dyn_attrs()");
+		continue;
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "RemoveAllDynamicAttribute" on device. Remove all
-	 * existing dynamic attributes.
-	 *
-	 * @param argin
-	 *            The dynamic attribute's name
-	 */
-	// =========================================================
-	public void remove_all_dyn_attr() throws DevFailed {
-		get_logger().info("Entering remove_dynamic_attribute()");
-
-		// ---Add your Own code to control device here ---
-
-		int numberOfAttributes = this.dev_attr == null ? 0 : this.dev_attr
-				.get_attr_nb();
-		String[] attributesToRemove = new String[numberOfAttributes];
-		for (int i = 0; i < numberOfAttributes; i++) {
-			Attribute nextAttribute = this.dev_attr.get_attr_by_ind(i);
-			String attributeName = nextAttribute.get_name();
-			// System.out.println ( "CLA/attributeName/"+attributeName);
-			attributesToRemove[i] = attributeName;
-		}
-
-		this.remove_dyn_attrs(attributesToRemove);
+	get_logger().info("Exiting remove_dyn_attrs()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "RemoveAllDynamicAttribute" on device. Remove all
+     * existing dynamic attributes.
+     * 
+     * @param argin
+     *            The dynamic attribute's name
+     */
+    // =========================================================
+    public void remove_all_dyn_attr() throws DevFailed {
+	get_logger().info("Entering remove_dynamic_attribute()");
+
+	// ---Add your Own code to control device here ---
+
+	int numberOfAttributes = this.dev_attr == null ? 0 : this.dev_attr.get_attr_nb();
+	String[] attributesToRemove = new String[numberOfAttributes];
+	for (int i = 0; i < numberOfAttributes; i++) {
+	    Attribute nextAttribute = this.dev_attr.get_attr_by_ind(i);
+	    String attributeName = nextAttribute.get_name();
+	    // System.out.println ( "CLA/attributeName/"+attributeName);
+	    attributesToRemove[i] = attributeName;
 	}
 
-	// ===================================================================
-	/**
-	 * Read the device properties from database.
-	 */
-	// ===================================================================
-	public void get_device_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
-		// snapUser = ConfigConst.default_sauser;
-		// snapPassword = ConfigConst.default_sapasswd;
-
-		// Read device properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = { "DbUser", "DbPassword" };
-
-		// Call database and extract values
-		// --------------------------------------------
-		DbDatum[] dev_prop = get_db_device().get_property(propnames);
-		SnapExtractorClass ds_class = (SnapExtractorClass) get_device_class();
-		int i = -1;
-		// Extract SnapUser value
-		if (dev_prop[++i].is_empty() == false)
-			snapUser = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				snapUser = cl_prop.extractString();
-		}
-
-		// Extract SnapPassword value
-		if (dev_prop[++i].is_empty() == false)
-			snapPassword = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				snapPassword = cl_prop.extractString();
-		}
-
-		// End of Automatic code generation
-		// -------------------------------------------------------------
-
+	this.remove_dyn_attrs(attributesToRemove);
+    }
+
+    // ===================================================================
+    /**
+     * Read the device properties from database.
+     */
+    // ===================================================================
+    public void get_device_property() throws DevFailed {
+	// Initialize your default values here.
+	// ------------------------------------------
+	snapUser = "";
+	snapPassword = "";
+	dbHost = "";
+	dbName = "";
+	dbSchema = "";
+	isRac = "";
+	// Read device properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
 	}
-
-	// =========================================================
-	/**
-	 * Method always executed before command execution.
-	 */
-	// =========================================================
-	public void always_executed_hook() {
-		//get_logger().info("In always_executed_hook method()");
+	String[] propnames = { "DbUser", "DbPassword", "DbHost", "DbName", "DbSchema", "IsRac" };
+
+	// Call database and extract values
+	// --------------------------------------------
+	DbDatum[] dev_prop = get_db_device().get_property(propnames);
+	SnapExtractorClass ds_class = (SnapExtractorClass) get_device_class();
+	int i = -1;
+	// Extract SnapUser value
+	if (dev_prop[++i].is_empty() == false) {
+	    snapUser = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		snapUser = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "GetSnap" on device. Loads a snapshot of given ID: if the
-	 * snapshot exists, creates for each one of the snapshot's attributes a
-	 * dynamic attribute for its read part, and, if the attribute isn't
-	 * read-only, for its write part. Returns a table containing, as many times
-	 * as there are attributes for the specified snapshot:
-	 * <UL>
-	 * <LI>the attribute complete name
-	 * <LI>the name of the dynamic attribute containing the attribute's read
-	 * value (if it has one, otherwise blank)
-	 * <LI>the name of the dynamic attribute containing the attribute's write
-	 * value (if it has one, otherwise blank)
-	 * </UL>
-	 *
-	 * @param argin
-	 *            the snapshot's ID
-	 * @return A table containing [attrRealName, dynAttrNameR,dynAttrNameW]*n
-	 * @throws DevFailed
-	 */
-	// =========================================================
-	public synchronized String[] get_snap(int argin) throws DevFailed {
-		String[] argout = new String[5];
-		get_logger().info("Entering get_snap()");
-
-		// ---Add your Own code to control device here ---
-		ISnapReader snapReader = SnapReaderFactory.getCurrentImpl();
-
-		try {
-			SnapAttributeExtract[] sae = snapReader.getSnap(argin);
-			if (sae == null || sae.length == 0) {
-				Except.throw_exception("INPUT_ERROR",
-						"Snapshot ID does not exist", "SnapExtractor.GetSnap");
-
-			}
-
-			// return emptyResult ();
-
-			argout = this.add_attributes(sae);
-		} catch (Throwable t) {
-			Tools.printIfDevFailed(t);
-			if (t instanceof DevFailed) {
-				throw (DevFailed) t;
-			}
-		}
-		// ------------------------------------------------
-
-		get_logger().info("Exiting get_snap()");
-
-		return argout;
+	// Extract SnapPassword value
+	if (dev_prop[++i].is_empty() == false) {
+	    snapPassword = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		snapPassword = cl_prop.extractString();
+	    }
+	}// Extract DbHost value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbHost = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbHost = cl_prop.extractString();
+	    }
 	}
-
-	// =========================================================
-	/**
-	 * Execute command "GetSnapValue" on device. Loads a snapshot of given ID:
-	 * if the snapshot exists, find if the attribute exists for this snapshot if
-	 * the attribute exists, Returns an attribute value
-	 *
-	 * @param snapID
-	 *            the snapshot's ID
-	 * @param attr_name
-	 *            the attribute name
-	 * @return the attribute value
-	 * @throws DevFailed
-	 */
-	// =========================================================
-	public synchronized String[] get_snap_value(int snapID, String attr_name)
-			throws DevFailed {
-		get_logger().info("Entering get_snap_value()");
-		String[] argout = { "NaN", "NaN" };
-		// ---Add your Own code to control device here ---
-		ISnapReader snapReader = SnapReaderFactory.getCurrentImpl();
-
-		try {
-			SnapAttributeExtract[] sae = snapReader.getSnap(snapID);
-			if (sae == null || sae.length == 0) {
-				return argout;
-			}
-
-			int index = getIndexOfAttribute(sae, attr_name);
-			if (index != -1) {
-				argout = this.get_attribute_value(sae[index]);
-			} else {
-				argout = null;
-				Except.throw_exception("INPUT_ERROR", "Invalid Attribute",
-						"SnapExtractor.GetSnapValue");
-			}
-		} catch (Throwable t) {
-			Tools.printIfDevFailed(t);
-			if (t instanceof DevFailed) {
-				throw (DevFailed) t;
-			}
-		}
-		// ------------------------------------------------
-
-		get_logger().info("Exiting get_snap_value()");
-
-		return argout;
+	// Extract DbName value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbName = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbName = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "GetSnapID" on device. Loads the list of snapshot' id of
-	 * a given context that respect the given criterion.
-	 *
-	 * @param ctxID
-	 *            the context's ID
-	 * @param criterion
-	 *            the search criterion
-	 * @return the list of snapshot ids.
-	 * @throws DevFailed
-	 * @throws SnapshotingException
-	 */
-	// =========================================================
-	public synchronized int[] get_snap_id(int ctxID, String[] criterions)
-			throws DevFailed {
-		get_logger().info("Entering get_snap_id()");
-
-		ISnapReader snapReader = SnapReaderFactory.getCurrentImpl();
-		int[] snap_ids = snapReader.getSnapshotsID(ctxID, criterions);
-		if (snap_ids == null) {
-			Except.throw_exception("INPUT_ERROR", "Invalid Criterions",
-					"SnapExtractor.GetSnapID");
-
-		}
-		get_logger().info("Exiting get_snaps_id()");
-		return snap_ids;
+	// Extract DbSchema value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbSchema = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbSchema = cl_prop.extractString();
+	    }
 	}
 
-	// /**
-	// *
-	// * @return a String[2] for an invalid attribute name callback
-	// */
-	// private String[] getInvalidAttributeName() {
-	// // TODO Auto-generated method stub
-	// return new String[]{"Invalid attribute name",""};
-	// }
-
-	/**
-	 *
-	 * @param sae
-	 *            : list of SnapAttributeExtract
-	 * @param attr_name
-	 *            : the given attribute name
-	 * @return the index of the attribute in the list of SnapAttributeExtract.
-	 */
-	private int getIndexOfAttribute(SnapAttributeExtract[] sae, String attr_name) {
-		// TODO Auto-generated method stub
-		int index = -1;
-		for (int i = 0; i < sae.length; i++) {
-			if (sae[i].getAttribute_complete_name().equalsIgnoreCase(attr_name)) {
-				index = i;
-				break;
-			}
-		}
-
-		return index;
+	// Extract IsRac value
+	if (dev_prop[++i].is_empty() == false) {
+	    isRac = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		isRac = cl_prop.extractString();
+	    }
 	}
 
-	/**
-	 *
-	 * @param snapAttributeExtract
-	 * @return read_value and write_value
-	 */
-	private synchronized String[] get_attribute_value(
-			SnapAttributeExtract snapAttributeExtract) {
-		// TODO Auto-generated method stub
-
-		String[] argout = { "NaN", "NaN" };
-		try {
-			SnapAttributeExtract currentExtract = snapAttributeExtract;
-
-			argout[0] = currentExtract.valueToString(0);
-			argout[1] = currentExtract.valueToString(1);
-
-		} catch (Exception e) {
-
-		}
-
-		return argout;
-
+	// End of Automatic code generation
+	// -------------------------------------------------------------
+
+    }
+
+    // =========================================================
+    /**
+     * Method always executed before command execution.
+     */
+    // =========================================================
+    @Override
+    public void always_executed_hook() {
+	// get_logger().info("In always_executed_hook method()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "GetSnap" on device. Loads a snapshot of given ID: if the
+     * snapshot exists, creates for each one of the snapshot's attributes a
+     * dynamic attribute for its read part, and, if the attribute isn't
+     * read-only, for its write part. Returns a table containing, as many times
+     * as there are attributes for the specified snapshot:
+     * <UL>
+     * <LI>the attribute complete name
+     * <LI>the name of the dynamic attribute containing the attribute's read
+     * value (if it has one, otherwise blank)
+     * <LI>the name of the dynamic attribute containing the attribute's write
+     * value (if it has one, otherwise blank)
+     * </UL>
+     * 
+     * @param argin
+     *            the snapshot's ID
+     * @return A table containing [attrRealName, dynAttrNameR,dynAttrNameW]*n
+     * @throws DevFailed
+     */
+    // =========================================================
+    public String[] get_snap(int argin) throws DevFailed {
+	String[] argout = new String[5];
+	get_logger().info("Entering get_snap()");
+
+	// ---Add your Own code to control device here ---
+
+	try {
+	    SnapAttributeExtract[] sae = snapReader.getSnap(argin);
+	    if (sae == null || sae.length == 0) {
+		Except.throw_exception("INPUT_ERROR", "Snapshot ID does not exist", "SnapExtractor.GetSnap");
+
+	    }
+
+	    // return emptyResult ();
+
+	    argout = this.add_attributes(sae);
+	} catch (Throwable t) {
+	    Tools.printIfDevFailed(t);
+	    if (t instanceof DevFailed) {
+		throw (DevFailed) t;
+	    }
 	}
-
-	/**
-	 * Loads the list of snapshots attached to a given context, specified by its
-	 * ID. Returns a DevVarLongStringArray object, where the array is as long as
-	 * there are many snapshots for the context. The Long part is the snapshot's
-	 * ID, the String part is the concatenation of its Date and Comment fields
-	 * values.
-	 *
-	 * @param argin
-	 *            The context ID
-	 * @return The snapshots: [ID, Date + Comment]*n
-	 * @throws DevFailed
-	 */
-	public synchronized DevVarLongStringArray get_snaps_for_context(int argin)
-			throws DevFailed {
-		get_logger().info("Entering get_snaps_for_context()");
-
-		// ---Add your Own code to control device here ---
-		ISnapReader snapReader = SnapReaderFactory.getCurrentImpl();
-		DevVarLongStringArray snapshots = snapReader
-				.getSnapshotsForContext(argin);
-		if (snapshots == null) {
-			return emptyDevVarLongStringArrayResult();
-		}
-		// ------------------------------------------------
-
-		get_logger().info("Exiting get_snaps_for_context()");
-		return snapshots;
+	// ------------------------------------------------
+
+	get_logger().info("Exiting get_snap()");
+
+	return argout;
+    }
+
+    // =========================================================
+    /**
+     * Execute command "GetSnapValue" on device. Loads a snapshot of given ID:
+     * if the snapshot exists, find if the attribute exists for this snapshot if
+     * the attribute exists, Returns an attribute value
+     * 
+     * @param snapID
+     *            the snapshot's ID
+     * @param attr_name
+     *            the attribute name
+     * @return the attribute value
+     * @throws DevFailed
+     */
+    // =========================================================
+    public String[] get_snap_value(int snapID, String attr_name) throws DevFailed {
+	get_logger().info("Entering get_snap_value()");
+
+	SnapAttributeExtract[] extraction = snapReader.getSnapValues(snapID, attr_name);
+	String[] argout = get_attribute_value(extraction[0]);
+
+	get_logger().info("Exiting get_snap_value()");
+	return argout;
+    }
+
+    public String[] getSnapValues(int snapID, boolean readValues, String... attributeNames) throws DevFailed {
+	String[] argout = new String[attributeNames.length];
+	SnapAttributeExtract[] extraction = snapReader.getSnapValues(snapID, attributeNames);
+	int i = 0;
+	for (SnapAttributeExtract snapAttributeExtract : extraction) {
+	    if (readValues) {
+		argout[i++] = snapAttributeExtract.valueToString(0);
+	    } else {
+		argout[i++] = snapAttributeExtract.valueToString(1);
+	    }
 	}
+	return argout;
+    }
+
+    // =========================================================
+    /**
+     * Execute command "GetSnapID" on device. Loads the list of snapshot' id of
+     * a given context that respect the given criterion.
+     * 
+     * @param ctxID
+     *            the context's ID
+     * @param criterion
+     *            the search criterion
+     * @return the list of snapshot ids.
+     * @throws DevFailed
+     * @throws SnapshotingException
+     */
+    // =========================================================
+    public int[] get_snap_id(int ctxID, String[] criterions) throws DevFailed {
+	get_logger().info("Entering get_snap_id()");
+
+	int[] snap_ids = snapReader.getSnapshotsID(ctxID, criterions);
+	if (snap_ids == null) {
+	    Except.throw_exception("INPUT_ERROR", "Invalid Criterions", "SnapExtractor.GetSnapID");
 
-	/**
-	 * @return
-	 */
-	private DevVarLongStringArray emptyDevVarLongStringArrayResult() {
-		DevVarLongStringArray ret = new DevVarLongStringArray();
-		int[] lvalue = new int[1];
-		java.lang.String[] svalue = new java.lang.String[1];
-
-		lvalue[0] = -1;
-		svalue[0] = "NO SNAPSHOT FOR THIS CONTEXT ID";
-
-		ret.lvalue = lvalue;
-		ret.svalue = svalue;
-
-		return ret;
 	}
-
-	/**
-	 * @return
-	 */
-	private String[] emptyResult() {
-		String[] argout = new String[3];
-
-		argout[0] = "NO SUCH SNAPSHOT";
-		argout[1] = "";
-		argout[2] = "";
-
-		return argout;
+	get_logger().info("Exiting get_snaps_id()");
+	return snap_ids;
+    }
+
+    // /**
+    // *
+    // * @return a String[2] for an invalid attribute name callback
+    // */
+    // private String[] getInvalidAttributeName() {
+    // // TODO Auto-generated method stub
+    // return new String[]{"Invalid attribute name",""};
+    // }
+
+    /**
+     * 
+     * @param sae
+     *            : list of SnapAttributeExtract
+     * @param attr_name
+     *            : the given attribute name
+     * @return the index of the attribute in the list of SnapAttributeExtract.
+     */
+    private int getIndexOfAttribute(SnapAttributeExtract[] sae, String attr_name) {
+	// TODO Auto-generated method stub
+	int index = -1;
+	for (int i = 0; i < sae.length; i++) {
+	    if (sae[i].getAttribute_complete_name().equalsIgnoreCase(attr_name)) {
+		index = i;
+		break;
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * main part for the device server class
-	 */
-	// =========================================================
-	public static void main(String[] argv) {
-		try {
-			Util tg = Util.init(argv, "SnapExtractor");
-			tg.server_init();
-
-			System.out.println("Ready to accept request");
+	return index;
+    }
 
-			tg.server_run();
-		}
+    /**
+     * 
+     * @param snapAttributeExtract
+     * @return read_value and write_value
+     */
+    private String[] get_attribute_value(SnapAttributeExtract snapAttributeExtract) {
+	// TODO Auto-generated method stub
 
-		catch (OutOfMemoryError ex) {
-			System.err.println("Can't allocate memory !!!!");
-			System.err.println("Exiting");
-		} catch (UserException ex) {
-			Except.print_exception(ex);
+	String[] argout = { "NaN", "NaN" };
+	try {
+	    SnapAttributeExtract currentExtract = snapAttributeExtract;
 
-			System.err.println("Received a CORBA user exception");
-			System.err.println("Exiting");
-		} catch (SystemException ex) {
-			Except.print_exception(ex);
+	    argout[0] = currentExtract.valueToString(0);
+	    argout[1] = currentExtract.valueToString(1);
 
-			System.err.println("Received a CORBA system exception");
-			System.err.println("Exiting");
-		}
+	} catch (Exception e) {
 
-		System.exit(-1);
 	}
 
-	private String[] add_attributes(SnapAttributeExtract[] sae)
-			throws DevFailed {
-		int numberOfAttributes = sae.length;
-
-		String[] argout = new String[3 * numberOfAttributes];
-		int j = 0;
-		for (int i = 0; i < numberOfAttributes; i++) {
-			SnapAttributeExtract currentExtract = sae[i];
-			String realName = currentExtract.getAttribute_complete_name();
-
-			// Object val = currentExtract.getValue();
-			String[] names = this.addAttribute(currentExtract);
-
-			String read_name = names[0];
-			String write_name = names[1];
-
-			argout[j] = realName;
-			argout[j + 1] = read_name;
-			argout[j + 2] = write_name;
-
-			j += 3;
-		}
-
-		return argout;
+	return argout;
+
+    }
+
+    /**
+     * Loads the list of snapshots attached to a given context, specified by its
+     * ID. Returns a DevVarLongStringArray object, where the array is as long as
+     * there are many snapshots for the context. The Long part is the snapshot's
+     * ID, the String part is the concatenation of its Date and Comment fields
+     * values.
+     * 
+     * @param argin
+     *            The context ID
+     * @return The snapshots: [ID, Date + Comment]*n
+     * @throws DevFailed
+     */
+    public DevVarLongStringArray get_snaps_for_context(int argin) throws DevFailed {
+	get_logger().info("Entering get_snaps_for_context()");
+
+	// ---Add your Own code to control device here ---
+	DevVarLongStringArray snapshots = snapReader.getSnapshotsForContext(argin);
+	if (snapshots == null) {
+	    return emptyDevVarLongStringArrayResult();
 	}
-
-	/**
-	 * @param currentExtract
-	 * @return
-	 * @throws DevFailed
-	 */
-	private String[] addAttribute(SnapAttributeExtract currentExtract)
-			throws DevFailed {
-		try {
-			if (currentExtract.getValue() == null) {
-				String message = "Null value for attribute |"
-						+ currentExtract.getAttribute_complete_name() + "|";
-				this.trace(message, Warnable.LOG_LEVEL_WARN);
-				return getErrorNames(currentExtract);
-			}
-
-			IConverter converter = ConverterFactory.getCurrentImpl();
-			DbData dbData = converter.convert(currentExtract);
-			if (dbData == null) {
-				String message = "Null DbData for attribute |"
-						+ currentExtract.getAttribute_complete_name()
-						+ "| (if the attribute is R/W or is a spectrum, at least one of its value's component is null)";
-				this.trace(message, Warnable.LOG_LEVEL_WARN);
-				return getErrorNames(currentExtract);
-			}
-
-			String[] names = this.buildDynamicAttributesNames(currentExtract);
-
-			this.createDynamicAttribute(dbData, names);
-
-			return names;
-		} catch (Throwable t) {
-			// Tools.printIfDevFailed ( t );
-			String message = "Exception for attribute |"
-					+ currentExtract.getAttribute_complete_name() + "|";
-			this.trace(message, t, Warnable.LOG_LEVEL_WARN);
-			return getErrorNames(currentExtract);
-		}
+	// ------------------------------------------------
+
+	get_logger().info("Exiting get_snaps_for_context()");
+	return snapshots;
+    }
+
+    /**
+     * @return
+     */
+    private DevVarLongStringArray emptyDevVarLongStringArrayResult() {
+	DevVarLongStringArray ret = new DevVarLongStringArray();
+	int[] lvalue = new int[1];
+	java.lang.String[] svalue = new java.lang.String[1];
+
+	lvalue[0] = -1;
+	svalue[0] = "NO SNAPSHOT FOR THIS CONTEXT ID";
+
+	ret.lvalue = lvalue;
+	ret.svalue = svalue;
+
+	return ret;
+    }
+
+    /**
+     * @return
+     */
+    private String[] emptyResult() {
+	String[] argout = new String[3];
+
+	argout[0] = "NO SUCH SNAPSHOT";
+	argout[1] = "";
+	argout[2] = "";
+
+	return argout;
+    }
+
+    // =========================================================
+    /**
+     * main part for the device server class
+     */
+    // =========================================================
+    public static void main(String[] argv) {
+	try {
+	    Util tg = Util.init(argv, "SnapExtractor");
+	    tg.server_init();
+
+	    System.out.println("Ready to accept request");
+
+	    tg.server_run();
 	}
 
-	private String[] getErrorNames(SnapAttributeExtract currentExtract) {
-		String[] errorNames = new String[2];
-		String name = currentExtract.getAttribute_complete_name();
+	catch (OutOfMemoryError ex) {
+	    System.err.println("Can't allocate memory !!!!");
+	    System.err.println("Exiting");
+	} catch (UserException ex) {
+	    Except.print_exception(ex);
 
-		errorNames[0] = name + "_ERROR";
-		errorNames[1] = name + "_ERROR";
+	    System.err.println("Received a CORBA user exception");
+	    System.err.println("Exiting");
+	} catch (SystemException ex) {
+	    Except.print_exception(ex);
 
-		return errorNames;
+	    System.err.println("Received a CORBA system exception");
+	    System.err.println("Exiting");
 	}
 
-	/**
-	 * @param currentExtract
-	 * @return
-	 */
-	private String[] buildDynamicAttributesNames(
-			SnapAttributeExtract currentExtract) {
-		String random_name_1 = "", random_name_2 = "";
-		String[] names;
-
-		// String name = currentExtract.getAttribute_complete_name ();
-		// String dynamicAttributeName = "";
-		// get_logger().info("CLA/buildRandomNames/name/"+name+"/");
-		boolean hasBothReadAndWriteValues = ((currentExtract.getWritable() == AttrWriteType._READ_WITH_WRITE) || (currentExtract
-				.getWritable() == AttrWriteType._READ_WRITE));
-
-		// Build new Attribute's name
-		IDynamicAttributeNamer dynamicAttributeNamer = DynamicAttributeNamerFactory
-				.getCurrentImpl();
-		boolean firstIsRead = (currentExtract.getWritable() != AttrWriteType._WRITE);
-		random_name_1 = dynamicAttributeNamer.getName(currentExtract, id,
-				firstIsRead);
-		// id++;
-		// get_logger().info("CLA/buildRandomNames/random_name_1/"+random_name_1+"/");
-		if (hasBothReadAndWriteValues) {
-			random_name_2 = dynamicAttributeNamer.getName(currentExtract, id,
-					!firstIsRead);
-			// id++;
-			// get_logger().info("CLA/buildRandomNames/random_name_2/"+random_name_2+"/");
-		}
-		id++;
-
-		names = new String[2];
-		names[0] = random_name_1;
-		names[1] = random_name_2;
-
-		return names;
+	System.exit(-1);
+    }
+
+    private String[] add_attributes(SnapAttributeExtract[] sae) throws DevFailed {
+	int numberOfAttributes = sae.length;
+
+	String[] argout = new String[3 * numberOfAttributes];
+	int j = 0;
+	for (int i = 0; i < numberOfAttributes; i++) {
+	    SnapAttributeExtract currentExtract = sae[i];
+	    String realName = currentExtract.getAttribute_complete_name();
+
+	    // Object val = currentExtract.getValue();
+	    try {
+		String[] names = this.addAttribute(currentExtract);
+		String read_name = names[0];
+		String write_name = names[1];
+		argout[j] = realName;
+		argout[j + 1] = read_name;
+		argout[j + 2] = write_name;
+	    } catch (DevFailed e) {
+		DevFailedUtils.printDevFailed(e);
+		System.err.println("cannot add attr  " + realName);
+	    }
+
+	    j += 3;
 	}
 
-	private DevVarLongStringArray createDynamicAttribute(DbData dbData /*
-																		 * added
-																		 * by
-																		 * CLA
-																		 */,
-			String[] names) throws DevFailed {
-		try {
-			DevVarLongStringArray argout = new DevVarLongStringArray();
-
-			boolean _2value = (dbData.getWritable() == AttrWriteType._READ_WITH_WRITE || dbData
-					.getWritable() == AttrWriteType._READ_WRITE) ? true : false;
-
-			// CLA modified
-			String random_name_1 = names[0];
-			String random_name_2 = names[1];
-
-			if (dbData.getData_type() == Tango_DEV_STATE) {
-				// We have to convert state vars to int otherwise they're not
-				// recognised by the method fr.esrf.TangoDs.check_type()
-				dbData.setData_type(Tango_DEV_LONG);
-			}
-
-			// Create the attribute depends on DataFormat
-			switch (dbData.getData_format()) {
-			case AttrDataFormat._SCALAR:
-				add_attribute(new Attr(random_name_1, dbData.getData_type(),
-						AttrWriteType.READ));
-				if (_2value)
-					add_attribute(new Attr(random_name_2,
-							dbData.getData_type(), AttrWriteType.READ));
-				break;
-			case AttrDataFormat._SPECTRUM:
-
-				add_attribute(new SpectrumAttr(random_name_1, dbData
-						.getData_type(), dbData.getMax_x()));
-				if (_2value) {
-
-					add_attribute(new SpectrumAttr(random_name_2, dbData
-							.getData_type(), dbData.getMax_x()));
-				}
-				break;
-			case AttrDataFormat._IMAGE:
-				add_attribute(new ImageAttr(random_name_1, dbData
-						.getData_type(), dbData.getMax_x(), dbData.getMax_y()));
-				break;
-			}
-
-			set_polled_attr(names);
-			set_poll_ring_depth(dbData.size());
-
-			// Start polling for this device in external sync. mode (udt = 0)
-			DevVarLongStringArray poll_1, poll_2;
-			poll_1 = new DevVarLongStringArray();
-			poll_2 = new DevVarLongStringArray();
-
-			poll_1.lvalue = new int[1];
-			poll_1.lvalue[0] = 0;
-			poll_1.svalue = new String[3];
-			poll_1.svalue[0] = device_name;
-			poll_1.svalue[1] = "attribute";
-			poll_1.svalue[2] = random_name_1;
-
-			if (_2value) {
-				poll_2.lvalue = new int[1];
-				poll_2.lvalue[0] = 0;
-				poll_2.svalue = new String[3];
-				poll_2.svalue[0] = device_name;
-				poll_2.svalue[1] = "attribute";
-				poll_2.svalue[2] = random_name_2;
-			}
-			Util tg_1 = Util.instance();
-			tg_1.get_dserver_device().add_obj_polling(poll_1, false);
-
-			Util tg_2 = Util.instance();
-			if (_2value) {
-				tg_2.get_dserver_device().add_obj_polling(poll_2, false);
-			}
-
-			// And fill buffer with database's data
-
-			if (_2value) {
-				// System.out.println ( "CLA/SnapExtractor/" +dbData.);
-
-				DbData[] dbDatas = dbData.splitDbData();
-				DbData readDbData = dbDatas[0];
-				DbData writeDbData = dbDatas[1];
-
-				TimedAttrData[] readTimedAttrDatas = readDbData
-						.getDataAsTimedAttrData();
-
-				TimedAttrData[] writeTimedAttrDatas = writeDbData
-						.getDataAsTimedAttrData();
-
-				updateWriteData(writeTimedAttrDatas);
-
-				tg_1.fill_attr_polling_buffer(this, random_name_1,
-						readTimedAttrDatas);
-				tg_2.fill_attr_polling_buffer(this, random_name_2,
-						writeTimedAttrDatas);
-			} else {
-				tg_1.fill_attr_polling_buffer(this, random_name_1, dbData
-						.getDataAsTimedAttrData());
-			}
-
-			argout = new DevVarLongStringArray();
-			argout.lvalue = new int[1];
-			if (!_2value) {
-				argout.svalue = new String[1];
-			} else {
-				argout.svalue = new String[2];
-			}
-
-			argout.lvalue[0] = dbData.getData_timed().length;
-			argout.svalue[0] = random_name_1;
-			if (_2value)
-				argout.svalue[1] = random_name_2;
-
-			return argout;
-		} catch (Throwable t) {
-			Tools.throwDevFailed(t);
-		}
-		return null;
+	return argout;
+    }
+
+    /**
+     * @param currentExtract
+     * @return
+     * @throws DevFailed
+     */
+    private String[] addAttribute(SnapAttributeExtract currentExtract) throws DevFailed {
+	if (currentExtract.getValue() == null) {
+	    String message = "Null value for attribute |" + currentExtract.getAttribute_complete_name() + "|";
+	    this.trace(message, Warnable.LOG_LEVEL_WARN);
+	    return getErrorNames(currentExtract);
 	}
 
-	/**
-	 * update x dimension to the data array length
-	 *
-	 * @param data
-	 */
-	private void updateWriteData(TimedAttrData[] data) {
-		// TODO Auto-generated method stub
-
-		for (int i = 0; i < data.length; i++) {
-
-			int size = 0;
-
-			switch (data[i].data_type) {
-			case Tango_DEV_BOOLEAN:
-				size = data[i].bool_ptr.length;
-				break;
-
-			case Tango_DEV_SHORT:
-				size = data[i].sh_ptr.length;
-				break;
-
-			case Tango_DEV_LONG:
-				size = data[i].lg_ptr.length;
-				break;
-
-			case Tango_DEV_LONG64:
-				size = data[i].lg64_ptr.length;
-				break;
-
-			case Tango_DEV_FLOAT:
-				size = data[i].fl_ptr.length;
-				break;
-
-			case Tango_DEV_DOUBLE:
-				size = data[i].db_ptr.length;
-				break;
-
-			case Tango_DEV_STRING:
-				size = data[i].str_ptr.length;
-				break;
-			default:
-				;
-			}
-			data[i].x = size;
-		}
-
+	IConverter converter = ConverterFactory.getImpl(ConverterFactory.DEFAULT);
+	DbData dbData = converter.convert(currentExtract);
+	if (dbData == null) {
+	    String message = "Null DbData for attribute |" + currentExtract.getAttribute_complete_name()
+		    + "| (if the attribute is R/W or is a spectrum, at least one of its value's component is null)";
+	    this.trace(message, Warnable.LOG_LEVEL_WARN);
+	    return getErrorNames(currentExtract);
 	}
 
-	public synchronized void warnOn() {
-		switch (this.state) {
-		case DevState._ALARM:
-			// do nothing
-			return;
-		}
-
-		this.set_state((short) DevState._ON);
+	String[] names = this.buildDynamicAttributesNames(currentExtract);
+
+	this.createDynamicAttribute(dbData, names);
+
+	return names;
+    }
+
+    private String[] getErrorNames(SnapAttributeExtract currentExtract) {
+	String[] errorNames = new String[2];
+	String name = currentExtract.getAttribute_complete_name();
+
+	errorNames[0] = name + "_ERROR";
+	errorNames[1] = name + "_ERROR";
+
+	return errorNames;
+    }
+
+    /**
+     * @param currentExtract
+     * @return
+     */
+    private String[] buildDynamicAttributesNames(SnapAttributeExtract currentExtract) {
+	String random_name_1 = "", random_name_2 = "";
+	String[] names;
+
+	// String name = currentExtract.getAttribute_complete_name ();
+	// String dynamicAttributeName = "";
+	// get_logger().info("CLA/buildRandomNames/name/"+name+"/");
+	boolean hasBothReadAndWriteValues = currentExtract.getWritable() == AttrWriteType._READ_WITH_WRITE
+		|| currentExtract.getWritable() == AttrWriteType._READ_WRITE;
+
+	// Build new Attribute's name
+	IDynamicAttributeNamer dynamicAttributeNamer = DynamicAttributeNamerFactory
+		.getImpl(DynamicAttributeNamerFactory.DEFAULT);
+
+	boolean firstIsRead = currentExtract.getWritable() != AttrWriteType._WRITE;
+	random_name_1 = dynamicAttributeNamer.getName(currentExtract, id, firstIsRead);
+	// id++;
+	// get_logger().info("CLA/buildRandomNames/random_name_1/"+random_name_1+"/");
+	if (hasBothReadAndWriteValues) {
+	    random_name_2 = dynamicAttributeNamer.getName(currentExtract, id, !firstIsRead);
+	    // id++;
+	    // get_logger().info("CLA/buildRandomNames/random_name_2/"+random_name_2+"/");
 	}
-
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see archwatch.strategy.delay.WarnAble#warnFault()
-	 */
-	public synchronized void warnFault() {
-		this.set_state((short) DevState._FAULT);
-	}
-
-	public synchronized void set_state(DevState in) {
-		this.set_state((short) in.value());
-	}
-
-	public synchronized void set_state(short _state) {
-		this.formerState = this.state;
-		super.set_state(DevState.from_int(_state));
-
-		String _status = this.formatStatus(_state);
-		this.setStatus(_status);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see archwatch.tools.WarnAble#warnAlarm()
-	 */
-	public synchronized void warnAlarm() {
-		this.set_state((short) DevState._ALARM);
-	}
-
-	public synchronized void warnOff() {
-		switch (this.state) {
-		case DevState._ALARM:
-			// do nothing
-			return;
-
-		case DevState._FAULT:
-			// do nothing
-			return;
+	id++;
+
+	names = new String[2];
+	names[0] = random_name_1;
+	names[1] = random_name_2;
+
+	return names;
+    }
+
+    private DevVarLongStringArray createDynamicAttribute(DbData dbData /*
+								        * added
+								        * by CLA
+								        */, String[] names) throws DevFailed {
+	try {
+	    DevVarLongStringArray argout = new DevVarLongStringArray();
+
+	    boolean _2value = dbData.getWritable() == AttrWriteType._READ_WITH_WRITE
+		    || dbData.getWritable() == AttrWriteType._READ_WRITE ? true : false;
+
+	    // CLA modified
+	    String random_name_1 = names[0];
+	    String random_name_2 = names[1];
+
+	    if (dbData.getData_type() == Tango_DEV_STATE) {
+		// We have to convert state vars to int otherwise they're not
+		// recognised by the method fr.esrf.TangoDs.check_type()
+		dbData.setData_type(Tango_DEV_LONG);
+	    }
+
+	    // Create the attribute depends on DataFormat
+	    switch (dbData.getData_format()) {
+	    case AttrDataFormat._SCALAR:
+		add_attribute(new Attr(random_name_1, dbData.getData_type(), AttrWriteType.READ));
+		if (_2value) {
+		    add_attribute(new Attr(random_name_2, dbData.getData_type(), AttrWriteType.READ));
 		}
+		break;
+	    case AttrDataFormat._SPECTRUM:
 
-		this.set_state((short) DevState._OFF);
-	}
+		add_attribute(new SpectrumAttr(random_name_1, dbData.getData_type(), dbData.getMax_x()));
+		if (_2value) {
 
-	public synchronized void warnInit() {
-		switch (this.state) {
-		case DevState._ALARM:
-			// do nothing
-			return;
+		    add_attribute(new SpectrumAttr(random_name_2, dbData.getData_type(), dbData.getMax_x()));
 		}
-
-		this.set_state((short) DevState._INIT);
+		break;
+	    case AttrDataFormat._IMAGE:
+		add_attribute(new ImageAttr(random_name_1, dbData.getData_type(), dbData.getMax_x(), dbData.getMax_y()));
+		break;
+	    }
+
+	    set_polled_attr(names);
+	    set_poll_ring_depth(dbData.size());
+
+	    // Start polling for this device in external sync. mode (udt = 0)
+	    DevVarLongStringArray poll_1, poll_2;
+	    poll_1 = new DevVarLongStringArray();
+	    poll_2 = new DevVarLongStringArray();
+
+	    poll_1.lvalue = new int[1];
+	    poll_1.lvalue[0] = 0;
+	    poll_1.svalue = new String[3];
+	    poll_1.svalue[0] = device_name;
+	    poll_1.svalue[1] = "attribute";
+	    poll_1.svalue[2] = random_name_1;
+
+	    if (_2value) {
+		poll_2.lvalue = new int[1];
+		poll_2.lvalue[0] = 0;
+		poll_2.svalue = new String[3];
+		poll_2.svalue[0] = device_name;
+		poll_2.svalue[1] = "attribute";
+		poll_2.svalue[2] = random_name_2;
+	    }
+	    Util tg_1 = Util.instance();
+	    tg_1.get_dserver_device().add_obj_polling(poll_1, false);
+
+	    Util tg_2 = Util.instance();
+	    if (_2value) {
+		tg_2.get_dserver_device().add_obj_polling(poll_2, false);
+	    }
+
+	    // And fill buffer with database's data
+
+	    if (_2value) {
+		// System.out.println ( "CLA/SnapExtractor/" +dbData.);
+
+		DbData[] dbDatas = dbData.splitDbData();
+		DbData readDbData = dbDatas[0];
+		DbData writeDbData = dbDatas[1];
+
+		TimedAttrData[] readTimedAttrDatas = readDbData.getDataAsTimedAttrData();
+
+		TimedAttrData[] writeTimedAttrDatas = writeDbData.getDataAsTimedAttrData();
+
+		updateWriteData(writeTimedAttrDatas);
+
+		tg_1.fill_attr_polling_buffer(this, random_name_1, readTimedAttrDatas);
+		tg_2.fill_attr_polling_buffer(this, random_name_2, writeTimedAttrDatas);
+	    } else {
+		tg_1.fill_attr_polling_buffer(this, random_name_1, dbData.getDataAsTimedAttrData());
+	    }
+
+	    argout = new DevVarLongStringArray();
+	    argout.lvalue = new int[1];
+	    if (!_2value) {
+		argout.svalue = new String[1];
+	    } else {
+		argout.svalue = new String[2];
+	    }
+
+	    argout.lvalue[0] = dbData.getData_timed().length;
+	    argout.svalue[0] = random_name_1;
+	    if (_2value) {
+		argout.svalue[1] = random_name_2;
+	    }
+
+	    return argout;
+	} catch (Throwable t) {
+	    Tools.throwDevFailed(t);
 	}
-
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see archwatch.tools.Warnable#setStatus(java.lang.String)
-	 */
-	public synchronized void setStatus(String status) {
-		super.set_status(status);
+	return null;
+    }
+
+    /**
+     * update x dimension to the data array length
+     * 
+     * @param data
+     */
+    private void updateWriteData(TimedAttrData[] data) {
+	// TODO Auto-generated method stub
+
+	for (int i = 0; i < data.length; i++) {
+
+	    int size = 0;
+
+	    switch (data[i].data_type) {
+	    case Tango_DEV_BOOLEAN:
+		size = data[i].bool_ptr.length;
+		break;
+
+	    case Tango_DEV_SHORT:
+		size = data[i].sh_ptr.length;
+		break;
+
+	    case Tango_DEV_LONG:
+		size = data[i].lg_ptr.length;
+		break;
+
+	    case Tango_DEV_LONG64:
+		size = data[i].lg64_ptr.length;
+		break;
+
+	    case Tango_DEV_FLOAT:
+		size = data[i].fl_ptr.length;
+		break;
+
+	    case Tango_DEV_DOUBLE:
+		size = data[i].db_ptr.length;
+		break;
+
+	    case Tango_DEV_STRING:
+		size = data[i].str_ptr.length;
+		break;
+	    default:
+		;
+	    }
+	    data[i].x = size;
 	}
 
-	/**
-	 * @param i
-	 */
-	private String formatStatus(int _state) {
-		switch (_state) {
-		case DevState._ALARM:
-			return "Archiving problems have been detected.";
+    }
 
-		case DevState._FAULT:
-			return "This device isn't working properly.";
+    /**
+     * @param i
+     */
+    private String formatStatus(int _state) {
+	switch (_state) {
+	case DevState._ALARM:
+	    return "Archiving problems have been detected.";
 
-		case DevState._INIT:
-			return "No control step has been completed yet. Please wait.";
+	case DevState._FAULT:
+	    return "This device isn't working properly.";
 
-		case DevState._OFF:
-			return "This device is waiting.";
+	case DevState._INIT:
+	    return "No control step has been completed yet. Please wait.";
 
-		case DevState._ON:
-			return "This device is running normally.";
+	case DevState._OFF:
+	    return "This device is waiting.";
 
-		default:
-			return "Unknown";
-		}
-	}
+	case DevState._ON:
+	    return "This device is running normally.";
 
-	private void goBackToFormerState() {
-		this.set_state((short) this.formerState);
+	default:
+	    return "Unknown";
 	}
-
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see
-	 * fr.soleil.hdbtdbArchivingApi.ArchivingWatchApi.devicelink.Warnable#trace
-	 * (java.lang.String, int)
-	 */
-	public synchronized void trace(String msg, int level) throws DevFailed {
-		switch (level) {
-		case Warnable.LOG_LEVEL_DEBUG:
-			get_logger().debug(msg);
-			break;
-
-		case Warnable.LOG_LEVEL_INFO:
-			get_logger().info(msg);
-			break;
-
-		case Warnable.LOG_LEVEL_WARN:
-			get_logger().warn(msg);
-			break;
-
-		case Warnable.LOG_LEVEL_ERROR:
-			get_logger().error(msg);
-			break;
-
-		case Warnable.LOG_LEVEL_FATAL:
-			get_logger().fatal(msg);
-			break;
-
-		default:
-			Tools
-					.throwDevFailed(new IllegalArgumentException(
-							"Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got "
-									+ level + "instead."));
-		}
+    }
+
+    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."));
 	}
-
-	public synchronized void trace(String msg, Throwable t, int level)
-			throws DevFailed {
-		switch (level) {
-		case Warnable.LOG_LEVEL_DEBUG:
-			get_logger().debug(msg, t);
-			break;
-
-		case Warnable.LOG_LEVEL_INFO:
-			get_logger().info(msg, t);
-			break;
-
-		case Warnable.LOG_LEVEL_WARN:
-			get_logger().warn(msg, t);
-			break;
-
-		case Warnable.LOG_LEVEL_ERROR:
-			get_logger().error(msg, t);
-			break;
-
-		case Warnable.LOG_LEVEL_FATAL:
-			get_logger().fatal(msg, t);
-			break;
-
-		default:
-			Tools
-					.throwDevFailed(new IllegalArgumentException(
-							"Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got "
-									+ level + "instead."));
-		}
+    }
+
+    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;
+
+	case Warnable.LOG_LEVEL_FATAL:
+	    get_logger().fatal(msg, t);
+	    break;
+
+	default:
+	    Tools.throwDevFailed(new IllegalArgumentException(
+		    "Expected LOG_LEVEL_DEBUG(9), LOG_LEVEL_INFO(7), LOG_LEVEL_WARN(5), LOG_LEVEL_ERROR(3), or LOG_LEVEL_FATAL(1), got "
+			    + level + "instead."));
 	}
-
-	// ===================================================================
-	/**
-	 * Method called by the read_attributes CORBA operation to set internal
-	 * attribute value.
-	 *
-	 * @param attr
-	 *            reference to the Attribute object
-	 */
-	// ===================================================================
-	public void read_attr(Attribute attr) throws DevFailed {
-		String attr_name = attr.get_name();
-		get_logger().info("In read_attr for attribute " + attr_name);
-
-		// Switch on attribute name
-		// ---------------------------------
-		if (attr_name == "version") {
-			// Add your own code here
-			attr.set_value(m_version);
-		}
+    }
+
+    // ===================================================================
+    /**
+     * Method called by the read_attributes CORBA operation to set internal
+     * attribute value.
+     * 
+     * @param attr
+     *            reference to the Attribute object
+     */
+    // ===================================================================
+    @Override
+    public void read_attr(Attribute attr) throws DevFailed {
+	String attr_name = attr.get_name();
+	get_logger().info("In read_attr for attribute " + attr_name);
+
+	// Switch on attribute name
+	// ---------------------------------
+	if (attr_name == "version") {
+	    // Add your own code here
+	    attr.set_value(m_version);
 	}
+    }
 
-	@Override
-	public void delete_device() throws DevFailed {
-		// TODO Auto-generated method stub
+    @Override
+    public void delete_device() throws DevFailed {
+	// TODO Auto-generated method stub
 
-	}
+    }
 }
 // --------------------------------------------------------------------------
 /*
diff --git a/src/main/java/SnapExtractor/SnapExtractorClass.java b/src/main/java/SnapExtractor/SnapExtractorClass.java
index 7c066ab..ecf0188 100644
--- a/src/main/java/SnapExtractor/SnapExtractorClass.java
+++ b/src/main/java/SnapExtractor/SnapExtractorClass.java
@@ -55,230 +55,228 @@ import fr.esrf.TangoDs.TangoConst;
 import fr.esrf.TangoDs.Util;
 
 public class SnapExtractorClass extends DeviceClass implements TangoConst {
-	/**
-	 * SnapExtractorClass class instance (it is a singleton).
-	 */
-	private static SnapExtractorClass _instance = null;
-
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = null;
-
-	// --------- Start of properties data members ----------
-
-	// --------- End of properties data members ----------
-
-	// ===================================================================
-	//
-	// method : instance()
-	// 
-	// description : static method to retrieve the SnapExtractorClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static SnapExtractorClass instance() {
-		if (_instance == null) {
-			System.err.println("SnapExtractorClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
+    /**
+     * SnapExtractorClass class instance (it is a singleton).
+     */
+    private static SnapExtractorClass _instance = null;
+
+    /**
+     * Class properties array.
+     */
+    // private final DbDatum[] cl_prop = null;
+
+    // --------- Start of properties data members ----------
+
+    // --------- End of properties data members ----------
+
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the SnapExtractorClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static SnapExtractorClass instance() {
+	if (_instance == null) {
+	    System.err.println("SnapExtractorClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
-
-	// ===================================================================
-	//
-	// method : Init()
-	// 
-	// description : static method to create/retrieve the SnapExtractorClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static SnapExtractorClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			_instance = new SnapExtractorClass(class_name);
-		}
-		return _instance;
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the SnapExtractorClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static SnapExtractorClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    _instance = new SnapExtractorClass(class_name);
 	}
-
-	// ===================================================================
-	//
-	// method : SnapExtractorClass()
-	// 
-	// description : constructor for the SnapExtractorClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected SnapExtractorClass(String name) throws DevFailed {
-		super(name);
-
-		Util.out2.println("Entering SnapExtractorClass constructor");
-		write_class_property();
-		get_class_property();
-
-		Util.out2.println("Leaving SnapExtractorClass constructor");
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : SnapExtractorClass()
+    //
+    // description : constructor for the SnapExtractorClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected SnapExtractorClass(String name) throws DevFailed {
+	super(name);
+
+	Util.out2.println("Entering SnapExtractorClass constructor");
+	write_class_property();
+	get_class_property();
+
+	Util.out2.println("Leaving SnapExtractorClass 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 RemoveAllDynAttrClass("RemoveAllDynAttr", Tango_DEV_VOID, Tango_DEV_VOID, "", "",
+		DispLevel.EXPERT));
+
+	command_list.addElement(new RemoveDynAttrsClass("RemoveDynAttrs", Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "",
+		"", DispLevel.OPERATOR));
+
+	command_list.addElement(new GetSnapClass("GetSnap", Tango_DEV_LONG, Tango_DEVVAR_STRINGARRAY, "snapID",
+		"[attrRealName, dynAttrNameW,dynAttrNameR]*n", DispLevel.OPERATOR));
+
+	command_list.addElement(new GetSnapValueClass("GetSnapValue", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_STRINGARRAY, "snapID and attribute name", "Attribute's Read value and Write value",
+		DispLevel.OPERATOR));
+
+	command_list.addElement(new RemoveDynAttrClass("RemoveDynAttr", Tango_DEV_STRING, Tango_DEV_VOID, "", "",
+		DispLevel.OPERATOR));
+
+	command_list.addElement(new GetSnapsForContextClass("GetSnapsForContext", Tango_DEV_LONG,
+		Tango_DEVVAR_LONGSTRINGARRAY, "", "", DispLevel.OPERATOR));
+
+	command_list.addElement(new GetSnapIDClass("GetSnapID", Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_LONGARRAY,
+		"ctx_id, criterion: \nSyntax: ctx_id, \"id_snap > | < | = | <= | >= nbr\",\n"
+			+ " \"time < | > | >= | <=  yyyy-mm-dd hh:mm:ss | dd-mm-yyyy hh:mm:ss\","
+			+ "\n \"comment starts | ends | contains string\",\n first | last", "list of snapshot_id",
+		DispLevel.OPERATOR));
+
+	command_list.addElement(new GetSnapValuesClass("GetSnapValues", Tango_DEVVAR_STRINGARRAY,
+		Tango_DEVVAR_STRINGARRAY, "snapID, true for read values or false for write values ,attribute names",
+		"Attribute's Read value and Write value", DispLevel.OPERATOR));
+
+	// 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
-	// ===================================================================
-	public void command_factory() {
-
-		command_list.addElement(new RemoveAllDynAttrClass("RemoveAllDynAttr",
-				Tango_DEV_VOID, Tango_DEV_VOID, "", "", DispLevel.EXPERT));
-
-		command_list.addElement(new RemoveDynAttrsClass("RemoveDynAttrs",
-				Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "", "",
-				DispLevel.OPERATOR));
-
-		command_list.addElement(new GetSnapClass("GetSnap", Tango_DEV_LONG,
-				Tango_DEVVAR_STRINGARRAY, "snapID",
-				"[attrRealName, dynAttrNameW,dynAttrNameR]*n",
-				DispLevel.OPERATOR));
-
-		command_list.addElement(new GetSnapValueClass("GetSnapValue",
-				Tango_DEVVAR_STRINGARRAY, Tango_DEVVAR_STRINGARRAY,
-				"snapID and attribute name",
-				"Attribute's Read value and Write value", DispLevel.OPERATOR));
-
-		command_list.addElement(new RemoveDynAttrClass("RemoveDynAttr",
-				Tango_DEV_STRING, Tango_DEV_VOID, "", "", DispLevel.OPERATOR));
-
-		command_list.addElement(new GetSnapsForContextClass(
-				"GetSnapsForContext", Tango_DEV_LONG,
-				Tango_DEVVAR_LONGSTRINGARRAY, "", "", DispLevel.OPERATOR));
-
-		command_list
-				.addElement(new GetSnapIDClass(
-						"GetSnapID",
-						Tango_DEVVAR_STRINGARRAY,
-						Tango_DEVVAR_LONGARRAY,
-						"ctx_id, criterion: \nSyntax: ctx_id, \"id_snap > | < | = | <= | >= nbr\",\n"
-								+ " \"time < | > | >= | <=  yyyy-mm-dd hh:mm:ss | dd-mm-yyyy hh:mm:ss\","
-								+ "\n \"comment starts | ends | contains string\",\n first | last",
-						"list of snapshot_id", DispLevel.OPERATOR));
-
-		// 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 : 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 SnapExtractor(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)
-	//
-	// =============================================================================
-	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);
+    }
+
+    // ===================================================================
+    /**
+     * Get the class property for specified name.
+     * 
+     * @param name
+     *            The property name.
+     * @throws DevFailed
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) throws DevFailed {
+	// for (int i = 0; i < cl_prop.length; i++) {
+	// if (cl_prop[i].name.equals(name)) {
+	// return cl_prop[i];
+	// }
+	// }
+	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 {
+	// Initialize your default values here.
+	// ------------------------------------------
+
+	// Read class properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
 	}
 
-	// ===================================================================
-	//
-	// method : device_factory()
-	// 
-	// description : Create the device object(s) and store them in the
-	// device list
-	//
-	// argument : in : String[] devlist : The device name list
-	//
-	// ===================================================================
-	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 SnapExtractor(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]);
-		}
-	}
+	// Call database and extract values
+	// --------------------------------------------
 
-	// ===================================================================
-	/**
-	 * 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);
-	}
+	// End of Automatic code generation
+	// -------------------------------------------------------------
 
-	// ===================================================================
-	/**
-	 * 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 = {};
-
-		// Call database and extract values
-		// --------------------------------------------
-		cl_prop = get_db_class().get_property(propnames);
-		int i = -1;
-
-		// 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");
-
-		data[1] = new DbDatum("Description");
-		data[1].insert("SnapExtractor");
-
-		// Call database and and values
-		// --------------------------------------------
-		get_db_class().put_property(data);
-	}
+	// 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("SnapExtractor");
+
+	// Call database and and values
+	// --------------------------------------------
+	get_db_class().put_property(data);
+    }
 
 }
diff --git a/src/main/java/SnapManager/LaunchSnapShotCmd.java b/src/main/java/SnapManager/LaunchSnapShotCmd.java
index 096e9bd..338f33a 100644
--- a/src/main/java/SnapManager/LaunchSnapShotCmd.java
+++ b/src/main/java/SnapManager/LaunchSnapShotCmd.java
@@ -71,93 +71,92 @@ import fr.esrf.TangoDs.Util;
  */
 
 public class LaunchSnapShotCmd extends Command implements TangoConst {
-	// ===============================================================
-	/**
-	 * Constructor for Command class LaunchSnapShotCmd
-	 * 
-	 * @param name
-	 *            command name
-	 * @param in
-	 *            argin type
-	 * @param out
-	 *            argout type
-	 */
-	// ===============================================================
-	public LaunchSnapShotCmd(String name, int in, int out) {
-		super(name, in, out);
-	}
+    // ===============================================================
+    /**
+     * Constructor for Command class LaunchSnapShotCmd
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param out
+     *            argout type
+     */
+    // ===============================================================
+    public LaunchSnapShotCmd(String name, int in, int out) {
+	super(name, in, out);
+    }
 
-	// ===============================================================
-	/**
-	 * Constructor for Command class LaunchSnapShotCmd
-	 * 
-	 * @param name
-	 *            command name
-	 * @param in
-	 *            argin type
-	 * @param in_comments
-	 *            argin description
-	 * @param out
-	 *            argout type
-	 * @param out_comments
-	 *            argout description
-	 */
-	// ===============================================================
-	public LaunchSnapShotCmd(String name, int in, int out, String in_comments,
-			String out_comments) {
-		super(name, in, out, in_comments, out_comments);
-	}
+    // ===============================================================
+    /**
+     * Constructor for Command class LaunchSnapShotCmd
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     */
+    // ===============================================================
+    public LaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments) {
+	super(name, in, out, in_comments, out_comments);
+    }
 
-	// ===============================================================
-	/**
-	 * Constructor for Command class LaunchSnapShotCmd
-	 * 
-	 * @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 LaunchSnapShotCmd(String name, int in, int out, String in_comments,
-			String out_comments, DispLevel level) {
-		super(name, in, out, in_comments, out_comments, level);
-	}
+    // ===============================================================
+    /**
+     * Constructor for Command class LaunchSnapShotCmd
+     * 
+     * @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 LaunchSnapShotCmd(String name, int in, int out, String in_comments, String out_comments, DispLevel level) {
+	super(name, in, out, in_comments, out_comments, level);
+    }
 
-	// ===============================================================
-	/**
-	 * return the result of the device's command.
-	 */
-	// ===============================================================
-	public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
-		Util.out2.println("LaunchSnapShotCmd.execute(): arrived");
-		short argin = extract_DevShort(in_any);
-		if (argin < 0) {
-			Except.throw_exception("INPUT_ERROR", "Invalid Context ID",
-					"SnapManager.LaunchSnapshot");
-		}
-
-		return insert(((SnapManager) (device)).launch_snap_shot(argin));
+    // ===============================================================
+    /**
+     * return the result of the device's command.
+     */
+    // ===============================================================
+    @Override
+    public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
+	Util.out2.println("LaunchSnapShotCmd.execute(): arrived");
+	short argin = extract_DevShort(in_any);
+	if (argin < 0) {
+	    Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapManager.LaunchSnapshot");
 	}
+	((SnapManager) device).launch_snap_shot(argin);
+	return insert();
+    }
 
-	// ===============================================================
-	/**
-	 * Check if it is allowed to execute the command.
-	 */
-	// ===============================================================
-	public boolean is_allowed(DeviceImpl device, Any data_in) {
-		// End of Generated Code
+    // ===============================================================
+    /**
+     * Check if it is allowed to execute the command.
+     */
+    // ===============================================================
+    @Override
+    public boolean is_allowed(DeviceImpl device, Any data_in) {
+	// End of Generated Code
 
-		// Re-Start of Generated Code
-		return true;
-	}
+	// Re-Start of Generated Code
+	return true;
+    }
 }
 
 // -----------------------------------------------------------------------------
diff --git a/src/main/java/SnapManager/SnapManager.java b/src/main/java/SnapManager/SnapManager.java
index 77711d9..80e31b2 100644
--- a/src/main/java/SnapManager/SnapManager.java
+++ b/src/main/java/SnapManager/SnapManager.java
@@ -112,19 +112,25 @@
 package SnapManager;
 
 import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Vector;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.UserException;
-import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.tango.utils.DevFailedUtils;
 
+import fr.esrf.Tango.DevError;
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
 import fr.esrf.Tango.DevVarLongStringArray;
 import fr.esrf.TangoApi.DbDatum;
-import fr.esrf.TangoApi.DeviceData;
-import fr.esrf.TangoApi.DeviceProxy;
 import fr.esrf.TangoDs.Attribute;
 import fr.esrf.TangoDs.DeviceClass;
 import fr.esrf.TangoDs.DeviceImpl;
@@ -134,18 +140,17 @@ import fr.esrf.TangoDs.Util;
 import fr.soleil.snapArchivingApi.SnapManagerApi.ISnapManager;
 import fr.soleil.snapArchivingApi.SnapManagerApi.SnapManagerApi;
 import fr.soleil.snapArchivingApi.SnapManagerApi.SnapManagerImpl;
-import fr.soleil.snapArchivingApi.SnapshotingApi.ConfigConst;
-import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManager;
-import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.SnapshotPersistenceManagerFactory;
+import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.GlobalConst;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
+import fr.soleil.tango.clientapi.TangoCommand;
 
 /**
  * Class Description: This DServer provides the connections points and methods
  * to the SnapShot service.
- *
+ * 
  * @author $Author: pierrejoseph $
  * @version $Revision: 1.22 $
  */
@@ -157,631 +162,618 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 // --------- End of States Description ----------
 public class SnapManager extends DeviceImpl
 /* WithShutdownRunnable */implements TangoConst {
-	protected int state;
-	private String m_version;
-	// --------- Start of attributes data members ----------
-
-	// --------- End of attributes data members ----------
-
-	// --------- Start of properties data members ----------
-	/**
-	 * User identifier (name) used to connect the database for snapshots. <br>
-	 * <b>Default value : </b> archiver
-	 */
-	String dbUser;
-	/**
-	 * Password used to connect the database for snapshots. <br>
-	 * <b>Default value : </b> archiver
-	 */
-	String dbPassword;
-
-	// --------- End of properties data members ----------
-
-	// Add your own data members here
-	private ISnapManager m_manager;
-
-	// private DataBaseAPI snapDb;
-	// --------------------------------------
-
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapManager(DeviceClass cl, String s, String version) throws DevFailed {
-		super(cl, s);
-		m_version = version;
-		init_device();
+    protected int state;
+    private final String m_version;
+    // --------- Start of attributes data members ----------
+
+    // --------- End of attributes data members ----------
+
+    // --------- Start of properties data members ----------
+    /**
+     * User identifier (name) used to connect the database for snapshots. <br>
+     * <b>Default value : </b> archiver
+     */
+    String dbUser;
+    /**
+     * Password used to connect the database for snapshots. <br>
+     * <b>Default value : </b> archiver
+     */
+    String dbPassword;
+
+    // --------- End of properties data members ----------
+
+    // Add your own data members here
+    private ISnapManager m_manager;
+
+    private final ExecutorService executorService = Executors.newSingleThreadExecutor();
+    private final Map<Short, Future<Short>> snapshotResults = new HashMap<Short, Future<Short>>();
+    private String dbHost;
+    private String dbName;
+    private String dbSchema;
+    private String isRac;
+
+    // private DataBaseAPI snapDb;
+    // --------------------------------------
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapManager(DeviceClass cl, String s, String version) throws DevFailed {
+	super(cl, s);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Constructor for simulated Time Device Server.
+     * 
+     * @param cl
+     *            The DeviceClass object
+     * @param s
+     *            The Device name.
+     * @param d
+     *            Device description.
+     * @param version
+     *            The device version
+     */
+    // =========================================================
+    SnapManager(DeviceClass cl, String s, String d, String version) throws DevFailed {
+	super(cl, s, d);
+	m_version = version;
+	init_device();
+    }
+
+    // =========================================================
+    /**
+     * Initialize the device.
+     */
+    // =========================================================
+    @Override
+    public void init_device() throws DevFailed {
+	System.out.println("SnapManager() create " + device_name);
+
+	// Initialise variables to default values
+	// -------------------------------------------
+
+	get_device_property();
+	try {
+	    // Snap Database connection
+	    SnapManagerApi.initSnapConnection(dbHost, dbName, dbSchema, dbUser, dbPassword, isRac);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
 	}
 
-	// =========================================================
-	/**
-	 * Constructor for simulated Time Device Server.
-	 *
-	 * @param cl
-	 *            The DeviceClass object
-	 * @param s
-	 *            The Device name.
-	 * @param d
-	 *            Device description.
-	 * @param version
-	 *            The device version
-	 */
-	// =========================================================
-	SnapManager(DeviceClass cl, String s, String d, String version)
-			throws DevFailed {
-		super(cl, s, d);
-		m_version = version;
-		init_device();
+	set_state(DevState.ON);
+    }
+
+    // ===================================================================
+    /**
+     * Read the device properties from database.
+     */
+    // ===================================================================
+    private void get_device_property() throws DevFailed {
+	// Initialize your default values here.
+	// ------------------------------------------
+	dbUser = "";
+	dbPassword = "";
+	dbHost = "";
+	dbName = "";
+	dbSchema = "";
+	isRac = "";
+	// Read device properties from database.(Automatic code generation)
+	// -------------------------------------------------------------
+	if (Util._UseDb == false) {
+	    return;
 	}
-
-	// =========================================================
-	/**
-	 * Initialize the device.
-	 */
-	// =========================================================
-	public void init_device() throws DevFailed {
-		System.out.println("SnapManager() create " + device_name);
-
-		// Initialise variables to default values
-		// -------------------------------------------
-		get_device_property();
-		try {
-			// Snap Database connection
-			SnapManagerApi.SnapshotingConfigure(dbUser, dbPassword);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		}
-
-		set_state(DevState.ON);
+	String[] propnames = { "DbUser", "DbPassword", "DbHost", "DbName", "DbSchema", "IsRac" };
+
+	// Call database and extract values
+	// --------------------------------------------
+	DbDatum[] dev_prop = get_db_device().get_property(propnames);
+	SnapManagerClass ds_class = (SnapManagerClass) get_device_class();
+	int i = -1;
+
+	if (dev_prop[++i].is_empty() == false) {
+	    dbUser = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbUser = cl_prop.extractString();
+	    }
 	}
 
-	// ===================================================================
-	/**
-	 * Read the device properties from database.
-	 */
-	// ===================================================================
-	private void get_device_property() throws DevFailed {
-		// Initialize your default values here.
-		// ------------------------------------------
-		dbUser = ConfigConst.default_sauser;
-		dbPassword = ConfigConst.default_sapasswd;
-
-		// Read device properties from database.(Automatic code generation)
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = { "DbUser", "DbPassword"};
-
-		// Call database and extract values
-		// --------------------------------------------
-		DbDatum[] dev_prop = get_db_device().get_property(propnames);
-		SnapManagerClass ds_class = (SnapManagerClass) get_device_class();
-		int i = -1;
-
-		if (dev_prop[++i].is_empty() == false)
-			dbUser = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				dbUser = cl_prop.extractString();
-		}
-
-		// Extract DbPassword value
-		if (dev_prop[++i].is_empty() == false)
-			dbPassword = dev_prop[i].extractString();
-		else {
-			// Try to get value from class property
-			DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
-			if (cl_prop.is_empty() == false)
-				dbPassword = cl_prop.extractString();
-		}
-
-
-		// End of Automatic code generation
-		// -------------------------------------------------------------
-
+	// Extract DbPassword value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbPassword = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbPassword = cl_prop.extractString();
+	    }
+	}
+	// Extract DbHost value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbHost = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbHost = cl_prop.extractString();
+	    }
+	}
+	System.out.println("b dbName " + dbName);
+	// Extract DbName value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbName = dev_prop[i].extractString();
+	    System.out.println("dbName " + dbName);
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbName = cl_prop.extractString();
+		System.out.println("class dbName " + dbName);
+	    }
+	}
+	System.out.println("a dbName " + dbName);
+
+	// Extract DbSchema value
+	if (dev_prop[++i].is_empty() == false) {
+	    dbSchema = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		dbSchema = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Method always executed before command execution.
-	 */
-	// =========================================================
-	public void always_executed_hook() {
-		// get_logger().info("In always_executed_hook method()");
+	// Extract IsRac value
+	if (dev_prop[++i].is_empty() == false) {
+	    isRac = dev_prop[i].extractString();
+	} else {
+	    // Try to get value from class property
+	    DbDatum cl_prop = ds_class.get_class_property(dev_prop[i].name);
+	    if (cl_prop.is_empty() == false) {
+		isRac = cl_prop.extractString();
+	    }
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "CreateNewContext" on device. This command is used to
-	 * register a snapShot context. All informations concerning the snapshot
-	 * pattern (creation date, reason, description and, the <I>list of
-	 * attributes</I> that are included in the context) are passed through an
-	 * array (DEVVAR_STRINGARRAY).
-	 *
-	 *
-	 *
-	 * @param argin
-	 *            All the informations usefull to create a context ,Snapshot
-	 *            pattern).
-	 * @return The new assigned context ID
-	 */
-	// =========================================================
-	public int create_new_context(String[] argin) throws DevFailed {
-		int argout = -1;
-		get_logger().info("Entering create_new_context()");
-
-		// ---Add your Own code to control device here ---
-		SnapContext snapContext = new SnapContext(argin);
-		try {
-			argout = SnapManagerApi.createContext(snapContext);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		}
-		get_logger().info("Exiting create_new_context()");
-		return argout;
+	// End of Automatic code generation
+	// -------------------------------------------------------------
+
+    }
+
+    // =========================================================
+    /**
+     * Method always executed before command execution.
+     */
+    // =========================================================
+    @Override
+    public void always_executed_hook() {
+	// get_logger().info("In always_executed_hook method()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "CreateNewContext" on device. This command is used to
+     * register a snapShot context. All informations concerning the snapshot
+     * pattern (creation date, reason, description and, the <I>list of
+     * attributes</I> that are included in the context) are passed through an
+     * array (DEVVAR_STRINGARRAY).
+     * 
+     * 
+     * 
+     * @param argin
+     *            All the informations usefull to create a context ,Snapshot
+     *            pattern).
+     * @return The new assigned context ID
+     */
+    // =========================================================
+    public int create_new_context(String[] argin) throws DevFailed {
+	int argout = -1;
+	get_logger().info("Entering create_new_context()");
+
+	// ---Add your Own code to control device here ---
+	SnapContext snapContext = new SnapContext(argin);
+	try {
+	    argout = SnapManagerApi.createContext(snapContext);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
 	}
+	get_logger().info("Exiting create_new_context()");
+	return argout;
+    }
+
+    // =========================================================
+    /**
+     * Execute command "LaunchSnapShot" on device. This command is used to
+     * trigger a snapShot. All informations concerning the snapshot will be
+     * retrieved with the identifier parameter.
+     * 
+     * @param argin
+     *            The snapshot associated context's identifier.
+     * @throws SnapshotingException
+     */
+    // =========================================================
+    public void launch_snap_shot(short argin) throws DevFailed {
+	get_logger().info("Entering launch_snap_shot()");
+	if (get_state().equals(DevState.RUNNING)) {
+	    DevFailedUtils.throwDevFailed("STATE_ERROR", "snapshot alreadly in progress");
+	}
+	set_state(DevState.RUNNING);
+	Future<Short> snapshotResult = executorService.submit(new SnapshotTask(argin));
+	snapshotResults.put(argin, snapshotResult);
+    }
+
+    public short getSnapShotResult(short argin) throws DevFailed {
+	short result = -1;
+	try {
+	    result = snapshotResults.get(argin).get();
+	} catch (InterruptedException e) {
+	    DevFailedUtils.throwDevFailed(e);
+	} catch (ExecutionException e) {
+	    if (e.getCause() instanceof DevFailed) {
+		throw (DevFailed) e.getCause();
+	    } else {
+		DevFailedUtils.throwDevFailed(e);
+	    }
+	}
+	return result;
+    }
 
-	// =========================================================
-	/**
-	 * Execute command "LaunchSnapShot" on device. This command is used to
-	 * trigger a snapShot. All informations concerning the snapshot will be
-	 * retrieved with the identifier parameter.
-	 *
-	 * @param argin
-	 *            The snapshot associated context's identifier.
-	 * @throws SnapshotingException
-	 */
-	// =========================================================
-	public synchronized short launch_snap_shot(short argin) throws DevFailed {
-		get_logger().info("Entering launch_snap_shot()");
+    private class SnapshotTask implements Callable<Short> {
+	private final short contextID;
 
-		if (m_manager == null) {
-			m_manager = new SnapManagerImpl(dbUser, dbPassword, true);
-		}
-		SnapContext context = new SnapContext();
-		SnapShot snapShot = null;
-		context.setId(argin);
-		try {
-			snapShot = m_manager.launchSnapshot(context);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		}
-		get_logger().info("Exiting launch_snap_shot()");
-		return (short) snapShot.getId_snap();
+	public SnapshotTask(short contextID) {
+	    this.contextID = contextID;
 	}
 
-	// =========================================================
-	/**
-	 * Execute command "SetEquipmentsWithSnapshot" on device. This command is
-	 * used to set values to equipments.
-	 *
-	 * @param argin
-	 *            The snapshot from which equipments are set.
-	 */
-	// =========================================================
-	public void set_equipments_with_snapshot(String[] argin) throws DevFailed {
-		get_logger().info("Entering set_equipments_with_snapshot() xxx");
-		// System.out.println("set_equipments_with_snapshot(String[] argin)");
-		SnapShot snapShot = new SnapShot(argin);
-		// ---Add your Own code to control device here ---
-		// System.out.println("snapshot : " + snapShot.toString());
-		try {
-			SnapManagerApi.TriggerSetEquipments(snapShot);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
-		} catch (Throwable t) {
-			t.printStackTrace();
-		}
-		get_logger().info("Exiting set_equipments_with_snapshot()");
+	@Override
+	public Short call() throws Exception {
+	    if (m_manager == null) {
+		m_manager = new SnapManagerImpl();
+	    }
+	    SnapContext context = new SnapContext();
+	    SnapShot snapShot = null;
+	    context.setId(contextID);
+	    try {
+		snapShot = m_manager.launchSnapshot(context);
+	    } catch (SnapshotingException e) {
+		get_logger().warn(e.toString(), e);
+		throw e.toTangoException();
+	    } finally {
+		SnapManager.this.set_state(DevState.ON);
+	    }
+	    get_logger().info("Exiting launch_snap_shot()");
+
+	    return (short) snapShot.getId_snap();
 	}
-
-	// =========================================================
-	/**
-	 * Execute command "SetEquipmentsWithCommand" on device. This command is
-	 * used to set snapshot attribute's values as command argument to
-	 * equipments.
-	 *
-	 * @param argin
-	 *            The command name and The snapshot id from which equipments are
-	 *            set.
-	 * @throws SnapshotingException
-	 */
-	// =========================================================
-	public String set_equipments_with_command(String[] argin) throws DevFailed {
-		// TODO Auto-generated method stub
-		try {
-
-			String command_name = argin[0];
-			int snap_id = Integer.parseInt(argin[2]);
-			NumberFormatException e1 = new NumberFormatException();
-			;
-			if (snap_id < 0)
-				throw e1;
-			// The attributes of the snapshot are gotten as they were saved in
-			// the database.
-			SnapAttributeExtract[] snapAttributeExtractArray;
-			if (m_manager == null) {
-				m_manager = new SnapManagerImpl(dbUser, dbPassword, true);
+    }
+
+    // =========================================================
+    /**
+     * Execute command "SetEquipmentsWithSnapshot" on device. This command is
+     * used to set values to equipments.
+     * 
+     * @param argin
+     *            The snapshot from which equipments are set.
+     */
+    // =========================================================
+    public void set_equipments_with_snapshot(String[] argin) throws DevFailed {
+	get_logger().info("Entering set_equipments_with_snapshot() xxx");
+	// System.out.println("set_equipments_with_snapshot(String[] argin)");
+	SnapShot snapShot = new SnapShot(argin);
+	// ---Add your Own code to control device here ---
+	// System.out.println("snapshot : " + snapShot.toString());
+	try {
+	    SnapManagerApi.TriggerSetEquipments(snapShot);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
+	} catch (Throwable t) {
+	    t.printStackTrace();
+	}
+	get_logger().info("Exiting set_equipments_with_snapshot()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "SetEquipmentsWithCommand" on device. This command is
+     * used to set snapshot attribute's values as command argument to
+     * equipments.
+     * 
+     * @param argin
+     *            The command name and The snapshot id from which equipments are
+     *            set.
+     * @throws SnapshotingException
+     */
+    // =========================================================
+    public String set_equipments_with_command(String[] argin) throws DevFailed {
+	try {
+
+	    String command_name = argin[0];
+	    int snap_id = Integer.parseInt(argin[2]);
+	    if (snap_id < 0) {
+		Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipmentsWithCommand");
+	    }
+	    // The attributes of the snapshot are gotten as they were saved in
+	    // the database.
+	    SnapAttributeExtract[] snapAttributeExtractArray;
+	    if (m_manager == null) {
+		m_manager = new SnapManagerImpl();
+	    }
+	    snapAttributeExtractArray = m_manager.getSnap(snap_id);
+	    if (snapAttributeExtractArray == null || snapAttributeExtractArray.length == 0) {
+		Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipmentsWithCommand");
+	    }
+
+	    // add attributes test: 1-different devices 2-same type 3-same
+	    // format
+	    if (validSnapshot(snapAttributeExtractArray)) {
+		List<String> result = new ArrayList<String>();
+		boolean hasFailed = false;
+		List<DevError> errorStack = new ArrayList<DevError>();
+		for (SnapAttributeExtract attributeSnap : snapAttributeExtractArray) {
+		    try {
+			TangoCommand cmd = new TangoCommand(attributeSnap.getdeviceName(), command_name);
+			Object value = null;
+			if (GlobalConst.STORED_READ_VALUE.equals(argin[1])) {
+			    value = attributeSnap.getReadValue();
+			    if (value == null) {
+				value = attributeSnap.getWriteValue();
+			    }
+			} else if (GlobalConst.STORED_WRITE_VALUE.equals(argin[1])) {
+			    value = attributeSnap.getWriteValue();
+			    if (value == null) {
+				value = attributeSnap.getReadValue();
+			    }
 			}
-			snapAttributeExtractArray = m_manager.getSnap(snap_id);
-			if (snapAttributeExtractArray == null
-					|| snapAttributeExtractArray.length == 0) {
-				Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId",
-						"SnapManager.SetEquipmentsWithCommand");
+			System.out.println(command_name + " with " + value + " on " + attributeSnap.getdeviceName());
+			cmd.execute(value);
+			if (!cmd.isArginVoid()) {
+			    result.add(cmd.extractToString(","));
 			}
-
-			// add attributes test: 1-different devices 2-same type 3-same
-			// format
-			if (validSnapshot(snapAttributeExtractArray)) {
-				SnapShot snapShot = SnapShot.getPartialSnapShot(argin, snap_id,
-						snapAttributeExtractArray);
-				if (snapShot == null)
-					return null;
-				// call command by every device proxy for each specific
-				// attribute
-				ArrayList listAttributes = snapShot.getAttribute_List();
-				DeviceData device_data_out;
-				Vector<String> result = new Vector<String>();
-				for (int i = 0; i < listAttributes.size(); i++) {
-					DeviceProxy deviceProxy = new DeviceProxy(
-							((SnapAttributeExtract) listAttributes.get(i))
-									.getdeviceName());
-					DeviceData device_data = new DeviceData();
-					snapAttributeExtractArray[i]
-							.insertsnapAttributeValue(device_data);
-					device_data_out = deviceProxy.command_inout(command_name,
-							device_data);
-					String[] tmp = extractData(device_data_out, result);
-					if (tmp != null && tmp.length > 1) {
-
-						String elt_res = command_name
-								+ "("
-								+ ((SnapAttributeExtract) listAttributes.get(i))
-										.getAttribute_complete_name() + ") = ";
-						for (int j = 0; j < tmp.length - 1; j++) {
-							elt_res += tmp[j].toString() + ", ";
-						}
-						elt_res += tmp[tmp.length - 1].toString();
-						result.add(elt_res);
-					} else if (device_data_out.extractAny() != null) {
-						result
-								.add(command_name
-										+ "("
-										+ ((SnapAttributeExtract) listAttributes
-												.get(i))
-												.getAttribute_complete_name()
-										+ ") = "
-										+ device_data_out.extractAny()
-												.toString());
-					} else {
-						result
-								.add("Execute "
-										+ command_name
-										+ "("
-										+ ((SnapAttributeExtract) listAttributes
-												.get(i))
-												.getAttribute_complete_name()
-										+ ")");
-					}
-
-				}
-				return toString(result);
-			} else {
-				Except.throw_exception("CONFIGURATION_ERROR",
-						"Invalid snapshot attributes",
-						"SnapManager.SetEquipmentsWithCommand");
+		    } catch (DevFailed e) {
+			hasFailed = true;
+			DevError[] err = e.errors;
+			for (DevError devError : err) {
+			    errorStack.add(devError);
 			}
-		} catch (SnapshotingException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (NumberFormatException e1) {
-			Except.throw_exception("CONFIGURATION_ERROR",
-					"Invalid snapshot ID",
-					"SnapManager.SetEquipmentsWithCommand");
-
+		    }
 		}
-		return null;
-	}
-
-	private String[] extractData(DeviceData data_out, Vector<String> result) {
-		// TODO Auto-generated method stub
-
-		String[] data_array = null;
-		try {
-			if (data_out.type().name().equals("DevVarDoubleArray")) {
-				double[] res_array = data_out.extractDoubleArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarFloatArray")) {
-				float[] res_array = data_out.extractFloatArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarLongArray")) {
-				int[] res_array = data_out.extractLongArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarShortArray")) {
-				short[] res_array = data_out.extractShortArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarStringArray")) {
-				data_array = data_out.extractStringArray();
-			} else if (data_out.type().name().equals("DevVarUShortArray")) {
-				int[] res_array = data_out.extractUShortArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarULongArray")) {
-				long[] res_array = data_out.extractULongArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarLong64Array")) {
-				long[] res_array = data_out.extractLong64Array();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			} else if (data_out.type().name().equals("DevVarULong64Array")) {
-				long[] res_array = data_out.extractULongArray();
-				data_array = new String[res_array.length];
-				for (int i = 0; i < res_array.length; i++) {
-					data_array[i] = String.valueOf(res_array[i]);
-				}
-			}
-
-		} catch (BadKind e) {
-			// TODO Auto-generated catch block
-
+		if (hasFailed) {
+		    throw new DevFailed(errorStack.toArray(new DevError[errorStack.size()]));
 		}
+		return Arrays.toString(result.toArray(new String[result.size()]));
+	    } else {
+		Except.throw_exception("CONFIGURATION_ERROR", "Invalid snapshot attributes",
+			"SnapManager.SetEquipmentsWithCommand");
+	    }
+	} catch (SnapshotingException e) {
+	    Except.throw_exception("CONFIGURATION_ERROR", e.getMessage(), "SnapManager.SetEquipmentsWithCommand");
+	} catch (NumberFormatException e1) {
+	    Except.throw_exception("CONFIGURATION_ERROR", "Invalid snapshot ID", "SnapManager.SetEquipmentsWithCommand");
 
-		return data_array;
 	}
-
-	private String toString(Vector<String> vect) {
-		// TODO Auto-generated method stub
-		if (vect == null)
-			return null;
-		String res = "";
-		int counter = 0;
-		for (Iterator iterator = vect.iterator(); iterator.hasNext();) {
-			res += (String) iterator.next() + "\n";
-			counter++;
-
-		}
-		return res;
+	return "";
+    }
+
+    /*
+     * test if the attributes are from different devices and have the same
+     * format and the same type
+     */
+    private boolean validSnapshot(SnapAttributeExtract[] snapAttributeExtractArray) {
+	int type = snapAttributeExtractArray[0].getData_type();
+	int format = snapAttributeExtractArray[0].getData_format();
+	if (numberOfOccurrences(snapAttributeExtractArray, snapAttributeExtractArray[0].getdeviceName()) > 1) {
+	    return false;
 	}
-
-	/*
-	 * test if the attributes are from different devices and have the same
-	 * format and the same type
-	 */
-	private boolean validSnapshot(
-			SnapAttributeExtract[] snapAttributeExtractArray) {
-		// TODO Auto-generated method stub
-
-		int type = snapAttributeExtractArray[0].getData_type();
-		int format = snapAttributeExtractArray[0].getData_format();
-		if (numberOfOccurrences(snapAttributeExtractArray,
-				snapAttributeExtractArray[0].getdeviceName()) > 1)
-			return false;
-		for (int i = 1; i < snapAttributeExtractArray.length; i++) {
-			if ((snapAttributeExtractArray[i].getData_type() != type)
-					|| (snapAttributeExtractArray[i].getData_format() != format)
-					|| numberOfOccurrences(snapAttributeExtractArray,
-							snapAttributeExtractArray[i].getdeviceName()) > 1)
-				return false;
-		}
-
-		return true;
+	for (int i = 1; i < snapAttributeExtractArray.length; i++) {
+	    if (snapAttributeExtractArray[i].getData_type() != type
+		    || snapAttributeExtractArray[i].getData_format() != format
+		    || numberOfOccurrences(snapAttributeExtractArray, snapAttributeExtractArray[i].getdeviceName()) > 1) {
+		return false;
+	    }
 	}
 
-	/**
-	 *
-	 * @param snapAttributeExtractArray
-	 * @param getdeviceName
-	 * @return occurrence number of the input device name
-	 */
-	private int numberOfOccurrences(
-			SnapAttributeExtract[] snapAttributeExtractArray, String device) {
-		// TODO Auto-generated method stub
-		int occ = 0;
-		for (int i = 0; i < snapAttributeExtractArray.length; i++) {
-			if (snapAttributeExtractArray[i].getdeviceName().equals(device))
-				occ++;
-		}
-		return occ;
+	return true;
+    }
+
+    /**
+     * 
+     * @param snapAttributeExtractArray
+     * @param getdeviceName
+     * @return occurrence number of the input device name
+     */
+    private int numberOfOccurrences(SnapAttributeExtract[] snapAttributeExtractArray, String device) {
+	int occ = 0;
+	for (int i = 0; i < snapAttributeExtractArray.length; i++) {
+	    if (snapAttributeExtractArray[i].getdeviceName().equals(device)) {
+		occ++;
+	    }
 	}
-
-	// =========================================================
-	/**
-	 * Execute command "SetEquipments" on device. This command is used to set
-	 * values to equipments.
-	 *
-	 * @param argin
-	 *            "SetEquipments arguments... <BR>
-	 *            <blockquote>
-	 *            <ul>
-	 *            <li><strong>First Case:</strong> Setpoint is done on all the
-	 *            snapshot attributes
-	 *            <ul>
-	 *            <li><var>argin</var>[0]<b> =</b> the snap identifier
-	 *            <li><var>argin</var>[1]<b> =</b> STORED_READ_VALUE (Setpoint
-	 *            with theirs read values) or STORED_WRITE_VALUE (Setpoint with
-	 *            theirs write values)<br>
-	 *            </ul>
-	 *            <li><strong>Second Case: </strong> Setpoint is done on a set
-	 *            of the snapshot attributes
-	 *            <ul>
-	 *            <li><var>argin</var>[0]<b> =</b> the snap identifier
-	 *            <li><var>argin</var>[1]<b> =</b> the number of attributes <br>
-	 *            Let us note <i>&quot;<var>index</var>&quot; </i>the last
-	 *            <var>index</var> used (for example, at this point,
-	 *            <i><var>index</var></i> = 2).
-	 *            <li><var>argin</var>[index]<b> =</b> NEW_VALUE or
-	 *            STORED_READ_VALUE or STORED_WRITE_VALUE
-	 *            <li><var>argin</var>[index+1]<b> =</b> the attribut name
-	 *            <li><var>argin</var>[index+2]<b> =</b> the value to set when
-	 *            NEW_VALUE is requested
-	 *            </ul>
-	 *            </blockquote>"
-	 */
-	// =========================================================
-	public void set_equipments(String[] argin) throws DevFailed {
-		get_logger().info("Entering set_equipments() xxx");
-		// System.out.println("set_equipments(String[] argin)");
-		// ---Add your Own code to control device here ---
-		// System.out.println("snapshot : " + snapShot.toString());
-		if (argin.length < 2) {
-			Except.throw_exception("CONFIGURATION_ERROR",
-					"Wrong number of parameters", "SnapManager.SetEquipments");
-		} else {
-			int snapId;
-			try {
-				// Retrieve the snapid value
-				snapId = Integer.parseInt(argin[0]);
-				if (m_manager == null) {
-					m_manager = new SnapManagerImpl(dbUser, dbPassword, true);
-				}
-				// The attributes of the snapshot are gotten as they were saved
-				// in the database.
-				SnapAttributeExtract[] snapAttributeExtractArray = m_manager
-						.getSnap(snapId);
-
-				if (snapAttributeExtractArray == null
-						|| snapAttributeExtractArray.length == 0) {
-					Except.throw_exception("CONFIGURATION_ERROR",
-							"Invalid SnapId", "SnapManager.SetEquipments");
-				}
-				SnapShot snapShot = SnapShot.getPartialSnapShot(argin, snapId,
-						snapAttributeExtractArray);
-				if (snapShot == null)
-					return;
-				SnapManagerApi.TriggerSetEquipments(snapShot);
-			} catch (SnapshotingException e) {
-				get_logger().warn(e.toString(), e);
-				throw e.toTangoException();
-			} catch (NumberFormatException e) {
-				Except
-						.throw_exception("CONFIGURATION_ERROR",
-								"Wrong parameters values ",
-								"SnapManager.SetEquipments");
-			} catch (Throwable t) {
-				t.printStackTrace();
-			}
+	return occ;
+    }
+
+    // =========================================================
+    /**
+     * Execute command "SetEquipments" on device. This command is used to set
+     * values to equipments.
+     * 
+     * @param argin
+     *            "SetEquipments arguments... <BR>
+     *            <blockquote>
+     *            <ul>
+     *            <li><strong>First Case:</strong> Setpoint is done on all the
+     *            snapshot attributes
+     *            <ul>
+     *            <li><var>argin</var>[0]<b> =</b> the snap identifier
+     *            <li><var>argin</var>[1]<b> =</b> STORED_READ_VALUE (Setpoint
+     *            with theirs read values) or STORED_WRITE_VALUE (Setpoint with
+     *            theirs write values)<br>
+     *            </ul>
+     *            <li><strong>Second Case: </strong> Setpoint is done on a set
+     *            of the snapshot attributes
+     *            <ul>
+     *            <li><var>argin</var>[0]<b> =</b> the snap identifier
+     *            <li><var>argin</var>[1]<b> =</b> the number of attributes <br>
+     *            Let us note <i>&quot;<var>index</var>&quot; </i>the last
+     *            <var>index</var> used (for example, at this point,
+     *            <i><var>index</var></i> = 2).
+     *            <li><var>argin</var>[index]<b> =</b> NEW_VALUE or
+     *            STORED_READ_VALUE or STORED_WRITE_VALUE
+     *            <li><var>argin</var>[index+1]<b> =</b> the attribut name
+     *            <li><var>argin</var>[index+2]<b> =</b> the value to set when
+     *            NEW_VALUE is requested
+     *            </ul>
+     *            </blockquote>"
+     */
+    // =========================================================
+    public void set_equipments(String[] argin) throws DevFailed {
+	get_logger().info("Entering set_equipments() xxx");
+	// System.out.println("set_equipments(String[] argin)");
+	// ---Add your Own code to control device here ---
+	// System.out.println("snapshot : " + snapShot.toString());
+	if (argin.length < 2) {
+	    Except.throw_exception("CONFIGURATION_ERROR", "Wrong number of parameters", "SnapManager.SetEquipments");
+	} else {
+	    int snapId;
+	    try {
+		// Retrieve the snapid value
+		snapId = Integer.parseInt(argin[0]);
+		if (m_manager == null) {
+		    m_manager = new SnapManagerImpl();
 		}
-		get_logger().info("Exiting set_equipments()");
-	}
+		// The attributes of the snapshot are gotten as they were saved
+		// in the database.
+		SnapAttributeExtract[] snapAttributeExtractArray = m_manager.getSnap(snapId);
 
-	// =========================================================
-	/**
-	 * Execute command "UpdateSnapComment" on device. This command updates the
-	 * comment of given snapshot
-	 *
-	 *
-	 * @param argin
-	 *            1) snapshot identifier 2) The new comment
-	 */
-	// =========================================================
-	public void update_snap_comment(DevVarLongStringArray argin)
-			throws DevFailed {
-		get_logger().info("Entering update_snap_comment()");
-
-		// ---Add your Own code to control device here ---
-		int id_snap = argin.lvalue[0];
-		String comment = argin.svalue[0];
-		try {
-			SnapManagerApi.updateSnapComment(id_snap, comment);
-		} catch (SnapshotingException e) {
-			get_logger().warn(e.toString(), e);
-			throw e.toTangoException();
+		if (snapAttributeExtractArray == null || snapAttributeExtractArray.length == 0) {
+		    Except.throw_exception("CONFIGURATION_ERROR", "Invalid SnapId", "SnapManager.SetEquipments");
 		}
-		get_logger().info("Exiting update_snap_comment()");
-	}
-
-	// ===================================================================
-	/**
-	 * Method called by the read_attributes CORBA operation to set internal
-	 * attribute value.
-	 *
-	 * @param attr
-	 *            reference to the Attribute object
-	 */
-	// ===================================================================
-	public void read_attr(Attribute attr) throws DevFailed {
-		String attr_name = attr.get_name();
-		get_logger().info("In read_attr for attribute " + attr_name);
-
-		// Switch on attribute name
-		// ---------------------------------
-		if (attr_name == "version") {
-			// Add your own code here
-			attr.set_value(m_version);
+		SnapShot snapShot = SnapShot.getPartialSnapShot(argin, snapId, snapAttributeExtractArray);
+		if (snapShot == null) {
+		    return;
 		}
+		SnapManagerApi.TriggerSetEquipments(snapShot);
+	    } catch (SnapshotingException e) {
+		get_logger().warn(e.toString(), e);
+		throw e.toTangoException();
+	    } catch (NumberFormatException e) {
+		Except.throw_exception("CONFIGURATION_ERROR", "Wrong parameters values ", "SnapManager.SetEquipments");
+	    } catch (Throwable t) {
+		t.printStackTrace();
+	    }
 	}
+	get_logger().info("Exiting set_equipments()");
+    }
+
+    // =========================================================
+    /**
+     * Execute command "UpdateSnapComment" on device. This command updates the
+     * comment of given snapshot
+     * 
+     * 
+     * @param argin
+     *            1) snapshot identifier 2) The new comment
+     */
+    // =========================================================
+    public void update_snap_comment(DevVarLongStringArray argin) throws DevFailed {
+	get_logger().info("Entering update_snap_comment()");
+
+	// ---Add your Own code to control device here ---
+	int id_snap = argin.lvalue[0];
+	String comment = argin.svalue[0];
+	try {
+	    SnapManagerApi.updateSnapComment(id_snap, comment);
+	} catch (SnapshotingException e) {
+	    get_logger().warn(e.toString(), e);
+	    throw e.toTangoException();
+	}
+	get_logger().info("Exiting update_snap_comment()");
+    }
+
+    public String getSnapComment(int snapID) throws DevFailed {
+	try {
+	    return SnapManagerApi.getSnapComment(snapID);
+	} catch (SnapshotingException e) {
+	    throw e.toTangoException();
+	}
+    }
+
+    // ===================================================================
+    /**
+     * Method called by the read_attributes CORBA operation to set internal
+     * attribute value.
+     * 
+     * @param attr
+     *            reference to the Attribute object
+     */
+    // ===================================================================
+    @Override
+    public void read_attr(Attribute attr) throws DevFailed {
+	String attr_name = attr.get_name();
+	get_logger().info("In read_attr for attribute " + attr_name);
+
+	// Switch on attribute name
+	// ---------------------------------
+	if (attr_name == "version") {
+	    // Add your own code here
+	    attr.set_value(m_version);
+	}
+    }
 
-	// =========================================================
-	/**
-	 * main part for the device server class
-	 */
-	// =========================================================
-	public static void main(String[] argv) {
-		try {
-			Util tg = Util.init(argv, "SnapManager");
-			tg.server_init();
-
-			System.out.println("Ready to accept request");
+    // =========================================================
+    /**
+     * main part for the device server class
+     */
+    // =========================================================
+    public static void main(String[] argv) {
+	try {
+	    Util tg = Util.init(argv, "SnapManager");
+	    tg.server_init();
 
-			tg.server_run();
-		}
+	    System.out.println("Ready to accept request");
 
-		catch (OutOfMemoryError ex) {
-			System.err.println("Can't allocate memory !!!!");
-			System.err.println("Exiting");
-		} catch (UserException ex) {
-			Except.print_exception(ex);
+	    tg.server_run();
+	}
 
-			System.err.println("Received a CORBA user exception");
-			System.err.println("Exiting");
-		} catch (SystemException ex) {
-			Except.print_exception(ex);
+	catch (OutOfMemoryError ex) {
+	    System.err.println("Can't allocate memory !!!!");
+	    System.err.println("Exiting");
+	} catch (UserException ex) {
+	    Except.print_exception(ex);
 
-			System.err.println("Received a CORBA system exception");
-			System.err.println("Exiting");
-		}
+	    System.err.println("Received a CORBA user exception");
+	    System.err.println("Exiting");
+	} catch (SystemException ex) {
+	    Except.print_exception(ex);
 
-		System.exit(-1);
+	    System.err.println("Received a CORBA system exception");
+	    System.err.println("Exiting");
 	}
 
-	@Override
-	public void delete_device() throws DevFailed {
-		// TODO Auto-generated method stub
+	System.exit(-1);
+    }
 
-	}
+    @Override
+    public void delete_device() throws DevFailed {
+	snapshotResults.clear();
+    }
 }
 
 // --------------------------------------------------------------------------
diff --git a/src/main/java/SnapManager/SnapManagerClass.java b/src/main/java/SnapManager/SnapManagerClass.java
index 06a92dc..4576fc3 100644
--- a/src/main/java/SnapManager/SnapManagerClass.java
+++ b/src/main/java/SnapManager/SnapManagerClass.java
@@ -66,6 +66,7 @@
 
 package SnapManager;
 
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.Vector;
 
@@ -78,290 +79,302 @@ import fr.esrf.TangoDs.Command;
 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 SnapManagerClass extends DeviceClass implements TangoConst {
-	// --------- 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;
-	/**
-	 * Database schema name.<br>
-	 * <b>Default value : </b> snap
-	 */
-	String dbSchema;
-
-	// --------- End of properties data members ----------
-
-	/**
-	 * SnapManagerClass class instance (it is a singleton).
-	 */
-	private static SnapManagerClass _instance = null;
-
-	/**
-	 * Class properties array.
-	 */
-	private DbDatum[] cl_prop = null;
-
-	// --------- Start of properties data members ----------
-
-	// --------- End of properties data members ----------
-
-	// ===================================================================
-	//
-	// method : instance()
-	// 
-	// description : static method to retrieve the SnapManagerClass object
-	// once it has been initialised
-	//
-	// ===================================================================
-	public static SnapManagerClass instance() {
-		if (_instance == null) {
-			System.err.println("SnapManagerClass is not initialised !!!");
-			System.err.println("Exiting");
-			System.exit(-1);
-		}
-		return _instance;
+    // --------- 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;
+    /**
+     * Database schema name.<br>
+     * <b>Default value : </b> snap
+     */
+    String dbSchema;
+
+    // --------- End of properties data members ----------
+
+    /**
+     * SnapManagerClass class instance (it is a singleton).
+     */
+    private static SnapManagerClass _instance = null;
+
+    /**
+     * Class properties array.
+     */
+    // private final DbDatum[] cl_prop = null;
+
+    // --------- Start of properties data members ----------
+
+    // --------- End of properties data members ----------
+
+    // ===================================================================
+    //
+    // method : instance()
+    //
+    // description : static method to retrieve the SnapManagerClass object
+    // once it has been initialised
+    //
+    // ===================================================================
+    public static SnapManagerClass instance() {
+	if (_instance == null) {
+	    System.err.println("SnapManagerClass is not initialised !!!");
+	    System.err.println("Exiting");
+	    System.exit(-1);
 	}
-
-	// ===================================================================
-	//
-	// method : Init()
-	// 
-	// description : static method to create/retrieve the SnapManagerClass
-	// object. This method is the only one which enables a
-	// user to create the object
-	//
-	// in : - class_name : The class name
-	//
-	// ===================================================================
-	public static SnapManagerClass init(String class_name) throws DevFailed {
-		if (_instance == null) {
-			_instance = new SnapManagerClass(class_name);
-		}
-		return _instance;
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : Init()
+    //
+    // description : static method to create/retrieve the SnapManagerClass
+    // object. This method is the only one which enables a
+    // user to create the object
+    //
+    // in : - class_name : The class name
+    //
+    // ===================================================================
+    public static SnapManagerClass init(String class_name) throws DevFailed {
+	if (_instance == null) {
+	    _instance = new SnapManagerClass(class_name);
 	}
-
-	// ===================================================================
-	//
-	// method : SnapManagerClass()
-	// 
-	// description : constructor for the SnapManagerClass class
-	//
-	// argument : in : - name : The class name
-	//
-	// ===================================================================
-	protected SnapManagerClass(String name) throws DevFailed {
-		super(name);
-
-		Util.out2.println("Entering SnapManagerClass constructor");
-		write_class_property();
-		get_class_property();
-
-		Util.out2.println("Leaving SnapManagerClass constructor");
+	return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : SnapManagerClass()
+    //
+    // description : constructor for the SnapManagerClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected SnapManagerClass(String name) throws DevFailed {
+	super(name);
+
+	Util.out2.println("Entering SnapManagerClass constructor");
+	write_class_property();
+	get_class_property();
+
+	Util.out2.println("Leaving SnapManagerClass 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 CreateNewContextClass("CreateNewContext", Tango_DEVVAR_STRINGARRAY, Tango_DEV_LONG,
+		"All the informations usefull to create a context ,Snapshot pattern).", "The new assigned context ID",
+		DispLevel.OPERATOR));
+	command_list.addElement(new SetEquipmentsWithSnapshotClass("SetEquipmentsWithSnapshot",
+		Tango_DEVVAR_STRINGARRAY, Tango_DEV_VOID, "The snapshot from which equipments are set.", "",
+		DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new SetEquipmentsWithCommandClass(
+			"SetEquipmentsWithCommand",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_STRING,
+			"The command name,  STORED_READ_VALUE || STORED_WRITE_VALUE ,\n and the snapshot ID from which equipments are set.",
+			"", DispLevel.OPERATOR));
+
+	command_list
+		.addElement(new SetEquipmentsClass(
+			"SetEquipments",
+			Tango_DEVVAR_STRINGARRAY,
+			Tango_DEV_VOID,
+			"* First Case: Setpoint is  done on all the snapshot attributes:\n"
+				+ "  - argin[0]= the snap identifier\n"
+				+ "  - argin[1]=STORED_READ_VALUE (Setpoint with theirs read values) or STORED_WRITE_VALUE (Setpoint with theirs write values)\n\n"
+				+ "* Second Case: Setpoint is done on a set of the snapshot attributes:\n "
+				+ "  - argin[0]= the snap identifier\n" + "  - argin[1]=the number of attributes.\n"
+				+ " Let us note index the last index used (for example, at this point,index = 2).\n"
+				+ "  - argin[index]=NEW_VALUE or STORED_READ_VALUE or STORED_WRITE_VALUE\n"
+				+ "  - argin[index+1]= the attribut name\n"
+				+ "  - argin[index+2]= the value to set when NEW_VALUE is requested", "",
+			DispLevel.OPERATOR));
+	command_list.addElement(new UpdateSnapCommentClass("UpdateSnapComment", Tango_DEV_LONG, Tango_DEV_STRING,
+		"1) snapshot identifier 2) The new comment", "", DispLevel.OPERATOR));
+
+	// Modify LaunchSnapShot call from archiver to manager
+	command_list.addElement(new LaunchSnapShotCmd("LaunchSnapShot", Tango_DEV_SHORT, Tango_DEV_VOID,
+		"The snapshot associated context's identifier", "", DispLevel.OPERATOR));
+
+	command_list.addElement(new TemplCommandInOut("GetSnapShotResult", "getSnapShotResult",
+		"The snapshot associated context's identifier", "The new snapshot identifier", DispLevel.OPERATOR));
+
+	command_list.addElement(new TemplCommandInOut("GetSnapShotComment", "getSnapComment", "The snapshot id",
+		"The comment", DispLevel.OPERATOR));
+
+	// 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
-	// ===================================================================
-	public void command_factory() {
-		command_list
-				.addElement(new CreateNewContextClass(
-						"CreateNewContext",
-						Tango_DEVVAR_STRINGARRAY,
-						Tango_DEV_LONG,
-						"All the informations usefull to create a context ,Snapshot pattern).",
-						"The new assigned context ID", DispLevel.OPERATOR));
-		command_list.addElement(new SetEquipmentsWithSnapshotClass(
-				"SetEquipmentsWithSnapshot", Tango_DEVVAR_STRINGARRAY,
-				Tango_DEV_VOID, "The snapshot from which equipments are set.",
-				"", DispLevel.OPERATOR));
-
-		command_list
-				.addElement(new SetEquipmentsWithCommandClass(
-						"SetEquipmentsWithCommand",
-						Tango_DEVVAR_STRINGARRAY,
-						Tango_DEV_STRING,
-						"The command name,  STORED_READ_VALUE || STORED_WRITE_VALUE ,\n and the snapshot ID from which equipments are set.",
-						"", DispLevel.OPERATOR));
-
-		command_list
-				.addElement(new SetEquipmentsClass(
-						"SetEquipments",
-						Tango_DEVVAR_STRINGARRAY,
-						Tango_DEV_VOID,
-						"The attributes from which equipments are set.",
-						"SetEquipments arguments... <BR><blockquote> <ul>             <li><strong>First Case:</strong> Setpoint is  done on all the snapshot attributes             <ul>                  <li><var>argin</var>[0]<b> =</b> the snap identifier<li><var>argin</var>[1]<b> =</b> STORED_READ_VALUE (Setpoint with theirs read values) or STORED_WRITE_VALUE (Setpoint with theirs write values)<br> </ul><li><strong>Second Case: </strong> Setpoint is done on a set of the snapshot attributes               <ul>                  <li><var>argin</var>[0]<b> =</b> the snap identifier<li><var>argin</var>[1]<b> =</b> the number of attributes <br>           Let us note <i>&quot;<var>index</var>&quot; </i>the last <var>index</var> used (for example, at this point, <i><var>index</var></i> = 2).<li><var>argin</var>[index]<b> =</b> NEW_VALUE or STORED_READ_VALUE or STORED_WRITE_VALUE<li><var>argin</var>[index+1]<b> =</b> the attribut name <li><var>argin</var>[index+2]<b> =</b> the value to set when NEW_VALUE is requested </ul>          </blockquote>",
-						DispLevel.OPERATOR));
-		command_list.addElement(new UpdateSnapCommentClass("UpdateSnapComment",
-				Tango_DEVVAR_LONGSTRINGARRAY, Tango_DEV_VOID,
-				"1) snapshot identifier 2) The new comment", "",
-				DispLevel.OPERATOR));
-
-		// Modify LaunchSnapShot call from archiver to manager
-		command_list.addElement(new LaunchSnapShotCmd("LaunchSnapShot",
-				Tango_DEV_SHORT, Tango_DEV_SHORT,
-				"The snapshot associated context's identifier.", "",
-				DispLevel.OPERATOR));
-
-		// 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 : 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 = "unkown";
+	try {
+	    device_version = ResourceBundle.getBundle("application").getString("project.version");
+	} catch (MissingResourceException e) {
 	}
-
-	// =============================================================================
+	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 SnapManager(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]);
+	    }
+	}
+    }
+
+    // ===================================================================
+    /**
+     * Get the class property for specified name.
+     * 
+     * @param name
+     *            The property name.
+     * @throws DevFailed
+     */
+    // ===================================================================
+    public DbDatum get_class_property(String name) throws DevFailed {
+	// for (int i = 0; i < cl_prop.length; i++) {
+	// if (cl_prop[i].name.equals(name)) {
+	// return cl_prop[i];
+	// }
+	// }
+	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 {
+	// Initialize your default values here.
+	// ------------------------------------------
+
+	// // Read class properties from database.(Automatic code generation)
+	// //-------------------------------------------------------------
+	// if ( Util._UseDb == false )
+	// return;
+	// String[] propnames = {
+	// };
 	//
-	// Method: attribute_factory(Vector att_list)
+	// // Call database and extract values
+	// //--------------------------------------------
+	// cl_prop = get_db_class().get_property(propnames);
+	// int i = -1;
 	//
-	// =============================================================================
-	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);
-	}
-
-	// ===================================================================
+	// // End of Automatic code generation
+	// -------------------------------------------------------------
+
+	// -------------------------------------------------------------
+	// if (Util._UseDb == false) {
+	// return;
+	// }
+	// String[] propnames = { "DbHost", "DbName", "DbSchema" };
 	//
-	// method : device_factory()
-	// 
-	// description : Create the device object(s) and store them in the
-	// device list
+	// // 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();
+	// }
 	//
-	// argument : in : String[] devlist : The device name list
+	// // Extract DbName value
+	// if (cl_prop[++i].is_empty() == false) {
+	// dbName = cl_prop[i].extractString();
+	// }
 	//
-	// ===================================================================
-	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 SnapManager(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]);
-		}
+	// // Extract DbSchema value
+	// if (cl_prop[++i].is_empty() == false) {
+	// dbSchema = cl_prop[i].extractString();
+	// }
+
+	// 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;
 	}
 
-	// ===================================================================
-	/**
-	 * 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);
-	}
+	// Prepeare DbDatum
+	// --------------------------------------------
+	DbDatum[] data = new DbDatum[2];
+	data[0] = new DbDatum("ProjectTitle");
+	data[0].insert("Tango Device Server");
 
-	// ===================================================================
-	/**
-	 * 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 = {
-		// };
-		//
-		// // Call database and extract values
-		// //--------------------------------------------
-		// cl_prop = get_db_class().get_property(propnames);
-		// int i = -1;
-		//
-		// // End of Automatic code generation
-		// -------------------------------------------------------------
-
-		// -------------------------------------------------------------
-		if (Util._UseDb == false)
-			return;
-		String[] propnames = { "DbHost", "DbName", "DbSchema" };
-
-		// 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 DbSchema value
-		if (cl_prop[++i].is_empty() == false)
-			dbSchema = cl_prop[i].extractString();
-		else
-			cl_prop[i].insert(dbSchema);
-
-		// End of Automatic code generation
-		// -------------------------------------------------------------
+	data[1] = new DbDatum("Description");
+	data[1].insert("This DServer provides the connections points and methods to the SnapShot service.");
 
-	}
-
-	// ===================================================================
-	/**
-	 * 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("This DServer provides the connections points and methods to the SnapShot service.");
-
-		// 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/resources/beansBeamline.xml b/src/main/resources/beansBeamline.xml
deleted file mode 100644
index 1b57fe9..0000000
--- a/src/main/resources/beansBeamline.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:tx="http://www.springframework.org/schema/tx"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-	<!-- DATASOURCE DEFINITION VVVVVVV-->
-	<bean id="dataSource"
-        class="org.apache.commons.dbcp.BasicDataSource"
-        destroy-method="close"> 
-			<property name="initialSize" value="8"/>
-		    <property name="maxActive" value="4"/>
-		    <property name="maxIdle" value="8"/>
-
-		    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
-		    <property name="url" value="jdbc:mysql://localhost/snap?autoReconnect=true" />
-		    <property name="username" value="snaparchiver" />
-		    <property name="password" value="snaparchiver" />
-	</bean>
-  	<!-- DATASOURCE DEFINITION ^^^^^^-->
-	
-	<!-- HIBERNATE DEFINITION VVVVVVV-->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
-		<property name="dataSource" ref="dataSource"/>
-	
-		<property name="mappingResources">
-		  <list>
-			<value>valueTables.hbm.xml</value>
-		  </list>
-		</property>
-
-    	<property name="hibernateProperties">
-		  <value>
-			hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
-			hibernate.show_sql=true
-			hibernate.format_sql=true
-			hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
-			hibernate.current_session_context_class=thread
-			hibernate.connection.autocommit=false
-			hibernate.connection.release_mode=after_transaction
-			hibernate.generate_statistics=true
-		  </value>
-		</property>
-    </bean>
-    <!-- HIBERNATE DEFINITION ^^^^^^-->
-  
-    <!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
-		<!-- MANAGER -->
-		<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-			<property name="sessionFactory" ref="sessionFactory"/>
-		</bean>
-	
-		<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
-		<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->	  
-			<tx:attributes><!-- the transactional semantics... -->
-				<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
-				<tx:method name="*"/><!-- other methods use the default transaction settings -->
-			</tx:attributes>
-		</tx:advice>
-	
-    	<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
-		<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
-			<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
-			<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
-		</aop:config>
-    <!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
-  
-	<!-- DAO BEANS DEFINITION VVVVVVV-->
-    <bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-	<!-- DAO BEANS DEFINITION ^^^^^^-->
-</beans>
\ No newline at end of file
diff --git a/src/main/resources/beansBeamlineSrv1.xml b/src/main/resources/beansBeamlineSrv1.xml
deleted file mode 100644
index ac76f0b..0000000
--- a/src/main/resources/beansBeamlineSrv1.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:tx="http://www.springframework.org/schema/tx"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-	<!-- DATASOURCE DEFINITION VVVVVVV-->
-	<bean id="dataSource"
-        class="org.apache.commons.dbcp.BasicDataSource"
-        destroy-method="close"> 
-			<property name="initialSize" value="8"/>
-		    <property name="maxActive" value="4"/>
-		    <property name="maxIdle" value="8"/>
-
-		    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
-		    <property name="url" value="jdbc:mysql://srv1/snap?autoReconnect=true" />
-		    <property name="username" value="snaparchiver" />
-		    <property name="password" value="snaparchiver" />
-	</bean>
-  	<!-- DATASOURCE DEFINITION ^^^^^^-->
-	
-	<!-- HIBERNATE DEFINITION VVVVVVV-->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
-		<property name="dataSource" ref="dataSource"/>
-	
-		<property name="mappingResources">
-		  <list>
-			<value>valueTables.hbm.xml</value>
-		  </list>
-		</property>
-
-    	<property name="hibernateProperties">
-		  <value>
-			hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
-			hibernate.show_sql=true
-			hibernate.format_sql=true
-			hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
-			hibernate.current_session_context_class=thread
-			hibernate.connection.autocommit=false
-			hibernate.connection.release_mode=after_transaction
-			hibernate.generate_statistics=true
-		  </value>
-		</property>
-    </bean>
-    <!-- HIBERNATE DEFINITION ^^^^^^-->
-  
-    <!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
-		<!-- MANAGER -->
-		<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-			<property name="sessionFactory" ref="sessionFactory"/>
-		</bean>
-	
-		<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
-		<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->	  
-			<tx:attributes><!-- the transactional semantics... -->
-				<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
-				<tx:method name="*"/><!-- other methods use the default transaction settings -->
-			</tx:attributes>
-		</tx:advice>
-	
-    	<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
-		<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
-			<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
-			<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
-		</aop:config>
-    <!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
-  
-	<!-- DAO BEANS DEFINITION VVVVVVV-->
-    <bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-	<!-- DAO BEANS DEFINITION ^^^^^^-->
-</beans>
\ No newline at end of file
diff --git a/src/main/resources/beansPHOBOS.xml b/src/main/resources/beansPHOBOS.xml
deleted file mode 100644
index 8b91530..0000000
--- a/src/main/resources/beansPHOBOS.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:tx="http://www.springframework.org/schema/tx"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-	<!-- DATASOURCE DEFINITION VVVVVVV-->
-	<bean id="dataSource"
-        class="org.apache.commons.dbcp.BasicDataSource"
-        destroy-method="close"> 
-			<property name="initialSize" value="2"/>
-		    <property name="maxActive" value="5"/>
-		    <property name="maxIdle" value="2"/>
-
-		    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
-		    <property name="url" value="jdbc:oracle:thin:@PHOBOS:1521:TEST" />
-		    <property name="username" value="SNAP" />
-		    <property name="password" value="SNAP" />
-	</bean>
-  	<!-- DATASOURCE DEFINITION ^^^^^^-->
-	
-	<!-- HIBERNATE DEFINITION VVVVVVV-->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
-		<property name="dataSource" ref="dataSource"/>
-	
-		<property name="mappingResources">
-		  <list>
-			<value>valueTables.hbm.xml</value>
-		  </list>
-		</property>
-
-    	<property name="hibernateProperties">
-		  <value>
-			hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
-			hibernate.show_sql=true
-			hibernate.format_sql=true
-			hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
-			hibernate.current_session_context_class=thread
-			hibernate.connection.autocommit=false
-			hibernate.generate_statistics=true
-		  </value>
-		</property>
-    </bean>
-    <!-- HIBERNATE DEFINITION ^^^^^^-->
-  
-    <!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
-		<!-- MANAGER -->
-		<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-			<property name="sessionFactory" ref="sessionFactory"/>
-		</bean>
-	
-		<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
-		<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->	  
-			<tx:attributes><!-- the transactional semantics... -->
-				<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
-				<tx:method name="*"/><!-- other methods use the default transaction settings (see below) -->
-			</tx:attributes>
-		</tx:advice>
-	
-    	<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
-		<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
-			<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
-			<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
-		</aop:config>
-    <!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
-  
-	<!-- DAO BEANS DEFINITION VVVVVVV-->
-    <bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-  
-    <bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" /> 
-    </bean>
-	<!-- DAO BEANS DEFINITION ^^^^^^-->
-</beans>
\ No newline at end of file
diff --git a/src/main/resources/beansRCM.xml b/src/main/resources/beansRCM.xml
deleted file mode 100644
index 43c7f9e..0000000
--- a/src/main/resources/beansRCM.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:tx="http://www.springframework.org/schema/tx"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
-       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-	<!-- DATASOURCE DEFINITION VVVVVVV-->
-	<bean id="dataSource"
-        class="org.apache.commons.dbcp.BasicDataSource"
-        destroy-method="close">
-			<property name="initialSize" value="2"/>
-		    <property name="maxActive" value="5"/>
-		    <property name="maxIdle" value="2"/>
-
-		    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
-		    <property name="url" value="jdbc:oracle:thin:@foo:1521:SNAP" />
-		    <property name="username" value="snaparchiver" />
-		    <property name="password" value="snaparchiver" />
-	</bean>
-  	<!-- DATASOURCE DEFINITION ^^^^^^-->
-
-	<!-- HIBERNATE DEFINITION VVVVVVV-->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
-		<property name="dataSource" ref="dataSource"/>
-
-		<property name="mappingResources">
-		  <list>
-			<value>valueTables.hbm.xml</value>
-		  </list>
-		</property>
-
-    	<property name="hibernateProperties">
-		  <value>
-			hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
-			hibernate.default_schema=SNAP
-			hibernate.show_sql=true
-			hibernate.format_sql=true
-			hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
-			hibernate.current_session_context_class=thread
-			hibernate.connection.autocommit=false
-			hibernate.generate_statistics=true
-		  </value>
-		</property>
-    </bean>
-    <!-- HIBERNATE DEFINITION ^^^^^^-->
-
-    <!-- TRANSACTIONS DEFINITIONS VVVVVVV-->
-		<!-- MANAGER -->
-		<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-			<property name="sessionFactory" ref="sessionFactory"/>
-		</bean>
-
-		<!-- DEFINES AN "ADVICE" IE. A WAY TO USE THE TRANSACTION MANAGER AROUND METHODS -->
-		<tx:advice id="txAdvice" transaction-manager="transactionManager"><!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) -->
-			<tx:attributes><!-- the transactional semantics... -->
-				<tx:method name="findBy*" read-only="true"/><!-- all methods starting with 'get' are read-only -->
-				<tx:method name="*"/><!-- other methods use the default transaction settings (see below) -->
-			</tx:attributes>
-		</tx:advice>
-
-    	<!-- DEFINES WHERE "ADVICES" WILL BE USED-->
-		<aop:config><!-- ensure that the above transactional advice runs for any execution of an operation defined by the FooService interface -->
-			<aop:pointcut id="valDAOOperation" expression="execution(* fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ValDAO.*(..))"/>
-			<aop:advisor advice-ref="txAdvice" pointcut-ref="valDAOOperation"/>
-		</aop:config>
-    <!-- TRANSACTIONS DEFINITIONS ^^^^^^-->
-
-	<!-- DAO BEANS DEFINITION VVVVVVV-->
-    <bean id="scNum1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="scNum2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScNum2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="scStr1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="scStr2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.ScStr2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="sp1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="sp2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Sp2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="im1ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im1ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-
-    <bean id="im2ValDAO" class="fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao.Im2ValDAOImpl">
-		<constructor-arg ref="sessionFactory" />
-    </bean>
-	<!-- DAO BEANS DEFINITION ^^^^^^-->
-</beans>
\ No newline at end of file
diff --git a/src/main/resources/beans_Orion.xml b/src/main/resources/beans_Orion.xml
index af39ad7..55c6a62 100644
--- a/src/main/resources/beans_Orion.xml
+++ b/src/main/resources/beans_Orion.xml
@@ -16,9 +16,9 @@
 		    <property name="maxIdle" value="2"/>
 
 		    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
-		    <property name="url" value="jdbc:oracle:thin:@ORION:1521:TEST" />
-		    <property name="username" value="snap" />
-		    <property name="password" value="snap" />
+		    <property name="url" value="jdbc:oracle:thin:@ORION:1521:TEST3" />
+		    <property name="username" value="toto" />
+		    <property name="password" value="toto" />
 	</bean>
   	<!-- DATASOURCE DEFINITION ^^^^^^-->
 	
@@ -34,7 +34,7 @@
 
     	<property name="hibernateProperties">
 		  <value>
-			hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
+			hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
 			hibernate.show_sql=true
 			hibernate.format_sql=true
 			hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
index 0acec65..b00c071 100644
--- a/src/main/resources/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,6 +1,6 @@
 #d�finition du niveau et des Appender du rootLogger
 log4j.rootLogger=INFO, monAppender
- 
+log4j.jacorb=ERROR
 #configuration de "monAppender"
 #nous allons envoyer les messages dans la console de Tomcat
 log4j.appender.monAppender=org.apache.log4j.ConsoleAppender
@@ -10,4 +10,4 @@ log4j.appender.monAppender.layout=org.apache.log4j.PatternLayout
  
 #d�finition du pattern d'affichage pour "monAppender"
 #voici un exemple de sortie que l'on va obtenir : 2005-06-18 14:53:37 DEBUG [Main] Hello World
-log4j.appender.monAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%c{1}] %m%n
\ No newline at end of file
+log4j.appender.monAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %C %-5p [%c{1}] %m%n
\ No newline at end of file
diff --git a/src/test/java/SnapArchiver/SnapArchiverTest.java b/src/test/java/SnapArchiver/SnapArchiverTest.java
index e7786a6..89fbfcd 100644
--- a/src/test/java/SnapArchiver/SnapArchiverTest.java
+++ b/src/test/java/SnapArchiver/SnapArchiverTest.java
@@ -1,77 +1,74 @@
 package SnapArchiver;
 
-import junit.framework.TestCase;
+import org.junit.Ignore;
+import org.junit.Test;
+
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoApi.DeviceData;
 import fr.esrf.TangoApi.DeviceProxy;
 
-public class SnapArchiverTest extends TestCase {
-
-	private short testTriggerLaunchSnap(DeviceProxy deviceProxy, short ctx) {
-		DeviceData device_data = null;
-		DeviceData device_data_out = null;
-		short snapId = -1;
-		try {
-			device_data = new DeviceData();
-			device_data.insert(ctx);
-			device_data_out = deviceProxy.command_inout(
-					"TriggerLaunchSnapShot", device_data);
-			snapId = device_data_out.extractShort();
-			device_data = null;
-		} catch (DevFailed e) {
-			StringBuffer buffer = new StringBuffer(
-					"ERROR DevFailed : argin ctx = " + ctx + "\n");
-			for (int i = 0; i < e.errors.length; i++) {
-				buffer.append("Error Level " + i + ":\n");
-				buffer.append("\t - desc: " + e.errors[i].desc.toString()
-						+ "\n");
-				buffer.append("\t - origin: " + e.errors[i].origin.toString()
-						+ "\n");
-				buffer.append("\t - reason: " + e.errors[i].reason.toString()
-						+ "\n");
+@Ignore
+public class SnapArchiverTest {
 
-				String sev = "";
-				if (e.errors[i].severity.value() == ErrSeverity.ERR.value()) {
-					sev = "ERROR";
-				} else if (e.errors[i].severity.value() == ErrSeverity.PANIC
-						.value()) {
-					sev = "PANIC";
-				} else if (e.errors[i].severity.value() == ErrSeverity.WARN
-						.value()) {
-					sev = "WARN";
-				}
-				buffer.append("\t - severity: " + sev + "\n");
-			}
+    @Test
+    private short testTriggerLaunchSnap(DeviceProxy deviceProxy, short ctx) {
+	DeviceData device_data = null;
+	DeviceData device_data_out = null;
+	short snapId = -1;
+	try {
+	    device_data = new DeviceData();
+	    device_data.insert(ctx);
+	    device_data_out = deviceProxy.command_inout("TriggerLaunchSnapShot", device_data);
+	    snapId = device_data_out.extractShort();
+	    device_data = null;
+	} catch (DevFailed e) {
+	    StringBuffer buffer = new StringBuffer("ERROR DevFailed : argin ctx = " + ctx + "\n");
+	    for (int i = 0; i < e.errors.length; i++) {
+		buffer.append("Error Level " + i + ":\n");
+		buffer.append("\t - desc: " + e.errors[i].desc.toString() + "\n");
+		buffer.append("\t - origin: " + e.errors[i].origin.toString() + "\n");
+		buffer.append("\t - reason: " + e.errors[i].reason.toString() + "\n");
 
-			System.out.println(buffer.toString());
-		} catch (Exception e) {
-			e.printStackTrace();
-			System.out.println("Unknown Exception argin ctx = " + ctx);
+		String sev = "";
+		if (e.errors[i].severity.value() == ErrSeverity.ERR.value()) {
+		    sev = "ERROR";
+		} else if (e.errors[i].severity.value() == ErrSeverity.PANIC.value()) {
+		    sev = "PANIC";
+		} else if (e.errors[i].severity.value() == ErrSeverity.WARN.value()) {
+		    sev = "WARN";
 		}
-		return snapId;
+		buffer.append("\t - severity: " + sev + "\n");
+	    }
+
+	    System.out.println(buffer.toString());
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.out.println("Unknown Exception argin ctx = " + ctx);
 	}
+	return snapId;
+    }
 
-	public void testTriggerLaunchSnapShot() {
-		try {
-			DeviceProxy deviceProxy = new DeviceProxy(
-					"archiving/snap/snaparchiver.1");
-			short snapId;
-			short ctx = -1;
-			// Un exception doit �tre lev�e
-			snapId = testTriggerLaunchSnap(deviceProxy, ctx);
-			System.out.println("1 - ctx = " + ctx + " snapId = " + snapId);
+    @Test
+    public void testTriggerLaunchSnapShot() {
+	try {
+	    DeviceProxy deviceProxy = new DeviceProxy("archiving/snap/snaparchiver.1");
+	    short snapId;
+	    short ctx = -1;
+	    // Un exception doit �tre lev�e
+	    snapId = testTriggerLaunchSnap(deviceProxy, ctx);
+	    System.out.println("1 - ctx = " + ctx + " snapId = " + snapId);
 
-			ctx = 20; // contexte existant
-			snapId = testTriggerLaunchSnap(deviceProxy, ctx);
-			System.out.println("2 - ctx = " + ctx + " snapId = " + snapId);
+	    ctx = 20; // contexte existant
+	    snapId = testTriggerLaunchSnap(deviceProxy, ctx);
+	    System.out.println("2 - ctx = " + ctx + " snapId = " + snapId);
 
-			ctx = 100; // contexte inexistant mais valide
-			snapId = testTriggerLaunchSnap(deviceProxy, ctx);
-			System.out.println("3 - ctx = " + ctx + " snapId = " + snapId);
+	    ctx = 100; // contexte inexistant mais valide
+	    snapId = testTriggerLaunchSnap(deviceProxy, ctx);
+	    System.out.println("3 - ctx = " + ctx + " snapId = " + snapId);
 
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
+	} catch (Exception e) {
+	    e.printStackTrace();
 	}
+    }
 }
diff --git a/src/test/java/SnapManager/SnapManagerTest.java b/src/test/java/SnapManager/SnapManagerTest.java
index e60bd12..71675b1 100644
--- a/src/test/java/SnapManager/SnapManagerTest.java
+++ b/src/test/java/SnapManager/SnapManagerTest.java
@@ -1,209 +1,176 @@
 package SnapManager;
 
-import junit.framework.TestCase;
+import org.junit.Ignore;
+import org.junit.Test;
+
 import fr.esrf.TangoApi.DeviceData;
 import fr.esrf.TangoApi.DeviceProxy;
 
-public class SnapManagerTest extends TestCase {
-
-	public void testSet_equipments() {
-		try
-		{
-			DeviceProxy deviceProxy = new DeviceProxy("archiving/snap/snapmanager.1");
-			DeviceData device_data = null;
-
-/*			try {
-				device_data = new DeviceData();
-				// tester une chaine vide ==> Une exception doit-�tre lev�e
-				device_data.insert(new String[] {});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("1 - ERROR : argin vide " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid uniquement ==> Une exception doit-�tre lev�e
-				device_data.insert(new String[] {"12"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("2 - ERROR : SnapId only  " + e);
-			}
-
-			try {
-				// AUCUNE erreur de remont�e dans ce cas l�
-				device_data = new DeviceData();
-				// tester un snapid invalide
-				device_data.insert(new String[] {"100","STORED_READ_VALUE"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("3 - ERROR : SnapId n'existe pas" + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester une chaine invalide
-				device_data.insert(new String[] {"40","STORED_READ_VALUEXXXX"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("4 - ERROR : param�tre stored_read invalide " + e);
-			}
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib uniquement ==> Une exception doit-�tre lev�e
-				device_data.insert(new String[] {"42","4"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("5 - ERROR : SnapId + Nb Attribut uniquement " + e);
-			}
-
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + invalid value ==> Une exception doit-�tre lev�e
-				device_data.insert(new String[] {"42","1","NEW_VALUE","tango/tangotest/spjz_1/long_scalar","chaine" });
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("6 - ERROR : SnapId + Nb Attribut + invalid new value " + e);
-			}
-
-			try {
-			device_data = new DeviceData();
-			// tester un snapid + nb attrib + read value
-			device_data.insert(new String[] {"42","1","STORED_READ_VALUECCCC","tango/tangotest/spjz_1/long_scalar" });
-			deviceProxy.command_inout("SetEquipments" , device_data);
-			device_data = null;
-		}
-		catch(Exception e){
-			System.out.println("7 - ERROR : SnapId + Nb Attribut + value stored_read value " + e);
-		}
-
-		try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + read value
-				device_data.insert(new String[] {"42","3","STORED_READ_VALUE","tango/tangotest/spjz_1/long_scalar",
-						"NEW_VALUE","tango/tangotest/spjz_1/long_scalar_w",
-						"STORED_WRITE_VALUE","tango/tangotest/spjz_1/short_scalar"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-			}
-		catch(Exception e){
-			System.out.println("8 - ERROR : SnapId + attribute name + STORED_READ_VALUE + NEW_VALUE (no) + STORED_WRITE_VALUE " + e);
-		}
-
-		try {
-			device_data = new DeviceData();
-			// tester un snapid + nb attrib + read value
-			device_data.insert(new String[] {"42","1","STORED_READ_VALUE","tango/tangotest/spjz_1/string_scalar"});
-			deviceProxy.command_inout("SetEquipments" , device_data);
-			device_data = null;
-		}
-		catch(Exception e){
-			System.out.println("9 - ERROR : SnapId + attribute doesn't exist " + e);
-		}
-
-		try {
-			device_data = new DeviceData();
-			// tester un snapid + nb attrib + read value
-			device_data.insert(new String[] {"blabla"});
-			deviceProxy.command_inout("SetEquipments" , device_data);
-			device_data = null;
-		}
-		catch(Exception e){
-			System.out.println("10 - ERROR : invalid SnapId " + e);
-		}*/
-
-			try {
-				device_data = new DeviceData();
-				// tester un STORED_READ_VALUE
-				device_data.insert(new String[] {"42","STORED_READ_VALUE"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				System.out.println("1 - SnapId + STORED_READ_VALUE done");
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("SnapId + STORED_READ_VALUE  " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un STORED_WRITE_VALUE
-				device_data.insert(new String[] {"42","STORED_WRITE_VALUE"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				System.out.println("2 - SnapId + STORED_WRITE_VALUE done");
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("SnapId + STORED_WRITE_VALUE  " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + value
-				device_data.insert(new String[] {"42","1","NEW_VALUE","tango/tangotest/spjz_1/long_scalar","50" });
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				System.out.println("3 - SnapId + attribute name + NEW_VALUE done");
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("SnapId + Nb Attribut + good value " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + value
-				device_data.insert(new String[] {"42","1","STORED_WRITE_VALUE","tango/tangotest/spjz_1/long_scalar" });
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				device_data = null;
-				System.out.println("4 - SnapId + attribute name + STORED_WRITE_VALUE done");
-			}
-			catch(Exception e){
-				System.out.println("SnapId + Nb Attribut + write " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + read value
-				device_data.insert(new String[] {"42","1","STORED_READ_VALUE","tango/tangotest/spjz_1/long_scalar" });
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				System.out.println("5 - SnapId + attribute name + STORED_READ_VALUE done");
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("SnapId + Nb Attribut + read value " + e);
-			}
-
-			try {
-				device_data = new DeviceData();
-				// tester un snapid + nb attrib + read value
-				device_data.insert(new String[] {"42","3","STORED_READ_VALUE","tango/tangotest/spjz_1/long_scalar",
-						"NEW_VALUE","tango/tangotest/spjz_1/long_scalar_w","500",
-						"STORED_WRITE_VALUE","tango/tangotest/spjz_1/short_scalar"});
-				deviceProxy.command_inout("SetEquipments" , device_data);
-				System.out.println("6 - SnapId + attribute name + STORED_READ_VALUE + NEW_VALUE + STORED_WRITE_VALUE done");
-				device_data = null;
-			}
-			catch(Exception e){
-				System.out.println("SnapId + Nb Attribut + read value " + e);
-			}
-		}
-		catch(Exception e)
-		{
-			System.out.println("Error in DeviceProxy SnapManager");
-			e.printStackTrace();
-		}
+@Ignore
+public class SnapManagerTest {
+
+    @Test
+    public void testSet_equipments() {
+	try {
+	    DeviceProxy deviceProxy = new DeviceProxy("archiving/snap/snapmanager.1");
+	    DeviceData device_data = null;
+
+	    /*
+	     * try { device_data = new DeviceData(); // tester une chaine vide
+	     * ==> Une exception doit-�tre lev�e device_data.insert(new String[]
+	     * {}); deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("1 - ERROR : argin vide " + e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid
+	     * uniquement ==> Une exception doit-�tre lev�e
+	     * device_data.insert(new String[] {"12"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("2 - ERROR : SnapId only  " + e); }
+	     * 
+	     * try { // AUCUNE erreur de remont�e dans ce cas l� device_data =
+	     * new DeviceData(); // tester un snapid invalide
+	     * device_data.insert(new String[] {"100","STORED_READ_VALUE"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("3 - ERROR : SnapId n'existe pas" + e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester une chaine
+	     * invalide device_data.insert(new String[]
+	     * {"40","STORED_READ_VALUEXXXX"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("4 - ERROR : param�tre stored_read invalide "
+	     * + e); } try { device_data = new DeviceData(); // tester un snapid
+	     * + nb attrib uniquement ==> Une exception doit-�tre lev�e
+	     * device_data.insert(new String[] {"42","4"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("5 - ERROR : SnapId + Nb Attribut uniquement "
+	     * + e); }
+	     * 
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid + nb
+	     * attrib + invalid value ==> Une exception doit-�tre lev�e
+	     * device_data.insert(new String[]
+	     * {"42","1","NEW_VALUE","tango/tangotest/spjz_1/long_scalar"
+	     * ,"chaine" }); deviceProxy.command_inout("SetEquipments" ,
+	     * device_data); device_data = null; } catch(Exception e){
+	     * System.out
+	     * .println("6 - ERROR : SnapId + Nb Attribut + invalid new value "
+	     * + e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid + nb
+	     * attrib + read value device_data.insert(new String[]
+	     * {"42","1","STORED_READ_VALUECCCC"
+	     * ,"tango/tangotest/spjz_1/long_scalar" });
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){System.out.println(
+	     * "7 - ERROR : SnapId + Nb Attribut + value stored_read value " +
+	     * e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid + nb
+	     * attrib + read value device_data.insert(new String[]
+	     * {"42","3","STORED_READ_VALUE"
+	     * ,"tango/tangotest/spjz_1/long_scalar",
+	     * "NEW_VALUE","tango/tangotest/spjz_1/long_scalar_w",
+	     * "STORED_WRITE_VALUE","tango/tangotest/spjz_1/short_scalar"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){System.out.println(
+	     * "8 - ERROR : SnapId + attribute name + STORED_READ_VALUE + NEW_VALUE (no) + STORED_WRITE_VALUE "
+	     * + e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid + nb
+	     * attrib + read value device_data.insert(new String[]
+	     * {"42","1","STORED_READ_VALUE"
+	     * ,"tango/tangotest/spjz_1/string_scalar"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("9 - ERROR : SnapId + attribute doesn't exist "
+	     * + e); }
+	     * 
+	     * try { device_data = new DeviceData(); // tester un snapid + nb
+	     * attrib + read value device_data.insert(new String[] {"blabla"});
+	     * deviceProxy.command_inout("SetEquipments" , device_data);
+	     * device_data = null; } catch(Exception e){
+	     * System.out.println("10 - ERROR : invalid SnapId " + e); }
+	     */
+
+	    try {
+		device_data = new DeviceData();
+		// tester un STORED_READ_VALUE
+		device_data.insert(new String[] { "42", "STORED_READ_VALUE" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		System.out.println("1 - SnapId + STORED_READ_VALUE done");
+		device_data = null;
+	    } catch (Exception e) {
+		System.out.println("SnapId + STORED_READ_VALUE  " + e);
+	    }
+
+	    try {
+		device_data = new DeviceData();
+		// tester un STORED_WRITE_VALUE
+		device_data.insert(new String[] { "42", "STORED_WRITE_VALUE" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		System.out.println("2 - SnapId + STORED_WRITE_VALUE done");
+		device_data = null;
+	    } catch (Exception e) {
+		System.out.println("SnapId + STORED_WRITE_VALUE  " + e);
+	    }
+
+	    try {
+		device_data = new DeviceData();
+		// tester un snapid + nb attrib + value
+		device_data.insert(new String[] { "42", "1", "NEW_VALUE", "tango/tangotest/spjz_1/long_scalar", "50" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		System.out.println("3 - SnapId + attribute name + NEW_VALUE done");
+		device_data = null;
+	    } catch (Exception e) {
+		System.out.println("SnapId + Nb Attribut + good value " + e);
+	    }
+
+	    try {
+		device_data = new DeviceData();
+		// tester un snapid + nb attrib + value
+		device_data
+			.insert(new String[] { "42", "1", "STORED_WRITE_VALUE", "tango/tangotest/spjz_1/long_scalar" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		device_data = null;
+		System.out.println("4 - SnapId + attribute name + STORED_WRITE_VALUE done");
+	    } catch (Exception e) {
+		System.out.println("SnapId + Nb Attribut + write " + e);
+	    }
+
+	    try {
+		device_data = new DeviceData();
+		// tester un snapid + nb attrib + read value
+		device_data
+			.insert(new String[] { "42", "1", "STORED_READ_VALUE", "tango/tangotest/spjz_1/long_scalar" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		System.out.println("5 - SnapId + attribute name + STORED_READ_VALUE done");
+		device_data = null;
+	    } catch (Exception e) {
+		System.out.println("SnapId + Nb Attribut + read value " + e);
+	    }
+
+	    try {
+		device_data = new DeviceData();
+		// tester un snapid + nb attrib + read value
+		device_data.insert(new String[] { "42", "3", "STORED_READ_VALUE", "tango/tangotest/spjz_1/long_scalar",
+			"NEW_VALUE", "tango/tangotest/spjz_1/long_scalar_w", "500", "STORED_WRITE_VALUE",
+			"tango/tangotest/spjz_1/short_scalar" });
+		deviceProxy.command_inout("SetEquipments", device_data);
+		System.out
+			.println("6 - SnapId + attribute name + STORED_READ_VALUE + NEW_VALUE + STORED_WRITE_VALUE done");
+		device_data = null;
+	    } catch (Exception e) {
+		System.out.println("SnapId + Nb Attribut + read value " + e);
+	    }
+	} catch (Exception e) {
+	    System.out.println("Error in DeviceProxy SnapManager");
+	    e.printStackTrace();
 	}
+    }
 
 }
-- 
GitLab