diff --git a/trunk/pom.xml b/trunk/pom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9e9bc878ddc7786283a9c0dab7b5814f7a069468
--- /dev/null
+++ b/trunk/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>super-pom-java</artifactId>
+    <groupId>fr.soleil</groupId>
+    <version>RELEASE</version>
+  </parent>
+  <groupId>fr.soleil.deviceservers</groupId>
+  <artifactId>snapArchivingServers</artifactId>
+  <version>1.7.7</version>
+  <name>snapArchivingServers</name>
+  <developers>
+    <developer>
+      <id>girardot</id>
+      <name>Raphaël GIRARDOT</name>
+      <email>raphael.girardot@synchrotron-soleil.fr</email>
+      <organization>Synchrotron Soleil</organization>
+      <organizationUrl>http://www.synchrotron-soleil.fr</organizationUrl>
+      <roles>
+        <role>Java Developer</role>
+      </roles>
+      <timezone>1</timezone>
+    </developer>
+  </developers>
+  <scm>
+    <connection>${scm.connection.svn.tango-cs}:archiving/server/snapArchivingServers</connection>
+    <developerConnection>${scm.developerConnection.svn.tango-cs}:archiving/server/snapArchivingServers</developerConnection>
+    <url>${scm.url.svn.tango-cs}/archiving/server/snapArchivingServers/</url>
+  </scm>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>fr.soleil.maven.plugins</groupId>
+        <artifactId>maven-script-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>install</id>
+            <phase>install</phase>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.tango</groupId>
+      <artifactId>TangORB</artifactId>
+       
+    </dependency>
+    <dependency>
+      <groupId>fr.soleil.lib</groupId>
+      <artifactId>snapArchivingApi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.tango</groupId>
+      <artifactId>JTangoClientLang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+     <dependency>
+      <groupId>org.tango</groupId>
+      <artifactId>JTangoServer</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/trunk/src/main/java/SnapArchiver/CreateNewContextCmd.java b/trunk/src/main/java/SnapArchiver/CreateNewContextCmd.java
new file mode 100644
index 0000000000000000000000000000000000000000..b0d81b9213d4f77a929c50b725b55e0ab437bbc4
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/CreateNewContextCmd.java
@@ -0,0 +1,152 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/CreateNewContextCmd.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapArchiver class.
+//
+// $Author: chinkumo $
+//
+// $Revision: 1.5 $
+//
+// $Log: CreateNewContextCmd.java,v $
+// Revision 1.5  2005/11/29 17:33:03  chinkumo
+// no message
+//
+// Revision 1.4.10.2  2005/11/29 16:16:50  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.4.10.1  2005/11/15 13:46:17  chinkumo
+// ...
+//
+// Revision 1.4  2005/06/15 14:02:53  chinkumo
+// The device was regenerated in Tango V5.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author: chinkumo $
+ * @version	$Revision: 1.5 $
+ */
+package SnapArchiver;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command is used to register a snapShot context. All
+ * informations concerning the snapshot
+ * (fr.soleil.archiving.snap.api.tools.SnapContext) are passed through an array
+ * (DEVVAR_STRINGARRAY).
+ */
+
+public class CreateNewContextCmd extends Command implements TangoConst {
+    // ===============================================================
+    /**
+     * Constructor for Command class CreateNewContextCmd
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param out
+     *            argout type
+     */
+    // ===============================================================
+    public CreateNewContextCmd(String name, int in, int out) {
+        super(name, in, out);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class CreateNewContextCmd
+     * 
+     * @param name
+     *            command name
+     * @param in
+     *            argin type
+     * @param in_comments
+     *            argin description
+     * @param out
+     *            argout type
+     * @param out_comments
+     *            argout description
+     */
+    // ===============================================================
+    public CreateNewContextCmd(String name, int in, int out, String in_comments, String out_comments) {
+        super(name, in, out, in_comments, out_comments);
+    }
+
+    // ===============================================================
+    /**
+     * Constructor for Command class CreateNewContextCmd
+     * 
+     * @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 CreateNewContextCmd(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.
+     */
+    // ===============================================================
+    @Override
+    public Any execute(DeviceImpl device, Any in_any) throws DevFailed {
+        Util.out2.println("CreateNewContextCmd.execute(): arrived");
+        String[] argin = extract_DevVarStringArray(in_any);
+        ((SnapArchiver) (device)).create_new_context(argin);
+        return insert();
+    }
+
+    // ===============================================================
+    /**
+     * 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;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/CreateNewContextCmd
+ * .java,v $
+ */
diff --git a/trunk/src/main/java/SnapArchiver/README b/trunk/src/main/java/SnapArchiver/README
new file mode 100644
index 0000000000000000000000000000000000000000..c9714640759d3b66c6cb002e0b5c5a75ca6a977e
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/README
@@ -0,0 +1,35 @@
+//-============================================================
+//
+//         This class has been generated by POGO
+//      (Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================
+
+
+Files generated:
+===============
+SnapArchiver.java:
+	Source code for the SnapArchiver class and its commands.
+	This class is derived from DeviceImpl class.
+	It represents the CORBA servant obbject which
+	will be accessed from the network.
+	All commands which can be executed on the
+	SnapArchiver are implemented in this file.
+
+SnapArchiverClass.java:
+	This class is a singleton class and implements everything
+	which exists only once for all the  SnapArchiver object
+	It inherits from the DeviceClass class.
+LaunchSnapShotCmd.java:
+	Java source code for the command LaunchSnapShot
+	This command is used to trigger a snapShot.
+All informations concerning the snapshot will be retrieved with the identifier parameter.
+
+
+CreateNewContextCmd.java:
+	Java source code for the command CreateNewContext
+	This command is used to register a snapShot context.
+All informations concerning the snapshot
+(fr.soleil.TangoSnap.SnapTools.Tools.SnapContext) are passed through an array (DEVVAR_STRINGARRAY).
+
diff --git a/trunk/src/main/java/SnapArchiver/SnapArchiver.java b/trunk/src/main/java/SnapArchiver/SnapArchiver.java
new file mode 100644
index 0000000000000000000000000000000000000000..050289a729356b595abb742bdec9ff225316a6d8
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/SnapArchiver.java
@@ -0,0 +1,523 @@
+// +============================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/SnapArchiver.java,v $
+//
+// project :     Tango Device Server
+//
+// Description: java source code for the SnapArchiver class and its commands.
+//              This class is derived from DeviceImpl class.
+//              It represents the CORBA servant obbject which
+//              will be accessed from the network. All commands which
+//              can be executed on the SnapArchiver are implemented
+//              in this file.
+//
+// $Author: pierrejoseph $
+//
+// $Revision: 1.18 $
+//
+// $Log: SnapArchiver.java,v $
+// Revision 1.18  2007/05/11 13:58:53  pierrejoseph
+// Attribute addition : release version
+//
+// Revision 1.17  2007/04/25 12:19:51  ounsy
+// *** empty log message ***
+//
+// Revision 1.16  2007/04/06 09:40:39  ounsy
+// refactoring
+//
+// Revision 1.15  2007/04/05 09:54:17  ounsy
+// added the beansFileName property
+//
+// Revision 1.14  2007/04/04 13:45:30  ounsy
+// new LaunchSnapShot command management
+//
+// Revision 1.13.2.3  2007/03/27 09:25:18  ounsy
+// removed logs
+//
+// Revision 1.13.2.2  2007/03/14 15:47:32  ounsy
+// new LaunchSnapShot implementation
+//
+// Revision 1.13.2.1  2007/03/05 10:14:15  ounsy
+// test branche
+//
+// Revision 1.13  2007/03/02 07:54:57  ounsy
+// extend DeviceImpl instead of DeviceImplWithShutdownRunnable
+//
+// Revision 1.12  2006/11/20 09:38:54  ounsy
+// minor changes
+//
+// Revision 1.11  2006/11/13 15:58:06  ounsy
+// all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl
+//
+// Revision 1.10  2006/06/15 08:41:17  ounsy
+// minor changes
+//
+// Revision 1.9  2006/04/12 15:45:41  ounsy
+// corrected the missing attributes problem
+//
+// Revision 1.8  2006/03/27 13:57:18  ounsy
+// organized imports
+//
+// Revision 1.7  2005/11/29 17:33:03  chinkumo
+// no message
+//
+// Revision 1.6.2.2  2005/11/29 16:16:50  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.6.2.1  2005/11/15 13:46:17  chinkumo
+// ...
+//
+// Revision 1.6  2005/08/19 14:03:47  chinkumo
+// no message
+//
+// Revision 1.5  2005/06/28 09:10:11  chinkumo
+// Changes made to improve the management of exceptions were reported here.
+//
+// Revision 1.4  2005/06/15 14:02:53  chinkumo
+// The device was regenerated in Tango V5.
+//
+// Revision 1.3  2005/01/26 17:03:59  chinkumo
+// Ultimate synchronization before real sharing.
+//
+// Revision 1.2  2004/12/06 17:30:44  chinkumo
+// Renaming package 'TangoSnap' into 'TangoSnapshoting'
+//
+//
+// copyleft :   European Synchrotron Radiation Facility
+//              BP 220, Grenoble 38043
+//              FRANCE
+//
+//-============================================================================
+//
+//          This file is generated by POGO
+//  (Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapArchiver;
+
+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;
+import fr.esrf.Tango.DevState;
+import fr.esrf.TangoApi.DbDatum;
+import fr.esrf.TangoApi.DbDevice;
+import fr.esrf.TangoDs.Attribute;
+import fr.esrf.TangoDs.DeviceClass;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+import fr.soleil.actiongroup.collectiveaction.onattributes.UsePlugin;
+import fr.soleil.archiving.snap.api.ConfigConst;
+import fr.soleil.archiving.snap.api.SnapConnectionParameters;
+import fr.soleil.archiving.snap.api.manager.SnapManagerApi;
+import fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManager;
+import fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManagerFactory;
+import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract;
+import fr.soleil.archiving.snap.api.tools.SnapContext;
+import fr.soleil.archiving.snap.api.tools.SnapShot;
+import fr.soleil.archiving.snap.api.tools.SnapshotingException;
+
+/**
+ * Class Description: Device of Snapshoting system
+ * 
+ * @author $Author: pierrejoseph $
+ * @version $Revision: 1.18 $
+ */
+
+// --------- Start of States Description ----------
+/*
+ * Device States Description:
+ */
+// --------- End of States Description ----------
+public class SnapArchiver extends DeviceImpl
+/* WithShutdownRunnable */implements TangoConst {
+    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<Integer, Future<Integer>> snapshotResults = new HashMap<Integer, Future<Integer>>();
+    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());
+        }
+    }
+
+    // ===================================================================
+    /**
+     * 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 = "";
+
+        DbDevice device = get_db_device();
+        try {
+            SnapConnectionParameters.performSnapInit(device, true, true);
+
+            dbHost = SnapConnectionParameters.getSnapHost();
+            dbName = SnapConnectionParameters.getSnapName();
+            dbSchema = SnapConnectionParameters.getSnapSchema();
+            dbUser = SnapConnectionParameters.getSnapUser();
+            dbPassword = SnapConnectionParameters.getSnapPassword();
+            isRac = SnapConnectionParameters.getSnapRac();
+
+            SnapConnectionParameters.printSnapConnectionInfoLog();
+
+        } catch (SnapshotingException e) {
+            e.printStackTrace();
+        }
+
+        // Read device properties from database.(Automatic code generation)
+        // -------------------------------------------------------------
+        if (Util._UseDb == false) {
+            return;
+        }
+
+        String[] propnames = { "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 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();
+            }
+        }
+    }
+
+    // =========================================================
+    /**
+     * 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(int 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<Integer> snapshotResult = executorService.submit(new SnapshotTask(argin));
+        snapshotResults.put(argin, snapshotResult);
+
+    }
+
+    /**
+     * Command
+     * 
+     * @param argin
+     *            the context ID
+     * @return
+     * @throws DevFailed
+     */
+    public int getSnapShotResult(int argin) throws DevFailed {
+        int result = -1;
+        try {
+            Future<Integer> 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;
+    }
+
+    private class SnapshotTask implements Callable<Integer> {
+        private final int contextID;
+
+        public SnapshotTask(int contextID) {
+            this.contextID = contextID;
+        }
+
+        @Override
+        public Integer call() throws Exception {
+            int snapId = -1;
+
+            try {
+                SnapShot snapShot = SnapManagerApi.registerSnapShot(contextID);
+                if (snapShot == null) {
+                    Except.throw_exception("INPUT_ERROR", "Invalid Context ID", "SnapArchiver.TriggerLaunchSnapshot");
+                }
+                snapId = 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;
+        }
+
+    }
+
+    // =========================================================
+    /**
+     * Execute command "CreateNewContext" on device. This command is used to
+     * register a snapShot context. All informations concerning the snapshot
+     * (fr.soleil.archiving.snap.api.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);
+        }
+    }
+
+    // =========================================================
+    /**
+     * 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 {
+
+        snapshotResults.clear();
+
+    }
+}
+
+// --------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/SnapArchiver.java,v
+ * $
+ */
diff --git a/trunk/src/main/java/SnapArchiver/SnapArchiverClass.java b/trunk/src/main/java/SnapArchiver/SnapArchiverClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..361630de328f4a4a0e7aeeb179b8c6b910f4f1fe
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/SnapArchiverClass.java
@@ -0,0 +1,332 @@
+// +======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapArchiver/SnapArchiverClass.java,v $
+//
+// Project:   	Tango Device Server
+//
+// Description:	java source code for the SnapArchiver class .
+//              This class is a singleton class and implements everything
+//              which exists only once for all the  SnapArchiver object
+//              It inherits from the DeviceClass class.
+//
+// $Author: pierrejoseph $
+//
+// $Revision: 1.10 $
+//
+// $Log: SnapArchiverClass.java,v $
+// Revision 1.10  2007/05/11 13:58:53  pierrejoseph
+// Attribute addition : release version
+//
+// Revision 1.9  2007/04/04 13:45:29  ounsy
+// new LaunchSnapShot command management
+//
+// Revision 1.8.2.1  2007/03/14 15:47:32  ounsy
+// new LaunchSnapShot implementation
+//
+// Revision 1.8  2006/04/12 15:46:40  ounsy
+// corrected the missing attributes problem
+//
+// Revision 1.7  2006/03/27 13:57:34  ounsy
+// organized imports
+//
+// Revision 1.6  2005/11/29 17:33:03  chinkumo
+// no message
+//
+// Revision 1.5.2.2  2005/11/29 16:16:50  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.5.2.1  2005/11/15 13:46:17  chinkumo
+// ...
+//
+// Revision 1.5  2005/08/19 14:03:47  chinkumo
+// no message
+//
+// Revision 1.4  2005/06/15 14:02:53  chinkumo
+// The device was regenerated in Tango V5.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapArchiver;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import fr.esrf.Tango.AttrWriteType;
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoApi.DbDatum;
+import fr.esrf.TangoDs.Attr;
+import fr.esrf.TangoDs.DeviceClass;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TemplCommandInOut;
+import fr.esrf.TangoDs.Util;
+
+public class SnapArchiverClass extends DeviceClass implements TangoConst {
+    /**
+     * SnapArchiverClass class instance (it is a singleton).
+     */
+    private static SnapArchiverClass _instance = null;
+
+    /**
+     * Class properties array.
+     */
+    // private final DbDatum[] cl_prop = null;
+
+    // //--------- Start of properties data members ----------
+    //
+    // /**
+    // * Computer identifier on wich is settled the database HDB. The identifier
+    // can be the computer name or its IP address. <br> <b>Default value : </b>
+    // localhost.
+    // */
+    // String dbHost;
+    // /**
+    // * Database name.<br> <b>Default value : </b> hdb
+    // */
+    // String dbName;
+    // /**
+    // * 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 : 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);
+
+        Util.out2.println("Entering SnapArchiverClass constructor");
+        // write_class_property();
+        get_class_property();
+
+        Util.out2.println("Leaving SnapArchiverClass constructor");
+    }
+
+    // =============================================================================
+    //
+    // 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
+    // ===================================================================
+    @Override
+    public void command_factory() {
+        command_list.addElement(new TriggerLaunchSnapShotCmd("TriggerLaunchSnapShot", Tango_DEV_LONG, 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 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
+    //
+    // ===================================================================
+    @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 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]);
+            }
+        }
+    }
+
+    // ===================================================================
+    /**
+     * 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)
+        // 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
+        // //-------------------------------------------------------------
+
+    }
+
+    // ===================================================================
+    /**
+     * Set class description as property in database
+     */
+    // ===================================================================
+//    private void write_class_property() throws DevFailed {
+//	// First time, check if database used
+//	// --------------------------------------------
+//	if (Util._UseDb == false) {
+//	    return;
+//	}
+//
+//	// Prepeare DbDatum
+//	// --------------------------------------------
+//	DbDatum[] data = new DbDatum[2];
+//	data[0] = new DbDatum("ProjectTitle");
+//	data[0].insert("Tango Device Server");
+//
+//	data[1] = new DbDatum("Description");
+//	data[1].insert("Device of Snapshoting system");
+//
+//	// Call database and and values
+//	// --------------------------------------------
+//	get_db_class().put_property(data);
+//    }
+
+}
diff --git a/trunk/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java b/trunk/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java
new file mode 100644
index 0000000000000000000000000000000000000000..2330c37f633fbb4a1381ea2a63d6bf014bab11e0
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/TriggerLaunchSnapShotCmd.java
@@ -0,0 +1,47 @@
+package SnapArchiver;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+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");
+        int argin = extract_DevLong(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/trunk/src/main/java/SnapArchiver/grouplink/INamedAttribute.java b/trunk/src/main/java/SnapArchiver/grouplink/INamedAttribute.java
new file mode 100644
index 0000000000000000000000000000000000000000..3a6ed320f51e9065afc6cfb44c74c750827d5fc4
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/grouplink/INamedAttribute.java
@@ -0,0 +1,5 @@
+package SnapArchiver.grouplink;
+
+public interface INamedAttribute {
+	public String getCompleteName();
+}
diff --git a/trunk/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java b/trunk/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..b16a670fc05dc0aeffd7c75541d5068d5f31b3ea
--- /dev/null
+++ b/trunk/src/main/java/SnapArchiver/grouplink/UsePluginBuilder.java
@@ -0,0 +1,156 @@
+/*
+ * Synchrotron Soleil
+ * 
+ * File : TangoGroupForReadingAnyAttributesBuilder.java
+ * 
+ * Project : javaapi
+ * 
+ * Description :
+ * 
+ * Author : CLAISSE
+ * 
+ * Original : 17 janv. 07
+ * 
+ * Revision: Author:
+ * Date: State:
+ * 
+ * Log: TangoGroupForReadingAnyAttributesBuilder.java,v
+ */
+/*
+ * Created on 17 janv. 07
+ * 
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tango.utils.DevFailedUtils;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.TangoApi.DeviceProxy;
+import fr.soleil.actiongroup.collectiveaction.components.tangowrapping.target.Target;
+import fr.soleil.actiongroup.collectiveaction.components.tangowrapping.target.TargetFactory;
+import fr.soleil.actiongroup.collectiveaction.onattributes.UsePlugin;
+import fr.soleil.actiongroup.collectiveaction.onattributes.UsePluginImpl;
+import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.PersistencePlugin;
+import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.context.PluginContext;
+import fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManager;
+import fr.soleil.archiving.snap.api.persistence.context.SnapshotPersistenceContext;
+import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract;
+
+public class UsePluginBuilder {
+    private final Logger logger = LoggerFactory.getLogger(UsePluginBuilder.class);
+    private static final String TANGO_SEPARATOR = "/";
+    private Map<String, Integer> attributeIds;
+
+    private final int snapId;
+    private final SnapshotPersistenceManager manager;
+
+    public UsePluginBuilder(final int _snapId, final SnapshotPersistenceManager _manager) {
+        snapId = _snapId;
+        manager = _manager;
+    }
+
+    // public UsePlugin build ( List <INamedAttribute> attributeList ) throws
+    // DevFailed
+    public UsePlugin build(final List<SnapAttributeExtract> attributeList) throws DevFailed {
+        attributeIds = new HashMap<String, Integer>(attributeList.size());
+        final Map<String, Collection<String>> deviceToAttributes = new Hashtable<String, Collection<String>>();
+
+        // SORT ATTRIBUTES BY DEVICE
+        for (final SnapAttributeExtract attribute : attributeList) {
+            final String completeName = attribute.getAttributeCompleteName();
+            final String[] parsedName = parseName(completeName);
+            final int attributeId = attribute.getAttId();
+            attributeIds.put(completeName, attributeId);
+            final String deviceName = parsedName[0];
+            final String attributeName = parsedName[1];
+
+            Collection<String> attributesForThisDevice = deviceToAttributes.get(deviceName);
+            if (attributesForThisDevice == null) {
+                attributesForThisDevice = new ArrayList<String>();
+                deviceToAttributes.put(deviceName, attributesForThisDevice);
+            }
+            attributesForThisDevice.add(attributeName);
+        }
+        // traceDeviceToAttributes ( deviceToAttributes );
+
+        // BUILD THE PROXIES AND ATTRIBUTES LIST
+        final Target[] devices = new Target[deviceToAttributes.size()];
+
+        final String[][] attributes = new String[deviceToAttributes.size()][];
+        final Iterator<String> it2 = deviceToAttributes.keySet().iterator();
+        int i = 0;
+
+        while (it2.hasNext()) {
+            final String nextDevice = it2.next();
+            try {
+                final DeviceProxy proxy = new DeviceProxy(nextDevice);
+                devices[i] = TargetFactory.getTarget(proxy);
+                final Collection<String> attributesForThisDevice = deviceToAttributes.get(nextDevice);
+                logger.debug("snapshoting {}/{}", nextDevice, attributesForThisDevice);
+                final Iterator<String> it3 = attributesForThisDevice.iterator();
+                attributes[i] = new String[attributesForThisDevice.size()];
+                int j = 0;
+                while (it3.hasNext()) {
+                    final String nextAttribute = it3.next();
+                    attributes[i][j] = nextAttribute;
+                    j++;
+                }
+
+                i++;
+            } catch (final DevFailed e) {
+                logger.error("error snapshoting device {}", nextDevice);
+                logger.error("error msg = {}", DevFailedUtils.toString(e));
+            } catch (final Exception e) {
+                logger.error("error snapshoting device {}", nextDevice);
+                logger.error("error", e);
+            }
+
+        }
+
+        final UsePlugin ret = new UsePluginImpl(devices, attributes, new PersistencePlugin());
+        logger.debug("launching snap ID {}", snapId);
+        final SnapshotPersistenceContext persistenceContext = new SnapshotPersistenceContext(snapId, attributeIds);
+        persistenceContext.setManager(manager);
+        final PluginContext context = new PluginContext();
+        context.setPersistenceContext(persistenceContext);
+        ret.setPluginContext(context);
+
+        return ret;
+    }
+
+    private String[] parseName(final String completeName) {
+        final String[] ret = new String[2];
+        final StringTokenizer st = new StringTokenizer(completeName, TANGO_SEPARATOR);
+        final StringBuilder buff = new StringBuilder();
+
+        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 attributeIds;
+    }
+}
diff --git a/trunk/src/main/java/SnapExtractor/SnapExtractor.java b/trunk/src/main/java/SnapExtractor/SnapExtractor.java
new file mode 100644
index 0000000000000000000000000000000000000000..16d4b401ec55cab6d354a526143f259d16467f1b
--- /dev/null
+++ b/trunk/src/main/java/SnapExtractor/SnapExtractor.java
@@ -0,0 +1,1202 @@
+// +============================================================================
+//$Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/SnapExtractor.java,v $
+
+//project :     Tango Device Server
+
+//Description:	java source code for the SnapExtractor class and its commands.
+//This class is derived from DeviceImpl class.
+//It represents the CORBA servant obbject which
+//will be accessed from the network. All commands which
+//can be executed on the SnapExtractor are implemented
+//in this file.
+
+//$Author: soleilarc $
+
+//$Revision: 1.16 $
+
+//$Log: SnapExtractor.java,v $
+//Revision 1.16  2007/10/15 15:14:53  soleilarc
+//Author: XP
+//Mantis bug ID: 6256
+//Comment:
+//In the init_device method, put the call to get_device_property method at the beginning.
+//In the get_device_property method, the values of the table propnames must be �DbUser� and �DbPassword�, instead of �SnapUser� and �SnapPassword�.
+
+//Revision 1.15  2007/05/11 13:58:55  pierrejoseph
+//Attribute addition : release version
+
+//Revision 1.14  2007/03/14 15:47:01  ounsy
+//passes its user and password to the APIs
+
+//Revision 1.13  2007/03/02 07:54:57  ounsy
+//extend DeviceImpl instead of DeviceImplWithShutdownRunnable
+
+//Revision 1.12  2006/12/06 10:16:02  ounsy
+//minor changes
+
+//Revision 1.11  2006/11/20 09:38:54  ounsy
+//minor changes
+
+//Revision 1.10  2006/11/13 15:58:06  ounsy
+//all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl
+
+//Revision 1.9  2006/10/31 16:54:15  ounsy
+//milliseconds and null values management
+
+//Revision 1.8  2006/04/12 15:47:03  ounsy
+//organized imports
+
+//Revision 1.7  2006/04/12 08:40:35  ounsy
+//cleaned the code and added a better error logging
+
+//Revision 1.6  2006/03/29 11:35:12  ounsy
+//small modification of the remove_dyn_attrs method so that in case the removal of an attribute fails, the others are still removed
+
+//Revision 1.5  2006/03/27 13:58:18  ounsy
+//added the commands removeAllDynAttr et removeDynAttrs
+
+//Revision 1.4  2006/03/14 13:05:16  ounsy
+//corrected the SNAP/spectrums/RW problem
+//about the read and write values having the same length
+
+//Revision 1.3  2006/03/08 16:31:13  ounsy
+//added the global POGO class comments for the devices SnapExtractor
+
+//Revision 1.2  2006/03/08 14:36:42  ounsy
+//added pogo comments
+
+//Revision 1.1  2006/02/07 13:03:52  ounsy
+//moved from the Archiving package
+
+//Revision 1.2  2006/02/06 13:11:20  ounsy
+//corrected a bug for WO attributes
+
+//Revision 1.1  2006/01/27 14:39:14  ounsy
+//new device for snap extracting
+
+//copyleft :   European Synchrotron Radiation Facility
+//BP 220, Grenoble 38043
+//FRANCE
+
+//-============================================================================
+
+//This file is generated by POGO
+//(Program Obviously used to Generate tango Object)
+
+//(c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapExtractor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tango.server.InvocationContext;
+import org.tango.server.ServerManager;
+import org.tango.server.annotation.AroundInvoke;
+import org.tango.server.annotation.Attribute;
+import org.tango.server.annotation.AttributeProperties;
+import org.tango.server.annotation.Command;
+import org.tango.server.annotation.Delete;
+import org.tango.server.annotation.Device;
+import org.tango.server.annotation.DeviceProperty;
+import org.tango.server.annotation.DynamicManagement;
+import org.tango.server.annotation.Init;
+import org.tango.server.annotation.State;
+import org.tango.server.annotation.Status;
+import org.tango.server.attribute.AttributeConfiguration;
+import org.tango.server.attribute.AttributeValue;
+import org.tango.server.attribute.IAttributeBehavior;
+import org.tango.server.attribute.ReflectAttributeBehavior;
+import org.tango.server.dynamic.DynamicManager;
+import org.tango.utils.DevFailedUtils;
+
+import fr.esrf.Tango.AttrDataFormat;
+import fr.esrf.Tango.AttrWriteType;
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DevState;
+import fr.esrf.Tango.DevVarLongStringArray;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.TimedAttrData;
+import fr.esrf.TangoDs.Util;
+
+import fr.soleil.archiving.common.api.tools.DbData;
+import fr.soleil.archiving.snap.api.SnapConnectionParameters;
+import fr.soleil.archiving.snap.api.extractor.convert.ConverterFactory;
+import fr.soleil.archiving.snap.api.extractor.convert.IConverter;
+import fr.soleil.archiving.snap.api.extractor.datasources.db.ISnapReader;
+import fr.soleil.archiving.snap.api.extractor.datasources.db.SnapReaderFactory;
+import fr.soleil.archiving.snap.api.extractor.devicelink.Warnable;
+import fr.soleil.archiving.snap.api.extractor.naming.DynamicAttributeNamerFactory;
+import fr.soleil.archiving.snap.api.extractor.naming.IDynamicAttributeNamer;
+import fr.soleil.archiving.snap.api.extractor.tools.Tools;
+import fr.soleil.archiving.snap.api.manager.SnapManagerApi;
+import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract;
+import fr.soleil.archiving.snap.api.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 $
+ */
+
+// --------- Start of States Description ----------
+/*
+ * Device States Description: DevState.ON : DevState.OFF : DevState.INIT :
+ * DevState.FAULT : DevState.EXTRACT : DevState.UNKNOWN :
+ */
+// --------- End of States Description ----------
+
+@Device
+public class SnapExtractor implements TangoConst {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(SnapExtractor.class);
+
+    @DynamicManagement
+    private DynamicManager dynMngt;
+
+    public DynamicManager getDynMngt() {
+        return dynMngt;
+    }
+
+    public void setDynMngt(final DynamicManager dynMngt) {
+        this.dynMngt = dynMngt;
+    }
+
+    @Attribute(name = "version", displayLevel = DispLevel._EXPERT)
+    @AttributeProperties(description = "The version of the device", label = "version", unit = "")
+    private String version = "unknown";
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = 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
+     */
+    @DeviceProperty(name = "dbUser", description = "", defaultValue = "")
+    private String dbUser;
+
+    public String getDbUser() {
+        return dbUser;
+    }
+
+    public void setDbUser(final String dbUser) {
+        this.dbUser = dbUser;
+    }
+
+    /**
+     * Password used to connect the database SNAP. <br>
+     * <b>Default value : </b> snap
+     */
+    @DeviceProperty(name = "dbPassword", description = "", defaultValue = "")
+    private String dbPassword;
+
+    // --------- End of properties data members ----------
+
+    public String getDbPassword() {
+        return dbPassword;
+    }
+
+    public void setDbPassword(final String dbPassword) {
+        this.dbPassword = dbPassword;
+    }
+
+    // Add your own data members here
+    protected int formerState = DevState._UNKNOWN;
+
+    @DeviceProperty(name = "dbHost", description = "", defaultValue = "")
+    private String dbHost;
+
+    public String getDbHost() {
+        return dbHost;
+    }
+
+    public void setDbHost(final String dbHost) {
+        this.dbHost = dbHost;
+    }
+
+    @DeviceProperty(name = "dbName", description = "", defaultValue = "")
+    private String dbName;
+
+    public String getDbName() {
+        return dbName;
+    }
+
+    public void setDbName(final String dbName) {
+        this.dbName = dbName;
+    }
+
+    @DeviceProperty(name = "dbName", description = "", defaultValue = "")
+    private String dbSchema;
+
+    public String getDbSchema() {
+        return dbSchema;
+    }
+
+    public void setDbSchema(final String dbSchema) {
+        this.dbSchema = dbSchema;
+    }
+
+    @DeviceProperty(name = "isRac", description = "", defaultValue = "")
+    private String isRac;
+
+    public String getIsRac() {
+        return isRac;
+    }
+
+    public void setIsRac(final String isRac) {
+        this.isRac = isRac;
+    }
+
+    private ISnapReader snapReader;
+
+    /**
+     * The state of the device
+     */
+    @State
+    private DevState state = DevState.UNKNOWN;
+
+    /**
+     * Execute command "State".
+     * description: This command gets the device state (stored in its 'state' data member) and returns it to the caller.
+     * 
+     * @return Device state
+     * @throws DevFailed if command execution failed.
+     */
+    public final DevState getState() throws DevFailed {
+        /*----- PROTECTED REGION ID(AlarmArchiver.getState) ENABLED START -----*/
+
+        // Put state code here
+
+        state = DevState.FAULT;
+
+        return state;
+    }
+
+    /**
+     * Set the device state
+     * 
+     * @param state the new device state
+     */
+    public void setState(final DevState state) {
+        this.state = state;
+
+    }
+
+    /**
+     * The status of the device
+     */
+    @Status
+    private String status = "Server is starting. The device state is unknown";
+
+    private String device_name;
+
+    /**
+     * Execute command "Status".
+     * description: This command gets the device status (stored in its 'status' data member) and returns it to the
+     * caller.
+     * 
+     * @return Device status
+     * @throws DevFailed if command execution failed.
+     */
+    public final String getStatus() throws DevFailed {
+
+        return status;
+    }
+
+    /**
+     * Set the device status
+     * 
+     * @param status the new device status
+     */
+    public void setStatus(final String status) {
+        this.status = status;
+    }
+
+    // =========================================================
+    /**
+     * Initialize the device.
+     */
+    // =========================================================
+
+    @Init(lazyLoading = true)
+    public void init_device() throws DevFailed {
+        device_name = "1";
+        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, dbUser, dbPassword, isRac);
+            snapReader = SnapReaderFactory.getImpl(SnapReaderFactory.REAL);
+            snapReader.openConnection();
+        } catch (SnapshotingException e) {
+            get_logger().warn(e.toString(), e);
+            throw e.toTangoException();
+        }
+
+        setState(DevState.ON);
+    }
+
+    /**
+     * all resources may be closed here. Collections may be also cleared.
+     * 
+     * @throws DevFailed if something fails during the device object delation.
+     */
+    @Delete
+    public final void deleteDevice() throws DevFailed {
+        /*----- PROTECTED REGION ID(AlarmArchiver.deleteDevice) ENABLED START -----*/
+
+        // Put your device clearing code here
+
+        /*----- PROTECTED REGION END -----*/// AlarmArchiver.deleteDevice
+
+    }
+
+    /**
+     * Method called before and after command and attribute calls.
+     * 
+     * @param ctx the invocation context
+     * @throws DevFailed if something fails during the this method execution.
+     */
+    @AroundInvoke
+    public final void aroundInvoke(final InvocationContext ctx) throws DevFailed {
+
+        /*----- PROTECTED REGION ID(AlarmArchiver.aroundInvoke) ENABLED START -----*/
+
+        // Put aroundInvoke code here
+
+        /*----- PROTECTED REGION END -----*/// AlarmArchiver.aroundInvoke
+
+    }
+
+    private Logger get_logger() {
+
+        return LOGGER;
+    }
+
+    // =========================================================
+    /**
+     * 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(final 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
+        dynMngt.removeAttribute(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(final 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 (String element : argin) {
+            try {
+                String[] obj_to_del = new String[3];
+
+                obj_to_del[0] = device_name;
+                obj_to_del[1] = "attribute";
+                obj_to_del[2] = element;
+
+                Util tg = Util.instance();
+                tg.get_dserver_device().rem_obj_polling(obj_to_del, false);
+
+                // Remove the attribute
+                dynMngt.removeAttribute(element);
+
+            } catch (Throwable t) {
+                Tools.printIfDevFailed(t);
+
+                continue;
+            }
+        }
+
+        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 ---
+
+        dynMngt.clearAttributes();
+    }
+
+    // ===================================================================
+    /**
+     * Read the device properties from database.
+     */
+    // ===================================================================
+    public void get_device_property() throws DevFailed {
+        // Initialize your default values here.
+        // ------------------------------------------
+        dbUser = "";
+        dbPassword = "";
+        dbHost = "";
+        dbName = "";
+        dbSchema = "";
+        isRac = "";
+
+        try {
+
+            SnapConnectionParameters.initFromSystemProperties();
+
+            SnapConnectionParameters.initFromClassProperties();
+
+            SnapConnectionParameters.initFromDefaultProperties();
+
+            dbHost = SnapConnectionParameters.getSnapHost();
+            dbName = SnapConnectionParameters.getSnapName();
+            dbSchema = SnapConnectionParameters.getSnapSchema();
+            dbUser = SnapConnectionParameters.getSnapUser();
+            dbPassword = SnapConnectionParameters.getSnapPassword();
+            isRac = SnapConnectionParameters.getSnapRac();
+
+            SnapConnectionParameters.printSnapConnectionInfoLog();
+
+        } catch (SnapshotingException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    // =========================================================
+    /**
+     * 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
+     */
+    // =========================================================
+
+    @Command(name = "GetSnap", inTypeDesc = "snapID", outTypeDesc = "[attrRealName, dynAttrNameW,dynAttrNameR]*n")
+    public String[] get_snap(final 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;
+            }
+        }
+        // ------------------------------------------------
+
+        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
+     */
+    // =========================================================
+    @Command(name = "GetSnapValue", inTypeDesc = "snapID and attribute name", outTypeDesc = "Attribute's Read value and Write value")
+    public String[] get_snap_value(final String[] argIn) throws DevFailed {
+
+        get_logger().info("Entering get_snap_value()");
+        int snapID = Integer.parseInt(argIn[0]);
+        String attr_name = argIn[1];
+        SnapAttributeExtract[] extraction = snapReader.getSnapValues(snapID, attr_name);
+        String[] argout = get_attribute_value(extraction[0]);
+
+        get_logger().info("Exiting get_snap_value()");
+        return argout;
+    }
+
+    @Command(name = "GetSnapValues", inTypeDesc = "snapID, true for read values or false for write values ,attribute names", outTypeDesc = "Attribute's Read value and Write value")
+    public String[] getSnapValues(final String[] argIn) throws DevFailed {
+
+        final int snapID = Integer.parseInt(argIn[0]);
+        final boolean readValues = Boolean.parseBoolean(argIn[1]);
+        final String[] attributeNames = new String[argIn.length - 2];
+
+        for (int i = 0; i < attributeNames.length - 1; i++) {
+            attributeNames[i] = argIn[i + 2];
+        }
+        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
+     */
+    // =========================================================
+    @Command(name = "GetSnapID", inTypeDesc = "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", outTypeDesc = " [id]*n")
+    public int[] get_snap_id(final String[] argIn) throws DevFailed {
+
+        get_logger().info("Entering get_snap_id()");
+
+        int ctxID = Integer.parseInt(argIn[0]);
+        String[] criterions = new String[argIn.length - 1];
+        for (int i = 1; i < criterions.length; i++) {
+            criterions[i] = argIn[i + 1];
+        }
+
+        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;
+    }
+
+    // /**
+    // *
+    // * @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].getAttributeCompleteName().equalsIgnoreCase(attr_name)) {
+    // index = i;
+    // break;
+    // }
+    // }
+    //
+    // return index;
+    // }
+
+    /**
+     * 
+     * @param snapAttributeExtract
+     * @return read_value and write_value
+     */
+
+    private String[] get_attribute_value(final 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;
+
+    }
+
+    /**
+     * 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
+     */
+    @Command(name = "GetSnapsForContext", inTypeDesc = "[ The context ID]", outTypeDesc = " [ID, Date + Comment]*n")
+    public DevVarLongStringArray get_snaps_for_context(final 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();
+        }
+        // ------------------------------------------------
+
+        get_logger().info("Exiting get_snaps_for_context()");
+        return snapshots;
+    }
+
+    /**
+     * Loads the list of contexts. 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.
+     * 
+     * 
+     * @return The contexts: [ID, Name, author name, Date, reason, description]*n
+     * @throws DevFailed
+     */
+    @Command(name = "GetAllContexts", outTypeDesc = "[ID, Name, author name, Date, reason, description]*n")
+    public DevVarLongStringArray get_all_contexts() throws DevFailed {
+        get_logger().info("Entering get_all_contexts()");
+
+        // ---Add your Own code to control device here ---
+        DevVarLongStringArray snapshots = snapReader.getAllContexts();
+        if (snapshots == null) {
+            return emptyDevVarLongStringArrayResult();
+        }
+        // ------------------------------------------------
+
+        get_logger().info("Exiting get_all_contexts()");
+        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 RESULT";
+
+        ret.lvalue = lvalue;
+        ret.svalue = svalue;
+
+        return ret;
+    }
+
+    // =========================================================
+    /**
+     * main part for the device server class
+     */
+    // =========================================================
+
+    public static void main(final String[] args) {
+        ServerManager.getInstance().start(args, SnapExtractor.class);
+        System.out.println("------- Started -------------");
+    }
+
+    private String[] add_attributes(final 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.getAttributeCompleteName();
+
+            // 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;
+        }
+
+        return argout;
+    }
+
+    /**
+     * @param currentExtract
+     * @return
+     * @throws DevFailed
+     */
+    private String[] addAttribute(final SnapAttributeExtract currentExtract) throws DevFailed {
+        if (currentExtract.getValue() == null) {
+            String message = "Null value for attribute |" + currentExtract.getAttributeCompleteName() + "|";
+            this.trace(message, Warnable.LOG_LEVEL_WARN);
+            return getErrorNames(currentExtract);
+        }
+
+        IConverter converter = ConverterFactory.getImpl(ConverterFactory.DEFAULT);
+        DbData dbData = converter.convert(currentExtract);
+        if (dbData == null) {
+            String message = "Null DbData for attribute |" + currentExtract.getAttributeCompleteName()
+                    + "| (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;
+    }
+
+    private String[] getErrorNames(final SnapAttributeExtract currentExtract) {
+        String[] errorNames = new String[2];
+        String name = currentExtract.getAttributeCompleteName();
+
+        errorNames[0] = name + "_ERROR";
+        errorNames[1] = name + "_ERROR";
+
+        return errorNames;
+    }
+
+    /**
+     * @param currentExtract
+     * @return
+     */
+    private String[] buildDynamicAttributesNames(final 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+"/");
+        }
+        id++;
+
+        names = new String[2];
+        names[0] = random_name_1;
+        names[1] = random_name_2;
+
+        return names;
+    }
+
+    private DevVarLongStringArray createDynamicAttribute(final DbData dbData /*
+                                                                             * added
+                                                                             * by CLA
+                                                                             */, final 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.getDataType() == 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.setDataType(Tango_DEV_LONG);
+            }
+
+            // Create the attribute depends on DataFormat
+            switch (dbData.getDataFormat()) {
+                case AttrDataFormat._SCALAR:
+                    AttributeConfiguration config = new AttributeConfiguration();
+                    config.setName(random_name_1);
+
+                    // dbData.getDataType()
+
+                    // config.setType(dbData.getDataType());
+                    config.setWritable(AttrWriteType.READ);
+                    IAttributeBehavior att = new ReflectAttributeBehavior(config, null, null, null);
+
+                    dynMngt.addAttribute(att);
+                    // add_attribute(new Attr(random_name_1, dbData.getDataType(), AttrWriteType.READ));
+                    if (_2value) {
+
+                        AttributeConfiguration config2 = new AttributeConfiguration();
+                        config2.setName(random_name_2);
+                        // config2.setType(dbData.getDataType());
+                        config2.setWritable(AttrWriteType.READ);
+                        IAttributeBehavior att2 = new ReflectAttributeBehavior(config2, null, null, null);
+                        dynMngt.addAttribute(att2);
+                        // add_attribute(new Attr(random_name_2, dbData.getDataType(), AttrWriteType.READ));
+                    }
+                    break;
+                case AttrDataFormat._SPECTRUM:
+                    AttributeConfiguration configSpectrum = new AttributeConfiguration();
+                    configSpectrum.setName(random_name_1);
+                    // configSpectrum.setType(dbData.getDataType());
+                    configSpectrum.setWritable(AttrWriteType.READ);
+                    IAttributeBehavior attSpectrum = new ReflectAttributeBehavior(configSpectrum, null, null, null);
+                    dynMngt.addAttribute(attSpectrum);
+                    // add_attribute(new SpectrumAttr(random_name_1, dbData.getDataType(), dbData.getMaxX()));
+                    if (_2value) {
+                        AttributeConfiguration configSpectrum2 = new AttributeConfiguration();
+                        configSpectrum2.setName(random_name_2);
+                        // configSpectrum2.setType(dbData.getMaxX());
+                        configSpectrum2.setWritable(AttrWriteType.READ);
+                        IAttributeBehavior attSpectrum2 = new ReflectAttributeBehavior(configSpectrum2, null, null,
+                                null);
+                        dynMngt.addAttribute(attSpectrum2);
+                        // add_attribute(new SpectrumAttr(random_name_2, dbData.getDataType(), dbData.getMaxX()));
+                    }
+                    break;
+                case AttrDataFormat._IMAGE:
+                    AttributeConfiguration configImage = new AttributeConfiguration();
+                    configImage.setName(random_name_1);
+                    configImage.setMaxX(dbData.getMaxX());
+                    configImage.setMaxY(dbData.getMaxY());
+
+                    // configImage.setType(dbData.getMaxX());
+
+                    IAttributeBehavior att2 = new ReflectAttributeBehavior(configImage, null, null, null);
+                    dynMngt.addAttribute(att2);
+
+                    // add_attribute(new ImageAttr(random_name_1, dbData.getDataType(), dbData.getMaxX(),
+                    // dbData.getMaxY()));
+                    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);
+
+                IAttributeBehavior attrName1 = dynMngt.getAttribute(random_name_1);
+                AttributeValue attV1 = new AttributeValue();
+                attV1.setValue(dbDatas);
+                attrName1.setValue(attV1);
+
+                IAttributeBehavior attrName2 = dynMngt.getAttribute(random_name_2);
+                AttributeValue attV2 = new AttributeValue();
+                attV2.setValue(dbDatas);
+                attrName2.setValue(attV2);
+
+            } else {
+                IAttributeBehavior attrName1 = dynMngt.getAttribute(random_name_1);
+                AttributeValue attV1 = new AttributeValue();
+                attV1.setValue(dbData);
+                attrName1.setValue(attV1);
+            }
+
+            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.getTimedData().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;
+    }
+
+    /**
+     * update x dimension to the data array length
+     * 
+     * @param data
+     */
+    private void updateWriteData(final 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.";
+    //
+    // case DevState._INIT:
+    // return "No control step has been completed yet. Please wait.";
+    //
+    // case DevState._OFF:
+    // return "This device is waiting.";
+    //
+    // case DevState._ON:
+    // return "This device is running normally.";
+    //
+    // default:
+    // return "Unknown";
+    // }
+    // }
+
+    public void trace(final String msg, final 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().error(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(final String msg, final Throwable t, final 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().error(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."));
+        }
+    }
+
+}
+// --------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapExtractor/SnapExtractor
+ * .java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/CreateNewContextClass.java b/trunk/src/main/java/SnapManager/CreateNewContextClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..db2f27008be24e2b9d086b6b04b0f7dfc2ac4a7c
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/CreateNewContextClass.java
@@ -0,0 +1,154 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/CreateNewContextClass.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapManager class.
+//
+// $Author: chinkumo $
+//
+// $Revision: 1.3 $
+//
+// $Log: CreateNewContextClass.java,v $
+// Revision 1.3  2005/11/29 17:34:34  chinkumo
+// no message
+//
+// Revision 1.2.2.2  2005/11/29 16:18:25  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.2.2.1  2005/11/15 13:45:32  chinkumo
+// ...
+//
+// Revision 1.2  2005/08/19 14:03:26  chinkumo
+// no message
+//
+// Revision 1.1  2005/06/22 09:27:21  chinkumo
+// Tango V5 regenerated.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author: chinkumo $
+ * @version	$Revision: 1.3 $
+ */
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: 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).
+ */
+
+public class CreateNewContextClass extends Command implements TangoConst {
+	// ===============================================================
+	/**
+	 * Constructor for Command class CreateNewContextClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param out
+	 *            argout type
+	 */
+	// ===============================================================
+	public CreateNewContextClass(String name, int in, int out) {
+		super(name, in, out);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class CreateNewContextClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param in_comments
+	 *            argin description
+	 * @param out
+	 *            argout type
+	 * @param out_comments
+	 *            argout description
+	 */
+	// ===============================================================
+	public CreateNewContextClass(String name, int in, int out,
+			String in_comments, String out_comments) {
+		super(name, in, out, in_comments, out_comments);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class CreateNewContextClass
+	 * 
+	 * @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 CreateNewContextClass(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("CreateNewContextClass.execute(): arrived");
+		String[] argin = extract_DevVarStringArray(in_any);
+		return insert(((SnapManager) (device)).create_new_context(argin));
+	}
+
+	// ===============================================================
+	/**
+	 * Check if it is allowed to execute the command.
+	 */
+	// ===============================================================
+	public boolean is_allowed(DeviceImpl device, Any data_in) {
+		// End of Generated Code
+
+		// Re-Start of Generated Code
+		return true;
+	}
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/CreateNewContextClass
+ * .java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/LaunchSnapShotCmd.java b/trunk/src/main/java/SnapManager/LaunchSnapShotCmd.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ea3ae416229becf8668c0c52bd8d7de5c4a4db1
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/LaunchSnapShotCmd.java
@@ -0,0 +1,167 @@
+// +======================================================================
+// $Source$
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapArchiver class.
+//
+// $Author$
+//
+// $Revision$
+//
+// $Log$
+// Revision 1.3  2009/12/17 10:29:53  pierrejoseph
+// CheckStyle:Organize imports
+//
+// Revision 1.2  2009/05/29 09:08:03  soleilarc
+// manage exception for the LaunchSnapshot command
+//
+// Revision 1.1  2009/01/27 14:05:50  soleilarc
+// move LauchSnapshot command from Archiver to Manager
+//
+// Revision 1.5  2006/04/12 15:46:40  ounsy
+// corrected the missing attributes problem
+//
+// Revision 1.4  2005/11/29 17:33:03  chinkumo
+// no message
+//
+// Revision 1.3.10.2  2005/11/29 16:16:50  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.3.10.1  2005/11/15 13:46:17  chinkumo
+// ...
+//
+// Revision 1.3  2005/06/15 14:02:53  chinkumo
+// The device was regenerated in Tango V5.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author $Author$
+ * @version $Revision$
+ */
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command is used to trigger a snapShot. All
+ * informations concerning the snapshot will be retrieved with the identifier
+ * parameter.
+ */
+
+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 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);
+    }
+
+    // ===============================================================
+    /**
+     * 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");
+        int argin = extract_DevLong(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.
+     */
+    // ===============================================================
+    @Override
+    public boolean is_allowed(DeviceImpl device, Any data_in) {
+        // End of Generated Code
+
+        // Re-Start of Generated Code
+        return true;
+    }
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/archiving/server/snapArchivingServers/src/main
+ * /java/SnapManager/LaunchSnapShotCmd.java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/SetEquipmentsClass.java b/trunk/src/main/java/SnapManager/SetEquipmentsClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff87424516a39964a624f7db422460b0c18dc2e5
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/SetEquipmentsClass.java
@@ -0,0 +1,138 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsClass.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapManager class.
+//
+// $Author: soleilarc $
+//
+// $Revision: 1.1 $
+//
+// $Log: SetEquipmentsClass.java,v $
+// Revision 1.1  2007/11/16 10:17:36  soleilarc
+// Author: XPigeon
+// Mantis bug ID: 5341
+// Comment : Define this new class.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command is used to set values to equipments.
+ */
+
+public class SetEquipmentsClass extends Command implements TangoConst {
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param out
+	 *            argout type
+	 */
+	// ===============================================================
+	public SetEquipmentsClass(String name, int in, int out) {
+		super(name, in, out);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param in_comments
+	 *            argin description
+	 * @param out
+	 *            argout type
+	 * @param out_comments
+	 *            argout description
+	 */
+	// ===============================================================
+	public SetEquipmentsClass(String name, int in, int out, String in_comments,
+			String out_comments) {
+		super(name, in, out, in_comments, out_comments);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsClass
+	 * 
+	 * @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 SetEquipmentsClass(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("SetEquipmentsClass.execute(): arrived");
+		String[] argin = extract_DevVarStringArray(in_any);
+		((SnapManager) (device)).set_equipments(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
+
+		// Re-Start of Generated Code
+		return true;
+	}
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsClass
+ * .java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java b/trunk/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..2dbeaecfea572b28c3e5adb54515c99a45fbf71e
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/SetEquipmentsWithCommandClass.java
@@ -0,0 +1,113 @@
+/**
+ * @author	$Author$
+ * @version	$Revision$
+ */
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command is used to set command to equipments.
+ */
+
+public class SetEquipmentsWithCommandClass extends Command implements
+		TangoConst {
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithCommandClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param out
+	 *            argout type
+	 */
+	// ===============================================================
+	public SetEquipmentsWithCommandClass(String name, int in, int out) {
+		super(name, in, out);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithCommandClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param in_comments
+	 *            argin description
+	 * @param out
+	 *            argout type
+	 * @param out_comments
+	 *            argout description
+	 */
+	// ===============================================================
+	public SetEquipmentsWithCommandClass(String name, int in, int out,
+			String in_comments, String out_comments) {
+		super(name, in, out, in_comments, out_comments);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithCommandClass
+	 * 
+	 * @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 SetEquipmentsWithCommandClass(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("SetEquipmentsWithCommandClass.execute(): arrived");
+		String[] argin = extract_DevVarStringArray(in_any);
+
+		return insert(((SnapManager) (device))
+				.set_equipments_with_command(argin));
+	}
+
+	// ===============================================================
+	/**
+	 * Check if it is allowed to execute the command.
+	 */
+	// ===============================================================
+	public boolean is_allowed(DeviceImpl device, Any data_in) {
+		// End of Generated Code
+
+		// Re-Start of Generated Code
+		return true;
+	}
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/archiving/server/snapArchivingServers/src/main
+ * /java/SnapManager/SetEquipmentsWithCommandClass.java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java b/trunk/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..69a212e8f2460707ff105b0e277b5dd07a1131d5
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/SetEquipmentsWithSnapshotClass.java
@@ -0,0 +1,152 @@
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SetEquipmentsWithSnapshotClass.java,v $
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapManager class.
+//
+// $Author: chinkumo $
+//
+// $Revision: 1.3 $
+//
+// $Log: SetEquipmentsWithSnapshotClass.java,v $
+// Revision 1.3  2005/11/29 17:34:34  chinkumo
+// no message
+//
+// Revision 1.2.2.2  2005/11/29 16:18:25  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.2.2.1  2005/11/15 13:45:32  chinkumo
+// ...
+//
+// Revision 1.2  2005/08/19 14:48:31  chinkumo
+// no message
+//
+// Revision 1.1.2.1  2005/08/11 08:17:45  chinkumo
+// The 'SetEquipement' command and thus functionnality was added.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author: chinkumo $
+ * @version	$Revision: 1.3 $
+ */
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command is used to set values to equipments.
+ */
+
+public class SetEquipmentsWithSnapshotClass extends Command implements
+		TangoConst {
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithSnapshotClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param out
+	 *            argout type
+	 */
+	// ===============================================================
+	public SetEquipmentsWithSnapshotClass(String name, int in, int out) {
+		super(name, in, out);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithSnapshotClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param in_comments
+	 *            argin description
+	 * @param out
+	 *            argout type
+	 * @param out_comments
+	 *            argout description
+	 */
+	// ===============================================================
+	public SetEquipmentsWithSnapshotClass(String name, int in, int out,
+			String in_comments, String out_comments) {
+		super(name, in, out, in_comments, out_comments);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class SetEquipmentsWithSnapshotClass
+	 * 
+	 * @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 SetEquipmentsWithSnapshotClass(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("SetEquipmentsWithSnapshotClass.execute(): arrived");
+		String[] argin = extract_DevVarStringArray(in_any);
+		((SnapManager) (device)).set_equipments_with_snapshot(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
+
+		// Re-Start of Generated Code
+		return true;
+	}
+}
+
+// -----------------------------------------------------------------------------
+/*
+ * end of $Source:/cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/
+ * SetEquipmentsWithSnapshotClass.java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/SnapManager.java b/trunk/src/main/java/SnapManager/SnapManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..fd1fd97707bcef55cfe1cc5780d170896be5d357
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/SnapManager.java
@@ -0,0 +1,745 @@
+// +============================================================================
+//$Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManager.java,v $
+
+//project :     Tango Device Server
+
+//Description:	java source code for the SnapManager class and its commands.
+//This class is derived from DeviceImpl class.
+//It represents the CORBA servant obbject which
+//will be accessed from the network. All commands which
+//can be executed on the SnapManager are implemented
+//in this file.
+
+//$Author: pierrejoseph $
+
+//$Revision: 1.22 $
+
+//$Log: SnapManager.java,v $
+//Revision 1.22  2007/12/12 17:39:42  pierrejoseph
+//Add comments on the SetEquipments method for the Javadoc
+
+//Revision 1.21  2007/11/23 09:23:13  pierrejoseph
+//Modification of set_equipements method to no more works with the SnapExtractor api
+
+//Revision 1.20  2007/11/20 15:27:19  pierrejoseph
+//Exception are raised by the method SetEquipments
+
+//Revision 1.19  2007/11/16 10:14:21  soleilarc
+//Author: XPigeon
+//Mantis bug ID: 5341
+//Comment :
+//In the init_device method, create an instance of ISnapReader.
+//Define the new method named setEquipments.
+
+//Revision 1.18  2007/05/11 13:58:54  pierrejoseph
+//Attribute addition : release version
+
+//Revision 1.17  2007/03/02 07:54:57  ounsy
+//extend DeviceImpl instead of DeviceImplWithShutdownRunnable
+
+//Revision 1.16  2006/12/06 10:16:02  ounsy
+//minor changes
+
+//Revision 1.15  2006/11/20 09:38:54  ounsy
+//minor changes
+
+//Revision 1.14  2006/11/13 15:58:06  ounsy
+//all java devices now inherit from UnexportOnShutdownDeviceImpl instead of from DeviceImpl
+
+//Revision 1.13  2006/05/30 13:03:10  ounsy
+//minor changes
+
+//Revision 1.12  2006/04/21 09:05:28  ounsy
+//New command "UpdateSnapComment" added
+
+//Revision 1.11  2006/02/15 09:09:57  ounsy
+//minor changes : uncomment to debug
+
+//Revision 1.10  2005/11/29 17:34:34  chinkumo
+//no message
+
+//Revision 1.9.2.2  2005/11/29 16:18:25  chinkumo
+//Code reformated (pogo compatible)
+
+//Revision 1.9.2.1  2005/11/15 13:45:32  chinkumo
+//...
+
+//Revision 1.9  2005/08/19 14:03:26  chinkumo
+//no message
+
+//Revision 1.8.6.1  2005/08/11 08:16:44  chinkumo
+//The 'SetEquipement' command and thus functionnality was added.
+
+//Revision 1.8  2005/06/28 09:10:28  chinkumo
+//Changes made to improve the management of exceptions were reported here.
+
+//Revision 1.7  2005/06/22 09:28:34  chinkumo
+//Tango V5 regenerated.
+
+//Revision 1.5  2005/06/15 14:03:29  chinkumo
+//The device was regenerated in Tango V5.
+
+//Revision 1.4  2005/06/14 12:11:40  chinkumo
+//Branch (snapManager_1_0_1-branch_0)  and HEAD merged.
+
+//Revision 1.3.4.1  2005/05/11 15:53:43  chinkumo
+//The create_new_context's command comment was enhanced.
+
+//Revision 1.3  2005/01/26 17:06:25  chinkumo
+//Ultimate synchronization before real sharing.
+
+//Revision 1.2  2004/12/06 17:30:44  chinkumo
+//Renaming package 'TangoSnap' into 'TangoSnapshoting'
+
+//Revision 1.1  2004/06/11 14:13:41  chinkumo
+//The first team version.
+
+//Revision 1.1  2004/05/10 14:01:33  chinkumo
+//Archiving sources
+
+//copyleft :   European Synchrotron Radiation Facility
+//BP 220, Grenoble 38043
+//FRANCE
+
+//-============================================================================
+
+//This file is generated by POGO
+//(Program Obviously used to Generate tango Object)
+
+//(c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapManager;
+
+import java.util.ArrayList;
+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.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.DbDevice;
+import fr.esrf.TangoDs.Attribute;
+import fr.esrf.TangoDs.DeviceClass;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.Except;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+import fr.soleil.archiving.snap.api.SnapConnectionParameters;
+import fr.soleil.archiving.snap.api.manager.ISnapManager;
+import fr.soleil.archiving.snap.api.manager.SnapManagerApi;
+import fr.soleil.archiving.snap.api.manager.SnapManagerImpl;
+import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract;
+import fr.soleil.archiving.snap.api.tools.SnapConst;
+import fr.soleil.archiving.snap.api.tools.SnapContext;
+import fr.soleil.archiving.snap.api.tools.SnapShot;
+import fr.soleil.archiving.snap.api.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 $
+ */
+
+// --------- Start of States Description ----------
+/*
+ * Device States Description:
+ */
+// --------- End of States Description ----------
+public class SnapManager extends DeviceImpl
+/* WithShutdownRunnable */implements TangoConst {
+    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<Integer, Future<Integer>> snapshotResults = new HashMap<Integer, Future<Integer>>();
+    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);
+            set_state(DevState.ON);
+        } catch (SnapshotingException e) {
+            get_logger().warn(e.toString(), e);
+            set_state(DevState.FAULT);
+            set_status(e.toString());
+            // throw e.toTangoException();
+        }
+
+    }
+
+    // ===================================================================
+    /**
+     * Read the device properties from database.
+     */
+    // ===================================================================
+    private void get_device_property() throws DevFailed {
+        // Initialize your default values here.
+        // ------------------------------------------
+        dbUser = "";
+        dbPassword = "";
+        dbHost = "";
+        dbName = "";
+        dbSchema = "";
+        isRac = "";
+
+        DbDevice device = get_db_device();
+        try {
+            SnapConnectionParameters.performSnapInit(device, true, true);
+
+            dbHost = SnapConnectionParameters.getSnapHost();
+            dbName = SnapConnectionParameters.getSnapName();
+            dbSchema = SnapConnectionParameters.getSnapSchema();
+            dbUser = SnapConnectionParameters.getSnapUser();
+            dbPassword = SnapConnectionParameters.getSnapPassword();
+            isRac = SnapConnectionParameters.getSnapRac();
+
+            SnapConnectionParameters.printSnapConnectionInfoLog();
+
+        } catch (SnapshotingException e) {
+            e.printStackTrace();
+        }
+    }
+
+    // =========================================================
+    /**
+     * 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(int 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<Integer> snapshotResult = executorService.submit(new SnapshotTask(argin));
+        snapshotResults.put(argin, snapshotResult);
+    }
+
+    public int getSnapShotResult(int argin) throws DevFailed {
+        int 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;
+    }
+
+    private class SnapshotTask implements Callable<Integer> {
+        private final int contextID;
+
+        public SnapshotTask(int contextID) {
+            this.contextID = contextID;
+        }
+
+        @Override
+        public Integer 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 snapShot.getId_snap();
+        }
+    }
+
+    // =========================================================
+    /**
+     * 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");
+        try {
+            // 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());
+            SnapManagerApi.TriggerSetEquipments(snapShot);
+        } catch (SnapshotingException e) {
+            e.printStackTrace();
+            get_logger().warn(e.toString(), e);
+            throw e.toTangoException();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw DevFailedUtils.newDevFailed(e);
+        } 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");
+            }
+
+            SnapAttributeExtract[] selectedAttributes = null;
+            // If there is more than 3 arguments for this method,
+            // we search if they are selected attributes for this snapshot (selected attributes).
+            if (argin.length > 3) {
+                List<SnapAttributeExtract> existingAttributes = new ArrayList<SnapAttributeExtract>();
+                for (SnapAttributeExtract snapshotAttribute : snapAttributeExtractArray) {
+                    for (int index = 3; index < argin.length; ++index) {
+                        String element = argin[index];
+                        if (element != null) {
+                            if (element.equalsIgnoreCase(snapshotAttribute.getAttributeCompleteName())) {
+                                existingAttributes.add(snapshotAttribute);
+                                break;
+                            }
+                        }
+                    }
+                }
+                if (existingAttributes.size() > 0) {
+                    selectedAttributes = new SnapAttributeExtract[existingAttributes.size()];
+                    selectedAttributes = existingAttributes.toArray(selectedAttributes);
+                }
+                existingAttributes = null;
+            } else {
+                selectedAttributes = snapAttributeExtractArray;
+            }
+
+            // add attributes test: 1-different devices 2-same format
+            if (validSnapshot(selectedAttributes)) {
+                List<String> result = new ArrayList<String>();
+                boolean hasFailed = false;
+                List<DevError> errorStack = new ArrayList<DevError>();
+                for (SnapAttributeExtract attributeSnap : selectedAttributes) {
+                    try {
+                        TangoCommand cmd = new TangoCommand(attributeSnap.getdeviceName(), command_name);
+                        Object value = null;
+                        if (SnapConst.STORED_READ_VALUE.equals(argin[1])) {
+                            value = attributeSnap.getReadValue();
+                            if (value == null) {
+                                value = attributeSnap.getWriteValue();
+                            }
+                        } else if (SnapConst.STORED_WRITE_VALUE.equals(argin[1])) {
+                            value = attributeSnap.getWriteValue();
+                            if (value == null) {
+                                value = attributeSnap.getReadValue();
+                            }
+                        }
+                        System.out.println(command_name + " with " + value + " on " + attributeSnap.getdeviceName());
+                        cmd.execute(value);
+                        if (!cmd.isArginVoid()) {
+                            result.add(cmd.extractToString(","));
+                        }
+                    } catch (DevFailed e) {
+                        hasFailed = true;
+                        DevError[] err = e.errors;
+                        for (DevError devError : err) {
+                            errorStack.add(devError);
+                        }
+                    }
+                }
+                if (hasFailed) {
+                    throw new DevFailed(errorStack.toArray(new DevError[errorStack.size()]));
+                }
+                return Arrays.toString(result.toArray(new String[result.size()]));
+            }
+        } 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 "";
+    }
+
+    /*
+     * test if the attributes are from different devices and have the same
+     * format
+     */
+    private boolean validSnapshot(SnapAttributeExtract[] selectedAttributes) throws DevFailed {
+        int format = selectedAttributes[0].getDataFormat();
+        int nbOccurs = numberOfOccurrences(selectedAttributes, selectedAttributes[0].getdeviceName());
+        if (nbOccurs > 1) {
+            Except.throw_exception("CONFIGURATION_ERROR", "A device cannot be selected more than one time",
+                    "SnapManager.SetEquipmentsWithCommand");
+            return false;
+        }
+        for (int i = 1; i < selectedAttributes.length; i++) {
+            if (selectedAttributes[i].getDataFormat() != format) {
+                Except.throw_exception("CONFIGURATION_ERROR", "Some attributes have incompatible format : "
+                        + selectedAttributes[i].getDataFormat() + " and " + format,
+                        "SnapManager.SetEquipmentsWithCommand");
+                return false;
+            } else if (numberOfOccurrences(selectedAttributes, selectedAttributes[i].getdeviceName()) > 1) {
+                Except.throw_exception("CONFIGURATION_ERROR", "A device cannot be selected more than one time",
+                        "SnapManager.SetEquipmentsWithCommand");
+            }
+        }
+        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++;
+            }
+        }
+        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();
+                }
+                // 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 (Exception e) {
+                throw DevFailedUtils.newDevFailed(e);
+            } 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");
+
+            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 {
+        snapshotResults.clear();
+    }
+}
+
+// --------------------------------------------------------------------------
+/*
+ * end of $Source:
+ * /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManager.java,v $
+ */
diff --git a/trunk/src/main/java/SnapManager/SnapManagerClass.java b/trunk/src/main/java/SnapManager/SnapManagerClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..1f1347ea44802b1b6540312575ec0ef0dfd154aa
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/SnapManagerClass.java
@@ -0,0 +1,381 @@
+// +======================================================================
+// $Source: /cvsroot/tango-cs/tango/jserver/snapshoting/SnapManager/SnapManagerClass.java,v $
+//
+// Project:   	Tango Device Server
+//
+// Description:	java source code for the SnapManager class .
+//              This class is a singleton class and implements everything
+//              which exists only once for all the  SnapManager object
+//              It inherits from the DeviceClass class.
+//
+// $Author: pierrejoseph $
+//
+// $Revision: 1.14 $
+//
+// $Log: SnapManagerClass.java,v $
+// Revision 1.14  2007/12/12 17:39:42  pierrejoseph
+// Add comments on the SetEquipments method for the Javadoc
+//
+// Revision 1.13  2007/11/16 10:16:55  soleilarc
+// Author: XPigeon
+// Mantis bug ID: 5341
+// Comment : Add the SetEquipments method in the commands list.
+//
+// Revision 1.12  2007/05/11 13:58:53  pierrejoseph
+// Attribute addition : release version
+//
+// Revision 1.11  2006/12/06 10:16:02  ounsy
+// minor changes
+//
+// Revision 1.10  2006/04/21 09:05:28  ounsy
+// New command "UpdateSnapComment" added
+//
+// Revision 1.9  2006/03/27 13:58:35  ounsy
+// organized imports
+//
+// Revision 1.8  2005/11/29 17:34:34  chinkumo
+// no message
+//
+// Revision 1.7.2.2  2005/11/29 16:18:25  chinkumo
+// Code reformated (pogo compatible)
+//
+// Revision 1.7.2.1  2005/11/15 13:45:32  chinkumo
+// ...
+//
+// Revision 1.7  2005/08/19 14:03:26  chinkumo
+// no message
+//
+// Revision 1.6.6.1  2005/08/11 08:16:44  chinkumo
+// The 'SetEquipement' command and thus functionnality was added.
+//
+// Revision 1.6  2005/06/22 09:28:34  chinkumo
+// Tango V5 regenerated.
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+package SnapManager;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+import fr.esrf.Tango.AttrWriteType;
+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 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 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);
+        }
+        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(final String class_name) throws DevFailed {
+        if (_instance == null) {
+            _instance = new SnapManagerClass(class_name);
+        }
+        return _instance;
+    }
+
+    // ===================================================================
+    //
+    // method : SnapManagerClass()
+    //
+    // description : constructor for the SnapManagerClass class
+    //
+    // argument : in : - name : The class name
+    //
+    // ===================================================================
+    protected SnapManagerClass(final 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_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_LONG, 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++) {
+            final Command cmd = (Command) command_list.elementAt(i);
+        }
+    }
+
+    // =============================================================================
+    //
+    // Method: attribute_factory(Vector att_list)
+    //
+    // =============================================================================
+    @Override
+    public void attribute_factory(final Vector att_list) throws DevFailed {
+        // Attribute : version
+        final 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(final String[] devlist) throws DevFailed {
+
+        String device_version = "unkown";
+        try {
+            device_version = ResourceBundle.getBundle("application").getString("project.version");
+        } catch (final 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(final String name) throws DevFailed {
+        // for (int i = 0; i < cl_prop.length; i++) {
+        // if (cl_prop[i].name.equals(name)) {
+        // return cl_prop[i];
+        // }
+        // }
+        final 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 = {
+        // };
+        //
+        // // 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();
+        // }
+        //
+        // // Extract DbName value
+        // if (cl_prop[++i].is_empty() == false) {
+        // dbName = cl_prop[i].extractString();
+        // }
+        //
+        // // 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;
+//	}
+//
+//	// Prepeare DbDatum
+//	// --------------------------------------------
+//	final 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);
+//    }
+
+}
diff --git a/trunk/src/main/java/SnapManager/UpdateSnapCommentClass.java b/trunk/src/main/java/SnapManager/UpdateSnapCommentClass.java
new file mode 100644
index 0000000000000000000000000000000000000000..b789b630b24d3a77f2a46e495b4181a2ef087cf2
--- /dev/null
+++ b/trunk/src/main/java/SnapManager/UpdateSnapCommentClass.java
@@ -0,0 +1,137 @@
+//+======================================================================
+// $Source$
+//
+// Project:      Tango Device Server
+//
+// Description:  Java source code for the command TemplateClass of the
+//               SnapManager class.
+//
+// $Author$
+//
+// $Revision$
+//
+// $Log$
+// Revision 1.1  2006/04/21 09:05:28  ounsy
+// New command "UpdateSnapComment" added
+//
+//
+// copyleft :    European Synchrotron Radiation Facility
+//               BP 220, Grenoble 38043
+//               FRANCE
+//
+//-======================================================================
+//
+//  		This file is generated by POGO
+//	(Program Obviously used to Generate tango Object)
+//
+//         (c) - Software Engineering Group - ESRF
+//=============================================================================
+
+/**
+ * @author	$Author$
+ * @version	$Revision$
+ */
+package SnapManager;
+
+import org.omg.CORBA.Any;
+
+import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DevVarLongStringArray;
+import fr.esrf.Tango.DispLevel;
+import fr.esrf.TangoDs.Command;
+import fr.esrf.TangoDs.DeviceImpl;
+import fr.esrf.TangoDs.TangoConst;
+import fr.esrf.TangoDs.Util;
+
+/**
+ * Class Description: This command updates the comment of given snapshot
+ * 
+ */
+
+public class UpdateSnapCommentClass extends Command implements TangoConst {
+	// ===============================================================
+	/**
+	 * Constructor for Command class UpdateSnapCommentClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param out
+	 *            argout type
+	 */
+	// ===============================================================
+	public UpdateSnapCommentClass(String name, int in, int out) {
+		super(name, in, out);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class UpdateSnapCommentClass
+	 * 
+	 * @param name
+	 *            command name
+	 * @param in
+	 *            argin type
+	 * @param in_comments
+	 *            argin description
+	 * @param out
+	 *            argout type
+	 * @param out_comments
+	 *            argout description
+	 */
+	// ===============================================================
+	public UpdateSnapCommentClass(String name, int in, int out,
+			String in_comments, String out_comments) {
+		super(name, in, out, in_comments, out_comments);
+	}
+
+	// ===============================================================
+	/**
+	 * Constructor for Command class UpdateSnapCommentClass
+	 * 
+	 * @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 UpdateSnapCommentClass(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("UpdateSnapCommentClass.execute(): arrived");
+		DevVarLongStringArray argin = extract_DevVarLongStringArray(in_any);
+		((SnapManager) (device)).update_snap_comment(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
+
+		// Re-Start of Generated Code
+		return true;
+	}
+}
+// -----------------------------------------------------------------------------
+/* end of $Source$ */
diff --git a/trunk/src/main/resources/application.properties b/trunk/src/main/resources/application.properties
new file mode 100644
index 0000000000000000000000000000000000000000..4ce0e7137a42a49f5096fbc3f11b7728851f35a5
--- /dev/null
+++ b/trunk/src/main/resources/application.properties
@@ -0,0 +1,5 @@
+#application properties
+project.name=${project.name}
+project.version=${project.version}
+build.date=${buildNumber}
+
diff --git a/trunk/src/main/resources/beans.xml b/trunk/src/main/resources/beans.xml
new file mode 100644
index 0000000000000000000000000000000000000000..51f1543f4937fae723c21006778505cf369d27da
--- /dev/null
+++ b/trunk/src/main/resources/beans.xml
@@ -0,0 +1,104 @@
+<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.archiving.snap.api.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.archiving.snap.api.persistence.spring.dao.ScNum1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scNum2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScNum2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scStr1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scStr2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="sp1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="sp2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="im1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="im2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+	<!-- DAO BEANS DEFINITION ^^^^^^-->
+</beans>
\ No newline at end of file
diff --git a/trunk/src/main/resources/beans_Orion.xml b/trunk/src/main/resources/beans_Orion.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1e08b85523c96edfa601bea5e248a5e944effcf4
--- /dev/null
+++ b/trunk/src/main/resources/beans_Orion.xml
@@ -0,0 +1,103 @@
+<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:@LUTIN:1521:TEST11" />
+		    <property name="username" value="toto" />
+		    <property name="password" value="toto" />
+	</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.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.archiving.snap.api.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.archiving.snap.api.persistence.spring.dao.ScNum1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scNum2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScNum2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scStr1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="scStr2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.ScStr2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="sp1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="sp2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Sp2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="im1ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im1ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+  
+    <bean id="im2ValDAO" class="fr.soleil.archiving.snap.api.persistence.spring.dao.Im2ValDAOImpl">
+		<constructor-arg ref="sessionFactory" /> 
+    </bean>
+	<!-- DAO BEANS DEFINITION ^^^^^^-->
+</beans>
\ No newline at end of file
diff --git a/trunk/src/main/resources/log4j.xml b/trunk/src/main/resources/log4j.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1eaef2ac37ab4553472d764f196255b04f9b8045
--- /dev/null
+++ b/trunk/src/main/resources/log4j.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<appender name="stdout-appender" class="org.apache.log4j.ConsoleAppender">
+		<layout class="org.apache.log4j.PatternLayout">
+			<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %C{5}.%l: %m%n" />
+		</layout>
+	</appender>
+
+	<logger name="org.jacorb">
+		<level value="ERROR" />
+	</logger>
+	
+	<logger name="org.hibernate">
+		<level value="ERROR" />
+	</logger>
+	
+	<logger name="org.springframework">
+		<level value="ERROR" />
+	</logger>
+
+	<root>
+		<level value="DEBUG" />
+		<appender-ref ref="stdout-appender" />
+	</root>
+
+</log4j:configuration>
diff --git a/trunk/src/main/resources/mysql.properties b/trunk/src/main/resources/mysql.properties
new file mode 100644
index 0000000000000000000000000000000000000000..382dd9f940b2a2718f112e5b4034093b9a6131bd
--- /dev/null
+++ b/trunk/src/main/resources/mysql.properties
@@ -0,0 +1,7 @@
+#change the mysql driver to the more recent com.mysql.jdbc.Driver
+#DRIVER_CLASS_NAME        =    org.gjt.mm.mysql.Driver
+DRIVER_CLASS_NAME        =    com.mysql.jdbc.Driver
+URL                      =    jdbc:mysql://localhost/snap?autoReconnect=true
+USERNAME                 =    snaparchiver
+PASSWORD                 =    snaparchiver
+HIBERNATE_DIALECT        =    org.hibernate.dialect.MySQL5Dialect
\ No newline at end of file
diff --git a/trunk/src/main/resources/oracle.properties b/trunk/src/main/resources/oracle.properties
new file mode 100644
index 0000000000000000000000000000000000000000..26cb80360cd5aae9ffacc221a3a0898c503ade2f
--- /dev/null
+++ b/trunk/src/main/resources/oracle.properties
@@ -0,0 +1,8 @@
+DRIVER_CLASS_NAME        =    oracle.jdbc.driver.OracleDriver
+#URL DEV
+URL                      =    jdbc:oracle:thin:@BIZET:1521:LET
+#URL RCM
+#URL                      =    jdbc:oracle:thin:@jacquard:1521:HDB
+USERNAME                 =    SNAP
+PASSWORD                 =    SNAP
+HIBERNATE_DIALECT        =    org.hibernate.dialect.Oracle9Dialect
\ No newline at end of file
diff --git a/trunk/src/main/resources/valueTables.hbm.xml b/trunk/src/main/resources/valueTables.hbm.xml
new file mode 100644
index 0000000000000000000000000000000000000000..71b51e24da6d46c1e4d87c49ccb0ee2743874ad0
--- /dev/null
+++ b/trunk/src/main/resources/valueTables.hbm.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="fr.soleil.archiving.snap.api.persistence.spring.dto">
+	
+	<class name="ScNum1Val" table="t_sc_num_1val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+        <property name="value" column="VALUE"/>
+    </class>
+
+	<class name="ScNum2Val" table="t_sc_num_2val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+        <property name="readValue" column="READ_VALUE"/>
+        <property name="writeValue" column="WRITE_VALUE"/>
+    </class>
+    
+  	<class name="ScStr1Val" table="t_sc_str_1val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+        <property name="value" column="VALUE"/>
+    </class>
+    
+   <class name="ScStr2Val" table="t_sc_str_2val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+        <property name="readValue" column="READ_VALUE"/>
+        <property name="writeValue" column="WRITE_VALUE"/>
+    </class>
+
+	<class name="Sp1Val" table="t_sp_1val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+		<property name="dimX" column="DIM_X"/>
+        <property name="value" column="VALUE"/>
+    </class>
+
+	<class name="Sp2Val" table="t_sp_2val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+		<property name="dimX" column="DIM_X"/>
+		<property name="readValue" column="READ_VALUE"/>
+        <property name="writeValue" column="WRITE_VALUE"/>
+    </class>
+    
+    <class name="Im1Val" table="t_im_1val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+		<property name="dimX" column="DIM_X"/>
+		<property name="dimY" column="DIM_Y"/>
+        <property name="value" column="VALUE"/>
+    </class>
+
+	<class name="Im2Val" table="t_im_2val">
+        <composite-id name="compositeId" class="CompositeId">
+				<key-property name="idSnap" column="ID_SNAP"/>
+		        <key-property name="idAtt" column="ID_ATT"/>
+		</composite-id>
+		<property name="dimX" column="DIM_X"/>
+		<property name="dimY" column="DIM_Y"/>
+		<property name="readValue" column="READ_VALUE"/>
+        <property name="writeValue" column="WRITE_VALUE"/>
+    </class>
+
+</hibernate-mapping>
\ No newline at end of file
diff --git a/trunk/src/test/java/SnapArchiver/SnapArchiverTest.java b/trunk/src/test/java/SnapArchiver/SnapArchiverTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ead0c9bf2cefb62d45c56b491be6253a4656dcc
--- /dev/null
+++ b/trunk/src/test/java/SnapArchiver/SnapArchiverTest.java
@@ -0,0 +1,74 @@
+package SnapArchiver;
+
+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;
+
+@Ignore
+public class SnapArchiverTest {
+
+    @Test
+    private int testTriggerLaunchSnap(DeviceProxy deviceProxy, int ctx) {
+        DeviceData device_data = null;
+        DeviceData device_data_out = null;
+        int snapId = -1;
+        try {
+            device_data = new DeviceData();
+            device_data.insert(ctx);
+            device_data_out = deviceProxy.command_inout("TriggerLaunchSnapShot", device_data);
+            snapId = device_data_out.extractLong();
+            device_data = null;
+        } catch (DevFailed e) {
+            StringBuilder buffer = new StringBuilder("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");
+
+                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");
+            }
+
+            System.out.println(buffer.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("Unknown Exception argin ctx = " + ctx);
+        }
+        return snapId;
+    }
+
+    @Test
+    public void testTriggerLaunchSnapShot() {
+        try {
+            DeviceProxy deviceProxy = new DeviceProxy("archiving/snap/snaparchiver.1");
+            int snapId;
+            int 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 = 100; // contexte inexistant mais valide
+            snapId = testTriggerLaunchSnap(deviceProxy, ctx);
+            System.out.println("3 - ctx = " + ctx + " snapId = " + snapId);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/trunk/src/test/java/SnapManager/SnapManagerTest.java b/trunk/src/test/java/SnapManager/SnapManagerTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..71675b17260594753861f6083c28f5ad6884984a
--- /dev/null
+++ b/trunk/src/test/java/SnapManager/SnapManagerTest.java
@@ -0,0 +1,176 @@
+package SnapManager;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import fr.esrf.TangoApi.DeviceData;
+import fr.esrf.TangoApi.DeviceProxy;
+
+@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();
+	}
+    }
+
+}