diff --git a/pom.xml b/pom.xml
index f1fca77fe42bb0ab684b233bade8bbb1d0f6b6cf..42d00c27289c91618dcca6c1a8551a86684700a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,9 +11,11 @@
 
   <groupId>fr.soleil.lib</groupId>
   <artifactId>snapArchivingApi</artifactId>
-  <version>1.8.6</version>
+  <version>1.9.0</version>
   <name>snapArchivingApi</name>
   <description>Snap Archiving API</description>
+
+
   <developers>
     <developer>
       <id>abeille</id>
@@ -40,9 +42,9 @@
   </developers>
 
   <scm>
-    <connection>${scm.connection.svn.tango-cs}:archiving/api/snapArchivingApi/trunk</connection>
-    <developerConnection>${scm.developerConnection.svn.tango-cs}:archiving/api/snapArchivingApi/trunk</developerConnection>
-    <url>${scm.url.svn.tango-cs}/archiving/api/snapArchivingApi/trunk</url>
+    <connection>git@gitlab.synchrotron-soleil.fr:software-control-system/tango-controls-archiving/SnapArchivingApi.git</connection>
+    <developerConnection>git@gitlab.synchrotron-soleil.fr:software-control-system/tango-controls-archiving/SnapArchivingApi.git</developerConnection>
+    <url>git@gitlab.synchrotron-soleil.fr:software-control-system/tango-controls-archiving/SnapArchivingApi.git</url>
   </scm>
 
   <dependencies>
diff --git a/src/main/java/fr/soleil/archiving/snap/api/DataBaseAPI.java b/src/main/java/fr/soleil/archiving/snap/api/DataBaseAPI.java
index 3f0e6bb0173e0f14bcb0c7fc2bec337bdf87e0f3..badafc8c2b1d63dbcf9ef718dfc96a07248997bd 100644
--- a/src/main/java/fr/soleil/archiving/snap/api/DataBaseAPI.java
+++ b/src/main/java/fr/soleil/archiving/snap/api/DataBaseAPI.java
@@ -172,36 +172,6 @@
 //-======================================================================
 package fr.soleil.archiving.snap.api;
 
-import java.lang.reflect.Array;
-
-/*
- * Import classes
- */
-
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.StringTokenizer;
-import java.util.stream.Collectors;
-
-import org.jdbi.v3.core.Handle;
-import org.jdbi.v3.core.statement.Query;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.ErrSeverity;
@@ -221,12 +191,36 @@ import fr.soleil.archiving.snap.api.tools.TangoJAVAUtils;
 import fr.soleil.database.connection.AbstractDataBaseConnector;
 import fr.soleil.database.connection.DataBaseParameters;
 import fr.soleil.database.connection.DataBaseParameters.DataBaseType;
+import org.jdbi.v3.core.Handle;
+import org.jdbi.v3.core.statement.Query;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.lang.reflect.Array;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.StringTokenizer;
+import java.util.stream.Collectors;
 
 /**
  * <b>Description : </b> This class hides the loading of drivers, the
  * connection/disconnection with the database, and more generaly, this class
  * hides number of methods to insert, update and query <I>Snap</I>.
- * 
+ *
  * @author Jean CHINKUMO
  * @version 1.0
  */
@@ -249,128 +243,95 @@ public class DataBaseAPI {
      * database'schema' used
      */
     private int currentSpectrumDimX;
-    
-    private DataBaseParameters params ;
+
+    private DataBaseParameters params;
     private AbstractDataBaseConnector connector;
 
     /**
      * Constructor using host name, user name, password and database name.
-     * 
-     * @param dbHostName
-     *            Identifier (name or IP adress) of the machine which supplies
-     *            the service data base
-     * @param dbName
-     *            Name of the data base used
-     * @param dbSchemaName
-     *            Name of the database's schema used
-     * @param userName
-     *            Name to use to connect
-     * @param password
-     *            Password to use to connect
+     *
+     * @param params Database connection parameters
      */
-    public DataBaseAPI(final String dbHostName, final String dbName, final String dbSchemaName, final String userName,
-			final String password, final boolean isRac) {
-    	params = new DataBaseParameters();
-    	params.setHost(dbHostName);
-    	params.setName(dbName);
-    	params.setSchema(dbSchemaName);
-    	params.setUser(userName);
-    	params.setPassword(password);
-        if (!dbSchemaName.equals("")) {
-        	params.setSchema(dbSchemaName);
+    public DataBaseAPI(DataBaseParameters params) throws ArchivingException {
+        if (params.getHost().equals("")) {
+            params.setDbType(DataBaseType.H2);
+            connector = ConnectionFactory.connect(params);
         } else {
-        	params.setSchema(dbName);
+            try {
+                params.setDbType(DataBaseType.ORACLE);
+                connector = ConnectionFactory.connect(params);
+            } catch (Exception e) {
+                params.setDbType(DataBaseType.MYSQL);
+                connector = ConnectionFactory.connect(params);
+            }
         }
-
-		if (dbHostName.equals("")) {
-			params.setDbType(DataBaseType.H2);
-			try {
-				connector = ConnectionFactory.connect(params);
-				return;
-			} catch (ArchivingException e) {
-				e.printStackTrace();
-			}
-		}
-        try {
-			params.setDbType(DataBaseType.ORACLE);
-			connector = ConnectionFactory.connect(params);
-		} catch (Exception e) {
-			params.setDbType(DataBaseType.MYSQL);
-			try {
-				connector = ConnectionFactory.connect(params);
-			} catch (ArchivingException e1) {
-				e1.printStackTrace();
-			}
-		}
+        this.params = params;
     }
-    
-   
+
 
     /**
      * <b>Description : </b> Gets the database name
-     * 
+     *
      * @return The database name
      */
     public String getDbName() {
-		return params.getName();
+        return params.getName();
     }
 
     /**
      * <b>Description : </b> Gets the database's schema name
-     * 
+     *
      * @return The database name
      */
     public String getDbSchema() {
-		return params.getSchema();
+        return params.getSchema();
     }
 
     /**
      * <b>Description : </b> Returns the connected database host identifier.
-     * 
+     *
      * @return The host where the connection is done
      */
     public String getHost() {
-		return params.getHost();
+        return params.getHost();
     }
 
     /**
      * <b>Description : </b> Gets the current user's name for the connection
-     * 
+     *
      * @return The user's name for the connection
      */
     public String getUser() {
-		return params.getUser();
+        return params.getUser();
     }
 
     /**
      * <b>Description : </b> Gets the current user's password for the connection
-     * 
+     *
      * @return The user's password for the connection
      */
     public String getPassword() {
-		return params.getPassword();
+        return params.getPassword();
     }
 
     /**
      * <b>Description : </b> Gets the type of database being used (<I>MySQL</I>,
      * <I>Oracle</I>, ...)
-     * 
+     *
      * @return The type of database being used
      */
-	public DataBaseType getDb_type() {
-		return params.getDbType();
+    public DataBaseType getDb_type() {
+        return params.getDbType();
     }
 
     /**
      * ************************************************************************
      * <b>Description</b> : Methods that counts the number of non null rows in
      * an array
-     * 
-     * @param arr
-     *            an array of Strings
-     * @throws NullPointerException
-     *             *************************************************************
-     *             * ***********
+     *
+     * @param arr an array of Strings
+     * @throws NullPointerException *************************************************************
+     *                              * ***********
      */
     public int getArrayCount(final String[] arr) {
         int arrayCount = 0;
@@ -389,34 +350,31 @@ public class DataBaseAPI {
     /**
      * ************************************************************************
      * <b>Description : </b> Closes the connection with the database
-     * 
-     * @throws SnapshotingException
-     *             *************************************************************
-     *             * *********
+     *
+     * @throws SnapshotingException *************************************************************
+     *                              * *********
      */
     public void close(final Connection conn) {
-		closeConnection(conn);
+        closeConnection(conn);
     }
 
 
     /*****************************************************************************
-     * 
-     * 
+     *
+     *
      * Generals methods used to query SNAP (SELECT) (Extraction)
-     * 
+     *
      ****************************************************************************/
 
     /**
      * ************************************************************************
      * <b>Description : </b> Gets for a specified attribute its ID as defined in
      * SnapDb
-     * 
-     * @param att_name
-     *            The attribute's name
+     *
+     * @param att_name The attribute's name
      * @return The <I>SnapDb</I>'s ID that caracterize the given attribute
-     * @throws SnapshotingException
-     *             *************************************************************
-     *             * *********
+     * @throws SnapshotingException *************************************************************
+     *                              * *********
      */
     public int getAttID(final String att_name) throws SnapshotingException {
         int attributesID = 0;
@@ -428,13 +386,13 @@ public class DataBaseAPI {
         StringBuilder selectStringBuilder = new StringBuilder();
         try {
             // Preparing statement...
-			selectStringBuilder.append("SELECT " + SnapConst.ID + " FROM " + table_name + " WHERE ");
-			if (params.getDbType() == DataBaseType.ORACLE) {
-				selectStringBuilder.append("LOWER(" + SnapConst.fullName + ") like LOWER(?)");
+            selectStringBuilder.append("SELECT " + SnapConst.ID + " FROM " + table_name + " WHERE ");
+            if (params.getDbType() == DataBaseType.ORACLE) {
+                selectStringBuilder.append("LOWER(" + SnapConst.fullName + ") like LOWER(?)");
             } else {
-				selectStringBuilder.append(SnapConst.fullName + " like ?");
+                selectStringBuilder.append(SnapConst.fullName + " like ?");
             }
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             ps_get_att_id = conn.prepareStatement(selectStringBuilder.toString());
 
             final String field1 = att_name.trim();
@@ -466,9 +424,8 @@ public class DataBaseAPI {
      * <b>Description : </b> Checks if the attribute of the given name, is
      * already registered in <I>SnapDb</I> (and more particularly in the table
      * of the definitions).
-     * 
-     * @param att_name
-     *            The name of the attribute to check.
+     *
+     * @param att_name The name of the attribute to check.
      * @return boolean
      * @throws SnapshotingException
      */
@@ -484,9 +441,9 @@ public class DataBaseAPI {
     /**
      * <b>Description : </b> Returns the new id for the new context being
      * referenced in database <I>snap</I>.<I>(mySQL only)</I>
-     * 
+     *
      * @return Returns the new id for the new context being referenced in
-     *         database <I>snap</I>.
+     * database <I>snap</I>.
      * @throws SnapshotingException
      */
     public int getMaxContextID() throws SnapshotingException {
@@ -494,11 +451,11 @@ public class DataBaseAPI {
         ResultSet rset = null;
         String query;
         int res = 0;
-		query = "SELECT MAX(" + SnapConst.ID_CONTEXT + ") FROM " + getDbSchema() + "." + SnapConst.CONTEXT;
+        query = "SELECT MAX(" + SnapConst.ID_CONTEXT + ") FROM " + getDbSchema() + "." + SnapConst.CONTEXT;
 
         Connection conn = null;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             stmt = conn.createStatement();
             rset = stmt.executeQuery(query);
             // Gets the result of the query
@@ -527,34 +484,33 @@ public class DataBaseAPI {
     }
 
 
-
     /**
      * This method retrives from the the database, the list of all registered
      * contexts (or 'snap-patterns) which subscribe to the clause and/or have
      * the identifier id_context. Author : Laure Garda
-     * 
+     *
      * @param clause
      * @param id_context
      * @return a list of registered contexts (or 'snap-patterns)
      * @throws SnapshotingException
      */
     public List<SnapContext> getContext(final String clause, final int id_context) throws SnapshotingException {
-		String select_field = String.join(", ", SnapConst.TAB_CONTEXT);
+        String select_field = String.join(", ", SnapConst.TAB_CONTEXT);
         // Choix de la table dans laquelle effectuer la requete SQL.
         final String table_1 = getDbSchema() + "." + SnapConst.CONTEXT;
         // Affichage des resusltats par ordre croissant d'ID du context.
         final String orderBy = " ORDER BY " + SnapConst.ID_CONTEXT;
-        
-		String query = "SELECT " + select_field + " FROM " + table_1;
+
+        String query = "SELECT " + select_field + " FROM " + table_1;
 
         try (Handle handle = connector.getJdbi().open()) {
-            Query queryBinder = handle.createQuery(query+clause+orderBy);
-            if(id_context != -1) {
-            	queryBinder.bind(0,id_context);
+            Query queryBinder = handle.createQuery(query + clause + orderBy);
+            if (id_context != -1) {
+                queryBinder.bind(0, id_context);
             }
-			return queryBinder.map((rs, ctx) -> new SnapContext(rs.getString(SnapConst.author),
-					rs.getString(SnapConst.name), rs.getInt(SnapConst.ID_CONTEXT), rs.getDate(SnapConst.time),
-					rs.getString(SnapConst.reason), rs.getString(SnapConst.description))).list();
+            return queryBinder.map((rs, ctx) -> new SnapContext(rs.getString(SnapConst.author),
+                    rs.getString(SnapConst.name), rs.getInt(SnapConst.ID_CONTEXT), rs.getDate(SnapConst.time),
+                    rs.getString(SnapConst.reason), rs.getString(SnapConst.description))).list();
         }
 
     }
@@ -564,37 +520,37 @@ public class DataBaseAPI {
      * <b>Description : </b> Gets all snapshots from a given context Author :
      * Laure Garda : Renvoi les snapshots associes au contexte passe en
      * parametre qui verifient les conditions passees en parametre.
-     * 
+     *
      * @return array of strings
      * @throws SnapshotingException
      * @see SnapshotLight
-     *      ********************************************************************
-     *      * ****
+     * ********************************************************************
+     * * ****
      */
     public List<SnapshotLight> getContextAssociatedSnapshots(final String clause, final int id_context,
-            final int id_snap) throws SnapshotingException {
+                                                             final int id_snap) throws SnapshotingException {
         // Create and execute the SQL query string
         String query;
-		final String select_field = SnapConst.ID_SNAP + ", " + SnapConst.time + ", " + SnapConst.snap_comment;
+        final String select_field = SnapConst.ID_SNAP + ", " + SnapConst.time + ", " + SnapConst.snap_comment;
         // recuperation de la table des snapshot.
         final String table_1 = getDbSchema() + "." + SnapConst.SNAPSHOT;
-		final String orderBy = " ORDER BY " + SnapConst.ID_SNAP;
-
-		query = "SELECT " + select_field + " FROM " + table_1 + clause + orderBy;
-
-		try (Handle handle = connector.getJdbi().open()) {
-			Query queryBinder = handle.createQuery(query);
-			if (id_context != -1 && id_snap != -1) {
-				queryBinder.bind(0, id_snap);
-				queryBinder.bind(1, id_context);
-			} else if (id_context != -1) {
-				queryBinder.bind(0, id_context);
-			} else if (id_snap != -1) {
-				queryBinder.bind(0, id_snap);
-			}
-			return queryBinder.map((rs, ctx) -> new SnapshotLight(rs.getInt(SnapConst.ID_SNAP),
-					rs.getTimestamp(SnapConst.time), rs.getString(SnapConst.snap_comment))).list();
-		}
+        final String orderBy = " ORDER BY " + SnapConst.ID_SNAP;
+
+        query = "SELECT " + select_field + " FROM " + table_1 + clause + orderBy;
+
+        try (Handle handle = connector.getJdbi().open()) {
+            Query queryBinder = handle.createQuery(query);
+            if (id_context != -1 && id_snap != -1) {
+                queryBinder.bind(0, id_snap);
+                queryBinder.bind(1, id_context);
+            } else if (id_context != -1) {
+                queryBinder.bind(0, id_context);
+            } else if (id_snap != -1) {
+                queryBinder.bind(0, id_snap);
+            }
+            return queryBinder.map((rs, ctx) -> new SnapshotLight(rs.getInt(SnapConst.ID_SNAP),
+                    rs.getTimestamp(SnapConst.time), rs.getString(SnapConst.snap_comment))).list();
+        }
 
     }
 
@@ -602,9 +558,8 @@ public class DataBaseAPI {
     /**
      * Retrieves the context identifier to wich the given snapshot identifier is
      * associated.
-     * 
-     * @param snapID
-     *            the snapshot identifier
+     *
+     * @param snapID the snapshot identifier
      * @return the associated context identifier
      * @throws SnapshotingException
      */
@@ -614,12 +569,12 @@ public class DataBaseAPI {
         PreparedStatement preparedStatement = null;
         Connection conn = null;
         String query;
-		final String select_field = SnapConst.ID_CONTEXT;
+        final String select_field = SnapConst.ID_CONTEXT;
         final String table_1 = getDbSchema() + "." + SnapConst.SNAPSHOT;
         final String clause_1 = SnapConst.ID_SNAP + " like ?";
         query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             preparedStatement.setInt(1, snapID);
             rset = preparedStatement.executeQuery();
@@ -644,31 +599,31 @@ public class DataBaseAPI {
         return res;
     }
 
-	private void selectScalarRO(final List<SnapAttributeExtract> attributes, int snapID, String table)
-			throws SnapshotingException, SQLException {
-		if(attributes.isEmpty()) {
-			return;
-		}
+    private void selectScalarRO(final List<SnapAttributeExtract> attributes, int snapID, String table)
+            throws SnapshotingException, SQLException {
+        if (attributes.isEmpty()) {
+            return;
+        }
         Connection conn = null;
         PreparedStatement preparedStatement = null;
         ResultSet resultSet = null;
         // SELECT id_att, value FROM t_sc_num_1val WHERE id_snap = ?
-		final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.value + " FROM " + getDbSchema() + "."
-				+ table + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND " + SnapConst.ID_ATT
-				+ " IN (" + String.join(", ",
-						attributes.stream().map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList()))
-				+ ")";
+        final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.value + " FROM " + getDbSchema() + "."
+                + table + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND " + SnapConst.ID_ATT
+                + " IN (" + String.join(", ",
+                attributes.stream().map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList()))
+                + ")";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
-			resultSet = preparedStatement.executeQuery();
+            resultSet = preparedStatement.executeQuery();
             while (resultSet.next()) {
-            	int attId = resultSet.getInt(1);
-				final SnapAttributeExtract snapAttributeExtract = attributes.stream()
-						.filter(att -> att.getAttId() == attId).findFirst().get();
-				snapAttributeExtract.setValue(
-						TangoJAVAUtils.castResultSetAsObject(snapAttributeExtract.getDataType(), resultSet, 2),
-						Boolean.valueOf(resultSet.wasNull()));
+                int attId = resultSet.getInt(1);
+                final SnapAttributeExtract snapAttributeExtract = attributes.stream()
+                        .filter(att -> att.getAttId() == attId).findFirst().get();
+                snapAttributeExtract.setValue(
+                        TangoJAVAUtils.castResultSetAsObject(snapAttributeExtract.getDataType(), resultSet, 2),
+                        Boolean.valueOf(resultSet.wasNull()));
             }
         } finally {
             closeResultSet(resultSet);
@@ -678,39 +633,38 @@ public class DataBaseAPI {
     }
 
 
+    private void selectRO(final List<SnapAttributeExtract> attributes, int snapID,
+                          final String tableName) throws SnapshotingException, SQLException {
 
-	private void selectRO(final List<SnapAttributeExtract> attributes, int snapID,
-            final String tableName) throws SnapshotingException, SQLException {
-
-		Connection conn = null;
-		PreparedStatement preparedStatement = null;
-		ResultSet resultSet = null;
+        Connection conn = null;
+        PreparedStatement preparedStatement = null;
+        ResultSet resultSet = null;
 
-		List<String> scpectrumROAttId = attributes.stream()
-				.filter(s -> s.getDataFormat() == AttrDataFormat._SPECTRUM
-						&& (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
-				.map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList());
+        List<String> scpectrumROAttId = attributes.stream()
+                .filter(s -> s.getDataFormat() == AttrDataFormat._SPECTRUM
+                        && (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
+                .map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList());
 
-		if (scpectrumROAttId.isEmpty()) {
-			return;
-		}
+        if (scpectrumROAttId.isEmpty()) {
+            return;
+        }
         // SELECT id_att, value FROM t_sp_1val WHERE id_snap = ?
-		final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.value + " FROM " + getDbSchema() + "."
-				+ tableName + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND " + SnapConst.ID_ATT + " IN ("
-				+ String.join(", ", scpectrumROAttId) + ")";
+        final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.value + " FROM " + getDbSchema() + "."
+                + tableName + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND " + SnapConst.ID_ATT + " IN ("
+                + String.join(", ", scpectrumROAttId) + ")";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             resultSet = preparedStatement.executeQuery();
             while (resultSet.next()) {
-				int attId = resultSet.getInt(1);
-				final SnapAttributeExtract snapAttributeExtract = attributes.stream()
-						.filter(att -> att.getAttId() == attId).findFirst().get();
+                int attId = resultSet.getInt(1);
+                final SnapAttributeExtract snapAttributeExtract = attributes.stream()
+                        .filter(att -> att.getAttId() == attId).findFirst().get();
                 // fill data
                 final Clob readClob = resultSet.getClob(2);
                 if (readClob != null) {
                     final String value = readClob.getSubString(1, (int) readClob.length());
-					NullableData<?> data = getSpectrumValue(value, null, snapAttributeExtract.getDataType(),
+                    NullableData<?> data = getSpectrumValue(value, null, snapAttributeExtract.getDataType(),
                             false);
                     snapAttributeExtract.setValue(data.getValue(), data.getNullElements());
                 }
@@ -722,48 +676,48 @@ public class DataBaseAPI {
         }
     }
 
-	private void selectRW(final List<SnapAttributeExtract> attributes, final int snapID,
-            final String tableName) throws SnapshotingException, SQLException {
+    private void selectRW(final List<SnapAttributeExtract> attributes, final int snapID,
+                          final String tableName) throws SnapshotingException, SQLException {
         Connection conn = null;
         PreparedStatement preparedStatement = null;
         ResultSet resultSet = null;
         // SELECT id_att, read_value, write_value, dim_x FROM
         // t_sp_2val WHERE id_snap = ?
 
-		List<String> scpectrumRWAttId = attributes.stream().filter(s -> s.getDataFormat() == AttrDataFormat._SPECTRUM
-				&& (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
-				.map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList());
-		if (scpectrumRWAttId.isEmpty()) {
-			return;
-		}
+        List<String> scpectrumRWAttId = attributes.stream().filter(s -> s.getDataFormat() == AttrDataFormat._SPECTRUM
+                && (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
+                .map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList());
+        if (scpectrumRWAttId.isEmpty()) {
+            return;
+        }
 
-		final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.read_value + "," + SnapConst.write_value
-				+ "," + SnapConst.dim_x + " FROM " + getDbSchema() + "." + tableName + " WHERE " + SnapConst.ID_SNAP
-				+ "=" + snapID + " AND " + SnapConst.ID_ATT + " IN (" + String.join(", ", scpectrumRWAttId) + ")";
+        final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.read_value + "," + SnapConst.write_value
+                + "," + SnapConst.dim_x + " FROM " + getDbSchema() + "." + tableName + " WHERE " + SnapConst.ID_SNAP
+                + "=" + snapID + " AND " + SnapConst.ID_ATT + " IN (" + String.join(", ", scpectrumRWAttId) + ")";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             resultSet = preparedStatement.executeQuery();
             while (resultSet.next()) {
-				int attId = resultSet.getInt(1);
-				final SnapAttributeExtract snapAttributeExtract = attributes.stream()
-						.filter(att -> att.getAttId() == attId).findFirst().get();
-                        // fill data
-                        String readValue = null;
-                        String writeValue = null;
-                        final Clob readClob = resultSet.getClob(2);
-                        if (readClob != null) {
-                            readValue = readClob.getSubString(1, (int) readClob.length());
-                        }
-                        final Clob writeClob = resultSet.getClob(3);
-                        if (writeClob != null) {
-                            writeValue = writeClob.getSubString(1, (int) writeClob.length());
-                        }
-						NullableData<?> data = getSpectrumValue(readValue, writeValue,
-                                snapAttributeExtract.getDataType(), true);
-                        snapAttributeExtract.setValue(data.getValue(), data.getNullElements());
-                        snapAttributeExtract.setDimX(resultSet.getInt(4));
-					}
+                int attId = resultSet.getInt(1);
+                final SnapAttributeExtract snapAttributeExtract = attributes.stream()
+                        .filter(att -> att.getAttId() == attId).findFirst().get();
+                // fill data
+                String readValue = null;
+                String writeValue = null;
+                final Clob readClob = resultSet.getClob(2);
+                if (readClob != null) {
+                    readValue = readClob.getSubString(1, (int) readClob.length());
+                }
+                final Clob writeClob = resultSet.getClob(3);
+                if (writeClob != null) {
+                    writeValue = writeClob.getSubString(1, (int) writeClob.length());
+                }
+                NullableData<?> data = getSpectrumValue(readValue, writeValue,
+                        snapAttributeExtract.getDataType(), true);
+                snapAttributeExtract.setValue(data.getValue(), data.getNullElements());
+                snapAttributeExtract.setDimX(resultSet.getInt(4));
+            }
         } finally {
             closeResultSet(resultSet);
             closeStatement(preparedStatement);
@@ -771,41 +725,41 @@ public class DataBaseAPI {
         }
     }
 
-	private void selectScalarRW(final List<SnapAttributeExtract> attributes, int snapID, String table)
-			throws SnapshotingException, SQLException {
-		if (attributes.isEmpty()) {
-			return;
-		}
+    private void selectScalarRW(final List<SnapAttributeExtract> attributes, int snapID, String table)
+            throws SnapshotingException, SQLException {
+        if (attributes.isEmpty()) {
+            return;
+        }
         Connection conn = null;
         PreparedStatement preparedStatement = null;
         ResultSet resultSet = null;
         // SELECT id_att, read_value, write_value FROM t_sc_num_2val WHERE
         // id_snap = ?
-		final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.read_value + "," + SnapConst.write_value
-				+ " FROM " + getDbSchema() + "." + table + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND "
-				+ SnapConst.ID_ATT + " IN (" + String.join(", ",
-						attributes.stream().map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList()))
-				+ ")";
+        final String query = "SELECT " + SnapConst.ID_ATT + "," + SnapConst.read_value + "," + SnapConst.write_value
+                + " FROM " + getDbSchema() + "." + table + " WHERE " + SnapConst.ID_SNAP + "=" + snapID + " AND "
+                + SnapConst.ID_ATT + " IN (" + String.join(", ",
+                attributes.stream().map(s -> String.valueOf(s.getAttId())).collect(Collectors.toList()))
+                + ")";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             resultSet = preparedStatement.executeQuery();
             while (resultSet.next()) {
-            	int attId = resultSet.getInt(1);
-				final SnapAttributeExtract snapAttributeExtract = attributes.stream()
-						.filter(att -> att.getAttId() == attId).findFirst().get();
-                        // fill data
-						final Object value = TangoJAVAUtils.initPrimitiveArray(snapAttributeExtract.getDataType(), 2);
-                        final boolean[] nullElements = new boolean[2];
-
-						Array.set(value, 0, TangoJAVAUtils.castResultSetAsPrimitive(snapAttributeExtract.getDataType(),
-								resultSet, 2));
-						nullElements[0] = resultSet.wasNull();
-						Array.set(value, 1, TangoJAVAUtils.castResultSetAsPrimitive(snapAttributeExtract.getDataType(),
-								resultSet, 3));
-						nullElements[1] = resultSet.wasNull();
-
-                        snapAttributeExtract.setValue(value, nullElements);
+                int attId = resultSet.getInt(1);
+                final SnapAttributeExtract snapAttributeExtract = attributes.stream()
+                        .filter(att -> att.getAttId() == attId).findFirst().get();
+                // fill data
+                final Object value = TangoJAVAUtils.initPrimitiveArray(snapAttributeExtract.getDataType(), 2);
+                final boolean[] nullElements = new boolean[2];
+
+                Array.set(value, 0, TangoJAVAUtils.castResultSetAsPrimitive(snapAttributeExtract.getDataType(),
+                        resultSet, 2));
+                nullElements[0] = resultSet.wasNull();
+                Array.set(value, 1, TangoJAVAUtils.castResultSetAsPrimitive(snapAttributeExtract.getDataType(),
+                        resultSet, 3));
+                nullElements[1] = resultSet.wasNull();
+
+                snapAttributeExtract.setValue(value, nullElements);
             }
 
         } finally {
@@ -817,85 +771,80 @@ public class DataBaseAPI {
 
     /**
      * Retrieve a snapshot results'
-     * 
-     * @param attributes
-     *            the attributes to retrieve. Will contain results after
-     *            execution
-     * @param snapID
-     *            The snap ID
+     *
+     * @param attributes the attributes to retrieve. Will contain results after
+     *                   execution
+     * @param snapID     The snap ID
      * @throws SnapshotingException
      */
-	public void getSnapResults(final List<SnapAttributeExtract> attributes, final int snapID)
-			throws SnapshotingException {
-
-		// one sql request per table
-
-		List<SnapAttributeExtract> numericScalarRO = attributes.stream()
-				.filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
-						&& s.getDataType() != TangoConst.Tango_DEV_STRING
-						&& (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
-				.collect(Collectors.toList());
-
-		List<SnapAttributeExtract> stringScalarRO = attributes.stream()
-				.filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
-				&& s.getDataType() == TangoConst.Tango_DEV_STRING
-				&& (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
-				.collect(Collectors.toList());
-
-		List<SnapAttributeExtract> numericScalarRW = attributes.stream()
-				.filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
-				&& s.getDataType() != TangoConst.Tango_DEV_STRING
-				&& (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
-				.collect(Collectors.toList());
-
-		List<SnapAttributeExtract> stringScalarRW = attributes.stream()
-				.filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
-				&& s.getDataType() == TangoConst.Tango_DEV_STRING
-				&& (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
-				.collect(Collectors.toList());
-
-		try {
-			// --- Get scalar numeric read only values
-			selectScalarRO(numericScalarRO, snapID, SnapConst.T_SC_NUM_1VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-		try {
-			// --- Get scalar numeric read write values
-			selectScalarRW(numericScalarRW, snapID, SnapConst.T_SC_NUM_2VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-
-		try {
-			// --- Get scalar string read only values
-			selectScalarRO(stringScalarRO, snapID, SnapConst.T_SC_STR_1VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-
-		try {
-			// --- Get scalar numeric read write values
-			selectScalarRW(stringScalarRW, snapID, SnapConst.T_SC_STR_2VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-		try {
-			// --- Get spectrum read values
-			selectRO(attributes, snapID, SnapConst.T_SP_1VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-		try {
-			// --- Get spectrum read write values
-			selectRW(attributes, snapID, SnapConst.T_SP_2VAL);
-		} catch (SQLException | SnapshotingException e) {
-			logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
-		}
-    }
+    public void getSnapResults(final List<SnapAttributeExtract> attributes, final int snapID)
+            throws SnapshotingException {
+
+        // one sql request per table
 
+        List<SnapAttributeExtract> numericScalarRO = attributes.stream()
+                .filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
+                        && s.getDataType() != TangoConst.Tango_DEV_STRING
+                        && (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
+                .collect(Collectors.toList());
 
+        List<SnapAttributeExtract> stringScalarRO = attributes.stream()
+                .filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
+                        && s.getDataType() == TangoConst.Tango_DEV_STRING
+                        && (s.getWritable() == AttrWriteType._READ || s.getWritable() == AttrWriteType._WRITE))
+                .collect(Collectors.toList());
 
+        List<SnapAttributeExtract> numericScalarRW = attributes.stream()
+                .filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
+                        && s.getDataType() != TangoConst.Tango_DEV_STRING
+                        && (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
+                .collect(Collectors.toList());
+
+        List<SnapAttributeExtract> stringScalarRW = attributes.stream()
+                .filter(s -> s.getDataFormat() == AttrDataFormat._SCALAR
+                        && s.getDataType() == TangoConst.Tango_DEV_STRING
+                        && (s.getWritable() == AttrWriteType._READ_WITH_WRITE || s.getWritable() == AttrWriteType._READ_WRITE))
+                .collect(Collectors.toList());
+
+        try {
+            // --- Get scalar numeric read only values
+            selectScalarRO(numericScalarRO, snapID, SnapConst.T_SC_NUM_1VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+        try {
+            // --- Get scalar numeric read write values
+            selectScalarRW(numericScalarRW, snapID, SnapConst.T_SC_NUM_2VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+
+        try {
+            // --- Get scalar string read only values
+            selectScalarRO(stringScalarRO, snapID, SnapConst.T_SC_STR_1VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+
+        try {
+            // --- Get scalar numeric read write values
+            selectScalarRW(stringScalarRW, snapID, SnapConst.T_SC_STR_2VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+        try {
+            // --- Get spectrum read values
+            selectRO(attributes, snapID, SnapConst.T_SP_1VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+        try {
+            // --- Get spectrum read write values
+            selectRW(attributes, snapID, SnapConst.T_SP_2VAL);
+        } catch (SQLException | SnapshotingException e) {
+            logger.error(ERROR_EXTRACTING_SNAPSHOT_DATA, e);
+        }
+    }
 
 
     public void closeResultSet(final ResultSet resultSet) {
@@ -947,9 +896,8 @@ public class DataBaseAPI {
     }
 
 
-
-	private NullableData<?> getSpectrumValue(final String readStr, final String writeStr, final int dataType,
-            final boolean returnAsReadWrite) {
+    private NullableData<?> getSpectrumValue(final String readStr, final String writeStr, final int dataType,
+                                             final boolean returnAsReadWrite) {
         int readSize = 0, writeSize = 0;
         StringTokenizer readTokenizer;
         String readString = null, writeString = null;
@@ -960,7 +908,7 @@ public class DataBaseAPI {
             if ("".equals(readString) || "null".equals(readString) || "NaN".equalsIgnoreCase(readString)) {
                 readTokenizer = null;
             } else {
-				readTokenizer = new StringTokenizer(readString, GlobalConst.CLOB_SEPARATOR);
+                readTokenizer = new StringTokenizer(readString, GlobalConst.CLOB_SEPARATOR);
                 readSize += readTokenizer.countTokens();
             }
         }
@@ -973,7 +921,7 @@ public class DataBaseAPI {
             if ("".equals(writeString) || "null".equals(writeString) || "NaN".equalsIgnoreCase(writeString)) {
                 writeTokenizer = null;
             } else {
-				writeTokenizer = new StringTokenizer(writeString, GlobalConst.CLOB_SEPARATOR);
+                writeTokenizer = new StringTokenizer(writeString, GlobalConst.CLOB_SEPARATOR);
                 writeSize += writeTokenizer.countTokens();
             }
         }
@@ -981,12 +929,12 @@ public class DataBaseAPI {
         boolean[] nullRead = null;
         boolean[] nullWrite = null;
 
-		Object valueArr_read = TangoJAVAUtils.initPrimitiveArray(dataType, readSize);
-		Object valueArr_write = null;
-       
-      
+        Object valueArr_read = TangoJAVAUtils.initPrimitiveArray(dataType, readSize);
+        Object valueArr_write = null;
+
+
         if (returnAsReadWrite) {
-			valueArr_write = TangoJAVAUtils.initPrimitiveArray(dataType, writeSize);
+            valueArr_write = TangoJAVAUtils.initPrimitiveArray(dataType, writeSize);
         }
         int i = 0;
         if (readTokenizer != null) {
@@ -996,12 +944,12 @@ public class DataBaseAPI {
                 if (currentValRead == null || currentValRead.trim().equals("")) {
                     break;
                 }
-				if (TangoJAVAUtils.isNullOrNaN(currentValRead)) {
-					nullRead[i] = true;
-					Array.set(valueArr_read, i, TangoJAVAUtils.defaultValue(dataType));
-				} else {
-					Array.set(valueArr_read, i, TangoJAVAUtils.cast(dataType, currentValRead));
-				}
+                if (TangoJAVAUtils.isNullOrNaN(currentValRead)) {
+                    nullRead[i] = true;
+                    Array.set(valueArr_read, i, TangoJAVAUtils.defaultValue(dataType));
+                } else {
+                    Array.set(valueArr_read, i, TangoJAVAUtils.cast(dataType, currentValRead));
+                }
                 i++;
             }
         }
@@ -1014,131 +962,129 @@ public class DataBaseAPI {
                 if (currentValWrite == null || currentValWrite.trim().equals("")) {
                     break;
                 }
-				if (TangoJAVAUtils.isNullOrNaN(currentValWrite)) {
-					nullWrite[i] = true;
-					Array.set(valueArr_write, i, TangoJAVAUtils.defaultValue(dataType));
-				} else {
-					Array.set(valueArr_write, i, TangoJAVAUtils.cast(dataType, currentValWrite));
-				}
+                if (TangoJAVAUtils.isNullOrNaN(currentValWrite)) {
+                    nullWrite[i] = true;
+                    Array.set(valueArr_write, i, TangoJAVAUtils.defaultValue(dataType));
+                } else {
+                    Array.set(valueArr_write, i, TangoJAVAUtils.cast(dataType, currentValWrite));
+                }
                 i++;
             }
         }
 
         if (returnAsReadWrite) {
-			final Object[] result = new Object[] { valueArr_read, valueArr_write };
-            final boolean[][] nullElements = new boolean[][] { nullRead, nullWrite };
+            final Object[] result = new Object[]{valueArr_read, valueArr_write};
+            final boolean[][] nullElements = new boolean[][]{nullRead, nullWrite};
 
-			return new NullableData<boolean[][]>(result, nullElements);
+            return new NullableData<boolean[][]>(result, nullElements);
         } else {
-			return new NullableData<boolean[]>(valueArr_read, nullRead);
+            return new NullableData<boolean[]>(valueArr_read, nullRead);
         }
     }
 
     /*****************************************************************************
-     * 
-     * 
+     *
+     *
      * Generals methods used to update SNAP (CREATE / ALTER) (Insert)
-     * 
+     *
      ****************************************************************************/
 
     /**
      * This method registers a given attribute into the database for snapshots
      * This methos does not take care of id parameter of the given attribute as
      * this parameter is managed in the database side (autoincrement).
-     * 
-     * @param snapAttributeHeavy
-     *            the attribute to register
+     *
+     * @param snapAttributeHeavy the attribute to register
      * @throws SnapshotingException
      */
-	public void registerAttribute(final AttributeHeavy snapAttributeHeavy) throws SnapshotingException {
-		Connection conn = null;
-		Object[] listValues = new Object[] { snapAttributeHeavy.getAttributeCompleteName(),
-				snapAttributeHeavy.getAttribute_device_name(), snapAttributeHeavy.getDomain(),
-				snapAttributeHeavy.getFamily(), snapAttributeHeavy.getMember(), snapAttributeHeavy.getAttribute_name(),
-				snapAttributeHeavy.getDataType(), snapAttributeHeavy.getDataFormat(), snapAttributeHeavy.getWritable(),
-				snapAttributeHeavy.getMax_dim_x(), snapAttributeHeavy.getMax_dim_y(), snapAttributeHeavy.getLevel(),
-				snapAttributeHeavy.getCtrl_sys(), snapAttributeHeavy.getArchivable(),
-				snapAttributeHeavy.getSubstitute() };
-
-		StringBuilder valueConcat = new StringBuilder();
-
-		PreparedStatement preparedStatement = null;
-		String query = "";
-		if (params.getDbType() == DataBaseType.MYSQL) {
-
-			final String tableName = getDbSchema() + "." + SnapConst.AST;
-
-			// Create and execute the SQL query string
-			// Build the query string
-			String insert_fields = String.join(", ", SnapConst.TAB_DEF);
-
-			String insert_values = "";
-			for (int i = 1; i < SnapConst.TAB_DEF.length - 1; i++) {
-				insert_values = insert_values + "?" + ", ";
-			}
-			insert_values = insert_values + "?";
-
-			query = "INSERT INTO " + tableName + " (" + insert_fields + ") " + " VALUES(" + insert_values + " ) ";
-		} else if (params.getDbType() == DataBaseType.ORACLE) {
-			final String procName = "RSA";
-			query = "{call " + getDbSchema() + "." + procName + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
-		}
-
-		try {
-			conn = connector.getConnection();
-			preparedStatement = params.getDbType() == DataBaseType.MYSQL ? conn.prepareStatement(query)
-					: conn.prepareCall(query);
-			if (params.getDbType() == DataBaseType.MYSQL) {
-				preparedStatement.setDate(1, new java.sql.Date(snapAttributeHeavy.getRegistration_time().getTime()));
-			} else {
-				preparedStatement.setTimestamp(1, snapAttributeHeavy.getRegistration_time());
-			}
-
-			valueConcat.append("(");
-			for (int i = 2; i < listValues.length + 2; ++i) {
-				Object value = listValues[i - 2];
-				if (value instanceof Integer) {
-					int intValue = ((Integer) value).intValue();
-					preparedStatement.setInt(i, intValue);
-					valueConcat.append(intValue);
-				}
-				if (value instanceof String) {
-					preparedStatement.setString(i, (String) value);
-					valueConcat.append((String) value);
-				}
-				valueConcat.append(",");
-			}
-			valueConcat.append(")");
-
-			preparedStatement.executeUpdate();
-			listValues = null;
-			valueConcat = null;
-
-			// preparedStatement.close();
-		} catch (final SQLException e) {
-			final String message = SnapConst.SNAPSHOTING_ERROR_PREFIX + " : " + SnapConst.QUERY_FAILURE;
-			final String reason = "Failed while executing DataBaseAPI.registerAttribute() method...";
-			final String desc = "";
-			final String queryDebug = query + " => " + valueConcat.toString();
-			throw new SnapshotingException(message, reason, queryDebug, ErrSeverity.PANIC, desc, "", e);
-		} finally {
-			closeStatement(preparedStatement);
-			closeConnection(conn);
-		}
-
-	}
+    public void registerAttribute(final AttributeHeavy snapAttributeHeavy) throws SnapshotingException {
+        Connection conn = null;
+        Object[] listValues = new Object[]{snapAttributeHeavy.getAttributeCompleteName(),
+                snapAttributeHeavy.getAttribute_device_name(), snapAttributeHeavy.getDomain(),
+                snapAttributeHeavy.getFamily(), snapAttributeHeavy.getMember(), snapAttributeHeavy.getAttribute_name(),
+                snapAttributeHeavy.getDataType(), snapAttributeHeavy.getDataFormat(), snapAttributeHeavy.getWritable(),
+                snapAttributeHeavy.getMax_dim_x(), snapAttributeHeavy.getMax_dim_y(), snapAttributeHeavy.getLevel(),
+                snapAttributeHeavy.getCtrl_sys(), snapAttributeHeavy.getArchivable(),
+                snapAttributeHeavy.getSubstitute()};
+
+        StringBuilder valueConcat = new StringBuilder();
+
+        PreparedStatement preparedStatement = null;
+        String query = "";
+        if (params.getDbType() == DataBaseType.MYSQL) {
+
+            final String tableName = getDbSchema() + "." + SnapConst.AST;
+
+            // Create and execute the SQL query string
+            // Build the query string
+            String insert_fields = String.join(", ", SnapConst.TAB_DEF);
+
+            String insert_values = "";
+            for (int i = 1; i < SnapConst.TAB_DEF.length - 1; i++) {
+                insert_values = insert_values + "?" + ", ";
+            }
+            insert_values = insert_values + "?";
+
+            query = "INSERT INTO " + tableName + " (" + insert_fields + ") " + " VALUES(" + insert_values + " ) ";
+        } else if (params.getDbType() == DataBaseType.ORACLE) {
+            final String procName = "RSA";
+            query = "{call " + getDbSchema() + "." + procName + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
+        }
+
+        try {
+            conn = connector.getConnection();
+            preparedStatement = params.getDbType() == DataBaseType.MYSQL ? conn.prepareStatement(query)
+                    : conn.prepareCall(query);
+            if (params.getDbType() == DataBaseType.MYSQL) {
+                preparedStatement.setDate(1, new java.sql.Date(snapAttributeHeavy.getRegistration_time().getTime()));
+            } else {
+                preparedStatement.setTimestamp(1, snapAttributeHeavy.getRegistration_time());
+            }
+
+            valueConcat.append("(");
+            for (int i = 2; i < listValues.length + 2; ++i) {
+                Object value = listValues[i - 2];
+                if (value instanceof Integer) {
+                    int intValue = ((Integer) value).intValue();
+                    preparedStatement.setInt(i, intValue);
+                    valueConcat.append(intValue);
+                }
+                if (value instanceof String) {
+                    preparedStatement.setString(i, (String) value);
+                    valueConcat.append((String) value);
+                }
+                valueConcat.append(",");
+            }
+            valueConcat.append(")");
+
+            preparedStatement.executeUpdate();
+            listValues = null;
+            valueConcat = null;
+
+            // preparedStatement.close();
+        } catch (final SQLException e) {
+            final String message = SnapConst.SNAPSHOTING_ERROR_PREFIX + " : " + SnapConst.QUERY_FAILURE;
+            final String reason = "Failed while executing DataBaseAPI.registerAttribute() method...";
+            final String desc = "";
+            final String queryDebug = query + " => " + valueConcat.toString();
+            throw new SnapshotingException(message, reason, queryDebug, ErrSeverity.PANIC, desc, "", e);
+        } finally {
+            closeStatement(preparedStatement);
+            closeConnection(conn);
+        }
+
+    }
 
     /**
      * This method registers a new context in the database for snapshots.
-     * 
-     * @param snapContext
-     *            the new context to register into the database for snapshots.
+     *
+     * @param snapContext the new context to register into the database for snapshots.
      * @return the context identifier (int) associated to the new registered
-     *         context.
+     * context.
      * @throws SnapshotingException
      */
     public int create_context(final SnapContext snapContext) throws SnapshotingException {
-		// TODO refact
+        // TODO refact
         int contextID = snapContext.getId();
         final String tableName = getDbSchema() + "." + SnapConst.CONTEXT;
         final java.util.List<Integer> contextIDList = new ArrayList<Integer>();
@@ -1146,7 +1092,7 @@ public class DataBaseAPI {
         Connection conn = null;
         final String queryCurrentContext = "select " + SnapConst.ID_CONTEXT + " from " + tableName;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             // check if context exists
             prest = conn.prepareStatement(queryCurrentContext);
             final ResultSet rs = prest.executeQuery();
@@ -1160,8 +1106,8 @@ public class DataBaseAPI {
                 // update snap.context SET name=?, author=?, reason=?,
                 // description=? where id =?;
                 final String updateQuery = "UPDATE " + tableName + " SET " + SnapConst.name + "= ?, "
-						+ SnapConst.author + "= ?, " + SnapConst.reason + "= ?, " + SnapConst.description + "= ? WHERE "
-						+ SnapConst.ID_CONTEXT + "= ?";
+                        + SnapConst.author + "= ?, " + SnapConst.reason + "= ?, " + SnapConst.description + "= ? WHERE "
+                        + SnapConst.ID_CONTEXT + "= ?";
                 try {
 
                     preparedStatement = conn.prepareStatement(updateQuery);
@@ -1186,7 +1132,7 @@ public class DataBaseAPI {
                 }
 
             } else { // context does not exists, create it
-				if (params.getDbType() == DataBaseType.MYSQL) {
+                if (params.getDbType() == DataBaseType.MYSQL) {
                     // Create and execute the SQL query string
                     // Build the query string
                     final String insert_fields = SnapConst.TAB_CONTEXT[1] + ", " + SnapConst.name + ", "
@@ -1218,7 +1164,7 @@ public class DataBaseAPI {
                     } finally {
                         closeStatement(preparedStatement);
                     }
-				} else if (params.getDbType() == DataBaseType.ORACLE) {
+                } else if (params.getDbType() == DataBaseType.ORACLE) {
                     CallableStatement callableStatement = null;
                     final String procName = "register_context";
                     final String query = "{? = call " + getDbSchema() + "." + procName + "(?, ?, ?, ?, ?)}";
@@ -1263,45 +1209,45 @@ public class DataBaseAPI {
         return contextID;
     }
 
-	public List<AttributeHeavy> getContextAttributes(final int contextID, final String whereClause)
+    public List<AttributeHeavy> getContextAttributes(final int contextID, final String whereClause)
             throws SnapshotingException {
-		final List<AttributeHeavy> result = new ArrayList<AttributeHeavy>();
+        final List<AttributeHeavy> result = new ArrayList<AttributeHeavy>();
 
         // Create and execute the SQL query string
         final String ast = getDbSchema() + "." + SnapConst.AST;
         final String context = getDbSchema() + "." + SnapConst.CONTEXT;
         final String list = getDbSchema() + "." + SnapConst.LIST;
         final String tables = ast + ", " + context + ", " + list;
-		final String selectFields = SnapConst.ID + ", " + ast + "." + SnapConst.time + ", " + SnapConst.fullName + ", "
-				+ SnapConst.device + ", " + SnapConst.domain + ", " + SnapConst.family + ", " + SnapConst.member + ", "
-				+ SnapConst.attName + ", " + SnapConst.dataType + ", " + SnapConst.dataFormat + ", "
-				+ SnapConst.writable + ", " + SnapConst.max_dim_x + ", " + SnapConst.max_dim_y + ", " + SnapConst.levelg
-				+ ", " + SnapConst.facility + ", " + SnapConst.archivable + ", " + SnapConst.substitute;
+        final String selectFields = SnapConst.ID + ", " + ast + "." + SnapConst.time + ", " + SnapConst.fullName + ", "
+                + SnapConst.device + ", " + SnapConst.domain + ", " + SnapConst.family + ", " + SnapConst.member + ", "
+                + SnapConst.attName + ", " + SnapConst.dataType + ", " + SnapConst.dataFormat + ", "
+                + SnapConst.writable + ", " + SnapConst.max_dim_x + ", " + SnapConst.max_dim_y + ", " + SnapConst.levelg
+                + ", " + SnapConst.facility + ", " + SnapConst.archivable + ", " + SnapConst.substitute;
 
         // final String selectFields = "*";
         final String clause1 = SnapConst.AST + "." + SnapConst.ID + " = " + SnapConst.LIST + "."
-				+ SnapConst.ID_ATT;
-		final String clause2 = SnapConst.LIST + "." + SnapConst.ID_CONTEXT + " = " + SnapConst.CONTEXT + "."
+                + SnapConst.ID_ATT;
+        final String clause2 = SnapConst.LIST + "." + SnapConst.ID_CONTEXT + " = " + SnapConst.CONTEXT + "."
                 + SnapConst.ID_CONTEXT;
         final String clause3 = SnapConst.CONTEXT + "." + SnapConst.ID_CONTEXT + " = ?";
         // the SQL request is : select DISTINCT full_name from snap.ast where
         // ast.id = list.id_att and list.id_context = context.id_context and
         // context.name = 'nom';
-		String query = "SELECT " + selectFields + " FROM " + tables
-				+ (whereClause.equals("") ? " WHERE " : whereClause + " AND ") + clause1 + " AND " + clause2 + " AND "
+        String query = "SELECT " + selectFields + " FROM " + tables
+                + (whereClause.equals("") ? " WHERE " : whereClause + " AND ") + clause1 + " AND " + clause2 + " AND "
                 + clause3;
 
         PreparedStatement statement = null;
         ResultSet rset = null;
         Connection conn = null;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             statement = conn.prepareStatement(query);
             statement.setInt(1, contextID);
             rset = statement.executeQuery();
             // Gets the result of the query
             while (rset.next()) {
-				final AttributeHeavy snapAttributeHeavy = new AttributeHeavy();
+                final AttributeHeavy snapAttributeHeavy = new AttributeHeavy();
                 snapAttributeHeavy.setAttributeId(rset.getInt(1));
                 snapAttributeHeavy.setRegistration_time(rset.getTimestamp(2));
                 snapAttributeHeavy.setAttributeCompleteName(rset.getString(3));
@@ -1337,9 +1283,8 @@ public class DataBaseAPI {
 
     /**
      * Retrieve ID, data_type, data_format, writable of some attributes
-     * 
-     * @param attributeNames
-     *            The attribute names
+     *
+     * @param attributeNames The attribute names
      * @return
      * @throws SnapshotingException
      */
@@ -1363,14 +1308,14 @@ public class DataBaseAPI {
         PreparedStatement preparedStatement = null;
         ResultSet rset = null;
         Connection conn = null;
-		Map<String, AttributeLight> extractMap = new HashMap<String, AttributeLight>();
+        Map<String, AttributeLight> extractMap = new HashMap<String, AttributeLight>();
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             rset = preparedStatement.executeQuery();
             // Gets the result of the query
             while (rset.next()) {
-				final AttributeLight snapAttributeLight = new AttributeLight();
+                final AttributeLight snapAttributeLight = new AttributeLight();
                 snapAttributeLight.setAttributeCompleteName(rset.getString(SnapConst.fullName));
                 snapAttributeLight.setAttributeId(rset.getInt(SnapConst.ID));
                 snapAttributeLight.setDataType(rset.getInt(SnapConst.dataType));
@@ -1393,11 +1338,11 @@ public class DataBaseAPI {
         }
         int index = 0;
         for (String attributeName : attributeNames) {
-			AttributeLight snapAttributeLight = extractMap.remove(attributeName);
+            AttributeLight snapAttributeLight = extractMap.remove(attributeName);
             if (snapAttributeLight == null) {
                 // case sensitivity problem
                 String nameToUse = null;
-				for (Entry<String, AttributeLight> entry : extractMap.entrySet()) {
+                for (Entry<String, AttributeLight> entry : extractMap.entrySet()) {
                     String tmpName = entry.getKey();
                     if ((tmpName != null) && tmpName.equalsIgnoreCase(attributeName)) {
                         nameToUse = tmpName;
@@ -1418,9 +1363,8 @@ public class DataBaseAPI {
 
     /**
      * This method returns the list of attributes associated to a context
-     * 
-     * @param id_context
-     *            The given context's identifier
+     *
+     * @param id_context The given context's identifier
      * @return The list of attributes associated to the given context
      * @throws SnapshotingException
      * @see SnapAttributeLight
@@ -1443,8 +1387,8 @@ public class DataBaseAPI {
                 SnapConst.dataFormat + ", " + // data_format
                 SnapConst.writable; // writable
         final String clause_1 = SnapConst.AST + "." + SnapConst.ID + " = " + SnapConst.LIST + "."
-				+ SnapConst.ID_ATT;
-		final String clause_2 = SnapConst.LIST + "." + SnapConst.ID_CONTEXT + " = " + SnapConst.CONTEXT + "."
+                + SnapConst.ID_ATT;
+        final String clause_2 = SnapConst.LIST + "." + SnapConst.ID_CONTEXT + " = " + SnapConst.CONTEXT + "."
                 + SnapConst.ID_CONTEXT;
         final String clause_3 = SnapConst.CONTEXT + "." + SnapConst.ID_CONTEXT + " = ?";
         // the SQL request is : select DISTINCT full_name from snap.ast where
@@ -1454,14 +1398,14 @@ public class DataBaseAPI {
                 + " AND " + clause_3;
 
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
 
             preparedStatement.setInt(1, id_context);
             rset = preparedStatement.executeQuery();
             // Gets the result of the query
             while (rset.next()) {
-				final AttributeLight snapAttributeLight = new AttributeLight();
+                final AttributeLight snapAttributeLight = new AttributeLight();
                 snapAttributeLight.setAttributeCompleteName(rset.getString(SnapConst.fullName));
                 snapAttributeLight.setAttributeId(rset.getInt(SnapConst.ID));
                 snapAttributeLight.setDataType(rset.getInt(SnapConst.dataType));
@@ -1488,25 +1432,25 @@ public class DataBaseAPI {
 
     /**
      * Registers the link between an attribute and a given context.
-     * 
+     *
      * @param snapContext
      * @throws SnapshotingException
      */
     public void setContextAssociatedAttributes(final SnapContext snapContext) throws SnapshotingException {
         final int id_context = snapContext.getId();
-		final List<AttributeLight> attList = snapContext.getAttributeList();
+        final List<AttributeLight> attList = snapContext.getAttributeList();
         PreparedStatement preparedStatement = null;
         final String tableName = getDbSchema() + "." + SnapConst.LIST;
 
         String query;
-		final String insert_fields = SnapConst.ID_CONTEXT + ", " + SnapConst.ID_ATT;
+        final String insert_fields = SnapConst.ID_CONTEXT + ", " + SnapConst.ID_ATT;
         query = "INSERT INTO " + tableName + " (" + insert_fields + ")" + " VALUES (?,?)";
         PreparedStatement prest = null;
         Connection conn = null;
-		final String selectQuery = "select " + SnapConst.ID_ATT + " from " + tableName + " where "
-				+ SnapConst.ID_CONTEXT + " = " + id_context;
+        final String selectQuery = "select " + SnapConst.ID_ATT + " from " + tableName + " where "
+                + SnapConst.ID_CONTEXT + " = " + id_context;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             prest = conn.prepareStatement(selectQuery);
             final ResultSet rs = prest.executeQuery();
             final List<Integer> attributeIDList = new ArrayList<Integer>();
@@ -1549,12 +1493,10 @@ public class DataBaseAPI {
 
     /**
      * This method registers a new snapshots and retrieves its identifier
-     * 
-     * @param contextID
-     *            the context identifier to wich the new registered snapshots
-     *            belongs to.
-     * @param timestamp
-     *            the registration timestamp
+     *
+     * @param contextID the context identifier to wich the new registered snapshots
+     *                  belongs to.
+     * @param timestamp the registration timestamp
      * @return the identifier for the new registered snapshot
      * @throws SnapshotingException
      * @see #getMaxContextID()
@@ -1564,9 +1506,9 @@ public class DataBaseAPI {
      */
     public Snapshot createNewSnap(final int contextID, final Timestamp timestamp) throws SnapshotingException {
         Snapshot snapShot = new Snapshot();
-		if (params.getDbType() == DataBaseType.MYSQL) {
+        if (params.getDbType() == DataBaseType.MYSQL) {
             snapShot = createNewSnapMySQL(contextID, timestamp);
-		} else if (params.getDbType() == DataBaseType.ORACLE) {
+        } else if (params.getDbType() == DataBaseType.ORACLE) {
             snapShot = createNewSnapOracle(contextID, timestamp);
         }
         return snapShot;
@@ -1574,12 +1516,10 @@ public class DataBaseAPI {
 
     /**
      * This method registers a new snapshots and retrieves its identifier
-     * 
-     * @param contextID
-     *            the context identifier to wich the new registered snapshots
-     *            belongs to.
-     * @param timestamp
-     *            the registration timestamp
+     *
+     * @param contextID the context identifier to wich the new registered snapshots
+     *                  belongs to.
+     * @param timestamp the registration timestamp
      * @return the identifier for the new registered snapshot
      * @throws SnapshotingException
      * @see #getMaxContextID()
@@ -1620,12 +1560,10 @@ public class DataBaseAPI {
 
     /**
      * This method registers a new snapshots and retrieves its identifier
-     * 
-     * @param contextID
-     *            the context identifier to wich the new registered snapshots
-     *            belongs to.
-     * @param timestamp
-     *            the registration timestamp
+     *
+     * @param contextID the context identifier to wich the new registered snapshots
+     *                  belongs to.
+     * @param timestamp the registration timestamp
      * @return the identifier for the new registered snapshot
      * @throws SnapshotingException
      * @see #getMaxContextID()
@@ -1644,7 +1582,7 @@ public class DataBaseAPI {
 
         Connection conn = null;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             cstmt_register_snapshot = conn.prepareCall(query);
             cstmt_register_snapshot.registerOutParameter(1, Types.INTEGER);
             cstmt_register_snapshot.setInt(2, contextID);
@@ -1673,7 +1611,7 @@ public class DataBaseAPI {
 
     /**
      * This method is used to update the ContextID for a snap record
-     * 
+     *
      * @param id_snap
      * @param initial_context_value
      * @throws SnapshotingException
@@ -1685,13 +1623,13 @@ public class DataBaseAPI {
     private void updateSnapContextID(final int id_snap, final int initial_context_value) throws SnapshotingException {
         PreparedStatement preparedStatement = null;
         final String table = getDbSchema() + "." + SnapConst.SNAPSHOT;
-		final String query = "UPDATE " + table + " SET " + SnapConst.ID_CONTEXT + "=? " + "WHERE " + SnapConst.ID_SNAP
-				+ "=?";
+        final String query = "UPDATE " + table + " SET " + SnapConst.ID_CONTEXT + "=? " + "WHERE " + SnapConst.ID_SNAP
+                + "=?";
         Connection conn = null;
 
         try {
 
-			conn = connector.getConnection();
+            conn = connector.getConnection();
 
             // preparedStatement = dbconn.prepareStatement(query);
             preparedStatement = conn.prepareStatement(query);
@@ -1713,7 +1651,7 @@ public class DataBaseAPI {
     /**
      * Remplace le commentaire d'un snapshot donne par celui passe en argument.
      * Author : Laure Garda
-     * 
+     *
      * @param id_snap
      * @param new_comment
      * @throws SnapshotingException
@@ -1722,10 +1660,10 @@ public class DataBaseAPI {
         PreparedStatement preparedStatement = null;
         Connection conn = null;
         final String table = getDbSchema() + "." + SnapConst.SNAPSHOT;
-		final String query = "UPDATE " + table + " SET " + SnapConst.snap_comment + " = '" + new_comment + "' WHERE "
-				+ SnapConst.ID_SNAP + " = ?";
+        final String query = "UPDATE " + table + " SET " + SnapConst.snap_comment + " = '" + new_comment + "' WHERE "
+                + SnapConst.ID_SNAP + " = ?";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             preparedStatement.setInt(1, id_snap);
             preparedStatement.executeUpdate();
@@ -1743,9 +1681,8 @@ public class DataBaseAPI {
 
     /**
      * Get the comment of a snapshot
-     * 
-     * @param snapID
-     *            the snapshot ID
+     *
+     * @param snapID the snapshot ID
      * @return the comment
      * @throws SnapshotingException
      */
@@ -1754,11 +1691,11 @@ public class DataBaseAPI {
         PreparedStatement preparedStatement = null;
         ResultSet resultSet = null;
         final String table = getDbSchema() + "." + SnapConst.SNAPSHOT;
-		final String query = "SELECT " + SnapConst.snap_comment + " FROM " + table + " WHERE " + SnapConst.ID_SNAP
-				+ " = " + snapID;
+        final String query = "SELECT " + SnapConst.snap_comment + " FROM " + table + " WHERE " + SnapConst.ID_SNAP
+                + " = " + snapID;
         String comment = "";
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             resultSet = preparedStatement.executeQuery();
             if (resultSet.next()) {
@@ -1780,7 +1717,7 @@ public class DataBaseAPI {
     /**
      * This methos is used to retrieve the snapID when registered with a
      * temporary generated and unique contextID
-     * 
+     *
      * @param id_context
      * @return the newly created snap identifier
      * @throws SnapshotingException
@@ -1793,13 +1730,13 @@ public class DataBaseAPI {
         int idSnap = -1;
         final String table = getDbSchema() + "." + SnapConst.SNAPSHOT;
         final String selectField = SnapConst.ID_SNAP;
-		final String clause_1 = SnapConst.ID_CONTEXT + "=?";
+        final String clause_1 = SnapConst.ID_CONTEXT + "=?";
         final String query = "SELECT " + selectField + " FROM " + table + " WHERE " + clause_1;
         PreparedStatement preparedStatement = null;
         ResultSet rset = null;
         Connection conn = null;
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             preparedStatement.setInt(1, id_context);
             rset = preparedStatement.executeQuery();
@@ -1825,7 +1762,7 @@ public class DataBaseAPI {
     /**
      * This methods registers a new snapShot in the database, but with a wrong
      * context identifier
-     * 
+     *
      * @param id_context
      * @throws SnapshotingException
      * @see #getMaxContextID()
@@ -1837,13 +1774,13 @@ public class DataBaseAPI {
         final java.sql.Timestamp time = new java.sql.Timestamp(new java.util.Date().getTime());
         PreparedStatement preparedStatement = null;
         final String table = getDbSchema() + "." + SnapConst.SNAPSHOT;
-		final String insert_fields = SnapConst.ID_CONTEXT + ", " + SnapConst.time;
+        final String insert_fields = SnapConst.ID_CONTEXT + ", " + SnapConst.time;
         final String insert_values = "?, ?";
         final String query = "INSERT INTO " + table + " (" + insert_fields + ") VALUES(" + insert_values + ")";
         Connection conn = null;
 
         try {
-			conn = connector.getConnection();
+            conn = connector.getConnection();
             preparedStatement = conn.prepareStatement(query);
             // preparedStatement = conn.prepareStatement(query);
             preparedStatement.setInt(1, id_context);
@@ -1870,8 +1807,7 @@ public class DataBaseAPI {
     }
 
     /**
-     * @param currentSpectrumDimX
-     *            The currentSpectrumDimX to set.
+     * @param currentSpectrumDimX The currentSpectrumDimX to set.
      */
     public void setCurrentSpectrumDimX(final int currentSpectrumDimX) {
         this.currentSpectrumDimX = currentSpectrumDimX;
@@ -1881,21 +1817,21 @@ public class DataBaseAPI {
     // Inner classes //
     // ///////////// //
 
-	public static class NullableData<T> {
-		private final Object value;
-		private final T nullElements;
+    public static class NullableData<T> {
+        private final Object value;
+        private final T nullElements;
 
-		public NullableData(Object value, T nullElements) {
+        public NullableData(Object value, T nullElements) {
             super();
             this.value = value;
             this.nullElements = nullElements;
         }
 
-		public Object getValue() {
+        public Object getValue() {
             return value;
         }
 
-		public T getNullElements() {
+        public T getNullElements() {
             return nullElements;
         }
     }
diff --git a/src/main/java/fr/soleil/archiving/snap/api/manager/SnapManagerApi.java b/src/main/java/fr/soleil/archiving/snap/api/manager/SnapManagerApi.java
index f6b10faa01a80c770f403af3789709d48a24b145..063112c3be1c77189865d48852628b7811de7083 100644
--- a/src/main/java/fr/soleil/archiving/snap/api/manager/SnapManagerApi.java
+++ b/src/main/java/fr/soleil/archiving/snap/api/manager/SnapManagerApi.java
@@ -94,15 +94,6 @@
 
 package fr.soleil.archiving.snap.api.manager;
 
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.DevFailed;
@@ -117,10 +108,10 @@ import fr.esrf.TangoApi.DeviceAttribute;
 import fr.esrf.TangoApi.DeviceData;
 import fr.esrf.TangoApi.DeviceProxy;
 import fr.esrf.TangoDs.TangoConst;
+import fr.soleil.archiving.common.api.exception.ArchivingException;
 import fr.soleil.archiving.common.api.tools.AttributeHeavy;
 import fr.soleil.archiving.common.api.tools.AttributeLight;
 import fr.soleil.archiving.snap.api.DataBaseAPI;
-import fr.soleil.archiving.snap.api.SnapConnectionParameters;
 import fr.soleil.archiving.snap.api.tools.Criterions;
 import fr.soleil.archiving.snap.api.tools.SnapAttributeExtract;
 import fr.soleil.archiving.snap.api.tools.SnapConst;
@@ -128,29 +119,32 @@ import fr.soleil.archiving.snap.api.tools.SnapContext;
 import fr.soleil.archiving.snap.api.tools.Snapshot;
 import fr.soleil.archiving.snap.api.tools.SnapshotLight;
 import fr.soleil.archiving.snap.api.tools.SnapshotingException;
+import fr.soleil.database.connection.DataBaseParameters;
 import fr.soleil.database.connection.DataBaseParameters.DataBaseType;
 import fr.soleil.lib.project.math.NumberArrayUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
 
 public class SnapManagerApi {
 
+    // Device class
+    public static final String SNAP_ARCHIVER_DEVICE_CLASS = "SnapArchiver";
+    public static final String SNAP_MANAGER_DEVICE_CLASS = "SnapManager";
+    public static final String SNAP_EXTRACTOR_DEVICE_CLASS = "SnapExtractor";
     private static final Logger LOGGER = LoggerFactory.getLogger(SnapManagerApi.class);
-
     private static final String NAN_ARRAY = "[NaN]";
-
     private static final String NAN = "NaN";
-
     private static final String DATA_BASE_API_NOT_INIT = "DataBaseAPI not initialized";
-
     // Command name
     private static final String LAUNCH_SNAPHOT = "LaunchSnapShot";
     private static final String CREATE_CONTEXT = "CreateNewContext";
     private static final String TRIGGER_LAUNCH_SNAPHOT = "TriggerLaunchSnapShot";
-
-    // Device class
-    public static final String SNAP_ARCHIVER_DEVICE_CLASS = "SnapArchiver";
-    public static final String SNAP_MANAGER_DEVICE_CLASS = "SnapManager";
-    public static final String SNAP_EXTRACTOR_DEVICE_CLASS = "SnapExtractor";
-
     // Snap Data Base
     private static DataBaseAPI snapDataBase = null;
 
@@ -211,11 +205,11 @@ public class SnapManagerApi {
     /**
      * @return the snap database type (MySQL, ORACLE)...
      */
-	public static DataBaseType getSnapDbType() {
+    public static DataBaseType getSnapDbType() {
         if (snapDataBase != null) {
             return snapDataBase.getDb_type();
         }
-		return DataBaseType.UNKNOWN;
+        return DataBaseType.UNKNOWN;
     }
 
     // ============================================================
@@ -224,9 +218,8 @@ public class SnapManagerApi {
     /**
      * This method returns the name of one of the running devices, according to
      * the given class
-     * 
-     * @param deviceClass
-     *            The device's class
+     *
+     * @param deviceClass The device's class
      * @return The device's name
      * @throws DevFailed
      */
@@ -254,7 +247,7 @@ public class SnapManagerApi {
     /**
      * This method gets all the running SnapArchivers and stores the name in the
      * m_snapArchiverList
-     * 
+     *
      * @throws DevFailed
      */
     private static void initDeviceList(final String deviceClass) throws DevFailed {
@@ -283,7 +276,7 @@ public class SnapManagerApi {
 
     /**
      * Tests if the given device is alive
-     * 
+     *
      * @param deviceName
      * @return true if the device is running
      */
@@ -355,38 +348,17 @@ public class SnapManagerApi {
         return argout;
     }
 
-    public static synchronized void initFullSnapConnection(final String host, final String name, final String schema,
-            final String user, final String pass, final String isRac) throws SnapshotingException {
-
-        SnapConnectionParameters.initFromArgumentsProperties(host, name, schema, user, pass, isRac);
-        SnapConnectionParameters.initFromSystemProperties();
-        SnapConnectionParameters.initFromClassProperties();
-        SnapConnectionParameters.initFromDefaultProperties();
-
-        snapDataBase = new DataBaseAPI(SnapConnectionParameters.getSnapHost(), SnapConnectionParameters.getSnapName(),
-                SnapConnectionParameters.getSnapSchema(), SnapConnectionParameters.getSnapUser(),
-                SnapConnectionParameters.getSnapPassword(), SnapConnectionParameters.isSnapRac());
-
-        LOGGER.info(SnapConnectionParameters.appendSnapConnectionInfoLog(new StringBuilder("Connection info:\n"))
-                .toString());
-
-    }
-
-    public static synchronized void initSnapConnection(final String host, final String name, final String schema,
-            final String user, final String pass, final String isRac) throws SnapshotingException {
-
-        snapDataBase = new DataBaseAPI(host, name, schema, user, pass, Boolean.parseBoolean(isRac));
+    public static synchronized void initSnapConnection(DataBaseParameters parameters) throws ArchivingException {
+        snapDataBase = new DataBaseAPI(parameters);
     }
 
     /**
      * This method gets informations on a given attribute and registers the
      * attribute into the database "Snap"
-     * 
-     * @param att_complete_name
-     *            the given attribute
-     * @throws SnapshotingException
-     *             exception throwned in case of communications problems with
-     *             the device or database
+     *
+     * @param att_complete_name the given attribute
+     * @throws SnapshotingException exception throwned in case of communications problems with
+     *                              the device or database
      */
     private static void register(String att_complete_name) throws SnapshotingException {
         if (snapDataBase == null) {
@@ -419,7 +391,7 @@ public class SnapManagerApi {
 
             final Timestamp time = new Timestamp(new java.util.Date().getTime());
 
-			final AttributeHeavy snapAttribute = new AttributeHeavy(att_complete_name);
+            final AttributeHeavy snapAttribute = new AttributeHeavy(att_complete_name);
             snapAttribute.setRegistration_time(time);
             snapAttribute.setAttributeCompleteName(att_complete_name);
             snapAttribute.setAttribute_device_name(device_name);
@@ -451,9 +423,8 @@ public class SnapManagerApi {
 
     /**
      * This method insure that a given attribute was registered into Snap DB
-     * 
-     * @param attributeName
-     *            the attribute name.
+     *
+     * @param attributeName the attribute name.
      */
     public static void insureRegitration(final String attributeName) throws SnapshotingException {
         if (snapDataBase == null) {
@@ -466,7 +437,7 @@ public class SnapManagerApi {
 
     /**
      * TODO LG
-     * 
+     *
      * @param att_name
      * @return
      * @throws SnapshotingException
@@ -483,11 +454,11 @@ public class SnapManagerApi {
             throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
         }
         // Gets the attributes associated to the context
-		final List<AttributeLight> theoricAttList = snapContext.getAttributeList();
+        final List<AttributeLight> theoricAttList = snapContext.getAttributeList();
 
         // Registers the attributes into the Snap database
         for (int i = 0; i < theoricAttList.size(); i++) {
-			final AttributeLight snapAtt = theoricAttList.get(i);
+            final AttributeLight snapAtt = theoricAttList.get(i);
             final String attributeName = snapAtt.getAttributeCompleteName();
 
             // Verify that the choosen attribute is registered into the Snap
@@ -544,11 +515,10 @@ public class SnapManagerApi {
     /**
      * TODO LG Description : Extracts the clause SQL from the given criterions
      * and gets the contexts which subscribe to thoses conditions
-     * 
-     * @param criterions
-     *            Conditions related to the fields of the context table
+     *
+     * @param criterions Conditions related to the fields of the context table
      * @return a list of contexts which subscribe to the given conditions
-     *         (Criterions)
+     * (Criterions)
      * @throws SnapshotingException
      */
     public static List<SnapContext> getContext(final Criterions criterions) throws SnapshotingException {
@@ -568,7 +538,7 @@ public class SnapManagerApi {
      * This method - registers the new Sanpshot in the database SnapDB, - gets
      * the ID of the snapshot being built and - return a 'SnapShot' object with
      * the ID field filled.
-     * 
+     *
      * @return a 'SnapShot' object with the snapID field filled.
      * @throws SnapshotingException
      */
@@ -584,11 +554,10 @@ public class SnapManagerApi {
     /**
      * This method triggers the snapshoting oh attributes that belong to the
      * context identified by the the given contextID
-     * 
-     * @param contextID
-     *            The context identifier
+     *
+     * @param contextID The context identifier
      * @return The 'SnapManagerResult.OK_SNAPLAUNCH' if success,
-     *         'SnapManagerResult.ERROR_SNAPLAUNCH' otherwise
+     * 'SnapManagerResult.ERROR_SNAPLAUNCH' otherwise
      */
     public static int launchSnap(final int contextID) throws DevFailed {
 
@@ -629,29 +598,27 @@ public class SnapManagerApi {
      * TODO LG This method returns a list of attributes that belong to the
      * context identified by the given id_context and subscribe to the given
      * conditions (criterions)
-     * 
-     * @param id_context
-     *            The context identifier
-     * @param criterions
-     *            Conditions related to fields of the context table
+     *
+     * @param id_context The context identifier
+     * @param criterions Conditions related to fields of the context table
      * @return a list of attributes that belong to the context identified by the
-     *         given id_context and subscribe to the given conditions
-     *         (criterions)
+     * given id_context and subscribe to the given conditions
+     * (criterions)
      * @throws SnapshotingException
      */
-	public static List<AttributeHeavy> getContextAssociatedAttributes(final int id_context,
-            final Criterions criterions) throws SnapshotingException {
+    public static List<AttributeHeavy> getContextAssociatedAttributes(final int id_context,
+                                                                      final Criterions criterions) throws SnapshotingException {
         if (snapDataBase == null) {
             throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
         }
-		final List<AttributeHeavy> res = snapDataBase.getContextAttributes(id_context,
+        final List<AttributeHeavy> res = snapDataBase.getContextAttributes(id_context,
                 criterions.getAttributeClause());
         return res;
     }
 
     /**
      * TODO LG
-     * 
+     *
      * @param snapshot
      * @return
      * @throws SnapshotingException
@@ -662,14 +629,13 @@ public class SnapManagerApi {
     }
 
     /**
-     * 
      * @param snapshot
      * @param contextID
      * @return
      * @throws SnapshotingException
      */
     public static List<SnapAttributeExtract> getSnapshotAssociatedAttributes(final SnapshotLight snapshot,
-            int contextID) throws SnapshotingException {
+                                                                             int contextID) throws SnapshotingException {
         if (snapDataBase == null) {
             throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
         }
@@ -686,7 +652,6 @@ public class SnapManagerApi {
     }
 
 
-
     public static int getMaxID() throws SnapshotingException {
         if (snapDataBase == null) {
             throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
@@ -695,15 +660,13 @@ public class SnapManagerApi {
     }
 
 
-
     /**
      * TODO LG Description : Extracts the clause SQL from the given criterions
      * and gets the snapshots which subscribe to thoses conditions
-     * 
-     * @param criterions
-     *            Conditions related to the fields of the snapshot table
+     *
+     * @param criterions Conditions related to the fields of the snapshot table
      * @return a list of snapshots which subscribe to the given conditions
-     *         (Criterions)
+     * (Criterions)
      * @throws SnapshotingException
      */
     public static List<SnapshotLight> getContextAssociatedSnapshots(final Criterions criterions)
@@ -743,9 +706,9 @@ public class SnapManagerApi {
 
     public static SnapAttributeExtract[] getSnapValues(final int idSnap, final String... attributeNames)
             throws SnapshotingException {
-		if (snapDataBase == null) {
-			throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
-		}
+        if (snapDataBase == null) {
+            throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+        }
         final SnapAttributeExtract[] conf = snapDataBase.getAttributeConfig(attributeNames);
         snapDataBase.getSnapResults(Arrays.asList(conf), idSnap);
         return conf;
@@ -753,7 +716,7 @@ public class SnapManagerApi {
 
     /**
      * TODO LG
-     * 
+     *
      * @param id_snap
      * @param new_comment
      * @throws SnapshotingException
@@ -767,9 +730,8 @@ public class SnapManagerApi {
 
     /**
      * Get the comment of a snapshot
-     * 
-     * @param snapID
-     *            the snapshot ID
+     *
+     * @param snapID the snapshot ID
      * @return the comment
      * @throws SnapshotingException
      */
@@ -782,7 +744,7 @@ public class SnapManagerApi {
 
     /**
      * This method is used by a client (GUI) to trigger an equipment setting.
-     * 
+     *
      * @param snapShot
      * @throws SnapshotingException
      */
@@ -815,7 +777,7 @@ public class SnapManagerApi {
     /**
      * This method is used by a snapshoting device to actually set equipements
      * to the their values on the given snapshot.
-     * 
+     *
      * @param snapShot
      * @throws SnapshotingException
      */
@@ -943,7 +905,6 @@ public class SnapManagerApi {
     }
 
     /**
-     * 
      * @param cmd_name
      * @param option
      * @param id_snap
@@ -961,7 +922,7 @@ public class SnapManagerApi {
                 DeviceData device_data = null;
                 device_data = new DeviceData();
 
-                String[] first_argin = new String[] { cmd_name, option, String.valueOf(snapShot.getId_snap()) };
+                String[] first_argin = new String[]{cmd_name, option, String.valueOf(snapShot.getId_snap())};
                 String[] argin = first_argin;
                 if (snapShot.isFiltered()) {
                     List<SnapAttributeExtract> attributes = snapShot.getAttribute_List();
diff --git a/src/test/java/fr/soleil/archiving/snap/api/DataBaseAPITest.java b/src/test/java/fr/soleil/archiving/snap/api/DataBaseAPITest.java
index e186f3214578124e7854edd30efdc24256406e04..3c02dead183ddcfdbf42ddb153b9d1f661425c98 100644
--- a/src/test/java/fr/soleil/archiving/snap/api/DataBaseAPITest.java
+++ b/src/test/java/fr/soleil/archiving/snap/api/DataBaseAPITest.java
@@ -10,6 +10,8 @@ import static org.junit.Assert.assertTrue;
 import java.util.ArrayList;
 import java.util.List;
 
+import fr.soleil.archiving.common.api.exception.ArchivingException;
+import fr.soleil.database.connection.DataBaseParameters;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -25,8 +27,14 @@ public class DataBaseAPITest extends AbstractTest {
 	DataBaseAPI dbApi;
 
 	@Before
-	public void initDataBaseAPI() {
-		dbApi = new DataBaseAPI("", "public", "public", "snap", "snap", false);
+	public void initDataBaseAPI() throws ArchivingException {
+		DataBaseParameters parameters = new DataBaseParameters();
+		parameters.setHost("");
+		parameters.setName("public");
+		parameters.setSchema("public");
+		parameters.setUser("snap");
+		parameters.setPassword("snap");
+		dbApi = new DataBaseAPI(parameters);
 	}
 
 	@Test