From a2b0eaf845a93059dfd3782988f59e349f137024 Mon Sep 17 00:00:00 2001
From: Gwenaelle Abeille <gwenaelle.abeille@synchrotron-soleil.fr>
Date: Wed, 19 Oct 2011 09:34:54 +0000
Subject: [PATCH] release

---
 pom.xml                                       |   27 +-
 .../action/UsePluginListener.java             |   63 +-
 .../tangowrapping/DeviceAttributeWrapper.java |  106 +-
 .../plugin/persistance/AnyAttribute.java      |  598 +--
 .../datasources/db/DummySnapReader.java       |  105 +-
 .../datasources/db/ISnapReader.java           |   77 +-
 .../datasources/db/RealSnapReader.java        |  397 +-
 .../datasources/db/SnapReaderFactory.java     |   64 +-
 .../lifecycle/DefaultLifeCycleManager.java    |  327 +-
 .../SnapManagerApi/ISnapManager.java          |   35 +-
 .../SnapManagerApi/SnapManagerApi.java        | 1721 ++++----
 .../SnapManagerApi/SnapManagerImpl.java       |  479 +--
 .../SnapshotingApi/ConfigConst.java           |  230 +-
 .../SnapshotingApi/DataBaseAPI.java           | 3725 ++++-------------
 .../SnapshotingApi/GetConf.java               |  244 +-
 .../SnapshotPersistenceManagerFactory.java    |   34 +-
 .../SpringSnapshotPersistenceManagerImpl.java |  105 +-
 .../spring/dao/AbstractValDAO.java            |   37 +-
 .../spring/dao/ClasspathDAOBeansLoader.java   |  226 +-
 .../persistence/spring/dto/CompositeId.java   |  128 +-
 .../persistence/spring/dto/Val.java           |   70 +-
 .../SnapshotingTools/Tools/SnapContext.java   |  589 ++-
 .../SnapshotingTools/Tools/SnapShot.java      |  642 ++-
 .../Tools/SnapshotingException.java           |  498 +--
 24 files changed, 4195 insertions(+), 6332 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8ee18fd..b46f1ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
 	<groupId>fr.soleil.lib</groupId>
 	<artifactId>snapArchivingApi</artifactId>
 	<name>snapArchivingApi</name>
-	<version>1.5.4-SNAPSHOT</version>
+	<version>1.6.2</version>
 
 	<description>Snap Archiving API</description>
 	<scm>
@@ -42,7 +42,7 @@
 		<dependency>
 			<groupId>commons-dbcp</groupId>
 			<artifactId>commons-dbcp</artifactId>
-			<version>1.2.1</version>
+			<version>1.4</version>
 		</dependency>
 		<dependency>
 			<groupId>commons-pool</groupId>
@@ -56,27 +56,29 @@
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring</artifactId>
-			<version>2.0.6</version>
+			<version>2.5.6</version>
 		</dependency>
 		<dependency>
 			<groupId>org.hibernate</groupId>
 			<artifactId>hibernate-core</artifactId>
-			<version>3.3.2.GA</version>
+			<version>3.6.5.Final</version>
 		</dependency>
+		<!--<dependency> <groupId>org.jboss</groupId> <artifactId>javassist</artifactId> 
+			<version>3.7.1.GA</version> </dependency> -->
 		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<version>1.5.6</version>
+			<groupId>javassist</groupId>
+			<artifactId>javassist</artifactId>
+			<version>3.12.1.GA</version>
 		</dependency>
 		<dependency>
-			<groupId>org.jboss</groupId>
-			<artifactId>javassist</artifactId>
-			<version>3.5.GA</version>
+			<groupId>org.lazyluke</groupId>
+			<artifactId>log4jdbc-remix</artifactId>
+			<version>0.2.4</version>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-mock</artifactId>
-			<version>2.0.2</version>
+			<version>2.0.8</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -93,12 +95,11 @@
 		<dependency>
 			<groupId>mysql</groupId>
 			<artifactId>mysql-connector-java</artifactId>
-			<version>5.0.4</version>
 		</dependency>
 		<dependency>
 			<groupId>com.oracle</groupId>
 			<artifactId>ojdbc6</artifactId>
-			<version>11.2.0.1.0</version>
+			<version>11.2.0.2.0</version>
 		</dependency>
 	</dependencies>
 </project>
diff --git a/src/main/java/fr/soleil/actiongroup/collectiveaction/components/singleactioncompletelistener/action/UsePluginListener.java b/src/main/java/fr/soleil/actiongroup/collectiveaction/components/singleactioncompletelistener/action/UsePluginListener.java
index 779ecb5..343737a 100644
--- a/src/main/java/fr/soleil/actiongroup/collectiveaction/components/singleactioncompletelistener/action/UsePluginListener.java
+++ b/src/main/java/fr/soleil/actiongroup/collectiveaction/components/singleactioncompletelistener/action/UsePluginListener.java
@@ -8,41 +8,40 @@ import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.Plugin;
 import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.context.PluginContext;
 
 /**
- * A listener for the event "the attributes (not necessarily numeric) reading operation from a device is complete".
- * If the operation succeeded, a "plugin action" uses the read result.
- * What this plugin action does (if it does anything) depends on the implementation of IPluginAction.
- * @author CLAISSE 
+ * A listener for the event
+ * "the attributes (not necessarily numeric) reading operation from a device is complete"
+ * . If the operation succeeded, a "plugin action" uses the read result. What
+ * this plugin action does (if it does anything) depends on the implementation
+ * of IPluginAction.
+ * 
+ * @author CLAISSE
  */
-public class UsePluginListener extends ActionListenerDecorator implements ActionListener 
-{
-    private Plugin action;
-    private PluginContext context;
-    
-    public UsePluginListener ( ActionListener _decorator , Plugin _action, PluginContext _context ) 
-    {
-        super(_decorator);
-        this.action = _action;
-        this.context = _context;
+public class UsePluginListener extends ActionListenerDecorator implements ActionListener {
+    private final Plugin action;
+    private final PluginContext context;
+
+    public UsePluginListener(ActionListener _decorator, Plugin _action, PluginContext _context) {
+	super(_decorator);
+	this.action = _action;
+	this.context = _context;
     }
 
-    /* (non-Javadoc)
-     * @see fr.soleil.core.groupactions.apis.listener.IActionCompleteListener#actionSucceeded(java.lang.String, java.lang.Object)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see fr.soleil.core.groupactions.apis.listener.IActionCompleteListener#
+     * actionSucceeded(java.lang.String, java.lang.Object)
      */
-    public void actionSucceeded ( String targetName , ActionResult actionResult )
-    {
-        try
-        {
-            DeviceAttributeWrapper[] attributesAnswer = actionResult.getAttributesValue();
-            for ( int i = 0 ; i < attributesAnswer.length ; i ++ )
-            {
-                this.action.execute ( this.context , targetName , attributesAnswer [ i ] );
-            }
-        }
-        catch ( Exception e )
-        {
-            super.actionFailed ( targetName , actionResult , e );
-        }
-        
-        super.actionSucceeded ( targetName , actionResult );
+    @Override
+    public void actionSucceeded(String targetName, ActionResult actionResult) {
+	DeviceAttributeWrapper[] attributesAnswer = actionResult.getAttributesValue();
+	for (int i = 0; i < attributesAnswer.length; i++) {
+	    try {
+		this.action.execute(this.context, targetName, attributesAnswer[i]);
+	    } catch (Exception e) {
+		super.actionFailed(targetName, actionResult, e);
+	    }
+	}
+	super.actionSucceeded(targetName, actionResult);
     }
 }
diff --git a/src/main/java/fr/soleil/actiongroup/collectiveaction/components/tangowrapping/DeviceAttributeWrapper.java b/src/main/java/fr/soleil/actiongroup/collectiveaction/components/tangowrapping/DeviceAttributeWrapper.java
index 66cdb01..c5bf2d8 100644
--- a/src/main/java/fr/soleil/actiongroup/collectiveaction/components/tangowrapping/DeviceAttributeWrapper.java
+++ b/src/main/java/fr/soleil/actiongroup/collectiveaction/components/tangowrapping/DeviceAttributeWrapper.java
@@ -16,7 +16,7 @@
  *   Log: DeviceAttributesWrapper.java,v 
  *
  */
- /*
+/*
  * Created on 9 f�vr. 07
  *
  * To change the template for this generated file go to
@@ -29,94 +29,100 @@ import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.DevState;
 import fr.esrf.TangoApi.DeviceAttribute;
 
-public class DeviceAttributeWrapper 
-{
+public class DeviceAttributeWrapper {
     private DeviceAttribute attribute;
 
     /**
      * @param attributes
      */
     public DeviceAttributeWrapper(DeviceAttribute attributes) {
-        this.attribute = attributes;
+	this.attribute = attributes;
     }
 
     /**
      * @return the attributes
      */
-    public DeviceAttribute getAttribute()
-    {
-        return this.attribute;
+    public DeviceAttribute getAttribute() {
+	return this.attribute;
     }
 
     /**
-     * @param attributes the attributes to set
+     * @param attributes
+     *            the attributes to set
      */
     public void setAttribute(DeviceAttribute attributes) {
-        this.attribute = attributes;
+	this.attribute = attributes;
+    }
+
+    public String getName() throws DevFailed {
+	return this.attribute.getName();
+    }
+
+    public int getDimX() throws DevFailed {
+	return this.attribute.getDimX();
+    }
+
+    public int getDimY() throws DevFailed {
+	return this.attribute.getDimY();
+    }
+
+    public int getType() throws DevFailed {
+	return this.attribute.getType();
+    }
+
+    public double[] extractDoubleArray() throws DevFailed {
+	return this.attribute.extractDoubleArray();
+    }
+
+    public short[] extractShortArray() throws DevFailed {
+	return this.attribute.extractShortArray();
     }
 
-    public String getName() throws DevFailed 
-    {
-        return this.attribute.getName();
+    public int[] extractUShortArray() throws DevFailed {
+	return this.attribute.extractUShortArray();
     }
 
-    public int getDimX() throws DevFailed 
-    {
-        return this.attribute.getDimX ();
+    public int[] extractLongArray() throws DevFailed {
+	return this.attribute.extractLongArray();
     }
 
-    public int getDimY() throws DevFailed 
-    {
-        return this.attribute.getDimY ();
+    public long[] extractULongArray() throws DevFailed {
+	return this.attribute.extractULongArray();
     }
 
-    public int getType() throws DevFailed 
-    {
-        return this.attribute.getType ();
+    public long[] extractULong64Array() throws DevFailed {
+	return this.attribute.extractULong64Array();
     }
 
-    public double[] extractDoubleArray() throws DevFailed 
-    {
-        return this.attribute.extractDoubleArray ();
+    public long[] extractLong64Array() throws DevFailed {
+	return this.attribute.extractLong64Array();
     }
 
-    public short[] extractShortArray() throws DevFailed 
-    {
-        return this.attribute.extractShortArray ();
+    public float[] extractFloatArray() throws DevFailed {
+	return this.attribute.extractFloatArray();
     }
 
-    public int[] extractLongArray() throws DevFailed 
-    {
-        return this.attribute.extractLongArray ();
+    public boolean[] extractBooleanArray() throws DevFailed {
+	return this.attribute.extractBooleanArray();
     }
 
-    public float[] extractFloatArray() throws DevFailed 
-    {
-        return this.attribute.extractFloatArray ();
+    public String[] extractStringArray() throws DevFailed {
+	return this.attribute.extractStringArray();
     }
 
-    public boolean[] extractBooleanArray() throws DevFailed 
-    {
-        return this.attribute.extractBooleanArray ();
+    public short extractShort() throws DevFailed {
+	return this.attribute.extractShort();
     }
 
-    public String[] extractStringArray() throws DevFailed 
-    {
-        return this.attribute.extractStringArray ();
+    public short[] extractUCharArray() throws DevFailed {
+	return this.attribute.extractUCharArray();
     }
 
-    public short extractShort() throws DevFailed 
-    {
-        return this.attribute.extractShort ();
+    public AttrQuality getQuality() throws DevFailed {
+	return this.attribute.getQuality();
     }
 
-    public AttrQuality getQuality() throws DevFailed 
-    {
-        return this.attribute.getQuality();
-    } 
-    
-    public DevState extractState () throws DevFailed 
-    {
-        return attribute.extractState();   
+    public DevState extractState() throws DevFailed {
+	return attribute.extractState();
     }
 }
diff --git a/src/main/java/fr/soleil/actiongroup/collectiveaction/onattributes/plugin/persistance/AnyAttribute.java b/src/main/java/fr/soleil/actiongroup/collectiveaction/onattributes/plugin/persistance/AnyAttribute.java
index ae52342..8460036 100644
--- a/src/main/java/fr/soleil/actiongroup/collectiveaction/onattributes/plugin/persistance/AnyAttribute.java
+++ b/src/main/java/fr/soleil/actiongroup/collectiveaction/onattributes/plugin/persistance/AnyAttribute.java
@@ -16,7 +16,7 @@
  *   Log: AnyAttribute.java,v 
  *
  */
- /*
+/*
  * Created on 17 janv. 07
  *
  * To change the template for this generated file go to
@@ -31,83 +31,84 @@ import fr.soleil.actiongroup.collectiveaction.components.tangowrapping.TangoCons
 
 /**
  * A data transfer object that holds the data extracted from a read attribute.
- * @author CLAISSE 
+ * 
+ * @author CLAISSE
  */
-public class AnyAttribute 
-{
+public class AnyAttribute {
     private static final String SPECTRUM_SEPARATOR = ",";
 
     /**
      * The attribute's complete name
      */
     private String completeName;
-    
+
     /**
      * The attribute's X dimension (1 for scalars)
      */
     private int dimX;
-    
+
     /**
      * The attribute's Y dimension (1 for scalars and spectrums)
      */
     private int dimY;
-    
+
     /**
      * The attribute's type
      */
     private int type;
-    
+
     /**
      * The attribute's format (scalar, spectrum, or image)
      */
     private int format;
-    
+
     /**
-     * The attribute's read/write property (read-only, write-only, or read/write)
+     * The attribute's read/write property (read-only, write-only, or
+     * read/write)
      */
     private int writable;
-    
+
     /**
      * The attribute's double value
      */
-    private double [] rawValueDouble;
-    
+    private double[] rawValueDouble;
+
     /**
      * The attribute's int value
      */
-    private int [] rawValueInt;
-    
+    private int[] rawValueInt;
+
     /**
      * The attribute's short value
      */
-    private short [] rawValueShort;
-    
+    private short[] rawValueShort;
+
     /**
      * The attribute's String value
      */
-    private String [] rawValueString;
-    
+    private String[] rawValueString;
+
     /**
      * The attribute's long value
      */
-    private int [] rawValueLong;
-    
+    private long[] rawValueLong;
+
     /**
      * The attribute's float value
      */
-    private float [] rawValueFloat;
-    
+    private float[] rawValueFloat;
+
     /**
      * The attribute's boolean value
      */
-    private boolean [] rawValueBoolean;
-    
+    private boolean[] rawValueBoolean;
+
     /**
      * The attribute's State value
      */
     private DevState rawValueState;
 
-    private int numberOfComponents;
+    private final int numberOfComponents;
 
     private double[] convertedNumericValuesTable;
 
@@ -118,339 +119,358 @@ public class AnyAttribute
     private boolean hasBeenAggreggated;
     private String aggreggateAll;
     private String aggreggateRead;
-    private String aggreggateWrite; 
-    
-    public AnyAttribute(String deviceName, DeviceAttributeWrapper attribute) throws Exception 
-    {
-        this.initParameters ( deviceName , attribute );
-        this.numberOfComponents = this.extractValue ( attribute );
-        this.initFormatAndWritable ();
-        this.buildPersistableValue ();
+    private String aggreggateWrite;
+
+    public AnyAttribute(String deviceName, DeviceAttributeWrapper attribute) throws Exception {
+	this.initParameters(deviceName, attribute);
+	this.numberOfComponents = this.extractValue(attribute);
+	this.initFormatAndWritable();
+	this.buildPersistableValue();
     }
-    
-    private void initFormatAndWritable() 
-    {
-        int format = TangoConstWrapper.AttrDataFormat_SCALAR;
-        if ( this.dimX > 1 )
-        {
-            format = TangoConstWrapper.AttrDataFormat_SPECTRUM;
-        }
-        if ( this.dimY > 1 )
-        {
-            format = TangoConstWrapper.AttrDataFormat_IMAGE;
-        }
-        this.setFormat ( format );
-        
-        this.hasBothReadAndWrite = numberOfComponents > dimX;
-        //WARNING comment distinguer le cas WO???
-        int writable = hasBothReadAndWrite ? TangoConstWrapper.AttrWriteType_READ_WRITE : TangoConstWrapper.AttrWriteType_READ;
-        this.setWritable ( writable );
+
+    private void initFormatAndWritable() {
+	int format = TangoConstWrapper.AttrDataFormat_SCALAR;
+	if (this.dimX > 1) {
+	    format = TangoConstWrapper.AttrDataFormat_SPECTRUM;
+	}
+	if (this.dimY > 1) {
+	    format = TangoConstWrapper.AttrDataFormat_IMAGE;
+	}
+	this.setFormat(format);
+
+	this.hasBothReadAndWrite = numberOfComponents > dimX;
+	// WARNING comment distinguer le cas WO???
+	int writable = hasBothReadAndWrite ? TangoConstWrapper.AttrWriteType_READ_WRITE
+		: TangoConstWrapper.AttrWriteType_READ;
+	this.setWritable(writable);
     }
 
-    private int extractValue(DeviceAttributeWrapper attribute) throws Exception 
-    {
-        int _numberOfComponents = 0;
-        switch ( this.getType() )
-        {
-            case TangoConst.Tango_DEV_BOOLEAN:
-                this.rawValueBoolean = attribute.extractBooleanArray ();
-                _numberOfComponents = rawValueBoolean == null ? 0 : rawValueBoolean.length; 
-            break;
-            
-            case TangoConst.Tango_DEV_DOUBLE:
-                this.rawValueDouble = attribute.extractDoubleArray ();
-                _numberOfComponents = rawValueDouble == null ? 0 : rawValueDouble.length;
-            break;
-            
-            case TangoConst.Tango_DEV_FLOAT:
-                this.rawValueFloat = attribute.extractFloatArray ();
-                _numberOfComponents = rawValueFloat == null ? 0 : rawValueFloat.length;
-            break;
-            
-            case TangoConst.Tango_DEV_LONG:
-            case TangoConst.Tango_DEV_ULONG:
-                this.rawValueLong = attribute.extractLongArray ();
-                _numberOfComponents = rawValueLong == null ? 0 : rawValueLong.length;
-            break;
-            
-            case TangoConst.Tango_DEV_SHORT:
-            case TangoConst.Tango_DEV_USHORT:
-                this.rawValueShort = attribute.extractShortArray ();
-                _numberOfComponents = rawValueShort == null ? 0 : rawValueShort.length;
-            break;
-            
-            case TangoConst.Tango_DEV_STATE:
-                this.rawValueState = attribute.extractState();
-                _numberOfComponents = 1;
-            break;
-            
-            case TangoConst.Tango_DEV_STRING:
-                this.rawValueString = attribute.extractStringArray ();
-                _numberOfComponents = rawValueString == null ? 0 : rawValueString.length;
-            break;
-        }
-        return _numberOfComponents;
+    private int extractValue(DeviceAttributeWrapper attribute) throws Exception {
+	int _numberOfComponents = 0;
+	switch (this.getType()) {
+	case TangoConst.Tango_DEV_BOOLEAN:
+	    this.rawValueBoolean = attribute.extractBooleanArray();
+	    _numberOfComponents = rawValueBoolean == null ? 0 : rawValueBoolean.length;
+	    break;
+
+	case TangoConst.Tango_DEV_DOUBLE:
+	    this.rawValueDouble = attribute.extractDoubleArray();
+	    _numberOfComponents = rawValueDouble == null ? 0 : rawValueDouble.length;
+	    break;
+
+	case TangoConst.Tango_DEV_FLOAT:
+	    this.rawValueFloat = attribute.extractFloatArray();
+	    _numberOfComponents = rawValueFloat == null ? 0 : rawValueFloat.length;
+	    break;
+	case TangoConst.Tango_DEV_LONG:
+	case TangoConst.Tango_DEV_INT:
+	    this.rawValueInt = attribute.extractLongArray();
+	    _numberOfComponents = rawValueInt == null ? 0 : rawValueInt.length;
+	    break;
+	case TangoConst.Tango_DEV_ULONG:
+	    this.rawValueLong = attribute.extractULongArray();
+	    _numberOfComponents = rawValueLong == null ? 0 : rawValueLong.length;
+	    break;
+	case TangoConst.Tango_DEV_LONG64:
+	    this.rawValueLong = attribute.extractLong64Array();
+	    _numberOfComponents = rawValueLong == null ? 0 : rawValueLong.length;
+	    break;
+	case TangoConst.Tango_DEV_ULONG64:
+	    this.rawValueLong = attribute.extractULong64Array();
+	    _numberOfComponents = rawValueLong == null ? 0 : rawValueLong.length;
+	    break;
+	case TangoConst.Tango_DEV_USHORT:
+	    this.rawValueInt = attribute.extractUShortArray();
+	    _numberOfComponents = rawValueInt == null ? 0 : rawValueInt.length;
+	    break;
+	case TangoConst.Tango_DEV_SHORT:
+	case TangoConst.Tango_DEV_CHAR:
+	    this.rawValueShort = attribute.extractShortArray();
+	    _numberOfComponents = rawValueShort == null ? 0 : rawValueShort.length;
+	    break;
+	case TangoConst.Tango_DEV_UCHAR:
+	    this.rawValueShort = attribute.extractUCharArray();
+	    _numberOfComponents = rawValueShort == null ? 0 : rawValueShort.length;
+	    break;
+
+	case TangoConst.Tango_DEV_STATE:
+	    this.rawValueState = attribute.extractState();
+	    _numberOfComponents = 1;
+	    break;
+
+	case TangoConst.Tango_DEV_STRING:
+	    this.rawValueString = attribute.extractStringArray();
+	    _numberOfComponents = rawValueString == null ? 0 : rawValueString.length;
+	    break;
+	default:
+	    System.out.println("NO EXTRACTION " + attribute.getName());
+	}
+	return _numberOfComponents;
     }
-    
-    private void buildPersistableValue() 
-    {
-        if ( this.numberOfComponents == 0 )
-        {
-            return;
-        }
-        this.convertedStringValuesTable = new String [ this.numberOfComponents ];
-        this.convertedNumericValuesTable = new double [ this.numberOfComponents ];
-        
-        for ( int i = 0 ; i < this.numberOfComponents ; i ++ )
-        {
-            switch ( this.getType() )
-            {
-                    case TangoConst.Tango_DEV_BOOLEAN:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueBoolean [ i ] ? 1 : 0; //for scalars which are stored as 0/1
-                        this.convertedStringValuesTable [ i ] = this.rawValueBoolean [ i ] + ""; //for spectrums which are stored as true,false,false,...
-                        //System.out.println("");
-                    break;
-                    
-                    case TangoConst.Tango_DEV_DOUBLE:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueDouble [ i ];
-                        this.convertedStringValuesTable [ i ] = this.rawValueDouble [ i ]+"";
-                    break;
-                    
-                    case TangoConst.Tango_DEV_FLOAT:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueFloat [ i ];
-                        this.convertedStringValuesTable [ i ] = this.rawValueFloat [ i ]+"";
-                    break;
-                    
-                    case TangoConst.Tango_DEV_LONG:
-                    case TangoConst.Tango_DEV_ULONG:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueLong [ i ];
-                        this.convertedStringValuesTable [ i ] = this.rawValueLong [ i ]+"";
-                    break;
-                    
-                    case TangoConst.Tango_DEV_SHORT:
-                    case TangoConst.Tango_DEV_USHORT:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueShort [ i ];
-                        this.convertedStringValuesTable [ i ] = this.rawValueShort [ i ]+"";
-                    break;
-                    
-                    case TangoConst.Tango_DEV_STATE:
-                        this.convertedNumericValuesTable [ i ] = this.rawValueState.value();
-                        this.convertedStringValuesTable [ i ] = this.rawValueState+"";
-                    break;
-                    
-                    case TangoConst.Tango_DEV_STRING:
-                        this.convertedStringValuesTable [ i ] = this.rawValueString [ i ];
-                    break;
-            }
-        }
+
+    private void buildPersistableValue() {
+	if (this.numberOfComponents == 0) {
+	    return;
+	}
+	this.convertedStringValuesTable = new String[this.numberOfComponents];
+	this.convertedNumericValuesTable = new double[this.numberOfComponents];
+
+	for (int i = 0; i < this.numberOfComponents; i++) {
+	    switch (this.getType()) {
+	    case TangoConst.Tango_DEV_BOOLEAN:
+		this.convertedNumericValuesTable[i] = this.rawValueBoolean[i] ? 1 : 0; // for
+										       // scalars
+										       // which
+										       // are
+										       // stored
+										       // as
+										       // 0/1
+		this.convertedStringValuesTable[i] = this.rawValueBoolean[i] + ""; // for
+										   // spectrums
+										   // which
+										   // are
+										   // stored
+										   // as
+										   // true,false,false,...
+		// System.out.println("");
+		break;
+
+	    case TangoConst.Tango_DEV_DOUBLE:
+		this.convertedNumericValuesTable[i] = this.rawValueDouble[i];
+		this.convertedStringValuesTable[i] = this.rawValueDouble[i] + "";
+		break;
+
+	    case TangoConst.Tango_DEV_FLOAT:
+		this.convertedNumericValuesTable[i] = this.rawValueFloat[i];
+		this.convertedStringValuesTable[i] = this.rawValueFloat[i] + "";
+		break;
+
+	    case TangoConst.Tango_DEV_LONG:
+	    case TangoConst.Tango_DEV_INT:
+	    case TangoConst.Tango_DEV_USHORT:
+		this.convertedNumericValuesTable[i] = this.rawValueInt[i];
+		this.convertedStringValuesTable[i] = this.rawValueInt[i] + "";
+		break;
+	    case TangoConst.Tango_DEV_ULONG:
+	    case TangoConst.Tango_DEV_ULONG64:
+	    case TangoConst.Tango_DEV_LONG64:
+		this.convertedNumericValuesTable[i] = this.rawValueLong[i];
+		this.convertedStringValuesTable[i] = this.rawValueLong[i] + "";
+		break;
+
+	    case TangoConst.Tango_DEV_SHORT:
+	    case TangoConst.Tango_DEV_CHAR:
+	    case TangoConst.Tango_DEV_UCHAR:
+		this.convertedNumericValuesTable[i] = this.rawValueShort[i];
+		this.convertedStringValuesTable[i] = this.rawValueShort[i] + "";
+		break;
+
+	    case TangoConst.Tango_DEV_STATE:
+		this.convertedNumericValuesTable[i] = this.rawValueState.value();
+		this.convertedStringValuesTable[i] = this.rawValueState + "";
+		break;
+
+	    case TangoConst.Tango_DEV_STRING:
+		this.convertedStringValuesTable[i] = this.rawValueString[i];
+		break;
+	    }
+	}
     }
 
-    private void initParameters(String deviceName, DeviceAttributeWrapper attribute) throws Exception 
-    {
-        String name = attribute.getName ();
-        String completeName = deviceName + "/" + name;
-        int dimX = attribute.getDimX ();
-        int dimY = attribute.getDimY ();
-        int type = attribute.getType ();
-        
-        this.setCompleteName ( completeName );
-        this.setDimX ( dimX );
-        this.setDimY ( dimY );
-        this.setType ( type );
+    private void initParameters(String deviceName, DeviceAttributeWrapper attribute) throws Exception {
+	String name = attribute.getName();
+	String completeName = deviceName + "/" + name;
+	int dimX = attribute.getDimX();
+	int dimY = attribute.getDimY();
+	int type = attribute.getType();
+
+	this.setCompleteName(completeName);
+	this.setDimX(dimX);
+	this.setDimY(dimY);
+	this.setType(type);
     }
+
     /**
      * @return the completeName
      */
     public String getCompleteName() {
-        return this.completeName;
+	return this.completeName;
     }
+
     /**
-     * @param completeName the completeName to set
+     * @param completeName
+     *            the completeName to set
      */
     public void setCompleteName(String completeName) {
-        this.completeName = completeName;
+	this.completeName = completeName;
     }
+
     /**
      * @return the dimX
      */
     public int getDimX() {
-        return this.dimX;
+	return this.dimX;
     }
+
     /**
-     * @param dimX the dimX to set
+     * @param dimX
+     *            the dimX to set
      */
     public void setDimX(int dimX) {
-        this.dimX = dimX;
+	this.dimX = dimX;
     }
+
     /**
      * @return the dimY
      */
     public int getDimY() {
-        return this.dimY;
+	return this.dimY;
     }
+
     /**
-     * @param dimY the dimY to set
+     * @param dimY
+     *            the dimY to set
      */
     public void setDimY(int dimY) {
-        this.dimY = dimY;
+	this.dimY = dimY;
     }
+
     /**
      * @return the type
      */
     public int getType() {
-        return this.type;
+	return this.type;
     }
+
     /**
-     * @param type the type to set
+     * @param type
+     *            the type to set
      */
     public void setType(int type) {
-        this.type = type;
+	this.type = type;
     }
-    
+
     /**
      * @return the format
      */
     public int getFormat() {
-        return this.format;
+	return this.format;
     }
+
     /**
-     * @param format the format to set
+     * @param format
+     *            the format to set
      */
     public void setFormat(int format) {
-        this.format = format;
+	this.format = format;
     }
+
     /**
      * @return the writable
      */
     public int getWritable() {
-        return this.writable;
+	return this.writable;
     }
+
     /**
-     * @param writable the writable to set
+     * @param writable
+     *            the writable to set
      */
     public void setWritable(int writable) {
-        this.writable = writable;
+	this.writable = writable;
     }
-    
-    public double [] getConvertedNumericValuesTable ()
-    {
-        return this.convertedNumericValuesTable;
+
+    public double[] getConvertedNumericValuesTable() {
+	return this.convertedNumericValuesTable;
     }
-    
-    public String [] getConvertedStringValuesTable ()
-    {
-        return this.convertedStringValuesTable;
+
+    public String[] getConvertedStringValuesTable() {
+	return this.convertedStringValuesTable;
     }
-    
-    public String getConvertedStringAggreggatedValues ( boolean wantsReadValue )
-    {
-       //System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/START");
-       if ( ! this.hasBeenAggreggated )
-       {
-           //System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/1");
-           this.aggreggate ();
-       }
-        
-       if ( ! this.hasBothReadAndWrite )
-       {
-           //System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/2");
-           return this.aggreggateAll;
-       }
-       else
-       {
-           if ( wantsReadValue )
-           {
-               //System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/3");
-               return aggreggateRead;
-           }
-           else
-           {
-               //System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/4");
-               return aggreggateWrite;
-           }
-       }
+
+    public String getConvertedStringAggreggatedValues(boolean wantsReadValue) {
+	// System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/START");
+	if (!this.hasBeenAggreggated) {
+	    // System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/1");
+	    this.aggreggate();
+	}
+
+	if (!this.hasBothReadAndWrite) {
+	    // System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/2");
+	    return this.aggreggateAll;
+	} else {
+	    if (wantsReadValue) {
+		// System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/3");
+		return aggreggateRead;
+	    } else {
+		// System.out.println("AnyAttribute/getConvertedStringAggreggatedValues/4");
+		return aggreggateWrite;
+	    }
+	}
     }
 
-    private void aggreggate() 
-    {
-        //System.out.println("AnyAttribute/aggreggate/START");
-        if ( ! this.hasBothReadAndWrite )
-        {
-            //System.out.println("AnyAttribute/aggreggateAll/");
-            this.aggreggateAll = this.aggreggateAll ();
-        }
-        else
-        {
-            //System.out.println("AnyAttribute/aggreggateRead/");
-            this.aggreggateRead = this.aggreggateRead ();
-        
-            //System.out.println("AnyAttribute/aggreggateWrite/");
-            this.aggreggateWrite = this.aggreggateWrite ();
-            //System.out.println("AnyAttribute/AFTER aggreggateWrite/aggreggateWrite|"+ this.aggreggateWrite+"|" );
-        }
-        this.hasBeenAggreggated = true;    
+    private void aggreggate() {
+	// System.out.println("AnyAttribute/aggreggate/START");
+	if (!this.hasBothReadAndWrite) {
+	    // System.out.println("AnyAttribute/aggreggateAll/");
+	    this.aggreggateAll = this.aggreggateAll();
+	} else {
+	    // System.out.println("AnyAttribute/aggreggateRead/");
+	    this.aggreggateRead = this.aggreggateRead();
+
+	    // System.out.println("AnyAttribute/aggreggateWrite/");
+	    this.aggreggateWrite = this.aggreggateWrite();
+	    // System.out.println("AnyAttribute/AFTER aggreggateWrite/aggreggateWrite|"+
+	    // this.aggreggateWrite+"|" );
+	}
+	this.hasBeenAggreggated = true;
     }
 
-    private String aggreggateWrite() 
-    {
-        try
-        {
-            if ( this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0 )
-            {
-                return null;
-            }
-            StringBuffer buff = new StringBuffer ();
-            for ( int i = this.dimX ; i < this.convertedStringValuesTable.length ; i ++ )
-            {
-                buff.append ( this.convertedStringValuesTable [ i ] );
-                if ( i < this.convertedStringValuesTable.length - 1 )
-                {
-                    buff.append ( SPECTRUM_SEPARATOR );
-                }
-            }
-            return buff.toString();
-        }
-        catch ( Exception e )
-        {
-            e.printStackTrace();
-        }
-        return null;
+    private String aggreggateWrite() {
+	try {
+	    if (this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0) {
+		return null;
+	    }
+	    StringBuffer buff = new StringBuffer();
+	    for (int i = this.dimX; i < this.convertedStringValuesTable.length; i++) {
+		buff.append(this.convertedStringValuesTable[i]);
+		if (i < this.convertedStringValuesTable.length - 1) {
+		    buff.append(SPECTRUM_SEPARATOR);
+		}
+	    }
+	    return buff.toString();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	}
+	return null;
     }
 
-    private String aggreggateRead() 
-    {
-        //System.out.println("AnyAttribute/aggreggateRead/START");
-        if ( this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0 )
-        {
-            return null;
-        }
-        StringBuffer buff = new StringBuffer ();
-        for ( int i = 0 ; i < this.dimX ; i ++ )
-        {
-            buff.append ( this.convertedStringValuesTable [ i ] );
-            if ( i < this.dimX - 1 )
-            {
-                buff.append ( SPECTRUM_SEPARATOR );
-            }
-        }
-        return buff.toString ();
+    private String aggreggateRead() {
+	// System.out.println("AnyAttribute/aggreggateRead/START");
+	if (this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0) {
+	    return null;
+	}
+	StringBuffer buff = new StringBuffer();
+	for (int i = 0; i < this.dimX; i++) {
+	    buff.append(this.convertedStringValuesTable[i]);
+	    if (i < this.dimX - 1) {
+		buff.append(SPECTRUM_SEPARATOR);
+	    }
+	}
+	return buff.toString();
     }
 
-    private String aggreggateAll() 
-    {
-        if ( this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0 )
-        {
-            return null;
-        }
-        StringBuffer buff = new StringBuffer ();
-        for ( int i = 0 ; i < this.convertedStringValuesTable.length ; i ++ )
-        {
-            buff.append ( this.convertedStringValuesTable [ i ] );
-            if ( i < this.convertedStringValuesTable.length - 1 )
-            {
-                buff.append ( SPECTRUM_SEPARATOR );
-            }
-        }
-        return buff.toString ();
+    private String aggreggateAll() {
+	if (this.convertedStringValuesTable == null || this.convertedStringValuesTable.length == 0) {
+	    return null;
+	}
+	StringBuffer buff = new StringBuffer();
+	for (int i = 0; i < this.convertedStringValuesTable.length; i++) {
+	    buff.append(this.convertedStringValuesTable[i]);
+	    if (i < this.convertedStringValuesTable.length - 1) {
+		buff.append(SPECTRUM_SEPARATOR);
+	    }
+	}
+	return buff.toString();
     }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/DummySnapReader.java b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/DummySnapReader.java
index 9731485..eda1828 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/DummySnapReader.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/DummySnapReader.java
@@ -34,61 +34,72 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
  * @author CLAISSE
  */
 public class DummySnapReader implements ISnapReader {
-	DummySnapReader() {
-		super();
-		// TODO Auto-generated constructor stub
-	}
+    DummySnapReader() {
+	super();
+	// TODO Auto-generated constructor stub
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see snapextractor.api.datasources.db.ISnapReader#openConnection()
-	 */
-	public void openConnection() {
-		// TODO Auto-generated method stub
+    /*
+     * (non-Javadoc)
+     * 
+     * @see snapextractor.api.datasources.db.ISnapReader#openConnection()
+     */
+    @Override
+    public void openConnection() {
+	// TODO Auto-generated method stub
 
-	}
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see snapextractor.api.datasources.db.ISnapReader#closeConnection()
-	 */
-	public void closeConnection() {
-		// TODO Auto-generated method stub
+    /*
+     * (non-Javadoc)
+     * 
+     * @see snapextractor.api.datasources.db.ISnapReader#closeConnection()
+     */
+    @Override
+    public void closeConnection() {
+	// TODO Auto-generated method stub
 
-	}
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * snapextractor.api.datasources.db.ISnapReader#getSnap(java.lang.String[])
-	 */
-	public SnapAttributeExtract[] getSnap(int id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * snapextractor.api.datasources.db.ISnapReader#getSnap(java.lang.String[])
+     */
+    @Override
+    public SnapAttributeExtract[] getSnap(int id) {
+	// TODO Auto-generated method stub
+	return null;
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * snapextractor.api.datasources.db.ISnapReader#getSnapshotsForContext(int)
-	 */
-	public DevVarLongStringArray getSnapshotsForContext(int contextId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * snapextractor.api.datasources.db.ISnapReader#getSnapshotsForContext(int)
+     */
+    @Override
+    public DevVarLongStringArray getSnapshotsForContext(int contextId) {
+	// TODO Auto-generated method stub
+	return null;
+    }
 
-	public void openConnection(String string, String string2) throws DevFailed {
-		// TODO Auto-generated method stub
+    public void openConnection(String string, String string2) throws DevFailed {
+	// TODO Auto-generated method stub
 
-	}
+    }
 
-	public int[] getSnapshotsID(int ctxID, String[] criterions) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Override
+    public int[] getSnapshotsID(int ctxID, String[] criterions) {
+	// TODO Auto-generated method stub
+	return null;
+    }
+
+    @Override
+    public SnapAttributeExtract[] getSnapValues(int id, String... attributeName) throws DevFailed {
+	// TODO Auto-generated method stub
+	return null;
+    }
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/ISnapReader.java b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/ISnapReader.java
index 6d4c507..0e60329 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/ISnapReader.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/ISnapReader.java
@@ -34,43 +34,50 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
  * @author CLAISSE
  */
 public interface ISnapReader {
-	/**
-	 * Opens a connection to the Snap database
-	 * 
-	 * @param string2
-	 * @param string
-	 * @throws DevFailed
-	 */
-	public void openConnection(String string, String string2) throws DevFailed;
+    /**
+     * Opens a connection to the Snap database
+     * 
+     * @throws DevFailed
+     */
+    public void openConnection() throws DevFailed;
 
-	/**
-	 * Closes the connection to the Snap database
-	 */
-	public void closeConnection();
+    /**
+     * Closes the connection to the Snap database
+     */
+    public void closeConnection();
 
-	/**
-	 * Extracts a given snapshot's data
-	 * 
-	 * @param id
-	 *            The ID of the snapshot to extract
-	 * @return The snapshot's data
-	 * @throws DevFailed
-	 */
-	public SnapAttributeExtract[] getSnap(int id) throws DevFailed;
+    /**
+     * Extracts a given snapshot's data
+     * 
+     * @param id
+     *            The ID of the snapshot to extract
+     * @return The snapshot's data
+     * @throws DevFailed
+     */
+    public SnapAttributeExtract[] getSnap(int id) throws DevFailed;
 
-	/**
-	 * Returns the list of snapshots associated to a given context
-	 * 
-	 * @param contextId
-	 *            The context's ID
-	 * @return A DevVarLongStringArray list where the Long elements are the
-	 *         snapshots' IDs, and the String elements are desciptions of each
-	 *         snapshot (typically, the concatenation of the snapshot's date and
-	 *         comment fields)
-	 * @throws DevFailed
-	 */
-	public DevVarLongStringArray getSnapshotsForContext(int contextId)
-			throws DevFailed;
+    /**
+     * Extracts values of a snapshot for an attributes
+     * 
+     * @param id
+     * @param attributeName
+     * @return
+     * @throws DevFailed
+     */
+    public SnapAttributeExtract[] getSnapValues(int id, String... attributeNames) throws DevFailed;
 
-	public int[] getSnapshotsID(int ctxID, String[] criterions);
+    /**
+     * Returns the list of snapshots associated to a given context
+     * 
+     * @param contextId
+     *            The context's ID
+     * @return A DevVarLongStringArray list where the Long elements are the
+     *         snapshots' IDs, and the String elements are desciptions of each
+     *         snapshot (typically, the concatenation of the snapshot's date and
+     *         comment fields)
+     * @throws DevFailed
+     */
+    public DevVarLongStringArray getSnapshotsForContext(int contextId) throws DevFailed;
+
+    public int[] getSnapshotsID(int ctxID, String[] criterions);
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/RealSnapReader.java b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/RealSnapReader.java
index 513e224..6d08419 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/RealSnapReader.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/RealSnapReader.java
@@ -40,232 +40,215 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
  * @author CLAISSE
  */
 public class RealSnapReader implements ISnapReader {
-	private ISnapManager manager;
-	private boolean isReady = false;
-
-	RealSnapReader() {
-		super();
+    private ISnapManager manager;
+    private boolean isReady = false;
+
+    RealSnapReader() {
+	super();
+    }
+
+    @Override
+    public synchronized void openConnection() throws DevFailed {
+	try {
+	    if (!this.isReady) {
+		this.manager = new SnapManagerImpl();
+		this.isReady = true;
+	    }
+	} catch (Exception e) {
+	    Tools.throwDevFailed(e);
 	}
-
-	public void openConnection(String snapUser, String snapPassword)
-			throws DevFailed {
-		try {
-			if (!this.isReady) {
-				this.manager = new SnapManagerImpl(snapUser, snapPassword);
-				this.isReady = true;
-			}
-		} catch (Exception e) {
-			Tools.throwDevFailed(e);
-		}
+    }
+
+    @Override
+    public void closeConnection() {
+	this.isReady = false;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * snapextractor.api.datasources.db.ISnapReader#getSnap(java.lang.String[])
+     */
+    @Override
+    public SnapAttributeExtract[] getSnap(int id) throws DevFailed {
+	try {
+	    return manager.getSnap(id);
+	} catch (SnapshotingException e) {
+	    throw e.toTangoException();
 	}
-
-	public void closeConnection() {
-		this.isReady = false;
+    }
+
+    @Override
+    public SnapAttributeExtract[] getSnapValues(int id, String... attributeNames) throws DevFailed {
+	try {
+	    return manager.getSnapValues(id, attributeNames);
+	} catch (SnapshotingException e) {
+	    throw e.toTangoException();
 	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * snapextractor.api.datasources.db.ISnapReader#getSnap(java.lang.String[])
-	 */
-	public SnapAttributeExtract[] getSnap(int id) throws DevFailed {
-		/*
-		 * Condition condition = new Condition( GlobalConst.TAB_SNAP[ 0 ] , "="
-		 * , String.valueOf( id ) ); Criterions searchCriterions = new
-		 * Criterions(); searchCriterions.addCondition( condition );
-		 * 
-		 * try { SnapShotLight[] snapshots = this.manager.findSnapshots(
-		 * searchCriterions ); if ( snapshots == null || snapshots.length == 0 )
-		 * { return null; } SnapShotLight snapshotLight = snapshots[ 0 ];
-		 * 
-		 * SnapAttributeExtract[] sae = this.manager.findSnapshotAttributes(
-		 * snapshotLight ); if ( sae == null || sae.length == 0 ) { return null;
-		 * } return sae; } catch ( Exception e ) { Tools.throwDevFailed ( e ); }
-		 * return null;
-		 */
-		SnapAttributeExtract[] sae = null;
-		try {
-			sae = this.manager.getSnap(id);
-		} catch (SnapshotingException e) {
-			throw e.toTangoException();
-		} catch (Exception e) {
-			Tools.throwDevFailed(e);
-		}
-		return sae;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * snapextractor.api.datasources.db.ISnapReader#getSnapshotsForContext(int)
+     */
+    @Override
+    public DevVarLongStringArray getSnapshotsForContext(int contextId) throws DevFailed {
+	Criterions searchCriterions = new Criterions();
+	searchCriterions.addCondition(new Condition(GlobalConst.TAB_SNAP[1], GlobalConst.OP_EQUALS, "" + contextId));
+
+	SnapShotLight[] snapshots = null;
+	try {
+	    snapshots = this.manager.findSnapshots(searchCriterions);
+	} catch (Exception e) {
+	    Tools.throwDevFailed(e);
 	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * snapextractor.api.datasources.db.ISnapReader#getSnapshotsForContext(int)
-	 */
-	public DevVarLongStringArray getSnapshotsForContext(int contextId)
-			throws DevFailed {
-		Criterions searchCriterions = new Criterions();
-		searchCriterions.addCondition(new Condition(GlobalConst.TAB_SNAP[1],
-				GlobalConst.OP_EQUALS, "" + contextId));
-
-		SnapShotLight[] snapshots = null;
-		try {
-			snapshots = this.manager.findSnapshots(searchCriterions);
-		} catch (Exception e) {
-			Tools.throwDevFailed(e);
-		}
-		if (snapshots == null || snapshots.length == 0) {
-			return null;
-		}
-		int numberOfSnapshots = snapshots.length;
-
-		DevVarLongStringArray ret = new DevVarLongStringArray();
-		int[] lvalue = new int[numberOfSnapshots];
-		java.lang.String[] svalue = new java.lang.String[numberOfSnapshots];
-		for (int i = 0; i < numberOfSnapshots; i++) {
-			SnapShotLight currentSnapshot = snapshots[i];
-			lvalue[i] = currentSnapshot.getId_snap();
-			svalue[i] = currentSnapshot.getSnap_date() + " , "
-					+ currentSnapshot.getComment();
-		}
-		ret.lvalue = lvalue;
-		ret.svalue = svalue;
-
-		return ret;
+	if (snapshots == null || snapshots.length == 0) {
+	    return null;
 	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see snapextractor.api.datasources.db.ISnapReader#getSnapshotID(int)
-	 */
-	public int[] getSnapshotsID(int ctxID, String[] criterions) {
-		// ---Add your Own code to control device here ---
-		int[] argout = null;
-
-		Criterions ret = getInputCriterion(criterions);
-		if (ret == null)
-			return null;
-		ret.addCondition(new Condition(GlobalConst.TAB_SNAP[1],
-				GlobalConst.OP_EQUALS, "" + ctxID));
-
-		SnapShotLight[] newList;
-		try {
-			newList = manager.findSnapshots(ret);
-			if (ret.getConditions("first") != null) {
-				argout = new int[1];
-				argout[0] = newList[0].getId_snap();
-			} else if (ret.getConditions("last") != null) {
-				argout = new int[1];
-				argout[0] = newList[newList.length - 1].getId_snap();
-			} else {
-				argout = new int[newList.length];
-				for (int i = 0; i < newList.length; i++) {
-					argout[i] = newList[i].getId_snap();
-				}
-			}
-		} catch (SnapshotingException e) {
-			// TODO Auto-generated catch block
-			return null;
+	int numberOfSnapshots = snapshots.length;
+
+	DevVarLongStringArray ret = new DevVarLongStringArray();
+	int[] lvalue = new int[numberOfSnapshots];
+	java.lang.String[] svalue = new java.lang.String[numberOfSnapshots];
+	for (int i = 0; i < numberOfSnapshots; i++) {
+	    SnapShotLight currentSnapshot = snapshots[i];
+	    lvalue[i] = currentSnapshot.getId_snap();
+	    svalue[i] = currentSnapshot.getSnap_date() + " , " + currentSnapshot.getComment();
+	}
+	ret.lvalue = lvalue;
+	ret.svalue = svalue;
+
+	return ret;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see snapextractor.api.datasources.db.ISnapReader#getSnapshotID(int)
+     */
+    @Override
+    public int[] getSnapshotsID(int ctxID, String[] criterions) {
+	// ---Add your Own code to control device here ---
+	int[] argout = null;
+
+	Criterions ret = getInputCriterion(criterions);
+	if (ret == null) {
+	    return null;
+	}
+	ret.addCondition(new Condition(GlobalConst.TAB_SNAP[1], GlobalConst.OP_EQUALS, "" + ctxID));
+
+	SnapShotLight[] newList;
+	try {
+	    newList = manager.findSnapshots(ret);
+	    if (ret.getConditions("first") != null) {
+		argout = new int[1];
+		argout[0] = newList[0].getId_snap();
+	    } else if (ret.getConditions("last") != null) {
+		argout = new int[1];
+		argout[0] = newList[newList.length - 1].getId_snap();
+	    } else {
+		argout = new int[newList.length];
+		for (int i = 0; i < newList.length; i++) {
+		    argout[i] = newList[i].getId_snap();
 		}
-
-		// ------------------------------------------------
-
-		return argout;
+	    }
+	} catch (SnapshotingException e) {
+	    // TODO Auto-generated catch block
+	    return null;
 	}
 
-	private Criterions getInputCriterion(String[] criterions) {
-		// TODO Auto-generated method stub
-		Criterions ret = new Criterions();
-		try {
-			Condition cond;
-			String criterion_type = null;
-			String criterion_op = null;
-			String criterion_value = null;
-			for (int i = 0; i < criterions.length; i++) {
-				if (criterions[i].equals("first")
-						|| criterions[i].equals("last")) {
-					cond = getCondition(criterions[i], criterions[i],
-							criterions[i]);
-					ret.addCondition(cond);
-
-				} else if (criterions[i].equals("id_snap")
-						|| criterions[i].equals("comment")
-						|| criterions[i].equals("time")) {
-					criterion_type = criterions[i].substring(0, criterions[i]
-							.indexOf(" "));
-					criterions[i] = criterions[i].substring(criterions[i]
-							.indexOf(criterion_type)
-							+ criterion_type.length() + 1);
-					criterion_op = criterions[i].substring(0, criterions[i]
-							.indexOf(" "));
-					criterion_value = criterions[i].substring(
-							criterions[i].indexOf(criterion_op)
-									+ criterion_op.length()).trim();
-
-					cond = getCondition(criterion_op, criterion_value,
-							criterion_type);
-					ret.addCondition(cond);
-
-				} else
-					return null;
-			}
-		} catch (Exception e) {
+	// ------------------------------------------------
 
-			return null;
+	return argout;
+    }
+
+    private Criterions getInputCriterion(String[] criterions) {
+	// TODO Auto-generated method stub
+	Criterions ret = new Criterions();
+	try {
+	    Condition cond;
+	    String criterion_type = null;
+	    String criterion_op = null;
+	    String criterion_value = null;
+	    for (int i = 0; i < criterions.length; i++) {
+		if (criterions[i].equals("first") || criterions[i].equals("last")) {
+		    cond = getCondition(criterions[i], criterions[i], criterions[i]);
+		    ret.addCondition(cond);
+
+		} else if (criterions[i].equals("id_snap") || criterions[i].equals("comment")
+			|| criterions[i].equals("time")) {
+		    criterion_type = criterions[i].substring(0, criterions[i].indexOf(" "));
+		    criterions[i] = criterions[i].substring(criterions[i].indexOf(criterion_type)
+			    + criterion_type.length() + 1);
+		    criterion_op = criterions[i].substring(0, criterions[i].indexOf(" "));
+		    criterion_value = criterions[i].substring(
+			    criterions[i].indexOf(criterion_op) + criterion_op.length()).trim();
+
+		    cond = getCondition(criterion_op, criterion_value, criterion_type);
+		    ret.addCondition(cond);
+
+		} else {
+		    return null;
 		}
+	    }
+	} catch (Exception e) {
 
-		return ret;
+	    return null;
 	}
 
-	// ------------------------------------------------
-	/**
-	 * If both operator and threshold value are filled, builds a Condition from
-	 * them. Otherwise returns null.
-	 * 
-	 * @param selectedItem
-	 *            The operator
-	 * @param text
-	 *            The value
-	 * @param id_field_key2
-	 *            The field's id
-	 * @return The resulting Condition or null
-	 */
-	public Condition getCondition(String selectedItem, String text,
-			String id_field_key2) {
-		// Date Formating
-		if (id_field_key2.equals("time")) {
-			text = Tools.formatDate(Tools.stringToMilli(text));
-		} else if (id_field_key2.contains("comment")) {
-			id_field_key2 = "snap_comment";
-			selectedItem = getCommentCondition(selectedItem);
-		}
-
-		boolean isACriterion = true;
+	return ret;
+    }
+
+    // ------------------------------------------------
+    /**
+     * If both operator and threshold value are filled, builds a Condition from
+     * them. Otherwise returns null.
+     * 
+     * @param selectedItem
+     *            The operator
+     * @param text
+     *            The value
+     * @param id_field_key2
+     *            The field's id
+     * @return The resulting Condition or null
+     */
+    public Condition getCondition(String selectedItem, String text, String id_field_key2) {
+	// Date Formating
+	if (id_field_key2.equals("time")) {
+	    text = Tools.formatDate(Tools.stringToMilli(text));
+	} else if (id_field_key2.contains("comment")) {
+	    id_field_key2 = "snap_comment";
+	    selectedItem = getCommentCondition(selectedItem);
+	}
 
-		if (selectedItem == null || selectedItem.equals("")) {
-			isACriterion = false;
-		}
+	boolean isACriterion = true;
 
-		if (text == null || text.trim().equals("")) {
-			isACriterion = false;
-		}
+	if (selectedItem == null || selectedItem.equals("")) {
+	    isACriterion = false;
+	}
 
-		if (isACriterion || selectedItem.equals("first")
-				|| selectedItem.equals("last")) {
-			return new Condition(id_field_key2, selectedItem, text.trim());
-		}
+	if (text == null || text.trim().equals("")) {
+	    isACriterion = false;
+	}
 
-		return null;
+	if (isACriterion || selectedItem.equals("first") || selectedItem.equals("last")) {
+	    return new Condition(id_field_key2, selectedItem, text.trim());
 	}
 
-	private String getCommentCondition(String selectedItem) {
-		// TODO Auto-generated method stub
-		if (selectedItem.equalsIgnoreCase("starts"))
-			return "Starts with";
-		else if (selectedItem.equalsIgnoreCase("ends"))
-			return "Ends with";
-		else
-			return "Contains";
+	return null;
+    }
+
+    private String getCommentCondition(String selectedItem) {
+	if (selectedItem.equalsIgnoreCase("starts")) {
+	    return "Starts with";
+	} else if (selectedItem.equalsIgnoreCase("ends")) {
+	    return "Ends with";
+	} else {
+	    return "Contains";
 	}
+    }
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/SnapReaderFactory.java b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/SnapReaderFactory.java
index 4c4ff1b..c64b293 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/SnapReaderFactory.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/datasources/db/SnapReaderFactory.java
@@ -38,44 +38,42 @@ package fr.soleil.snapArchivingApi.SnapExtractorApi.datasources.db;
  * @author CLAISSE
  */
 public class SnapReaderFactory {
-	public static final int DUMMY_TYPE = 1;
-	public static final int REAL = 2;
+    public static final int DUMMY_TYPE = 1;
+    public static final int REAL = 2;
 
-	private static ISnapReader currentImpl = null;
+    private static ISnapReader currentImpl = null;
 
-	/**
-	 * Instantiates and return the ISnapReader singleton
-	 * 
-	 * @param typeOfImpl
-	 *            The type of implementation
-	 * @return The required implementation
-	 */
-	public static ISnapReader getImpl(int typeOfImpl) {
-		switch (typeOfImpl) {
-		case DUMMY_TYPE:
-			currentImpl = new DummySnapReader();
-			break;
+    /**
+     * Instantiates and return the ISnapReader singleton
+     * 
+     * @param typeOfImpl
+     *            The type of implementation
+     * @return The required implementation
+     */
+    public static ISnapReader getImpl(int typeOfImpl) {
+	switch (typeOfImpl) {
+	case DUMMY_TYPE:
+	    currentImpl = new DummySnapReader();
+	    break;
 
-		case REAL:
-			currentImpl = new RealSnapReader();
-			break;
+	case REAL:
+	    currentImpl = new RealSnapReader();
+	    break;
 
-		default:
-			throw new IllegalArgumentException(
-					"Expected either DUMMY_IMPL_TYPE (1) or REAL_IMPL_TYPE (2), got "
-							+ typeOfImpl + " instead.");
-		}
-
-		return currentImpl;
+	default:
+	    throw new IllegalArgumentException("Expected either DUMMY_IMPL_TYPE (1) or REAL_IMPL_TYPE (2), got "
+		    + typeOfImpl + " instead.");
 	}
+	return currentImpl;
+    }
 
-	/**
-	 * Returns the current implementation singleton
-	 * 
-	 * @return The current implementation singleton
-	 */
-	public static ISnapReader getCurrentImpl() {
-		return currentImpl;
-	}
+    /**
+     * Returns the current implementation singleton
+     * 
+     * @return The current implementation singleton
+     */
+    public static ISnapReader getCurrentImpl() {
+	return currentImpl;
+    }
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/lifecycle/DefaultLifeCycleManager.java b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/lifecycle/DefaultLifeCycleManager.java
index f9d35a3..e6fa887 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/lifecycle/DefaultLifeCycleManager.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapExtractorApi/lifecycle/DefaultLifeCycleManager.java
@@ -58,180 +58,185 @@ import fr.soleil.snapArchivingApi.SnapExtractorApi.naming.DynamicAttributeNamerF
  * @author CLAISSE
  */
 public class DefaultLifeCycleManager extends Thread implements LifeCycleManager {
-	/**
-	 * A reference to the device that instantiated this, if the application is
-	 * running in device mode
-	 */
-	protected Warnable watcherToWarn;
-	private ISnapReader snapReader;
-
-	private String snapUser;
-	private String snapPassword;
-
-	DefaultLifeCycleManager() {
-		this.setName("watcherThread");
+    /**
+     * A reference to the device that instantiated this, if the application is
+     * running in device mode
+     */
+    protected Warnable watcherToWarn;
+    private ISnapReader snapReader;
+
+    private String snapUser;
+    private String snapPassword;
+
+    DefaultLifeCycleManager() {
+	this.setName("watcherThread");
+    }
+
+    /**
+     * @param snapPassword
+     *            the snapPassword to set
+     */
+    public void setSnapPassword(String snapPassword) {
+	this.snapPassword = snapPassword;
+    }
+
+    /**
+     * @param snapUser
+     *            the snapUser to set
+     */
+    public void setSnapUser(String snapUser) {
+	this.snapUser = snapUser;
+    }
+
+    /*
+     * (non-Javadoc)snapUser
+     * 
+     * @see
+     * mambo.lifecycle.LifeCycleManager#applicationWillStart(java.util.Hashtable
+     * )
+     */
+    @Override
+    public synchronized void applicationWillStart(Hashtable startParameters) {
+	System.out.println(".....INITIALIZING APPLICATION");
+
+	try {
+	    startFactories();
+
+	    snapReader = SnapReaderFactory.getCurrentImpl();
+	    snapReader.openConnection();
+	} catch (Throwable t) {
+	    t.printStackTrace();
+	    this.warnWatcherFault();
 	}
 
-	/**
-	 * @param snapPassword
-	 *            the snapPassword to set
-	 */
-	public void setSnapPassword(String snapPassword) {
-		this.snapPassword = snapPassword;
+	System.out.println(".....APPLICATION INITIALIZED");
+	System.out.println();
+    }
+
+    /**
+     * 5 juil. 2005
+     */
+    private void startFactories() {
+	SnapReaderFactory.getImpl(SnapReaderFactory.REAL);
+	ConverterFactory.getImpl(ConverterFactory.DEFAULT);
+	DynamicAttributeNamerFactory.getImpl(DynamicAttributeNamerFactory.DEFAULT);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * mambo.lifecycle.LifeCycleManager#applicationClosed(java.util.Hashtable)
+     */
+    @Override
+    public synchronized void applicationWillClose(Hashtable endParameters) {
+	try {
+	    // begin do stuff
+	    System.out.println("Application will close !");
+
+	    snapReader = SnapReaderFactory.getCurrentImpl();
+	    snapReader.closeConnection();
+
+	    System.out.println("Application closed");
+	    // end do stuff
+	    System.exit(0);
+	} catch (Throwable t) {
+	    t.printStackTrace();
+	    System.exit(1);
 	}
-
-	/**
-	 * @param snapUser
-	 *            the snapUser to set
-	 */
-	public void setSnapUser(String snapUser) {
-		this.snapUser = snapUser;
-	}
-
-	/*
-	 * (non-Javadoc)snapUser
-	 * 
-	 * @see
-	 * mambo.lifecycle.LifeCycleManager#applicationWillStart(java.util.Hashtable
-	 * )
-	 */
-	public synchronized void applicationWillStart(Hashtable startParameters) {
-		System.out.println(".....INITIALIZING APPLICATION");
-
-		try {
-			startFactories();
-
-			snapReader = SnapReaderFactory.getCurrentImpl();
-			snapReader.openConnection(this.snapUser, this.snapPassword);
-		} catch (Throwable t) {
-			t.printStackTrace();
-			this.warnWatcherFault();
-		}
-
-		System.out.println(".....APPLICATION INITIALIZED");
-		System.out.println();
-	}
-
-	/**
-	 * 5 juil. 2005
-	 */
-	private void startFactories() {
-		SnapReaderFactory.getImpl(SnapReaderFactory.REAL);
-		ConverterFactory.getImpl(ConverterFactory.DEFAULT);
-		DynamicAttributeNamerFactory
-				.getImpl(DynamicAttributeNamerFactory.DEFAULT);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * mambo.lifecycle.LifeCycleManager#applicationClosed(java.util.Hashtable)
-	 */
-	public synchronized void applicationWillClose(Hashtable endParameters) {
-		try {
-			// begin do stuff
-			System.out.println("Application will close !");
-
-			snapReader = SnapReaderFactory.getCurrentImpl();
-			snapReader.closeConnection();
-
-			System.out.println("Application closed");
-			// end do stuff
-			System.exit(0);
-		} catch (Throwable t) {
-			t.printStackTrace();
-			System.exit(1);
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Runnable#run()
-	 */
-	public void run() {
-		try {
-			this.applicationWillStart(null);
-		} catch (Throwable t) {
-			t.printStackTrace();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see archwatch.lifecycle.LifeCycleManager#getAsThread()
-	 */
-	public Thread getAsThread() {
-		return this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
-	 * archwatch.strategy.delay.IDelayManager#setWatcherToWarn(ArchivingWatcher
-	 * .ArchivingWatcher)
-	 */
-	public synchronized void setWatcherToWarn(Warnable _watcher) {
-		this.watcherToWarn = _watcher;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Runnable#run()
+     */
+    @Override
+    public void run() {
+	try {
+	    this.applicationWillStart(null);
+	} catch (Throwable t) {
+	    t.printStackTrace();
 	}
-
-	/**
-	 * Warns the device it should go into Fault state
-	 */
-	protected synchronized void warnWatcherFault() {
-		if (this.watcherToWarn == null) {
-			// standalone mode, do nothing
-			return;
-		}
-
-		this.watcherToWarn.warnFault();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see archwatch.lifecycle.LifeCycleManager#getAsThread()
+     */
+    @Override
+    public Thread getAsThread() {
+	return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * archwatch.strategy.delay.IDelayManager#setWatcherToWarn(ArchivingWatcher
+     * .ArchivingWatcher)
+     */
+    @Override
+    public synchronized void setWatcherToWarn(Warnable _watcher) {
+	this.watcherToWarn = _watcher;
+    }
+
+    /**
+     * Warns the device it should go into Fault state
+     */
+    protected synchronized void warnWatcherFault() {
+	if (this.watcherToWarn == null) {
+	    // standalone mode, do nothing
+	    return;
 	}
 
-	/**
-	 * Warns the device it should go into Alarm state
-	 */
-	protected synchronized void warnWatcherAlarm() {
-		if (this.watcherToWarn == null) {
-			// standalone mode, do nothing
-			return;
-		}
+	this.watcherToWarn.warnFault();
+    }
 
-		this.watcherToWarn.warnAlarm();
+    /**
+     * Warns the device it should go into Alarm state
+     */
+    protected synchronized void warnWatcherAlarm() {
+	if (this.watcherToWarn == null) {
+	    // standalone mode, do nothing
+	    return;
 	}
 
-	/**
-	 * Warns the device it should go into Init state
-	 */
-	protected synchronized void warnWatcherInit() {
-		if (this.watcherToWarn == null) {
-			// standalone mode, do nothing
-			return;
-		}
+	this.watcherToWarn.warnAlarm();
+    }
 
-		this.watcherToWarn.warnInit();
+    /**
+     * Warns the device it should go into Init state
+     */
+    protected synchronized void warnWatcherInit() {
+	if (this.watcherToWarn == null) {
+	    // standalone mode, do nothing
+	    return;
 	}
 
-	/**
-	 * Warns the device it should go into Off state
-	 */
-	protected synchronized void warnWatcherOff() {
-		if (this.watcherToWarn == null) {
-			// standalone mode, do nothing
-			return;
-		}
+	this.watcherToWarn.warnInit();
+    }
 
-		this.watcherToWarn.warnOff();
+    /**
+     * Warns the device it should go into Off state
+     */
+    protected synchronized void warnWatcherOff() {
+	if (this.watcherToWarn == null) {
+	    // standalone mode, do nothing
+	    return;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see snapextractor.api.devicelink.Warner#getWatcherToWarn()
-	 */
-	public Warnable getWatcherToWarn() {
-		return this.watcherToWarn;
-	}
+	this.watcherToWarn.warnOff();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see snapextractor.api.devicelink.Warner#getWatcherToWarn()
+     */
+    @Override
+    public Warnable getWatcherToWarn() {
+	return this.watcherToWarn;
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/ISnapManager.java b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/ISnapManager.java
index 9ea17f5..c9b0a38 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/ISnapManager.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/ISnapManager.java
@@ -58,38 +58,33 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
  */
 public interface ISnapManager {
 
-    public SnapContext[] findContexts(Criterions criterions)
-            throws SnapshotingException;
+    public SnapContext[] findContexts(Criterions criterions) throws SnapshotingException;
 
-    public SnapShotLight[] findSnapshots(Criterions criterions)
-            throws SnapshotingException;
+    public SnapShotLight[] findSnapshots(Criterions criterions) throws SnapshotingException;
 
-    public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot)
-            throws SnapshotingException;
+    public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot) throws SnapshotingException;
 
     public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot, int contextID)
-            throws SnapshotingException;
+	    throws SnapshotingException;
 
-    public SnapContext saveContext(SnapContext context)
-            throws SnapshotingException;
+    public SnapContext saveContext(SnapContext context) throws SnapshotingException;
 
-    public SnapShot launchSnapshot(SnapContext context)
-            throws SnapshotingException;
+    public SnapShot launchSnapshot(SnapContext context) throws SnapshotingException;
 
-    public SnapShotLight updateCommentOfSnapshot(SnapShotLight snapshot,
-            String comment) throws SnapshotingException;
+    public SnapShotLight updateCommentOfSnapshot(SnapShotLight snapshot, String comment) throws SnapshotingException;
 
-    public void setEquipmentsWithSnapshot(SnapShot snapshot)
-            throws SnapshotingException;
+    public void setEquipmentsWithSnapshot(SnapShot snapshot) throws SnapshotingException;
 
-    public SnapAttributeHeavy[] findContextAttributes(SnapContext context,
-            Criterions criterions) throws SnapshotingException;
+    public SnapAttributeHeavy[] findContextAttributes(SnapContext context, Criterions criterions)
+	    throws SnapshotingException;
 
     public SnapAttributeExtract[] getSnap(int id) throws SnapshotingException;
 
-    public String setEquipmentsWithCommand(String cmd_name, String option,
-            SnapShot snapshot);
-    
+    SnapAttributeExtract[] getSnapValues(int id, String... attributeNames) throws SnapshotingException;
+
+    public String setEquipmentsWithCommand(String cmd_name, String option, SnapShot snapshot)
+	    throws SnapshotingException;
+
     public int findContextId(int snapshotId) throws SnapshotingException;
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerApi.java b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerApi.java
index 85c6d42..54ca84d 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerApi.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerApi.java
@@ -1,116 +1,109 @@
-// +======================================================================
-// $Source:
-// /cvsroot/tango-cs/tango/api/java/fr/soleil/TangoSnapshoting/SnapManagerApi/SnapManagerApi.java,v
-// $
+//+======================================================================
+// $Source: /cvsroot/tango-cs/tango/api/java/fr/soleil/TangoSnapshoting/SnapManagerApi/SnapManagerApi.java,v $
 //
-// Project: Tango Archiving Service
+// Project:      Tango Archiving Service
 //
-// Description: Java source code for the class SnapManagerApi.
-// (Chinkumo Jean) - Nov 2, 2004
+// Description:  Java source code for the class  SnapManagerApi.
+//						(Chinkumo Jean) - Nov 2, 2004
 // $Author: soleilarc $
 //
 // $Revision: 1.20 $
 //
 // $Log: SnapManagerApi.java,v $
-// Revision 1.20 2007/10/15 13:24:49 soleilarc
+// Revision 1.20  2007/10/15 13:24:49  soleilarc
 // Author: XP
 // Mantis bug ID: 6695
 // Comment:
-// In the connectSnapDatabase method, change the syntax oneString.equals("")
-// into this one : "".equals(oneString).
-// In the TriggerSetEquipments method, to use a final SnapshotingException
-// exception, to get the list of all lift exceptions with all unreachable
-// devices, by adding the DevFailed exceptions to its stack.
+// In the connectSnapDatabase method, change the syntax oneString.equals("") into this one : "".equals(oneString).
+// In the TriggerSetEquipments method, to use a final SnapshotingException exception, to get the list of all lift exceptions with all unreachable devices, by adding the DevFailed exceptions to its stack.
 //
-// Revision 1.19 2007/06/29 09:20:31 ounsy
+// Revision 1.19  2007/06/29 09:20:31  ounsy
 // devLong represented as Integer
 //
-// Revision 1.18 2007/03/14 15:43:50 ounsy
+// Revision 1.18  2007/03/14 15:43:50  ounsy
 // modified launchSnap2Archiver to no longer wait after launching a snapshot
 //
-// Revision 1.17 2007/01/22 10:47:13 ounsy
+// Revision 1.17  2007/01/22 10:47:13  ounsy
 // added a giveup condition in launchSnap2Archiver
 //
-// Revision 1.16 2006/11/20 09:27:18 ounsy
+// Revision 1.16  2006/11/20 09:27:18  ounsy
 // minor changes
 //
-// Revision 1.15 2006/10/31 16:54:24 ounsy
+// Revision 1.15  2006/10/31 16:54:24  ounsy
 // milliseconds and null values management
 //
-// Revision 1.14 2006/10/30 14:37:21 ounsy
+// Revision 1.14  2006/10/30 14:37:21  ounsy
 // minor change
 //
-// Revision 1.13 2006/06/28 12:43:58 ounsy
+// Revision 1.13  2006/06/28 12:43:58  ounsy
 // image support
 //
-// Revision 1.12 2006/05/17 10:13:08 ounsy
-// added the name of the attribute the command failed on for the
-// TriggerSetEquipment method
+// Revision 1.12  2006/05/17 10:13:08  ounsy
+// added the name of the attribute the command failed on for the TriggerSetEquipment method
 //
-// Revision 1.11 2006/05/04 14:32:38 ounsy
+// Revision 1.11  2006/05/04 14:32:38  ounsy
 // minor changes (commented useless methods and variables)
 //
-// Revision 1.10 2006/04/13 12:46:48 ounsy
+// Revision 1.10  2006/04/13 12:46:48  ounsy
 // spectrum management updated
 //
-// Revision 1.9 2006/04/12 15:32:59 ounsy
-// added a wait loop in launchSnap2Archiver so that the snap is completely
-// loaded
+// Revision 1.9  2006/04/12 15:32:59  ounsy
+// added a wait loop in launchSnap2Archiver so that the snap is completely loaded
 //
-// Revision 1.8 2006/02/17 09:29:50 chinkumo
+// Revision 1.8  2006/02/17 09:29:50  chinkumo
 // Minor change : code reformated.
 //
-// Revision 1.7 2006/02/15 09:02:56 ounsy
+// Revision 1.7  2006/02/15 09:02:56  ounsy
 // Spectrums Management
 //
-// Revision 1.6 2005/11/29 17:11:17 chinkumo
+// Revision 1.6  2005/11/29 17:11:17  chinkumo
 // no message
 //
-// Revision 1.5.2.1 2005/11/15 13:34:38 chinkumo
+// Revision 1.5.2.1  2005/11/15 13:34:38  chinkumo
 // no message
 //
-// Revision 1.5 2005/08/19 14:04:02 chinkumo
+// Revision 1.5  2005/08/19 14:04:02  chinkumo
 // no message
 //
-// Revision 1.4.6.1.2.1 2005/08/11 08:16:49 chinkumo
+// Revision 1.4.6.1.2.1  2005/08/11 08:16:49  chinkumo
 // The 'SetEquipement' command and thus functionnality was added.
 //
-// Revision 1.4.6.1 2005/08/01 13:49:57 chinkumo
-// Several changes carried out for the support of the new graphical application
-// (Bensikin).
+// Revision 1.4.6.1  2005/08/01 13:49:57  chinkumo
+// Several changes carried out for the support of the new graphical application (Bensikin).
 //
-// Revision 1.4 2005/06/28 09:10:16 chinkumo
+// Revision 1.4  2005/06/28 09:10:16  chinkumo
 // Changes made to improve the management of exceptions were reported here.
 //
-// Revision 1.3 2005/06/24 12:04:18 chinkumo
-// The fr.soleil.snapArchivingApi.SnapshotingApi.DataBaseAPI.crateNewSnap method
-// was renamed into createNewSnap.
+// Revision 1.3  2005/06/24 12:04:18  chinkumo
+// The fr.soleil.snapArchivingApi.SnapshotingApi.DataBaseAPI.crateNewSnap method was renamed into createNewSnap.
 // This change was reported here.
 //
-// Revision 1.2 2005/01/26 15:35:37 chinkumo
+// Revision 1.2  2005/01/26 15:35:37  chinkumo
 // Ultimate synchronization before real sharing.
 //
-// Revision 1.1 2004/12/06 17:39:56 chinkumo
+// Revision 1.1  2004/12/06 17:39:56  chinkumo
 // First commit (new API architecture).
 //
 //
-// copyleft : Synchrotron SOLEIL
-// L'Orme des Merisiers
-// Saint-Aubin - BP 48
-// 91192 GIF-sur-YVETTE CEDEX
+// copyleft :	Synchrotron SOLEIL
+//					L'Orme des Merisiers
+//					Saint-Aubin - BP 48
+//					91192 GIF-sur-YVETTE CEDEX
 //
-// -======================================================================
+//-======================================================================
 
 package fr.soleil.snapArchivingApi.SnapManagerApi;
 
 import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Random;
 import java.util.Vector;
 
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.DevFailed;
+import fr.esrf.Tango.DevState;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoApi.ApiUtil;
 import fr.esrf.TangoApi.AttributeInfo;
@@ -121,7 +114,6 @@ import fr.esrf.TangoApi.DeviceAttribute;
 import fr.esrf.TangoApi.DeviceData;
 import fr.esrf.TangoApi.DeviceProxy;
 import fr.esrf.TangoDs.TangoConst;
-import fr.esrf.TangoDs.Util;
 import fr.soleil.snapArchivingApi.SnapshotingApi.ConfigConst;
 import fr.soleil.snapArchivingApi.SnapshotingApi.DataBaseAPI;
 import fr.soleil.snapArchivingApi.SnapshotingApi.GetConf;
@@ -136,20 +128,21 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShotLight;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 
 public class SnapManagerApi {
+    private static final String DATA_BASE_API_NOT_INIT = "DataBaseAPI not initialized";
     // Command name
-    private static final String m_LAUNCHSNAP              = "LaunchSnapShot";
-    private static final String m_CREATECONTEXT           = "CreateNewContext";
-    private static final String m_TRIGGERLAUNCHSNAP       = "TriggerLaunchSnapShot";
+    private static final String m_LAUNCHSNAP = "LaunchSnapShot";
+    private static final String m_CREATECONTEXT = "CreateNewContext";
+    private static final String m_TRIGGERLAUNCHSNAP = "TriggerLaunchSnapShot";
 
     // Snap Data Base
-    private static DataBaseAPI  m_snapDataBase            = null;
+    private static DataBaseAPI snapDataBase = null;
 
     private static final String m_snapArchiverClassDevice = "SnapArchiver";
-    private static String[]     m_snapArchiverList;
-    private static final String m_snapManagerClassDevice  = "SnapManager";
-    private static String[]     m_snapManagerList;
-    private static final String m_snapBrowserClassDevice  = "SnapExtractor";
-    private static String[]     m_snapBrowserList;
+    private static String[] m_snapArchiverList;
+    private static final String m_snapManagerClassDevice = "SnapManager";
+    private static String[] m_snapManagerList;
+    private static final String m_snapBrowserClassDevice = "SnapExtractor";
+    private static String[] m_snapBrowserList;
 
     // private static boolean sFacility = false;
     // private static boolean is_snap_connected = false;
@@ -160,74 +153,72 @@ public class SnapManagerApi {
      * @return the Host of the snap database
      */
     public static String getSnapHost() {
-        if (m_snapDataBase != null)
-            return m_snapDataBase.getHost();
-        else
-            return "";
+	if (snapDataBase != null) {
+	    return snapDataBase.getHost();
+	} else {
+	    return "";
+	}
     }
 
     /**
      * @return the name of the snap database
      */
     public static String getSnapDatabaseName() {
-        if (m_snapDataBase != null)
-            return m_snapDataBase.getDbName();
-        else
-            return "";
+	if (snapDataBase != null) {
+	    return snapDataBase.getDbName();
+	} else {
+	    return "";
+	}
     }
 
     /**
      * @return the user of the snap database
      */
     public static String getSnapUser() {
-        if (m_snapDataBase != null)
-            return m_snapDataBase.getUser();
-        else
-            return "";
+	if (snapDataBase != null) {
+	    return snapDataBase.getUser();
+	} else {
+	    return "";
+	}
     }
 
     /**
      * @return the password of the snap database
      */
     public static String getSnapPassword() {
-        if (m_snapDataBase != null)
-            return m_snapDataBase.getPassword();
-        else
-            return "";
+	if (snapDataBase != null) {
+	    return snapDataBase.getPassword();
+	} else {
+	    return "";
+	}
     }
 
     /**
      * @return the snap database type (MySQL, ORACLE)...
      */
     public static int getSnapDbType() {
-        if (m_snapDataBase != null)
-            return m_snapDataBase.getDb_type();
-        return -1;
+	if (snapDataBase != null) {
+	    return snapDataBase.getDb_type();
+	}
+	return -1;
     }
 
     /**
      * @return the facility property for that type of archiving.
      */
     private static boolean getFacility() {
-        boolean facility = false;
-        try {
-            facility = GetConf.getFacility(m_snapArchiverClassDevice);
-        } catch (SnapshotingException e) {
-            System.err.println(e.toString());
-        }
-        return facility;
+	boolean facility = false;
+	try {
+	    facility = GetConf.getFacility(m_snapArchiverClassDevice);
+	} catch (SnapshotingException e) {
+	    System.err.println(e.toString());
+	}
+	return facility;
     }
 
     // ============================================================
     // Methodes
 
-    /**
-     * initialize snapManagerApi
-     */
-    public static void Init() {
-        closeSnapDatabase();
-    }
-
     /**
      * This method returns the name of one of the running devices, according to
      * the given class
@@ -235,72 +226,68 @@ public class SnapManagerApi {
      * @param deviceClass
      *            The device's class
      * @return The device's name
+     * @throws DevFailed
      */
-    private static String chooseDevice(String deviceClass) {
-        String device_name = "";
-        String[] devicesList = null;
-        if (deviceClass == m_snapArchiverClassDevice) {
-            initDeviceList(m_snapArchiverClassDevice);
-            devicesList = m_snapArchiverList;
-        } else if (deviceClass == m_snapManagerClassDevice) {
-            initDeviceList(m_snapManagerClassDevice);
-            devicesList = m_snapManagerList;
-        } else if (deviceClass == m_snapBrowserClassDevice) {
-            initDeviceList(m_snapBrowserClassDevice);
-            devicesList = m_snapBrowserList;
-        }
-        Random hasard = new Random(System.currentTimeMillis());
-        if (devicesList.length > 0) {
-            int choosed_index = hasard.nextInt(devicesList.length);
-            device_name = devicesList[choosed_index];
-        }
-        return device_name;
+    private static String chooseDevice(String deviceClass) throws DevFailed {
+	String device_name = "";
+	String[] devicesList = null;
+	if (deviceClass == m_snapArchiverClassDevice) {
+	    initDeviceList(m_snapArchiverClassDevice);
+	    devicesList = m_snapArchiverList;
+	} else if (deviceClass == m_snapManagerClassDevice) {
+	    initDeviceList(m_snapManagerClassDevice);
+	    devicesList = m_snapManagerList;
+	} else if (deviceClass == m_snapBrowserClassDevice) {
+	    initDeviceList(m_snapBrowserClassDevice);
+	    devicesList = m_snapBrowserList;
+	}
+	Random hasard = new Random(System.currentTimeMillis());
+	if (devicesList.length > 0) {
+	    int choosed_index = hasard.nextInt(devicesList.length);
+	    device_name = devicesList[choosed_index];
+	}
+	return device_name;
     }
 
     /**
      * This method gets all the running SnapArchivers and stores the name in the
      * m_snapArchiverList
+     * 
+     * @throws DevFailed
      */
-    private static void initDeviceList(String deviceClass) {
-        try {
-            Database dbase = ApiUtil.get_db_obj();
-            String[] runningDeviceList = dbase.get_device_exported("*"
-                    + deviceClass + "*");
-            String[] myRunningDeviceList = new String[runningDeviceList.length];
-            int j = 0;
-            for (int i = 0; i < runningDeviceList.length; i++) {
-                if (deviceLivingTest(runningDeviceList[i], deviceClass)) {
-                    myRunningDeviceList[j] = runningDeviceList[i];
-                    j++;
-                }
-            }
-
-            if (deviceClass == m_snapArchiverClassDevice) { // SnapArchiverList
-                // building
-                m_snapArchiverList = new String[j];
-                for (int i = 0; i < j; i++)
-                    m_snapArchiverList[i] = myRunningDeviceList[i];
-            } else if (deviceClass == m_snapManagerClassDevice) { // SnapManagerList
-                // building
-                m_snapManagerList = new String[j];
-                for (int i = 0; i < j; i++)
-                    m_snapManagerList[i] = myRunningDeviceList[i];
-            } else if (deviceClass == m_snapBrowserClassDevice) { // SnapBrowserList
-                // building
-                m_snapBrowserList = new String[j];
-                for (int i = 0; i < j; i++)
-                    m_snapBrowserList[i] = myRunningDeviceList[i];
-            }
-        } catch (DevFailed e) {
-            Util.out2
-                    .println("ERROR !! " + "\r\n" + "\t Origin : \t "
-                            + "SnapManagerApi.initDeviceList" + "\r\n"
-                            + "\t Reason : \t " + "SNAP_FAILURE" + "\r\n"
-                            + "\t Description : \t " + e.getMessage() + "\r\n"
-                            + "\t Additional information : \t "
-                            + "Failed initializing " + deviceClass + "'s list"
-                            + "\r\n");
-        }
+    private static void initDeviceList(String deviceClass) throws DevFailed {
+	Database dbase = ApiUtil.get_db_obj();
+	String[] runningDeviceList = dbase.get_device_exported_for_class("*" + deviceClass + "*");
+
+	String[] myRunningDeviceList = new String[runningDeviceList.length];
+
+	int j = 0;
+	for (int i = 0; i < runningDeviceList.length; i++) {
+	    if (deviceLivingTest(runningDeviceList[i], deviceClass)) {
+		myRunningDeviceList[j] = runningDeviceList[i];
+		j++;
+	    }
+	}
+	if (deviceClass == m_snapArchiverClassDevice) { // SnapArchiverList
+	    // building
+	    m_snapArchiverList = new String[j];
+	    for (int i = 0; i < j; i++) {
+		m_snapArchiverList[i] = myRunningDeviceList[i];
+	    }
+	} else if (deviceClass == m_snapManagerClassDevice) { // SnapManagerList
+	    // building
+	    m_snapManagerList = new String[j];
+	    for (int i = 0; i < j; i++) {
+		m_snapManagerList[i] = myRunningDeviceList[i];
+	    }
+	} else if (deviceClass == m_snapBrowserClassDevice) { // SnapBrowserList
+	    // building
+	    m_snapBrowserList = new String[j];
+	    for (int i = 0; i < j; i++) {
+		m_snapBrowserList[i] = myRunningDeviceList[i];
+	    }
+	}
+
     }
 
     /**
@@ -309,37 +296,37 @@ public class SnapManagerApi {
      * @param deviceName
      * @return true if the device is running
      */
-    private static boolean deviceLivingTest(String deviceName,
-            String deviceClass) {
-        try {
-            DeviceProxy deviceProxy = new DeviceProxy(deviceName);
-            deviceProxy.ping();
-
-            // verification de l existance d une commande
-            CommandInfo[] commandList = deviceProxy.command_list_query();
-            if (deviceClass == m_snapArchiverClassDevice) {
-                for (int i = 0; i < commandList.length; i++) {
-                    if (m_TRIGGERLAUNCHSNAP.equals(commandList[i].cmd_name))
-                        return true;
-                }
-            } else if (deviceClass == m_snapManagerClassDevice) {
-                for (int i = 0; i < commandList.length; i++) {
-                    if (m_CREATECONTEXT.equals(commandList[i].cmd_name))
-                        return true;
-                    if (m_LAUNCHSNAP.equals(commandList[i].cmd_name))
-                        return true;
-                }
-            }
-            return false;
-        } catch (DevFailed devFailed) {
-            System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-                    + "SnapManagerApi.deviceLivingTest" + "\r\n"
-                    + "\t Reason : \t " + "SNAP_FAILURE" + "\r\n"
-                    + "\t Description : \t " + devFailed.getMessage() + "\r\n"
-                    + "\t Additional information : \t " + "The device "
-                    + deviceName + " does not answer..." + "\r\n");
-            return false;
-        }
+    private static boolean deviceLivingTest(String deviceName, String deviceClass) {
+	try {
+	    DeviceProxy deviceProxy = new DeviceProxy(deviceName);
+	    deviceProxy.ping();
+
+	    // verification de l existance d une commande
+	    CommandInfo[] commandList = deviceProxy.command_list_query();
+	    if (deviceClass == m_snapArchiverClassDevice) {
+		for (int i = 0; i < commandList.length; i++) {
+		    if (m_TRIGGERLAUNCHSNAP.equals(commandList[i].cmd_name)) {
+			return true;
+		    }
+		}
+	    } else if (deviceClass == m_snapManagerClassDevice) {
+		for (int i = 0; i < commandList.length; i++) {
+		    if (m_CREATECONTEXT.equals(commandList[i].cmd_name)) {
+			return true;
+		    }
+		    if (m_LAUNCHSNAP.equals(commandList[i].cmd_name)) {
+			return true;
+		    }
+		}
+	    }
+	    return false;
+	} catch (DevFailed devFailed) {
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "SnapManagerApi.deviceLivingTest" + "\r\n"
+		    + "\t Reason : \t " + "SNAP_FAILURE" + "\r\n" + "\t Description : \t " + devFailed.getMessage()
+		    + "\r\n" + "\t Additional information : \t " + "The device " + deviceName + " does not answer..."
+		    + "\r\n");
+	    return false;
+	}
     }
 
     /**
@@ -411,125 +398,149 @@ public class SnapManagerApi {
      */
 
     private static String[] split_att_name_3_fields(String att_name) {
-        String host = "";
-        String domain = "";
-        String family = "";
-        String member = "";
-        String attribut = "";
-        String[] argout = new String[5];// = {"HOST", "DOMAIN", "FAMILY",
-        // "MEMBER", "ATTRIBUT"};
-        String[] decoupe; // d�coupage en 5 partie : host, domain, family,
-        // member, attribut
-
-        // Host name management
-        if (att_name.startsWith("//"))
-            att_name = att_name.substring(2, att_name.length());
-        else
-            att_name = "HOST:port/" + att_name;
-
-        // Spliting
-        decoupe = att_name.split("/"); // spliting the name in 3 fields
-        host = decoupe[0];
-        domain = decoupe[1];
-        family = decoupe[2];
-        member = decoupe[3];
-        attribut = decoupe[4];
-
-        argout[0] = host;
-        argout[1] = domain;
-        argout[2] = family;
-        argout[3] = member;
-        argout[4] = attribut;
-        return argout;
+	String host = "";
+	String domain = "";
+	String family = "";
+	String member = "";
+	String attribut = "";
+	String[] argout = new String[5];// = {"HOST", "DOMAIN", "FAMILY",
+					// "MEMBER", "ATTRIBUT"};
+	String[] decoupe; // d�coupage en 5 partie : host, domain, family,
+			  // member, attribut
+
+	// Host name management
+	if (att_name.startsWith("//")) {
+	    att_name = att_name.substring(2, att_name.length());
+	} else {
+	    att_name = "HOST:port/" + att_name;
+	}
+
+	// Spliting
+	decoupe = att_name.split("/"); // spliting the name in 3 fields
+	host = decoupe[0];
+	domain = decoupe[1];
+	family = decoupe[2];
+	member = decoupe[3];
+	attribut = decoupe[4];
+
+	argout[0] = host;
+	argout[1] = domain;
+	argout[2] = family;
+	argout[3] = member;
+	argout[4] = attribut;
+	return argout;
     }
 
-    /**
-     * This method allows to open the connection on the historic database
-     */
-    private static void connectSnapDatabase(String muser, String mpassword)
-            throws SnapshotingException {
-        if (m_snapDataBase == null) {
-            // Host
-            String host = null;
-            try {
-                host = GetConf.getHost(m_snapManagerClassDevice);
-                if ("".equals(host))
-                    host = ConfigConst.default_shost;
-            } catch (SnapshotingException e) {
-                System.err.println(e.toString());
-                host = ConfigConst.default_shost;
-            }
-
-            // Name
-            String name = null;
-            try {
-                name = GetConf.getName(m_snapManagerClassDevice);
-                if ("".equals(name))
-                    name = ConfigConst.default_sbd;
-
-            } catch (SnapshotingException e) {
-                System.err.println(e.toString());
-                name = ConfigConst.default_sbd;
-            }
-
-            // Schema
-            String schema = null;
-            try {
-                schema = GetConf.getSchema(m_snapManagerClassDevice);
-                if ("".equals(schema))
-                    schema = ConfigConst.default_sschema;
-            } catch (SnapshotingException e) {
-                System.err.println(e.toString());
-                schema = ConfigConst.default_sschema;
-            }
-
-            // User
-            String user = muser;
-            if ("".equals(user))
-                user = ConfigConst.default_smuser;
-
-            String pass = mpassword;
-            if ("".equals(pass))
-                pass = ConfigConst.default_smpasswd;
-
-            m_snapDataBase = new DataBaseAPI(host, name, schema, user, pass);
-            m_snapDataBase.connect_auto();
-            // is_snap_connected = true;
-        }
+    private static String getDefaultHost(final String host) {
+	String hostResult = host;
+	if (hostResult.isEmpty()) {
+	    try {
+		hostResult = GetConf.getHost(m_snapManagerClassDevice);
+		if ("".equals(hostResult)) {
+		    hostResult = ConfigConst.default_shost;
+		}
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		hostResult = ConfigConst.default_shost;
+	    }
+	}
+	return hostResult;
+    }
 
+    public static String getDefaultDbName(final String name) {
+	String result = name;
+	if (result.isEmpty()) {
+	    try {
+		result = GetConf.getName(m_snapManagerClassDevice);
+		if ("".equals(result)) {
+		    result = ConfigConst.default_sbd;
+		}
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		result = ConfigConst.default_sbd;
+	    }
+	}
+	return result;
     }
 
-    /**
-     * Close the connection of the historic database
-     */
-    public static void closeSnapDatabase() {
-        try {
-            if (m_snapDataBase != null) {
-                m_snapDataBase.close();
-                m_snapDataBase = null;
-                // is_snap_connected = false;
-            }
-
-        } catch (SnapshotingException e) {
-            m_snapDataBase = null;
-        }
+    public static String getDefaultSchema(final String name) {
+	String result = name;
+	if (result.isEmpty()) {
+	    try {
+		result = GetConf.getSchema(m_snapManagerClassDevice);
+		if ("".equals(result)) {
+		    result = ConfigConst.default_sschema;
+		}
+
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		result = ConfigConst.default_sschema;
+	    }
+	}
+	return result;
     }
 
-    /**
-     * configure the Archiving
-     */
-    public static void SnapshotingConfigure(String user, String password)
-            throws SnapshotingException {
-        // sFacility = getFacility();
-        getFacility();
-        connectSnapDatabase(user, password);
+    public static String getDefaultUser(final String name) {
+	String result = name;
+	if (result.isEmpty()) {
+	    try {
+		result = GetConf.getUser(m_snapManagerClassDevice);
+		if ("".equals(result)) {
+		    result = ConfigConst.default_smuser;
+		}
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		result = ConfigConst.default_smuser;
+	    }
+	}
+	return result;
     }
 
-    /**
-     * @return
-     */
-    public static DataBaseAPI getSnapDataBase() {
-        return m_snapDataBase;
+    public static String getDefaultPwd(final String name) {
+	String result = name;
+	if (result.isEmpty()) {
+	    try {
+		result = GetConf.getPwd(m_snapManagerClassDevice);
+		if ("".equals(result)) {
+		    result = ConfigConst.default_smpasswd;
+		}
+
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		result = ConfigConst.default_smpasswd;
+	    }
+	}
+	return result;
+    }
+
+    public static boolean getisRac(final String isRAC) {
+	boolean result = Boolean.parseBoolean(isRAC);
+	if (isRAC.isEmpty()) {
+	    try {
+		String s = GetConf.isRAC(m_snapManagerClassDevice);
+		if ("".equals(s)) {
+		    result = false;
+		} else {
+		    result = Boolean.parseBoolean(s);
+		}
+	    } catch (SnapshotingException e) {
+		System.err.println(e.toString());
+		result = false;
+	    }
+	}
+	return result;
+    }
+
+    public static synchronized void initSnapConnection(String host, String name, String schema, String user,
+	    String pass, String isRac) throws SnapshotingException {
+	System.out.println("host: " + host);
+	System.out.println("name: " + name);
+	System.out.println("schema: " + schema);
+	System.out.println("user: " + user);
+	System.out.println("pass: " + pass);
+	snapDataBase = new DataBaseAPI(getDefaultHost(host), getDefaultDbName(name), getDefaultSchema(schema),
+		getDefaultUser(user), getDefaultPwd(pass), getisRac(isRac));
+	snapDataBase.connect_auto();
     }
 
     /**
@@ -542,97 +553,68 @@ public class SnapManagerApi {
      *             exception throwned in case of communications problems with
      *             the device or database
      */
-    private static void register(String att_complete_name)
-            throws SnapshotingException {
-        try {
-            AttributeInfo att_info = attributeGetInfo(att_complete_name);
-
-            int index = att_complete_name.lastIndexOf("/");
-            String device_name = att_complete_name.substring(0, index);
-
-            String[] att_splitted_name = split_att_name_3_fields(att_complete_name);
-
-            Timestamp time = new Timestamp(new java.util.Date().getTime());
-
-            SnapAttributeHeavy snapAttribute = new SnapAttributeHeavy(
-                    att_complete_name);
-            snapAttribute.setAttribute_device_name(device_name);
-            snapAttribute.setRegistration_time(time); // ****************
-            // Attribute
-            // registration
-            // timestamp
-            snapAttribute.setAttribute_complete_name(att_complete_name); // ****************
-            // The
-            // whole
-            // attribute
-            // name
-            // (device_name
-            // +
-            // attribute_name)
-            snapAttribute.setAttribute_device_name(device_name); // ****************
-            // name of
-            // the
-            // belonging
-            // device.
-            snapAttribute.setDomain(att_splitted_name[1]); // ****************
-            // domain to which
-            // the attribute is
-            // associated
-            snapAttribute.setFamily(att_splitted_name[2]); // ****************
-            // family to which
-            // the attribute is
-            // associated
-            snapAttribute.setMember(att_splitted_name[3]); // ****************
-            // member to which
-            // the attribute is
-            // associated
-            snapAttribute.setAttribute_name(att_splitted_name[4]); // ****************
-            // attribute
-            // name
-            snapAttribute.setData_type(att_info.data_type); // ****************
-            // Attribute data
-            // type
-            snapAttribute.setData_format(att_info.data_format.value()); // ****************
-            // Attribute
-            // data
-            // format
-            snapAttribute.setWritable(att_info.writable.value()); // ****************
-            // Attribute
-            // read/write
-            // type
-            snapAttribute.setMax_dim_x(att_info.max_dim_x); // ****************
-            // Attribute Maximum
-            // X dimension
-            snapAttribute.setMax_dim_y(att_info.max_dim_y); // ****************
-            // Attribute Maximum
-            // Y dimension
-            snapAttribute.setLevel(att_info.level.value()); // ****************
-            // Attribute display
-            // level
-            snapAttribute.setCtrl_sys(att_splitted_name[0]); // ****************
-            // Control
-            // system to
-            // which the
-            // attribute
-            // belongs
-            snapAttribute.setArchivable(0); // **************** archivable
-            // (Property that precises whether
-            // the attribute is "on-run-only"
-            // archivable, or if it is "always"
-            // archivable
-            snapAttribute.setSubstitute(0); // **************** substitute
-
-            m_snapDataBase.registerAttribute(snapAttribute);
-        } catch (DevFailed devFailed) {
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.ATT_UNREACH_EXCEPTION;
-            String reason = "Failed while executing SnapManagerApi.register() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.PANIC,
-                    desc, "", devFailed);
-        } catch (SnapshotingException e) {
-            throw e;
-        }
+    private static void register(String att_complete_name) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	try {
+	    // /srubio@cells.es
+	    // This code has been modified to ensure that the device_name and
+	    // the attribute_name match
+	    // exactly those defined in the TangoDatabase (to avoid problems of
+	    // case in hibernate modules)
+
+	    // AttributeInfo att_info = attributeGetInfo(att_complete_name);
+	    int index = att_complete_name.lastIndexOf("/");
+	    String device_name = att_complete_name.substring(0, index);
+	    DeviceProxy deviceProxy = new DeviceProxy(device_name);
+	    Database dbase = ApiUtil.get_db_obj();
+	    String[] devslist = dbase.get_device_class_list(deviceProxy.info().server_id);
+	    for (int i = 0; i < devslist.length; i++) {
+		if (i > 1 && 0 == i % 2 && devslist[i].equalsIgnoreCase(device_name)) {
+		    device_name = devslist[i];
+		    // System.out.println("SnapManagerAPI.register: And the name of "+att_complete_name+" device is "+device_name);
+		}
+	    }
+	    String attribute_name = att_complete_name.substring(index + 1);
+	    AttributeInfo att_info = deviceProxy.get_attribute_info(attribute_name);
+	    attribute_name = att_info.name;
+	    att_complete_name = device_name + "/" + attribute_name;
+	    // / srubio@cells.es: end of my code
+
+	    System.out.println("SnapManagerAPI.register: " + att_complete_name);
+
+	    String[] att_splitted_name = split_att_name_3_fields(att_complete_name);
+
+	    Timestamp time = new Timestamp(new java.util.Date().getTime());
+
+	    SnapAttributeHeavy snapAttribute = new SnapAttributeHeavy(att_complete_name);
+	    snapAttribute.setRegistration_time(time);
+	    snapAttribute.setAttribute_complete_name(att_complete_name);
+	    snapAttribute.setAttribute_device_name(device_name);
+	    snapAttribute.setDomain(att_splitted_name[1]);
+	    snapAttribute.setFamily(att_splitted_name[2]);
+	    snapAttribute.setMember(att_splitted_name[3]);
+	    snapAttribute.setAttribute_name(att_splitted_name[4]);
+	    snapAttribute.setData_type(att_info.data_type);
+	    snapAttribute.setData_format(att_info.data_format.value());
+	    snapAttribute.setWritable(att_info.writable.value());
+	    snapAttribute.setMax_dim_x(att_info.max_dim_x);
+	    snapAttribute.setMax_dim_y(att_info.max_dim_y);
+	    snapAttribute.setLevel(att_info.level.value());
+	    snapAttribute.setCtrl_sys(att_splitted_name[0]);
+	    snapAttribute.setArchivable(0);
+	    snapAttribute.setSubstitute(0);
+
+	    snapDataBase.registerAttribute(snapAttribute);
+	} catch (DevFailed devFailed) {
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ATT_UNREACH_EXCEPTION;
+	    String reason = "Failed while executing SnapManagerApi.register() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
+	} catch (SnapshotingException e) {
+	    throw e;
+	}
     }
 
     /**
@@ -645,15 +627,15 @@ public class SnapManagerApi {
      *             execption throwned in case of communications problems with
      *             the device
      */
-    private static AttributeInfo attributeGetInfo(String att_complete_name)
-            throws DevFailed {
-        int index = att_complete_name.lastIndexOf("/");
-        String device_name = att_complete_name.substring(0, index);
-        String attribute_name = att_complete_name.substring(index + 1);
-        DeviceProxy deviceProxy = new DeviceProxy(device_name);
-        AttributeInfo att_info = deviceProxy.get_attribute_info(attribute_name);
-        return att_info;
-    }
+    // private static AttributeInfo attributeGetInfo(String att_complete_name)
+    // throws DevFailed {
+    // int index = att_complete_name.lastIndexOf("/");
+    // String device_name = att_complete_name.substring(0, index);
+    // String attribute_name = att_complete_name.substring(index + 1);
+    // DeviceProxy deviceProxy = new DeviceProxy(device_name);
+    // AttributeInfo att_info = deviceProxy.get_attribute_info(attribute_name);
+    // return att_info;
+    // }
 
     /**
      * This method insure that a given attribute was registered into Snap DB
@@ -661,11 +643,13 @@ public class SnapManagerApi {
      * @param attributeName
      *            the attribute name.
      */
-    public static void insureRegitration(String attributeName)
-            throws SnapshotingException {
-        if (!m_snapDataBase.isRegistered(attributeName)) {
-            register(attributeName);
-        }
+    public static void insureRegitration(String attributeName) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	if (!snapDataBase.isRegistered(attributeName)) {
+	    register(attributeName);
+	}
     }
 
     /**
@@ -676,58 +660,78 @@ public class SnapManagerApi {
      * @throws SnapshotingException
      */
     public static int getAttId(String att_name) throws SnapshotingException {
-        return m_snapDataBase.getAttID(att_name);
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getAttID(att_name);
     }
 
-    public static int createContext(SnapContext snapContext)
-            throws SnapshotingException {
-        return m_snapDataBase.create_context(snapContext);
+    public static int createContext(SnapContext snapContext) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	// Gets the attributes associated to the context
+	List<SnapAttributeLight> theoricAttList = snapContext.getAttributeList();
+
+	// Registers the attributes into the Snap database
+	for (int i = 0; i < theoricAttList.size(); i++) {
+	    SnapAttributeLight snapAtt = theoricAttList.get(i);
+	    String attributeName = snapAtt.getAttribute_complete_name();
+
+	    // Verify that the choosen attribute is registered into the Snap
+	    // database
+	    SnapManagerApi.insureRegitration(attributeName);
+
+	    // Gets the attribute identifier
+	    int att_id = SnapManagerApi.getAttId(attributeName.trim());
+	    snapAtt.setAttribute_id(att_id);
+
+	}
+	return snapDataBase.create_context(snapContext);
     }
 
     /**
      * @param snapContext
      */
-    public static int createContext2Manager(SnapContext snapContext)
-            throws SnapshotingException {
-        int timeout = 3000;
-        int newContextID = -1;
-        try {
-
-            String device = chooseDevice(m_snapManagerClassDevice);
-            if (!device.equals("")) {
-                DeviceProxy deviceProxy = new DeviceProxy(device);
-                deviceProxy.set_timeout_millis(snapContext.getAttributeList()
-                        .size()
-                        * timeout);
-                deviceProxy.ping();
-                DeviceData device_data_in = null;
-                device_data_in = new DeviceData();
-                device_data_in.insert(snapContext.toArray());
-                DeviceData device_data_out = deviceProxy.command_inout(
-                        "CreateNewContext", device_data_in);
-                newContextID = device_data_out.extractLong();
-            } else {
-                String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                        + GlobalConst.ERROR_SNAPPATTERN_CREATION;
-                String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
-                String desc = "";
-                throw new SnapshotingException(message, reason,
-                        ErrSeverity.PANIC, desc, "");
-            }
-        } catch (DevFailed devFailed) {
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.DEV_UNREACH_EXCEPTION;
-            String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.PANIC,
-                    desc, "", devFailed);
-        }
-        return newContextID;
+    public static int createContext2Manager(SnapContext snapContext) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	int timeout = 3000;
+	int newContextID = -1;
+	try {
+
+	    String device = chooseDevice(m_snapManagerClassDevice);
+	    if (!device.equals("")) {
+		DeviceProxy deviceProxy = new DeviceProxy(device);
+		deviceProxy.set_timeout_millis(snapContext.getAttributeList().size() * timeout);
+		deviceProxy.ping();
+		DeviceData device_data_in = null;
+		device_data_in = new DeviceData();
+		device_data_in.insert(snapContext.toArray());
+		DeviceData device_data_out = deviceProxy.command_inout("CreateNewContext", device_data_in);
+		newContextID = device_data_out.extractLong();
+	    } else {
+		String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_SNAPPATTERN_CREATION;
+		String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
+		String desc = "";
+		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "");
+	    }
+	} catch (DevFailed devFailed) {
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.DEV_UNREACH_EXCEPTION;
+	    String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
+	}
+	return newContextID;
 
     }
 
     public static ArrayList getAllContext() throws SnapshotingException {
-        return m_snapDataBase.getAllContext();
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getAllContext();
     }
 
     /**
@@ -740,15 +744,17 @@ public class SnapManagerApi {
      *         (Criterions)
      * @throws SnapshotingException
      */
-    public static ArrayList getContext(Criterions criterions)
-            throws SnapshotingException {
-        // Gets the clause that corresponds to the given criterions
-        String clause = criterions.getContextClause();
-        // Gets the conditions related to the context identifier
-        int context_id = criterions.getIdContextContextTable();
-        // Gets the list of the contexts which subscribe to all thoses
-        // conditions
-        return m_snapDataBase.getContext(clause, context_id);
+    public static ArrayList getContext(Criterions criterions) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	// Gets the clause that corresponds to the given criterions
+	String clause = criterions.getContextClause();
+	// Gets the conditions related to the context identifier
+	int context_id = criterions.getIdContextContextTable();
+	// Gets the list of the contexts which subscribe to all thoses
+	// conditions
+	return snapDataBase.getContext(clause, context_id);
     }
 
     /**
@@ -759,11 +765,13 @@ public class SnapManagerApi {
      * @return a 'SnapShot' object with the snapID field filled.
      * @throws SnapshotingException
      */
-    public static SnapShot registerSnapShot(int contextID)
-            throws SnapshotingException {
-        Timestamp time = new Timestamp(System.currentTimeMillis());
-        SnapShot snapShot = m_snapDataBase.createNewSnap(contextID, time);
-        return snapShot;
+    public static SnapShot registerSnapShot(int contextID) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	Timestamp time = new Timestamp(System.currentTimeMillis());
+	SnapShot snapShot = snapDataBase.createNewSnap(contextID, time);
+	return snapShot;
     }
 
     /**
@@ -775,27 +783,38 @@ public class SnapManagerApi {
      * @return The 'SnapManagerResult.OK_SNAPLAUNCH' if success,
      *         'SnapManagerResult.ERROR_SNAPLAUNCH' otherwise
      */
-    public static int launchSnap2Archiver(int contextID) throws DevFailed {
-        String snapArchiverName = chooseDevice(m_snapArchiverClassDevice);
-        if (snapArchiverName.equals("")) {
-            throw new DevFailed();
-        }
-
-        DeviceProxy snapArchiverProxy = new DeviceProxy(snapArchiverName);
-        DeviceData device_data = null;
-        device_data = new DeviceData();
-        device_data.insert((short) contextID);
-
-        DeviceData device_data_out = snapArchiverProxy.command_inout(
-                "TriggerLaunchSnapShot", device_data);
-
-        int snapID = (int) device_data_out.extractShort();
-        return snapID;
+    public static int launchSnap(int contextID) throws DevFailed {
+
+	String snapArchiverName = chooseDevice(m_snapArchiverClassDevice);
+	if (snapArchiverName.equals("")) {
+	    throw new DevFailed();
+	}
+	DeviceProxy snapArchiverProxy = new DeviceProxy(snapArchiverName);
+
+	DeviceData device_data = null;
+	device_data = new DeviceData();
+	device_data.insert((short) contextID);
+	// launch snapshot
+	snapArchiverProxy.command_inout("TriggerLaunchSnapShot", device_data);
+	// wait for its completion
+	while (snapArchiverProxy.state().equals(DevState.RUNNING)) {
+	    try {
+		Thread.sleep(100);
+	    } catch (InterruptedException e) {
+	    }
+	}
+	// get the result
+	DeviceData device_data_out = snapArchiverProxy.command_inout("GetSnapShotResult", device_data);
+
+	int snapID = device_data_out.extractShort();
+	return snapID;
     }
 
-    public static ArrayList getContextAssociatedAttributes(int id_context)
-            throws SnapshotingException {
-        return m_snapDataBase.getContextAssociatedAttributes(id_context);
+    public static List<SnapAttributeExtract> getContextAssociatedAttributes(int id_context) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getContextAssociatedAttributes(id_context);
     }
 
     /**
@@ -812,29 +831,13 @@ public class SnapManagerApi {
      *         (criterions)
      * @throws SnapshotingException
      */
-    public static ArrayList getContextAssociatedAttributes(int id_context,
-            Criterions criterions) throws SnapshotingException {
-        ArrayList arrayList = new ArrayList(512);
-
-        // Gets the list of attributes asociated to the given context
-        ArrayList attributes = getContextAssociatedAttributes(id_context);
-
-        // creates the clause
-        String clause = criterions.getAttributeClause();
-
-        // Gets the attributes which match to the given conditions
-        for (int i = 0; i < attributes.size(); i++) {
-            SnapAttributeLight snapAttributeLight = (SnapAttributeLight) attributes
-                    .get(i);
-            ArrayList res = null;
-            res = m_snapDataBase.getAttDefinitionData(snapAttributeLight
-                    .getAttribute_complete_name(), clause);
-            if (!res.isEmpty()) {
-                arrayList.add(res.get(0));
-            }
-        }
-
-        return arrayList;
+    public static List<SnapAttributeHeavy> getContextAssociatedAttributes(int id_context, Criterions criterions)
+	    throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	List<SnapAttributeHeavy> res = snapDataBase.getContextAttributes(id_context, criterions.getAttributeClause());
+	return res;
     }
 
     /**
@@ -844,9 +847,9 @@ public class SnapManagerApi {
      * @return
      * @throws SnapshotingException
      */
-    public static ArrayList getSnapshotAssociatedAttributes(
-            SnapShotLight snapshot) throws SnapshotingException {
-        return getSnapshotAssociatedAttributes(snapshot, -1);
+    public static List<SnapAttributeExtract> getSnapshotAssociatedAttributes(SnapShotLight snapshot)
+	    throws SnapshotingException {
+	return getSnapshotAssociatedAttributes(snapshot, -1);
     }
 
     /**
@@ -856,42 +859,49 @@ public class SnapManagerApi {
      * @return
      * @throws SnapshotingException
      */
-    public static ArrayList getSnapshotAssociatedAttributes(
-            SnapShotLight snapshot, int contextID) throws SnapshotingException {
-
-        ArrayList arrayList = new ArrayList(512);
-
-        if (contextID < 0) {
-            contextID = getContextID(snapshot.getId_snap());
-        }
-        // Gets the attributes list
-        ArrayList theoricList = getContextAssociatedAttributes(contextID);
-        // Gets the attributes's values
-        for (int i = 0; i < theoricList.size(); i++) {
-            SnapAttributeLight snapAttributeLight = (SnapAttributeLight) theoricList
-                    .get(i);
-            SnapAttributeExtract snapAttributeExtract = m_snapDataBase
-                    .getSnapResult(snapAttributeLight, snapshot.getId_snap());
-            arrayList.add(snapAttributeExtract);
-        }
-
-        return arrayList;
+    public static List<SnapAttributeExtract> getSnapshotAssociatedAttributes(SnapShotLight snapshot, int contextID)
+	    throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	List<SnapAttributeExtract> arrayList = new ArrayList<SnapAttributeExtract>();
+
+	if (contextID < 0) {
+	    contextID = getContextID(snapshot.getId_snap());
+	}
+	// Gets the attributes list
+	List<SnapAttributeExtract> theoricList = getContextAssociatedAttributes(contextID);
+	// Gets the attributes's values
+	for (int i = 0; i < theoricList.size(); i++) {
+	    SnapAttributeExtract snapAttributeLight = theoricList.get(i);
+	    SnapAttributeExtract snapAttributeExtract = snapDataBase.getSnapResult(snapAttributeLight,
+		    snapshot.getId_snap());
+	    arrayList.add(snapAttributeExtract);
+	}
+
+	return arrayList;
     }
 
-    public static Vector getAttDefinitionData(String attributeName)
-            throws SnapshotingException {
-        Vector vector = null;
-        vector = m_snapDataBase.getAttDefinitionData(attributeName);
-        return vector;
+    public static Vector getAttDefinitionData(String attributeName) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	Vector vector = snapDataBase.getAttDefinitionData(attributeName);
+	return vector;
     }
 
     public static int getMaxID() throws SnapshotingException {
-        return m_snapDataBase.getMaxID();
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getMaxContextID();
     }
 
-    public static ArrayList getContextAssociatedSnapshots(int id_context)
-            throws SnapshotingException {
-        return m_snapDataBase.getContextAssociatedSnapshots(id_context);
+    public static ArrayList getContextAssociatedSnapshots(int id_context) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getContextAssociatedSnapshots(id_context);
     }
 
     /**
@@ -904,39 +914,51 @@ public class SnapManagerApi {
      *         (Criterions)
      * @throws SnapshotingException
      */
-    public static ArrayList getContextAssociatedSnapshots(Criterions criterions)
-            throws SnapshotingException {
-        // Gets the clause that corresponds to the given criterions
-        String clause = criterions.getSnapshotClause();
-        // Gets the conditions related to the context identifier and the
-        // snapshot identifier
-        int id_context = criterions.getIdContextSnapTable();
-        int id_snap = criterions.getIdSnap();
-        // Gets the list of the snapshots which subscribe to all thoses
-        // conditions
-        return m_snapDataBase.getContextAssociatedSnapshots(clause, id_context,
-                id_snap);
+    public static ArrayList getContextAssociatedSnapshots(Criterions criterions) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	// Gets the clause that corresponds to the given criterions
+	String clause = criterions.getSnapshotClause();
+	// Gets the conditions related to the context identifier and the
+	// snapshot identifier
+	int id_context = criterions.getIdContextSnapTable();
+	int id_snap = criterions.getIdSnap();
+	// Gets the list of the snapshots which subscribe to all thoses
+	// conditions
+	return snapDataBase.getContextAssociatedSnapshots(clause, id_context, id_snap);
     }
 
     public static int getContextID(int idSnapshot) throws SnapshotingException {
-        return m_snapDataBase.getContextID(idSnapshot);
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	return snapDataBase.getContextID(idSnapshot);
+    }
+
+    public static List<SnapAttributeExtract> getSnapResult(int id_snap) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	List<SnapAttributeExtract> arrayList = new ArrayList<SnapAttributeExtract>();
+	int contextID = snapDataBase.getContextID(id_snap);
+	List<SnapAttributeExtract> theoricList = getContextAssociatedAttributes(contextID);
+	for (int i = 0; i < theoricList.size(); i++) {
+	    SnapAttributeExtract snapAttributeLight = theoricList.get(i);
+	    SnapAttributeExtract snapAttributeExtract = snapDataBase.getSnapResult(snapAttributeLight, id_snap);
+	    arrayList.add(snapAttributeExtract);
+	}
+
+	return arrayList;
     }
 
-    public static ArrayList getSnapResult(int id_snap)
-            throws SnapshotingException {
-        ArrayList arrayList = new ArrayList(512);
-
-        int contextID = getContextID(id_snap);
-        ArrayList theoricList = getContextAssociatedAttributes(contextID);
-        for (int i = 0; i < theoricList.size(); i++) {
-            SnapAttributeLight snapAttributeLight = (SnapAttributeLight) theoricList
-                    .get(i);
-            SnapAttributeExtract snapAttributeExtract = m_snapDataBase
-                    .getSnapResult(snapAttributeLight, id_snap);
-            arrayList.add(snapAttributeExtract);
-        }
-
-        return arrayList;
+    public static SnapAttributeExtract[] getSnapValues(int idSnap, String... attributeNames)
+	    throws SnapshotingException {
+	SnapAttributeExtract[] conf = snapDataBase.getAttributeConfig(attributeNames);
+	for (SnapAttributeExtract snapAttributeExtract : conf) {
+	    snapAttributeExtract = snapDataBase.getSnapResult(snapAttributeExtract, idSnap);
+	}
+	return conf;
     }
 
     /**
@@ -946,9 +968,11 @@ public class SnapManagerApi {
      * @param new_comment
      * @throws SnapshotingException
      */
-    public static void updateSnapComment(int id_snap, String new_comment)
-            throws SnapshotingException {
-        m_snapDataBase.updateSnapComment(id_snap, new_comment);
+    public static void updateSnapComment(int id_snap, String new_comment) throws SnapshotingException {
+	if (snapDataBase == null) {
+	    throw new SnapshotingException(DATA_BASE_API_NOT_INIT);
+	}
+	snapDataBase.updateSnapComment(id_snap, new_comment);
     }
 
     /**
@@ -957,40 +981,32 @@ public class SnapManagerApi {
      * @param snapShot
      * @throws SnapshotingException
      */
-    public static void setEquipmentsWithSnapshot(SnapShot snapShot)
-            throws SnapshotingException {
-        try {
-            int timeout = 3000;
-            String device = chooseDevice(m_snapManagerClassDevice);
-            if (!device.equals("")) {
-                DeviceProxy deviceProxy = new DeviceProxy(device);
-                deviceProxy.set_timeout_millis(snapShot.getAttribute_List()
-                        .size()
-                        * timeout);
-                deviceProxy.ping();
-                DeviceData device_data = null;
-                device_data = new DeviceData();
-                device_data.insert(snapShot.toArray());
-                // System.out.println("----------------------------On transf�re au SnapManager");
-                deviceProxy.command_inout("SetEquipmentsWithSnapshot",
-                        device_data);
-            } else {
-                String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                        + GlobalConst.ERROR_SNAP_SET_EQUIPMENT;
-                String reason = "Failed while executing SnapManagerApi.setEquipmentsWithSnapshot() method...";
-                String desc = "";
-                throw new SnapshotingException(message, reason,
-                        ErrSeverity.PANIC, desc, "");
-            }
-        } catch (DevFailed devFailed) {
-            // devFailed.printStackTrace();
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.DEV_UNREACH_EXCEPTION;
-            String reason = "Failed while executing SnapManagerApi.setEquipmentsWithSnapshot() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.PANIC,
-                    desc, "", devFailed);
-        }
+    public static void setEquipmentsWithSnapshot(SnapShot snapShot) throws SnapshotingException {
+	try {
+	    int timeout = 3000;
+	    String device = chooseDevice(m_snapManagerClassDevice);
+	    if (!device.equals("")) {
+		DeviceProxy deviceProxy = new DeviceProxy(device);
+		deviceProxy.set_timeout_millis(snapShot.getAttribute_List().size() * timeout);
+		deviceProxy.ping();
+		DeviceData device_data = null;
+		device_data = new DeviceData();
+		device_data.insert(snapShot.toArray());
+		// System.out.println("----------------------------On transf�re au SnapManager");
+		deviceProxy.command_inout("SetEquipmentsWithSnapshot", device_data);
+	    } else {
+		String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_SNAP_SET_EQUIPMENT;
+		String reason = "Failed while executing SnapManagerApi.setEquipmentsWithSnapshot() method...";
+		String desc = "";
+		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "");
+	    }
+	} catch (DevFailed devFailed) {
+	    // devFailed.printStackTrace();
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.DEV_UNREACH_EXCEPTION;
+	    String reason = "Failed while executing SnapManagerApi.setEquipmentsWithSnapshot() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
+	}
     }
 
     /**
@@ -1000,245 +1016,224 @@ public class SnapManagerApi {
      * @param snapShot
      * @throws SnapshotingException
      */
-    public static void TriggerSetEquipments(SnapShot snapShot)
-            throws SnapshotingException {
-        ArrayList attribute_List = snapShot.getAttribute_List();
-        SnapshotingException snapFinalEx = null;
-
-        for (int i = 0; i < attribute_List.size(); i++) {
-            SnapAttributeExtract snapAttributeExtract = (SnapAttributeExtract) attribute_List
-                    .get(i);
-            if (snapAttributeExtract.getWritable() != AttrWriteType._READ
-                    && snapAttributeExtract.getWritable() != AttrWriteType._READ_WITH_WRITE) {
-                try {
-                    // System.out.println("TriggerSetEquipments test0");
-                    AttributeProxy attributeProxy = new AttributeProxy(
-                            snapAttributeExtract.getAttribute_complete_name());
-                    // System.out.println("TriggerSetEquipments test1");
-                    DeviceAttribute deviceAttribute = new DeviceAttribute(
-                            attributeProxy.name());
-                    // System.out.println("TriggerSetEquipments test2");
-                    Object value = snapAttributeExtract.getWriteValue();
-                    // System.out.println("TriggerSetEquipments test3");
-                    switch (snapAttributeExtract.getData_format()) {
-                        case AttrDataFormat._SCALAR:
-                            if (value == null || "NaN".equals(value)) {
-                                break;
-                            }
-                            switch (snapAttributeExtract.getData_type()) {
-                                case TangoConst.Tango_DEV_STRING:
-                                    deviceAttribute.insert(((String) value)
-                                            .toString());
-                                    break;
-                                case TangoConst.Tango_DEV_STATE:
-                                    deviceAttribute.insert(((Integer) value)
-                                            .intValue());
-                                    break;
-                                case TangoConst.Tango_DEV_UCHAR:
-                                    deviceAttribute.insert_uc(((Byte) value)
-                                            .byteValue());
-                                    break;
-                                case TangoConst.Tango_DEV_LONG:
-                                    deviceAttribute.insert(((Integer) value)
-                                            .intValue());
-                                    break;
-                                case TangoConst.Tango_DEV_ULONG:
-                                    deviceAttribute.insert_us(((Integer) value)
-                                            .intValue());
-                                    break;
-                                case TangoConst.Tango_DEV_BOOLEAN:
-                                    deviceAttribute.insert(((Boolean) value)
-                                            .booleanValue());
-                                    break;
-                                case TangoConst.Tango_DEV_USHORT:
-                                    deviceAttribute.insert_us(((Short) value)
-                                            .shortValue());
-                                    break;
-                                case TangoConst.Tango_DEV_SHORT:
-                                    deviceAttribute.insert(((Short) value)
-                                            .shortValue());
-                                    break;
-                                case TangoConst.Tango_DEV_FLOAT:
-                                    deviceAttribute.insert(((Float) value)
-                                            .floatValue());
-                                    break;
-                                case TangoConst.Tango_DEV_DOUBLE:
-                                    deviceAttribute.insert(((Double) value)
-                                            .doubleValue());
-                                    break;
-                                default:
-                                    deviceAttribute.insert(((Double) value)
-                                            .doubleValue());
-                                    break;
-                            }
-                            break;
-                        case AttrDataFormat._SPECTRUM:
-                            if (value == null || "[NaN]".equals(value)
-                                    || "NaN".equals(value)) {
-                                break;
-                            }
-                            switch (snapAttributeExtract.getData_type()) {
-                                case TangoConst.Tango_DEV_UCHAR:
-                                    Byte[] byteVal = (Byte[]) value;
-                                    byte[] byteVal2 = null;
-                                    if (byteVal != null) {
-                                        byteVal2 = new byte[byteVal.length];
-                                        for (int j = 0; j < byteVal.length; j++) {
-                                            byte val = 0;
-                                            if (byteVal[j] != null) {
-                                                val = byteVal[j].byteValue();
-                                            }
-                                            byteVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert_uc(byteVal2,
-                                            byteVal.length, 0);
-                                    break;
-                                case TangoConst.Tango_DEV_LONG:
-                                    Integer[] longVal = (Integer[]) value;
-                                    int[] longVal2 = null;
-                                    if (longVal != null) {
-                                        longVal2 = new int[longVal.length];
-                                        for (int j = 0; j < longVal.length; j++) {
-                                            int val = 0;
-                                            if (longVal[j] != null) {
-                                                val = longVal[j].intValue();
-                                            }
-                                            longVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert(longVal2);
-                                    break;
-                                case TangoConst.Tango_DEV_ULONG:
-                                    Integer[] longValu = (Integer[]) value;
-                                    int[] longValu2 = null;
-                                    if (longValu != null) {
-                                        longValu2 = new int[longValu.length];
-                                        for (int j = 0; j < longValu.length; j++) {
-                                            int val = 0;
-                                            if (longValu[j] != null) {
-                                                val = longValu[j].intValue();
-                                            }
-                                            longValu2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert_us(longValu2);
-                                    break;
-                                case TangoConst.Tango_DEV_SHORT:
-                                    Short[] shortVal = (Short[]) value;
-                                    short[] shortVal2 = null;
-                                    if (shortVal != null) {
-                                        shortVal2 = new short[shortVal.length];
-                                        for (int j = 0; j < shortVal.length; j++) {
-                                            short val = 0;
-                                            if (shortVal[j] != null) {
-                                                val = shortVal[j].shortValue();
-                                            }
-                                            shortVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert(shortVal2);
-                                    break;
-                                case TangoConst.Tango_DEV_USHORT:
-                                    Short[] shortValu = (Short[]) value;
-                                    short[] shortValu2 = null;
-                                    if (shortValu != null) {
-                                        shortValu2 = new short[shortValu.length];
-                                        for (int j = 0; j < shortValu.length; j++) {
-                                            short val = 0;
-                                            if (shortValu[j] != null) {
-                                                val = shortValu[j].shortValue();
-                                            }
-                                            shortValu2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert_us(shortValu2);
-                                    break;
-                                case TangoConst.Tango_DEV_FLOAT:
-                                    Float[] floatVal = (Float[]) value;
-                                    float[] floatVal2 = null;
-                                    if (floatVal != null) {
-                                        floatVal2 = new float[floatVal.length];
-                                        for (int j = 0; j < floatVal.length; j++) {
-                                            float val = 0;
-                                            if (floatVal[j] != null) {
-                                                val = floatVal[j].floatValue();
-                                            }
-                                            floatVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert(floatVal2);
-                                    break;
-                                case TangoConst.Tango_DEV_DOUBLE:
-                                    Double[] doubleVal = (Double[]) value;
-                                    double[] doubleVal2 = null;
-                                    if (doubleVal != null) {
-                                        doubleVal2 = new double[doubleVal.length];
-                                        for (int j = 0; j < doubleVal.length; j++) {
-                                            double val = Double.NaN;
-                                            if (doubleVal[j] != null) {
-                                                val = doubleVal[j]
-                                                        .doubleValue();
-                                            }
-                                            doubleVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert(doubleVal2);
-                                    break;
-                                case TangoConst.Tango_DEV_STRING:
-                                    String[] stringVal = (String[]) value;
-                                    deviceAttribute.insert(stringVal);
-                                    break;
-                                case TangoConst.Tango_DEV_BOOLEAN:
-                                    Boolean[] boolVal = (Boolean[]) value;
-                                    boolean[] boolVal2 = null;
-                                    if (boolVal != null) {
-                                        boolVal2 = new boolean[boolVal.length];
-                                        for (int j = 0; j < boolVal.length; j++) {
-                                            boolean val = false;
-                                            if (boolVal[j] != null) {
-                                                val = boolVal[j].booleanValue();
-                                            }
-                                            boolVal2[j] = val;
-                                        }
-                                    }
-                                    deviceAttribute.insert(boolVal2);
-                                    break;
-                                default:
-                                    break;
-                            }
-                            break;
-                        default:
-                            // nothing to do
-                    }
-                    attributeProxy.write(deviceAttribute);
-                } catch (DevFailed devFailed) {
-                    String nameOfFailure = snapAttributeExtract
-                            .getAttribute_complete_name();
-
-                    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX
-                            + " : " + GlobalConst.ERROR_SNAP_SET_EQUIPMENT
-                            + " on attribute: " + nameOfFailure;
-                    String reason = "Failed while executing SnapManagerApi.TriggerSetEquipments() method on attribute:"
-                            + nameOfFailure;
-                    String desc = reason;
-                    // String origin = "Attribute: " + nameOfFailure;
-                    // throw new SnapshotingException(message , reason ,
-                    // ErrSeverity.PANIC , desc , "" , devFailed);
-                    if (snapFinalEx == null) {
-                        snapFinalEx = new SnapshotingException(message, reason,
-                                ErrSeverity.PANIC, desc, "", devFailed);
-                    } else {
-                        SnapshotingException snapEx = new SnapshotingException(
-                                devFailed);
-                        snapFinalEx.addStack(message, reason,
-                                ErrSeverity.PANIC, desc, "", snapEx);
-                    }
-                }
-            }
-        }
-        if (snapFinalEx != null)
-            throw snapFinalEx;
+    public static void TriggerSetEquipments(SnapShot snapShot) throws SnapshotingException {
+	List<SnapAttributeExtract> attribute_List = snapShot.getAttribute_List();
+	SnapshotingException snapFinalEx = null;
+
+	for (int i = 0; i < attribute_List.size(); i++) {
+	    SnapAttributeExtract snapAttributeExtract = attribute_List.get(i);
+	    if (snapAttributeExtract.getWritable() != AttrWriteType._READ
+		    && snapAttributeExtract.getWritable() != AttrWriteType._READ_WITH_WRITE) {
+		try {
+		    // System.out.println("TriggerSetEquipments test0");
+		    AttributeProxy attributeProxy = new AttributeProxy(
+			    snapAttributeExtract.getAttribute_complete_name());
+		    // System.out.println("TriggerSetEquipments test1");
+		    DeviceAttribute deviceAttribute = new DeviceAttribute(attributeProxy.name());
+		    // System.out.println("TriggerSetEquipments test2");
+		    Object value = snapAttributeExtract.getWriteValue();
+		    // System.out.println("TriggerSetEquipments test3");
+		    switch (snapAttributeExtract.getData_format()) {
+		    case AttrDataFormat._SCALAR:
+			if (value == null || "NaN".equals(value)) {
+			    break;
+			}
+			switch (snapAttributeExtract.getData_type()) {
+			case TangoConst.Tango_DEV_STRING:
+			    deviceAttribute.insert(((String) value).toString());
+			    break;
+			case TangoConst.Tango_DEV_STATE:
+			    deviceAttribute.insert(((Integer) value).intValue());
+			    break;
+			case TangoConst.Tango_DEV_UCHAR:
+			    deviceAttribute.insert_uc(((Byte) value).byteValue());
+			    break;
+			case TangoConst.Tango_DEV_LONG:
+			    deviceAttribute.insert(((Integer) value).intValue());
+			    break;
+			case TangoConst.Tango_DEV_ULONG:
+			    deviceAttribute.insert_us(((Integer) value).intValue());
+			    break;
+			case TangoConst.Tango_DEV_BOOLEAN:
+			    deviceAttribute.insert(((Boolean) value).booleanValue());
+			    break;
+			case TangoConst.Tango_DEV_USHORT:
+			    deviceAttribute.insert_us(((Short) value).shortValue());
+			    break;
+			case TangoConst.Tango_DEV_SHORT:
+			    deviceAttribute.insert(((Short) value).shortValue());
+			    break;
+			case TangoConst.Tango_DEV_FLOAT:
+			    deviceAttribute.insert(((Float) value).floatValue());
+			    break;
+			case TangoConst.Tango_DEV_DOUBLE:
+			    deviceAttribute.insert(((Double) value).doubleValue());
+			    break;
+			default:
+			    deviceAttribute.insert(((Double) value).doubleValue());
+			    break;
+			}
+			break;
+		    case AttrDataFormat._SPECTRUM:
+			if (value == null || "[NaN]".equals(value) || "NaN".equals(value)) {
+			    break;
+			}
+			switch (snapAttributeExtract.getData_type()) {
+			case TangoConst.Tango_DEV_UCHAR:
+			    Byte[] byteVal = (Byte[]) value;
+			    byte[] byteVal2 = null;
+			    if (byteVal != null) {
+				byteVal2 = new byte[byteVal.length];
+				for (int j = 0; j < byteVal.length; j++) {
+				    byte val = 0;
+				    if (byteVal[j] != null) {
+					val = byteVal[j].byteValue();
+				    }
+				    byteVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert_uc(byteVal2, byteVal.length, 0);
+			    break;
+			case TangoConst.Tango_DEV_LONG:
+			    Integer[] longVal = (Integer[]) value;
+			    int[] longVal2 = null;
+			    if (longVal != null) {
+				longVal2 = new int[longVal.length];
+				for (int j = 0; j < longVal.length; j++) {
+				    int val = 0;
+				    if (longVal[j] != null) {
+					val = longVal[j].intValue();
+				    }
+				    longVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert(longVal2);
+			    break;
+			case TangoConst.Tango_DEV_ULONG:
+			    Integer[] longValu = (Integer[]) value;
+			    int[] longValu2 = null;
+			    if (longValu != null) {
+				longValu2 = new int[longValu.length];
+				for (int j = 0; j < longValu.length; j++) {
+				    int val = 0;
+				    if (longValu[j] != null) {
+					val = longValu[j].intValue();
+				    }
+				    longValu2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert_us(longValu2);
+			    break;
+			case TangoConst.Tango_DEV_SHORT:
+			    Short[] shortVal = (Short[]) value;
+			    short[] shortVal2 = null;
+			    if (shortVal != null) {
+				shortVal2 = new short[shortVal.length];
+				for (int j = 0; j < shortVal.length; j++) {
+				    short val = 0;
+				    if (shortVal[j] != null) {
+					val = shortVal[j].shortValue();
+				    }
+				    shortVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert(shortVal2);
+			    break;
+			case TangoConst.Tango_DEV_USHORT:
+			    Short[] shortValu = (Short[]) value;
+			    short[] shortValu2 = null;
+			    if (shortValu != null) {
+				shortValu2 = new short[shortValu.length];
+				for (int j = 0; j < shortValu.length; j++) {
+				    short val = 0;
+				    if (shortValu[j] != null) {
+					val = shortValu[j].shortValue();
+				    }
+				    shortValu2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert_us(shortValu2);
+			    break;
+			case TangoConst.Tango_DEV_FLOAT:
+			    Float[] floatVal = (Float[]) value;
+			    float[] floatVal2 = null;
+			    if (floatVal != null) {
+				floatVal2 = new float[floatVal.length];
+				for (int j = 0; j < floatVal.length; j++) {
+				    float val = 0;
+				    if (floatVal[j] != null) {
+					val = floatVal[j].floatValue();
+				    }
+				    floatVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert(floatVal2);
+			    break;
+			case TangoConst.Tango_DEV_DOUBLE:
+			    Double[] doubleVal = (Double[]) value;
+			    double[] doubleVal2 = null;
+			    if (doubleVal != null) {
+				doubleVal2 = new double[doubleVal.length];
+				for (int j = 0; j < doubleVal.length; j++) {
+				    double val = Double.NaN;
+				    if (doubleVal[j] != null) {
+					val = doubleVal[j].doubleValue();
+				    }
+				    doubleVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert(doubleVal2);
+			    break;
+			case TangoConst.Tango_DEV_STRING:
+			    String[] stringVal = (String[]) value;
+			    deviceAttribute.insert(stringVal);
+			    break;
+			case TangoConst.Tango_DEV_BOOLEAN:
+			    Boolean[] boolVal = (Boolean[]) value;
+			    boolean[] boolVal2 = null;
+			    if (boolVal != null) {
+				boolVal2 = new boolean[boolVal.length];
+				for (int j = 0; j < boolVal.length; j++) {
+				    boolean val = false;
+				    if (boolVal[j] != null) {
+					val = boolVal[j].booleanValue();
+				    }
+				    boolVal2[j] = val;
+				}
+			    }
+			    deviceAttribute.insert(boolVal2);
+			    break;
+			default:
+			    break;
+			}
+			break;
+		    default:
+			// nothing to do
+		    }
+		    attributeProxy.write(deviceAttribute);
+		} catch (DevFailed devFailed) {
+		    String nameOfFailure = snapAttributeExtract.getAttribute_complete_name();
+
+		    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
+			    + GlobalConst.ERROR_SNAP_SET_EQUIPMENT + " on attribute: " + nameOfFailure;
+		    String reason = "Failed while executing SnapManagerApi.TriggerSetEquipments() method on attribute:"
+			    + nameOfFailure;
+		    String desc = reason;
+		    // String origin = "Attribute: " + nameOfFailure;
+		    // throw new SnapshotingException(message , reason ,
+		    // ErrSeverity.PANIC , desc , "" , devFailed);
+		    if (snapFinalEx == null) {
+			snapFinalEx = new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
+		    } else {
+			SnapshotingException snapEx = new SnapshotingException(devFailed);
+			snapFinalEx.addStack(message, reason, ErrSeverity.PANIC, desc, "", snapEx);
+		    }
+		}
+	    }
+	}
+	if (snapFinalEx != null) {
+	    throw snapFinalEx;
+	}
     }
 
     /**
@@ -1248,44 +1243,36 @@ public class SnapManagerApi {
      * @param id_snap
      * @throws SnapshotingException
      */
-    public static String setEquipmentWithCommand(String cmd_name,
-            String option, SnapShot snapShot) throws SnapshotingException {
-        // TODO Auto-generated method stub
-        try {
-            int timeout = 3000;
-            String device = chooseDevice(m_snapManagerClassDevice);
-            if (!device.equals("")) {
-                DeviceProxy deviceProxy = new DeviceProxy(device);
-                deviceProxy.set_timeout_millis(snapShot.getAttribute_List()
-                        .size()
-                        * timeout);
-                deviceProxy.ping();
-                DeviceData device_data = null;
-                device_data = new DeviceData();
-
-                device_data.insert(new String[] { cmd_name, option,
-                        String.valueOf(snapShot.getId_snap()) });
-                // System.out.println("----------------------------On transf�re au SnapManager");
-                device_data = deviceProxy.command_inout(
-                        "SetEquipmentsWithCommand", device_data);
-                return device_data.extractString();
-            } else {
-                String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                        + GlobalConst.ERROR_SNAP_SET_EQUIPMENT;
-                String reason = "Failed while executing SnapManagerApi.setEquipmentWithCommand() method...";
-                String desc = "";
-                throw new SnapshotingException(message, reason,
-                        ErrSeverity.PANIC, desc, "");
-            }
-        } catch (DevFailed devFailed) {
-            // devFailed.printStackTrace();
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.DEV_UNREACH_EXCEPTION;
-            String reason = "Failed while executing SnapManagerApi.setEquipmentWithCommand() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.PANIC,
-                    desc, "", devFailed);
-        }
+    public static String setEquipmentWithCommand(String cmd_name, String option, SnapShot snapShot)
+	    throws SnapshotingException {
+	// TODO Auto-generated method stub
+	try {
+	    int timeout = 3000;
+	    String device = chooseDevice(m_snapManagerClassDevice);
+	    if (!device.equals("")) {
+		DeviceProxy deviceProxy = new DeviceProxy(device);
+		deviceProxy.set_timeout_millis(snapShot.getAttribute_List().size() * timeout);
+		deviceProxy.ping();
+		DeviceData device_data = null;
+		device_data = new DeviceData();
+
+		device_data.insert(new String[] { cmd_name, option, String.valueOf(snapShot.getId_snap()) });
+		// System.out.println("----------------------------On transf�re au SnapManager");
+		device_data = deviceProxy.command_inout("SetEquipmentsWithCommand", device_data);
+		return device_data.extractString();
+	    } else {
+		String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_SNAP_SET_EQUIPMENT;
+		String reason = "Failed while executing SnapManagerApi.setEquipmentWithCommand() method...";
+		String desc = "";
+		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "");
+	    }
+	} catch (DevFailed devFailed) {
+	    // devFailed.printStackTrace();
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.DEV_UNREACH_EXCEPTION;
+	    String reason = "Failed while executing SnapManagerApi.setEquipmentWithCommand() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", devFailed);
+	}
 
     }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerImpl.java b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerImpl.java
index 68183fd..fe63604 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerImpl.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapManagerApi/SnapManagerImpl.java
@@ -66,9 +66,11 @@
 package fr.soleil.snapArchivingApi.SnapManagerApi;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import fr.esrf.Tango.DevFailed;
 import fr.esrf.Tango.ErrSeverity;
+import fr.esrf.TangoDs.Except;
 import fr.soleil.snapArchivingApi.SnapshotingApi.ConfigConst;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.Condition;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.Criterions;
@@ -76,7 +78,6 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.DateUtil;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.GlobalConst;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeHeavy;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeLight;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShotLight;
@@ -90,27 +91,28 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
  */
 public class SnapManagerImpl implements ISnapManager {
 
-    private static boolean isConnected = false;
-    private String         user;
-    private String         pwd;
+    // private static boolean isConnected = false;
+    // private final String user;
+    // private final String pwd;
 
     // private static SnapManagerApi m_snapManager = null;
 
-    public SnapManagerImpl(String _user, String _pwd) {
-        this.user = _user;
-        this.pwd = _pwd;
+    public SnapManagerImpl() {
+	// this.user = _user;
+	// this.pwd = _pwd;
 
-        System.out.println("SnapManagerImpl/new/user/" + user + "/pwd/" + pwd);
+	// System.out.println("SnapManagerImpl/new/user/" + user + "/pwd/" +
+	// pwd);
     }
 
-    public SnapManagerImpl(String _user, String _pwd, boolean _isConnected) {
-        this.user = _user;
-        this.pwd = _pwd;
-        this.isConnected = _isConnected;
-
-        System.out.println("SnapManagerImpl/new/user/" + user + "/pwd/" + pwd
-                + "/isConnected/" + isConnected);
-    }
+    // public SnapManagerImpl(String _user, String _pwd, boolean _isConnected) {
+    // this.user = _user;
+    // this.pwd = _pwd;
+    // this.isConnected = _isConnected;
+    //
+    // System.out.println("SnapManagerImpl/new/user/" + user + "/pwd/" + pwd +
+    // "/isConnected/" + isConnected);
+    // }
 
     /*
      * (non-Javadoc) Description : Return an array of the attributes
@@ -127,28 +129,31 @@ public class SnapManagerImpl implements ISnapManager {
      * fr.soleil.snapArchivingApi.SnapManagerApi.ISnapManager#findSnapshotAttributes
      * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShotLight)
      */
-    public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot)
-            throws SnapshotingException {
-        return findSnapshotAttributes(snapshot, -1);
+    @Override
+    public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot) throws SnapshotingException {
+	return findSnapshotAttributes(snapshot, -1);
+    }
+
+    @Override
+    public SnapAttributeExtract[] findSnapshotAttributes(SnapShotLight snapshot, int contextID)
+	    throws SnapshotingException {
+	// checkConnection();
+
+	// Gets the list of attributes associated to the given snapshot
+	List<SnapAttributeExtract> arrayList = SnapManagerApi.getSnapshotAssociatedAttributes(snapshot, contextID);
+
+	// Cast the attributes in SnapAttributesExtract
+	SnapAttributeExtract[] snapAttributeExtract = new SnapAttributeExtract[arrayList.size()];
+	for (int i = 0; i < arrayList.size(); i++) {
+	    snapAttributeExtract[i] = arrayList.get(i);
+	}
+
+	return snapAttributeExtract;
     }
 
     @Override
-    public SnapAttributeExtract[] findSnapshotAttributes(
-            SnapShotLight snapshot, int contextID) throws SnapshotingException {
-        checkConnection();
-
-        // Gets the list of attributes associated to the given snapshot
-        ArrayList arrayList = SnapManagerApi.getSnapshotAssociatedAttributes(
-                snapshot, contextID);
-
-        // Cast the attributes in SnapAttributesExtract
-        SnapAttributeExtract[] snapAttributeExtract = new SnapAttributeExtract[arrayList
-                .size()];
-        for (int i = 0; i < arrayList.size(); i++) {
-            snapAttributeExtract[i] = (SnapAttributeExtract) arrayList.get(i);
-        }
-
-        return snapAttributeExtract;
+    public SnapAttributeExtract[] getSnapValues(int id, String... attributeNames) throws SnapshotingException {
+	return SnapManagerApi.getSnapValues(id, attributeNames);
     }
 
     /*
@@ -169,72 +174,25 @@ public class SnapManagerImpl implements ISnapManager {
      * .soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext,
      * java.util.Hashtable)
      */
-    public SnapContext saveContext(SnapContext context)
-            throws SnapshotingException {
-        checkConnection();
-
-        ArrayList goodAttList = new ArrayList(32);
-        // ArrayList badAttList = new ArrayList(32);
-
-        // Gets the attributes associated to the context
-        ArrayList theoricAttList = context.getAttributeList();
-
-        // Registers the attributes into the Snap database
-        for (int i = 0; i < theoricAttList.size(); i++) {
-            SnapAttributeLight snapAtt = (SnapAttributeLight) theoricAttList
-                    .get(i);
-            String attributeName = snapAtt.getAttribute_complete_name()
-                    .toString();
-            try {
-                // Verify that the choosen attribute is registered into the Snap
-                // database
-                SnapManagerApi.insureRegitration(attributeName);
-            } catch (SnapshotingException e) {
-                // Failed of the attribute's registration
-                throw e;
-            }
-            // Gets the attribute identifier
-            try {
-                int att_id = SnapManagerApi.getAttId(attributeName.trim());
-                snapAtt.setAttribute_id(att_id);
-                goodAttList.add(snapAtt.getAttribute_complete_name());
-            } catch (SnapshotingException e) {
-                throw e;
-            }
-        }
-        /*
-         * if (!badAttList.isEmpty()) { String message =
-         * "The following attributes have not been registered : \r\n"; for (int
-         * i = 0; i < badAttList.size(); i++) { message = message + "\t" +
-         * badAttList.get(i) + "\r\n"; } MyMessages.Error(this, message); }
-         */
-        context.setAttributeList(goodAttList);
-        // System.out.println("SnapContext avec liste d'attributs enregistes : "
-        // + context);
-        // The context is registered into the database
-        try {
-            int context_id = SnapManagerApi.createContext2Manager(context);
-            context.setId(context_id);
-            // PB : Pas d'enregistrement de la relation id_context <-> id_att
-            // dans la table 'list'.
-            // SnapManagerApi.createContext2Archiver(context);
-        } catch (SnapshotingException e) {
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.ERROR_SNAPPATTERN_CREATION;
-            String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.ERR,
-                    desc, "", e);
-        }
-        /*
-         * short res = SnapManagerApi.createContext2Manager(context); if (res ==
-         * SnapManagerResult.ERROR_CONTEXTCREATION) {
-         * //Util.out2.println("AddContext.jB_OK_actionPerformed");
-         * MainPanel.jL_Error.setText("Error creating the new context"); } else
-         * { MainPanel.jL_Error.setText("New context registered..."); }
-         */
-
-        return context;
+    @Override
+    public SnapContext saveContext(SnapContext context) throws SnapshotingException {
+	// checkConnection();
+
+	// The context is registered into the database
+	try {
+	    int context_id = SnapManagerApi.createContext2Manager(context);
+	    context.setId(context_id);
+	    // PB : Pas d'enregistrement de la relation id_context <-> id_att
+	    // dans la table 'list'.
+	    // SnapManagerApi.createContext2Archiver(context);
+	} catch (SnapshotingException e) {
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_SNAPPATTERN_CREATION;
+	    String reason = "Failed while executing SnapManagerApi.createContext2Manager() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.ERR, desc, "", e);
+	}
+
+	return context;
     }
 
     /*
@@ -252,77 +210,70 @@ public class SnapManagerImpl implements ISnapManager {
      * fr.soleil.snapArchivingApi.SnapManagerApi.ISnapManager#launchSnapshot
      * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext)
      */
-    public SnapShot launchSnapshot(SnapContext context)
-            throws SnapshotingException {
-        checkConnection();
-
-        // Registers the snapshot into the database
-        long milliseconds = System.currentTimeMillis();
-        int type = SnapManagerApi.getSnapDbType();
-        String date = "";
-        switch (type) {
-            case ConfigConst.BD_ORACLE:
-                date = DateUtil.milliToString(milliseconds,
-                        DateUtil.FR_DATE_PATTERN);
-                break;
-            case ConfigConst.BD_MYSQL:
-            default:
-                date = DateUtil.milliToString(milliseconds,
-                        DateUtil.US_DATE_PATTERN);
-        }
-
-        int snapId = 0;
-        try {
-            snapId = SnapManagerApi.launchSnap2Archiver(context.getId());
-        } catch (DevFailed dFEx)// Failure of 'launchSnap2Archiver'.
-        {
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.ERROR_LAUNCHINGSNAP;
-            String reason = "Failed while executing SnapManagerApi.launchSnap2Archiver() method...";
-            String desc = "No SnapArchiver Found";
-            SnapshotingException snapEx = new SnapshotingException(message,
-                    reason, ErrSeverity.ERR, desc, "");
-            try {
-                snapEx.initCause(dFEx);
-
-            } catch (IllegalStateException e) {
-                System.out.println("CLA/Failed during initCause!");
-                e.printStackTrace();
-                // do nothing
-            }
-            boolean computeIsDueToATimeOut = snapEx.computeIsDueToATimeOut();
-            if (computeIsDueToATimeOut) {
-                desc += "\n--Time out";
-            }
-            throw snapEx;
-        }
-
-        // Gets the snapshot identifier
-        Condition[] condition = new Condition[1];
-        condition[0] = new Condition(GlobalConst.TAB_SNAP[0],
-                GlobalConst.OP_EQUALS, snapId + "");
-        Criterions criterions = new Criterions(condition);
-        SnapShotLight[] snapShotLight = findSnapshots(criterions);
-
-        if (snapShotLight.length > 0) {
-            // Gets the attributes and theirs values
-            SnapShotLight snap = snapShotLight[0];
-            ArrayList arrayList = SnapManagerApi
-                    .getSnapshotAssociatedAttributes(snap, context.getId());
-            String[] tableau = { "" + context.getId(), "" + snap.getId_snap(),
-                    "" + snap.getSnap_date() };
-            SnapShot snapShot = new SnapShot(tableau);
-            snapShot.setAttribute_List(arrayList);
-            return snapShot;
-        } else {
-            // Pas de snapshot correspondant.
-            String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-                    + GlobalConst.ERROR_RET_SNAP;
-            String reason = "Failed while executing SnapManagerApi.getSnapshotAssociatedAttributes() method...";
-            String desc = "";
-            throw new SnapshotingException(message, reason, ErrSeverity.ERR,
-                    desc, "");
-        }
+    @Override
+    public SnapShot launchSnapshot(SnapContext context) throws SnapshotingException {
+	// checkConnection();
+
+	// Registers the snapshot into the database
+	long milliseconds = System.currentTimeMillis();
+	int type = SnapManagerApi.getSnapDbType();
+	String date = "";
+	switch (type) {
+	case ConfigConst.BD_ORACLE:
+	    date = DateUtil.milliToString(milliseconds, DateUtil.FR_DATE_PATTERN);
+	    break;
+	case ConfigConst.BD_MYSQL:
+	default:
+	    date = DateUtil.milliToString(milliseconds, DateUtil.US_DATE_PATTERN);
+	}
+
+	int snapId = 0;
+	try {
+	    snapId = SnapManagerApi.launchSnap(context.getId());
+	} catch (DevFailed dFEx)// Failure of 'launchSnap2Archiver'.
+	{
+	    Except.print_exception(dFEx.errors);
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_LAUNCHINGSNAP;
+	    String reason = "Failed while executing SnapManagerApi.launchSnap2Archiver() method...";
+	    String desc = "No SnapArchiver Found";
+	    SnapshotingException snapEx = new SnapshotingException(message, reason, ErrSeverity.ERR, desc, "");
+	    try {
+		snapEx.initCause(dFEx);
+
+	    } catch (IllegalStateException e) {
+		System.out.println("CLA/Failed during initCause!");
+		e.printStackTrace();
+		// do nothing
+	    }
+	    boolean computeIsDueToATimeOut = snapEx.computeIsDueToATimeOut();
+	    if (computeIsDueToATimeOut) {
+		desc += "\n--Time out";
+	    }
+	    throw snapEx;
+	}
+
+	// Gets the snapshot identifier
+	Condition[] condition = new Condition[1];
+	condition[0] = new Condition(GlobalConst.TAB_SNAP[0], GlobalConst.OP_EQUALS, snapId + "");
+	Criterions criterions = new Criterions(condition);
+	SnapShotLight[] snapShotLight = findSnapshots(criterions);
+
+	if (snapShotLight.length > 0) {
+	    // Gets the attributes and theirs values
+	    SnapShotLight snap = snapShotLight[0];
+	    List<SnapAttributeExtract> arrayList = SnapManagerApi
+		    .getSnapshotAssociatedAttributes(snap, context.getId());
+	    String[] tableau = { "" + context.getId(), "" + snap.getId_snap(), "" + snap.getSnap_date() };
+	    SnapShot snapShot = new SnapShot(tableau);
+	    snapShot.setAttribute_List(arrayList);
+	    return snapShot;
+	} else {
+	    // Pas de snapshot correspondant.
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_SNAP;
+	    String reason = "Failed while executing SnapManagerApi.getSnapshotAssociatedAttributes() method...";
+	    String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.ERR, desc, "");
+	}
     }
 
     /*
@@ -381,23 +332,22 @@ public class SnapManagerImpl implements ISnapManager {
      * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShotLight,
      * java.lang.String)
      */
-    public SnapShotLight updateCommentOfSnapshot(SnapShotLight context,
-            String comment) throws SnapshotingException {
-        checkConnection();
-
-        // Updates the comment of the given snapshot
-        int id_snap = context.getId_snap();
-        SnapManagerApi.updateSnapComment(id_snap, comment);
-
-        // Gets the updated snapshot
-        Condition[] condition = new Condition[1];
-        String id_snap_str = "" + id_snap;
-        condition[0] = new Condition(GlobalConst.TAB_SNAP[0],
-                GlobalConst.OP_EQUALS, id_snap_str);
-        Criterions criterions = new Criterions(condition);
-
-        SnapShotLight[] updatedContexts = findSnapshots(criterions);
-        return updatedContexts[0];
+    @Override
+    public SnapShotLight updateCommentOfSnapshot(SnapShotLight context, String comment) throws SnapshotingException {
+	// checkConnection();
+
+	// Updates the comment of the given snapshot
+	int id_snap = context.getId_snap();
+	SnapManagerApi.updateSnapComment(id_snap, comment);
+
+	// Gets the updated snapshot
+	Condition[] condition = new Condition[1];
+	String id_snap_str = "" + id_snap;
+	condition[0] = new Condition(GlobalConst.TAB_SNAP[0], GlobalConst.OP_EQUALS, id_snap_str);
+	Criterions criterions = new Criterions(condition);
+
+	SnapShotLight[] updatedContexts = findSnapshots(criterions);
+	return updatedContexts[0];
     }
 
     /*
@@ -407,9 +357,9 @@ public class SnapManagerImpl implements ISnapManager {
      * setEquipmentsWithSnapshot
      * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot)
      */
-    public void setEquipmentsWithSnapshot(SnapShot snapshot)
-            throws SnapshotingException {
-        SnapManagerApi.setEquipmentsWithSnapshot(snapshot);
+    @Override
+    public void setEquipmentsWithSnapshot(SnapShot snapshot) throws SnapshotingException {
+	SnapManagerApi.setEquipmentsWithSnapshot(snapshot);
     }
 
     /*
@@ -427,20 +377,18 @@ public class SnapManagerImpl implements ISnapManager {
      * fr.soleil.snapArchivingApi.SnapManagerApi.ISnapManager#findContexts(manager
      * .Criterions)
      */
-    public SnapContext[] findContexts(Criterions criterions)
-            throws SnapshotingException {
-        checkConnection();
-
-        // Gets the contexts which subscribe to the given conditions
-        ArrayList arrayList = SnapManagerApi.getContext(criterions);
-
-        // Cast of the found contexts
-        SnapContext[] snapContext = new SnapContext[arrayList.size()];
-        for (int i = 0; i < arrayList.size(); i++) {
-            snapContext[i] = (SnapContext) arrayList.get(i);
-        }
-
-        return snapContext;
+    @Override
+    public SnapContext[] findContexts(Criterions criterions) throws SnapshotingException {
+	// checkConnection();
+	// Gets the contexts which subscribe to the given conditions
+	ArrayList arrayList = SnapManagerApi.getContext(criterions);
+
+	// Cast of the found contexts
+	SnapContext[] snapContext = new SnapContext[arrayList.size()];
+	for (int i = 0; i < arrayList.size(); i++) {
+	    snapContext[i] = (SnapContext) arrayList.get(i);
+	}
+	return snapContext;
     }
 
     /*
@@ -458,20 +406,18 @@ public class SnapManagerImpl implements ISnapManager {
      * fr.soleil.snapArchivingApi.SnapManagerApi.ISnapManager#findSnapshots(
      * manager.Criterions)
      */
-    public SnapShotLight[] findSnapshots(Criterions criterions)
-            throws SnapshotingException {
-        checkConnection();
-
-        // Gets the snapshots which subscribe to the given conditions
-        ArrayList arrayList = SnapManagerApi
-                .getContextAssociatedSnapshots(criterions);
-
-        // Cast of the found snapshots
-        SnapShotLight[] snapShots = new SnapShotLight[arrayList.size()];
-        for (int i = 0; i < arrayList.size(); i++) {
-            snapShots[i] = (SnapShotLight) arrayList.get(i);
-        }
-        return snapShots;
+    @Override
+    public SnapShotLight[] findSnapshots(Criterions criterions) throws SnapshotingException {
+	// checkConnection();
+	// Gets the snapshots which subscribe to the given conditions
+	ArrayList arrayList = SnapManagerApi.getContextAssociatedSnapshots(criterions);
+
+	// Cast of the found snapshots
+	SnapShotLight[] snapShots = new SnapShotLight[arrayList.size()];
+	for (int i = 0; i < arrayList.size(); i++) {
+	    snapShots[i] = (SnapShotLight) arrayList.get(i);
+	}
+	return snapShots;
     }
 
     /*
@@ -494,73 +440,50 @@ public class SnapManagerImpl implements ISnapManager {
      * (fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext,
      * manager.Criterions)
      */
-    public SnapAttributeHeavy[] findContextAttributes(SnapContext context,
-            Criterions criterions) throws SnapshotingException {
-        checkConnection();
-
-        // Gets the attributes which are associated to the given context and
-        // subscribe to the given conditions
-        ArrayList arrayList = SnapManagerApi.getContextAssociatedAttributes(
-                context.getId(), criterions);
-
-        // Cast of the found attributes
-        SnapAttributeHeavy[] snapshotAttributes = new SnapAttributeHeavy[arrayList
-                .size()];
-        for (int i = 0; i < arrayList.size(); i++) {
-            snapshotAttributes[i] = (SnapAttributeHeavy) arrayList.get(i);
-        }
-
-        return snapshotAttributes;
+    @Override
+    public SnapAttributeHeavy[] findContextAttributes(SnapContext context, Criterions criterions)
+	    throws SnapshotingException {
+	// checkConnection();
+	// Gets the attributes which are associated to the given context and
+	// subscribe to the given conditions
+	List<SnapAttributeHeavy> arrayList = SnapManagerApi.getContextAssociatedAttributes(context.getId(), criterions);
+	return arrayList.toArray(new SnapAttributeHeavy[arrayList.size()]);
     }
 
+    @Override
     public SnapAttributeExtract[] getSnap(int id) throws SnapshotingException {
-        checkConnection();
-
-        Condition condition = new Condition(GlobalConst.TAB_SNAP[0], "=",
-                String.valueOf(id));
-        Criterions searchCriterions = new Criterions();
-        searchCriterions.addCondition(condition);
-
-        try {
-            SnapShotLight[] snapshots = this.findSnapshots(searchCriterions);
-            if (snapshots == null || snapshots.length == 0) {
-                return null;
-            }
-            SnapShotLight snapshotLight = snapshots[0];
-
-            SnapAttributeExtract[] sae = this
-                    .findSnapshotAttributes(snapshotLight);
-            if (sae == null || sae.length == 0) {
-                return null;
-            }
-            return sae;
-        } catch (SnapshotingException e) {
-            throw e;
-        }
+	// checkConnection();
+
+	Condition condition = new Condition(GlobalConst.TAB_SNAP[0], "=", String.valueOf(id));
+	Criterions searchCriterions = new Criterions();
+	searchCriterions.addCondition(condition);
+	SnapShotLight snapshotLight = new SnapShotLight();
+	snapshotLight.setId_snap(id);
+	SnapAttributeExtract[] sae = this.findSnapshotAttributes(snapshotLight);
+	if (sae == null || sae.length == 0) {
+	    return null;
+	}
+	return sae;
+
     }
 
-    public String setEquipmentsWithCommand(String cmd_name, String option,
-            SnapShot snapShot) {
-        // TODO Auto-generated method stub
-        try {
-            return SnapManagerApi.setEquipmentWithCommand(cmd_name, option,
-                    snapShot);
-        } catch (SnapshotingException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        return null;
+    @Override
+    public String setEquipmentsWithCommand(String cmd_name, String option, SnapShot snapShot)
+	    throws SnapshotingException {
+	return SnapManagerApi.setEquipmentWithCommand(cmd_name, option, snapShot);
+
     }
 
     @Override
     public int findContextId(int snapshotId) throws SnapshotingException {
-        checkConnection();
-        int contextId = SnapManagerApi.getContextID(snapshotId);
-        return contextId;
+	// checkConnection();
+	int contextId = SnapManagerApi.getContextID(snapshotId);
+	return contextId;
     }
 
-    private void checkConnection() throws SnapshotingException {
-        if (!isConnected)
-            SnapManagerApi.SnapshotingConfigure(this.user, this.pwd);
-    }
+    // private void checkConnection() throws SnapshotingException {
+    // if (!isConnected) {
+    // SnapManagerApi.SnapshotingConfigure(this.user, this.pwd);
+    // }
+    // }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/ConfigConst.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/ConfigConst.java
index fb0bd5f..941bcf3 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/ConfigConst.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/ConfigConst.java
@@ -68,124 +68,124 @@ import java.io.File;
  * by all other classes of the package<br/>
  */
 public class ConfigConst {
-	/*
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * DataBase defaults parameters
-	 * ||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 */
+    /*
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * DataBase defaults parameters
+     * ||||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     */
 
-	// ----------------------------------- >> Historical DataBase
-	/**
-	 * Parameter that represents the default database host
-	 */
-	public static final String default_shost = "localhost";
-	/**
-	 * Parameter that represents the default database names
-	 */
-	public static final String default_sbd = "hdb";
-	/**
-	 * Parameter that represents the default database's schema name
-	 */
-	public static final String default_sschema = "snap"; //
-	/**
-	 * Parameter that represents the default database manager user id
-	 * (operators...)
-	 */
-	public static final String default_smuser = "snap"; // "manager";
-	/**
-	 * Parameter that represents the default database manager user password
-	 */
-	public static final String default_smpasswd = "snap"; // "manager";
-	/**
-	 * Parameter that represents the default database archiver user id
-	 * (archivers...)
-	 */
-	public static final String default_sauser = "archiver";
-	/**
-	 * Parameter that represents the default database archiver user password
-	 */
-	public static final String default_sapasswd = "archiver";
-	/**
-	 * Parameter that represents the default database archiver user password
-	 */
-	public static final String default_sabeansfilename = "beans.xml";
-	/**
-	 * Parameter that represents the default database browser user id
-	 */
-	public static final String default_sbuser = "browser";
-	/**
-	 * Parameter that represents the default database browser user password (for
-	 * the default user...)
-	 */
-	public static final String default_sbpasswd = "browser";
+    // ----------------------------------- >> Historical DataBase
+    /**
+     * Parameter that represents the default database host
+     */
+    public static final String default_shost = "localhost";
+    /**
+     * Parameter that represents the default database names
+     */
+    public static final String default_sbd = "snap";
+    /**
+     * Parameter that represents the default database's schema name
+     */
+    public static final String default_sschema = "snap"; //
+    /**
+     * Parameter that represents the default database manager user id
+     * (operators...)
+     */
+    public static final String default_smuser = "snap"; // "manager";
+    /**
+     * Parameter that represents the default database manager user password
+     */
+    public static final String default_smpasswd = "snap"; // "manager";
+    /**
+     * Parameter that represents the default database archiver user id
+     * (archivers...)
+     */
+    public static final String default_sauser = "archiver";
+    /**
+     * Parameter that represents the default database archiver user password
+     */
+    public static final String default_sapasswd = "archiver";
+    /**
+     * Parameter that represents the default database archiver user password
+     */
+    public static final String default_sabeansfilename = "beans.xml";
+    /**
+     * Parameter that represents the default database browser user id
+     */
+    public static final String default_sbuser = "browser";
+    /**
+     * Parameter that represents the default database browser user password (for
+     * the default user...)
+     */
+    public static final String default_sbpasswd = "browser";
 
-	// ----------------------------------- >> DataBase Type
-	/**
-	 * Parameter that represents the MySQL database type
-	 */
-	public static final int BD_MYSQL = 0;
-	/**
-	 * Parameter that represents the Oracle database type
-	 */
-	public static final int BD_ORACLE = 1;
-	/**
-	 * Parameter that represents the PostGreSQL database type
-	 */
-	public static final int BD_POSTGRESQL = 2;
+    // ----------------------------------- >> DataBase Type
+    /**
+     * Parameter that represents the MySQL database type
+     */
+    public static final int BD_MYSQL = 0;
+    /**
+     * Parameter that represents the Oracle database type
+     */
+    public static final int BD_ORACLE = 1;
+    /**
+     * Parameter that represents the PostGreSQL database type
+     */
+    public static final int BD_POSTGRESQL = 2;
 
-	// ----------------------------------- >> Drivers Types
-	/**
-	 * Parameter that represents the MySQL database driver
-	 */
-	public static final String DRIVER_MYSQL = "jdbc:mysql";
-	/**
-	 * Parameter that represents the Oracle database driver
-	 */
-	public static final String DRIVER_ORACLE = "jdbc:oracle:thin";
-	/**
-	 * Parameter that represents the PostGreSQL database driver
-	 */
-	public static final String DRIVER_POSTGRESQL = ""; // todo Give a value to
-	// the PostGres JDBC
-	// driver
-	/**
-	 * Port number for the connection
-	 */
-	public final static String ORACLE_PORT = "1521";
+    // ----------------------------------- >> Drivers Types
+    /**
+     * Parameter that represents the MySQL database driver
+     */
+    public static final String DRIVER_MYSQL = "jdbc:mysql";
+    /**
+     * Parameter that represents the Oracle database driver
+     */
+    public static final String DRIVER_ORACLE = "jdbc:oracle:thin";
+    /**
+     * Parameter that represents the PostGreSQL database driver
+     */
+    public static final String DRIVER_POSTGRESQL = ""; // todo Give a value to
+    // the PostGres JDBC
+    // driver
+    /**
+     * Port number for the connection
+     */
+    public final static String ORACLE_PORT = "1521";
 
-	/*
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 * Miscellaneous global constants
-	 * ||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||
-	 * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-	 */
-	/**
-	 * Parameter that represents an empty String
-	 */
-	public static final String EMPTY = "";
-	// todo mettre en place une solution plus g�n�rique pour le "default_path"
-	public static String default_path = "C:" + File.separator + "tango"
-			+ File.separator + "dsnap" + File.separator + "snapshots";
+    /*
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     * Miscellaneous global constants
+     * ||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||
+     * ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+     */
+    /**
+     * Parameter that represents an empty String
+     */
+    public static final String EMPTY = "";
+    // todo mettre en place une solution plus g�n�rique pour le "default_path"
+    public static String default_path = "C:" + File.separator + "tango" + File.separator + "dsnap" + File.separator
+	    + "snapshots";
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/DataBaseAPI.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/DataBaseAPI.java
index 06e97ec..15d3f01 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/DataBaseAPI.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/DataBaseAPI.java
@@ -176,14 +176,9 @@ package fr.soleil.snapArchivingApi.SnapshotingApi;
  * Import classes
  */
 
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
 import java.sql.CallableStatement;
 import java.sql.Clob;
 import java.sql.Connection;
-import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -192,40 +187,24 @@ import java.sql.Statement;
 import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Random;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
-import javax.sql.DataSource;
-
-import org.apache.commons.dbcp.ConnectionFactory;
-import org.apache.commons.dbcp.DriverManagerConnectionFactory;
-import org.apache.commons.dbcp.PoolableConnectionFactory;
-import org.apache.commons.dbcp.PoolingDataSource;
-import org.apache.commons.pool.ObjectPool;
-import org.apache.commons.pool.impl.GenericObjectPool;
-
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
-import fr.esrf.Tango.DevState;
 import fr.esrf.Tango.ErrSeverity;
 import fr.esrf.TangoDs.TangoConst;
 import fr.soleil.commonarchivingapi.ArchivingTools.Tools.StringFormater;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.GlobalConst;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.ScalarEvent;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeExtract;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeHeavy;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeLight;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapContext;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapImageEvent_RO;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapImageEvent_RW;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapScalarEvent_RO;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapScalarEvent_RW;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapScalarEvent_WO;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShot;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapShotLight;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapSpectrumEvent_RO;
-import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapSpectrumEvent_RW;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 
 /**
@@ -237,115 +216,67 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
  * @version 1.0
  */
 public class DataBaseAPI {
-    /*
-     * Members
-     */
+    public static boolean useLog4JDBC = System.getProperty("log4jdbc.active") == null ? false : System.getProperty(
+	    "log4jdbc.active").equalsIgnoreCase("true");
     /**
      * Connection dbatabase type (<I>MySQL</I>, <I>Oracle</I>, ...)
      */
-    private static int db_type;
-    /*
-     * Port number for the connection private static int port;
-     */
+    private int db_type;
+
     /* JDBC driver used for the connection */
-    private static String driver;
+    private String driver;
     /* Database Host adress */
-    private static String host;
+    private final String dbHostName;
     /* User's name for the connection */
-    private static String user;
+    private final String userName;
     /* User's password for the connection */
-    private static String passwd;
+    private final String password;
     /* database name */
-    private static String name;
+    private final String dbName;
     /**
      * database'schema' used
      */
-    private String schema;
-    /* Connection object used */
-    private static Connection dbconn;
-
-    private DataSource m_dataSource = null;
-
-    // True if connection and disconnection are made once
-    // False if the connection are or made for every request,
-    private static boolean autoConnect;
-
-    private static String temporarilyPath;
+    private final String dbSchemaName;
+    private final boolean isRac;
 
     private int currentSpectrumDimX;
 
-    /*
-     * Contructors
-     */
-
-    /**
-     * Default constructor.
-     */
-    public DataBaseAPI() {
-    }
-
-    /**
-     * Constructor using host name, user name, password and database name.
-     * 
-     * @param host_name
-     *            Identifier (name or IP adress) of the machine which supplies
-     *            the service "data base <I>Snap</I>"
-     * @param host_name
-     *            Identifier (name or IP adress) of the machine which supplies
-     *            the service "data base <I>HDB</I>"
-     * @param db_name
-     *            database name
-     * @param db_schema
-     *            Name of the database's schema used
-     */
-    public DataBaseAPI(final String host_name, final String db_name, final String db_schema) {
-	setHost(host_name);
-	setDbName(db_name);
-	if (!db_schema.equals("")) {
-	    setDbShema(db_schema);
-	} else {
-	    setDbShema(db_name);
-	}
-    }
-
     /**
      * Constructor using host name, user name, password and database name.
      * 
-     * @param host_name
+     * @param dbHostName
      *            Identifier (name or IP adress) of the machine which supplies
      *            the service data base
-     * @param db_name
+     * @param dbName
      *            Name of the data base used
-     * @param db_schema
+     * @param dbSchemaName
      *            Name of the database's schema used
-     * @param user_name
+     * @param userName
      *            Name to use to connect
      * @param password
      *            Password to use to connect
      */
-    public DataBaseAPI(final String host_name, final String db_name, final String db_schema,
-	    final String user_name, final String password) {
-	this(host_name, db_name, db_schema);
-	setUser(user_name);
-	setPassword(password);
+    public DataBaseAPI(final String dbHostName, final String dbName, final String dbSchemaName, final String userName,
+	    final String password, boolean isRac) {
+	this.dbHostName = dbHostName;
+	this.dbName = dbName;
+	this.userName = userName;
+	this.password = password;
+	if (!dbSchemaName.equals("")) {
+	    this.dbSchemaName = dbSchemaName;
+	} else {
+	    this.dbSchemaName = dbName;
+	}
+	this.isRac = isRac;
     }
 
-    /*****************************************************************************
-     * 
-     * 
-     * Generals methods used for the connection
-     * 
-     * 
-     ****************************************************************************/
-
-    // Getter methods
     /**
      * <b>Description : </b> Gets the database name
      * 
      * @return The database name
      */
     public String getDbName() {
-	return name;
+	return dbName;
     }
 
     /**
@@ -354,7 +285,7 @@ public class DataBaseAPI {
      * @return The database name
      */
     public String getDbSchema() {
-	return schema;
+	return dbSchemaName;
     }
 
     /**
@@ -372,7 +303,7 @@ public class DataBaseAPI {
      * @return The host where the connection is done
      */
     public String getHost() {
-	return host;
+	return dbHostName;
     }
 
     /**
@@ -381,7 +312,7 @@ public class DataBaseAPI {
      * @return The user's name for the connection
      */
     public String getUser() {
-	return user;
+	return userName;
     }
 
     /**
@@ -390,7 +321,7 @@ public class DataBaseAPI {
      * @return The user's password for the connection
      */
     public String getPassword() {
-	return passwd;
+	return password;
     }
 
     /**
@@ -403,183 +334,6 @@ public class DataBaseAPI {
 	return db_type;
     }
 
-    public static String getTemporarilyPath() {
-	return temporarilyPath;
-    }
-
-    public static void setTemporarilyPath(final String temporarilyPath) {
-	DataBaseAPI.temporarilyPath = temporarilyPath;
-    }
-
-    /**
-     * <b>Description</b> : Returns misc informations about the database and a
-     * set of parameters characterizing the connection. <br>
-     * 
-     * @return miscellaneous informations about the database and a set of
-     *         parameters characterizing the connection.
-     * @throws SnapshotingException
-     */
-    public String getInfo() throws SnapshotingException {
-	String msg = null;
-	// Then get info from the database
-	try {
-	    final DatabaseMetaData db_info = dbconn.getMetaData();
-
-	    msg = "\tUser : " + db_info.getUserName() + "\n\tdatabase name : " + name;
-	    msg = msg + "\n\tdatabase product : " + db_info.getDatabaseProductVersion();
-	    msg = msg + "\n\tURL : " + db_info.getURL();
-	    msg = msg + "\n\tDriver name : " + db_info.getDriverName();
-	    msg = msg + " Version " + db_info.getDriverVersion();
-	    msg = msg + "\n\tdatabase modes : ";
-	    if (dbconn.getAutoCommit()) {
-		msg = msg + "AUTO COMMIT ; ";
-	    } else {
-		msg = msg + "MANUAL COMMIT ; ";
-	    }
-
-	    if (dbconn.isReadOnly()) {
-		msg = msg + "READ ONLY ; ";
-	    } else {
-		msg = msg + "READ-WRITE ; ";
-	    }
-
-	    if (db_info.usesLocalFiles()) {
-		msg = msg + "USES LOCAL FILES";
-	    } else {
-		msg = msg + "DONT USE LOCAL FILES";
-	    }
-
-	} catch (final SQLException e) {
-	    String message = "";
-	    if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-		    || e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.ADB_CONNECTION_FAILURE;
-	    } else {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.STATEMENT_FAILURE;
-	    }
-	    // String message = "";
-	    final String reason = GlobalConst.STATEMENT_FAILURE;
-	    final String desc = "Failed while executing DataBaseApi.getInfo() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this.getClass()
-		    .getName(), e);
-	}
-	return msg;
-
-    }
-
-    /**
-     * <b>Description : </b> Gets the current used connection's object
-     * 
-     * @return The connection object return when connecting
-     */
-    public Connection getConnectionObject() {
-	if (dbconn == null) {
-	    String msg = "Error detected :\n";
-	    msg = msg + "---> Class : DataBaseAPI\n" + "---> Method : getConnectionObject\n";
-	    msg = msg + "---> Description : Impossible to connect with the database.\n";
-	    msg = msg + "                   The connection object returned is NULL ... exiting.";
-	    System.out.println(msg);
-	    System.exit(-1);
-	}
-	return dbconn;
-    }
-
-    /**
-     * <b>Description : </b> Gets the current connection's type <br>
-     * 
-     * @return True if connection and disconnection are made for every request,
-     *         False if the connection and disconnection are made once
-     */
-    public boolean getAutoConnect() {
-	return autoConnect;
-    }
-
-    // Setter methods
-    /**
-     * <b>Description : </b> Sets the database name <br>
-     * 
-     * @param db_name
-     *            The database name
-     */
-    public void setDbName(final String db_name) {
-	name = db_name;
-    }
-
-    /**
-     * <b>Description : </b> Sets the database name <br>
-     * 
-     * @param db_shema
-     *            The database shema used
-     */
-    public void setDbShema(final String db_shema) {
-	schema = db_shema;
-    }
-
-    /**
-     * <b>Description : </b> Sets the database type (<I>MySQL</I>,
-     * <I>Oracle</I>, ...) <br>
-     * 
-     * @param db_type
-     *            The database name
-     */
-    public void setDb_type(final int db_type) {
-	DataBaseAPI.db_type = db_type;
-    }
-
-    /**
-     * <b>Description : </b> Specifies a driver for the connection
-     * 
-     * @param driver_name
-     *            The driver's name to use for the connection
-     */
-    public void setDriver(final String driver_name) {
-	driver = driver_name;
-    }
-
-    /**
-     * <b>Description : </b> Sets the host to connect
-     * 
-     * @param host_name
-     *            The host to connect
-     */
-    public void setHost(final String host_name) {
-	host = host_name;
-    }
-
-    /**
-     * <b>Description : </b> Sets the current user's name for the connection
-     * 
-     * @param user_name
-     *            The user's name for the connection
-     */
-    public void setUser(final String user_name) {
-	user = user_name;
-    }
-
-    /**
-     * <b>Description : </b> Sets a password for the connection
-     * 
-     * @param password
-     *            The password for the connection
-     */
-    public void setPassword(final String password) {
-	passwd = password;
-    }
-
-    /**
-     * <b>Description : </b> Sets the current connection's mode
-     * 
-     * @param value
-     *            <li><I>True</I> : implies that connection and disconnection
-     *            are made for every request, <li><I>False</I> : implies that
-     *            connection and disconnection are made once
-     */
-    public void setAutoConnect(final boolean value) {
-	autoConnect = value;
-    }
-
     /**
      * ************************************************************************
      * <b>Description</b> : Methods that counts the number of non null rows in
@@ -588,8 +342,8 @@ public class DataBaseAPI {
      * @param arr
      *            an array of Strings
      * @throws NullPointerException
-     *             **************************************************************
-     *             ***********
+     *             *************************************************************
+     *             * ***********
      */
     public int getArrayCount(final String[] arr) {
 	int arrayCount = 0;
@@ -604,29 +358,6 @@ public class DataBaseAPI {
 	return arrayCount;
     }
 
-    /**
-     * ************************************************************************
-     * <b>Description</b> : Sets the auto commit mode to "true" or "false"
-     * 
-     * @param value
-     *            The mode value
-     * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
-     */
-    public void setAutoCommit(final boolean value) throws SnapshotingException {
-	// Set commit mode to manual
-	try {
-	    dbconn.setAutoCommit(value);
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : ";
-	    final String reason = GlobalConst.STATEMENT_FAILURE;
-	    final String desc = "Failed while executing DataBaseApi.setAutoCommit() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this.getClass()
-		    .getName(), e);
-	}
-    }
-
     /**
      * ************************************************************************
      * <b>Description</b> : Load an instance of the JDBC driver according to the
@@ -656,72 +387,6 @@ public class DataBaseAPI {
 	}
     }
 
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Build the url string and get a connection object
-     * 
-     * @throws SnapshotingException
-     *             **************************************************************
-     *             ***********
-     */
-    private void buildUrlAndConnect() throws SnapshotingException {
-	// Gets connected to the database
-	String url = "";
-	switch (db_type) {
-	case ConfigConst.BD_MYSQL:
-	    url = ConfigConst.DRIVER_MYSQL + "://" + host + "/" + name; // D�finition
-	    // du
-	    // pilote
-	    // MySQL
-	    break;
-	case ConfigConst.BD_ORACLE:
-	    url = ConfigConst.DRIVER_ORACLE + ":@" + host + ":" + ConfigConst.ORACLE_PORT + ":"
-		    + name; // pilote Oracle
-	    break;
-	}
-	System.out.println("DataBaseApi/buildUrlAndConnect/url|" + url);
-	// System.out.println("\turl = " + url);
-	try {
-	    dbconn = DriverManager.getConnection(url, user, passwd);
-	    // System.out.println("DataBaseApi/buildUrlAndConnect/url|"+url);
-	    dbconn.setAutoCommit(true);
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + "Error initializing the connection...";
-	    final String reason = GlobalConst.STATEMENT_FAILURE;
-	    final String desc = "Failed while executing DataBaseApi.buildUrlAndConnect() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, e.getClass()
-		    .getName(), e);
-	} catch (final Exception e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + "Error initializing the connection...";
-	    final String reason = GlobalConst.STATEMENT_FAILURE;
-	    final String desc = "Failed while executing DataBaseApi.buildUrlAndConnect() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, e.getClass()
-		    .getName(), e);
-	}
-    }
-
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Loads the JDBC driver, connects with the database
-     * and initializes. Remark: the type of the base (MySQL/Oracle) must
-     * beforehand have been specified...
-     * 
-     * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
-     */
-    public void connect() throws SnapshotingException {
-	// Load the driver
-	loadDriver();
-	// Gets connected to the database
-	buildUrlAndConnect();
-	// Set connection's default settings
-	setAutoCommit(true);
-	System.out.println("SnapInfo : \n" + getInfo());
-    }
-
     /**
      * <b>Description : </b> Allows to connect to the database <I>Snap</I>,
      * independently of its type (<I>mySQL</I>/<I>Oracle</I>)
@@ -730,38 +395,37 @@ public class DataBaseAPI {
 	SnapshotingException archivingException1 = null, archivingException2 = null;
 	try {
 	    // try oracle
-	    connect_oracle();
 	    System.out.println("DataBaseApi.connect_auto oracle: " + getUser() + "@" + getHost());
+	    connect_oracle();
+	    System.out.println("connection to oracle OK");
 	    return;
 	} catch (final SnapshotingException e) {
 	    // e.printStackTrace();
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + "CONNECTION FAILED !";
+	    System.out.println("connection to oracle KO");
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + "CONNECTION FAILED !";
 	    final String reason = "Failed while executing DataBaseApi.connect_auto() method...";
 	    final String desc = "Failed while connecting to the Oracle archiving database";
-	    archivingException1 = new SnapshotingException(message, reason, ErrSeverity.PANIC,
-		    desc, "", e);
+	    archivingException1 = new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	}
 	try {
 	    // try MySQL;
-	    connect_mysql();
 	    System.out.println("DataBaseApi.connect_auto MySQL: " + getUser() + "@" + getHost());
+	    connect_mysql();
+	    System.out.println("connection to MySQL OK");
 	    return;
 	} catch (final SnapshotingException e) {
 	    // e.printStackTrace();
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + "CONNECTION FAILED !";
+	    System.out.println("connection to MySQL KO");
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + "CONNECTION FAILED !";
 	    final String reason = "Failed while executing DataBaseApi.connect_auto() method...";
 	    final String desc = "Failed while connecting to the MySQL archiving database";
-	    archivingException2 = new SnapshotingException(message, reason, ErrSeverity.PANIC,
-		    desc, "", e);
+	    archivingException2 = new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 
 	    final String _desc = "Failed while connecting to the archiving database";
 
-	    final SnapshotingException archivingException = new SnapshotingException(message,
-		    reason, ErrSeverity.PANIC, _desc, "", archivingException1);
-	    archivingException.addStack(message, reason, ErrSeverity.PANIC, _desc, "",
-		    archivingException2);
+	    final SnapshotingException archivingException = new SnapshotingException(message, reason,
+		    ErrSeverity.PANIC, _desc, "", archivingException1);
+	    archivingException.addStack(message, reason, ErrSeverity.PANIC, _desc, "", archivingException2);
 	    throw archivingException;
 	}
     }
@@ -772,46 +436,38 @@ public class DataBaseAPI {
      * 
      * @throws SnapshotingException
      */
-    public void connect_mysql() throws SnapshotingException {
+    private Connection connect_mysql() throws SnapshotingException {
 	// Load the driver
+	Connection connection = null;
 	try {
-	    Class.forName("org.gjt.mm.mysql.Driver"); // D�finition du pilote
-	    // MySQL
-	    final String url = ConfigConst.DRIVER_MYSQL + "://" + host + "/" + name
-		    + "?autoReconnect=true"; // D�finition du pilote MySQL
-	    System.out.println("DataBaseApi.connect_mysql - url: " + url);
-	    dbconn = DriverManager.getConnection(url, user, passwd);
-	    setAutoCommit(true);
-	    setDb_type(ConfigConst.BD_MYSQL);
-	    setDriver(ConfigConst.DRIVER_MYSQL);
-
-	    final ObjectPool connectionPool = new GenericObjectPool(null);
-	    final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(url,
-		    user, passwd);
-	    final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
-		    connectionFactory, connectionPool, null, null, false, true);
-	    m_dataSource = new PoolingDataSource(connectionPool);
-
+	    Class.forName("org.gjt.mm.mysql.Driver");
+	    final String url = ConfigConst.DRIVER_MYSQL + "://" + dbHostName + "/" + dbName + "?autoReconnect=true";
+	    System.out.println("mysql URL " + url);
+	    connection = DriverManager.getConnection(url, userName, password);
+	    if (useLog4JDBC) {
+		connection = new net.sf.log4jdbc.ConnectionSpy(connection);
+	    }
+	    connection.setAutoCommit(true);
+	    db_type = ConfigConst.BD_MYSQL;
+	    driver = ConfigConst.DRIVER_MYSQL;
+	    return connection;
 	} catch (final ClassNotFoundException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.DRIVER_MISSING;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.DRIVER_MISSING;
 	    final String reason = "Failed while executing DataBaseApi.connect_mysql() method...";
 	    final String desc = "No MySQL driver available..., please check !";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ADB_CONNECTION_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ADB_CONNECTION_FAILURE;
 	    final String reason = "Failed while executing DataBaseApi.connect_mysql() method...";
 	    final String desc = e.getMessage().indexOf(GlobalConst.NO_HOST_EXCEPTION) != -1 ? "The 'host' property ("
-		    + host + ") might be wrong... please check it..."
+		    + dbHostName + ") might be wrong... please check it..."
 		    : "The loggin parameters (host, database name,  user, password) seem to be wrong...";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} catch (final Exception e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ADB_CONNECTION_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ADB_CONNECTION_FAILURE;
 	    final String reason = "Failed while executing DataBaseApi.connect_mysql() method...";
 	    final String desc = e.getMessage().indexOf(GlobalConst.NO_HOST_EXCEPTION) != -1 ? "The 'host' property ("
-		    + host + ") might be wrong... please check it..."
+		    + dbHostName + ") might be wrong... please check it..."
 		    : "The loggin parameters (host, database name,  user, password) seem to be wrong...";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	}
@@ -823,141 +479,98 @@ public class DataBaseAPI {
      * 
      * @throws SnapshotingException
      */
-    public void connect_oracle() throws SnapshotingException {
+    private Connection connect_oracle() throws SnapshotingException {
 	// Load the driver
+	Connection connection = null;
 	try {
-	    Class.forName("oracle.jdbc.driver.OracleDriver"); // pilote Oracle
-	    final String url = ConfigConst.DRIVER_ORACLE + ":@" + host + ":"
-		    + ConfigConst.ORACLE_PORT + ":" + name; // pilote Oracle
-	    dbconn = DriverManager.getConnection(url, user, passwd);
-	    setAutoCommit(true);
-	    setDb_type(ConfigConst.BD_ORACLE);
-	    setDriver(ConfigConst.DRIVER_ORACLE);
-	    alterSession();
+	    Class.forName("oracle.jdbc.driver.OracleDriver");
+	    final String url;
+	    if (isRac) {
+		url = ConfigConst.DRIVER_ORACLE + ":@" + dbHostName;
+	    } else {
+		url = ConfigConst.DRIVER_ORACLE + ":@" + dbHostName + ":" + ConfigConst.ORACLE_PORT + ":" + dbName;
+	    }
+	    System.out.println("ORACLE url = " + url);
+	    connection = DriverManager.getConnection(url, userName, password);
+
+	    if (useLog4JDBC) {
+		connection = new net.sf.log4jdbc.ConnectionSpy(connection);
+	    }
+	    connection.setAutoCommit(true);
+	    db_type = ConfigConst.BD_ORACLE;
+	    driver = ConfigConst.DRIVER_ORACLE;
+	    alterSession(connection);
+	    return connection;
 	} catch (final ClassNotFoundException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.DRIVER_MISSING;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.DRIVER_MISSING;
 	    final String reason = "Failed while executing DataBaseApi.connect_oracle() method...";
 	    final String desc = "No Oracle driver available..., please check !";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ADB_CONNECTION_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ADB_CONNECTION_FAILURE;
 	    final String reason = "Failed while executing DataBaseApi.connect_oracle() method...";
 	    final String desc = "The loggin parameters (host, database name,  user, password) seem to be wrong...";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	}
     }
 
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Closes the connection with the database
-     * 
-     * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
-     */
-    public void close() throws SnapshotingException {
-	if (dbconn != null) {
-	    try {
-		dbconn.close();
-	    } catch (final SQLException e) {
-		String message;
-		if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		// String message = ConfigConst.SNAPSHOTING_ERROR_PREFIX +
-		// " : ";
-		final String reason = GlobalConst.STATEMENT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.close() method...";
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e);
+    private Connection getConnection() throws SnapshotingException {
 
-	    }
+	if (db_type == ConfigConst.BD_ORACLE) {
+	    return connect_oracle();
+	} else {
+	    return connect_mysql();
 	}
     }
 
     /**
      * ************************************************************************
-     * <b>Description : </b> Commits actions in the database <br>
+     * <b>Description : </b> Closes the connection with the database
      * 
      * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
+     *             *************************************************************
+     *             * *********
      */
-    public void commit() throws SnapshotingException {
-	try {
-	    dbconn.commit();
-	} catch (final SQLException e) {
-	    String message = "";
-	    if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-		    || e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.ADB_CONNECTION_FAILURE;
-	    } else {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.STATEMENT_FAILURE;
-	    }
-
-	    final String reason = GlobalConst.STATEMENT_FAILURE;
-	    final String desc = "Failed while executing DataBaseApi.commit() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this.getClass()
-		    .getName(), e);
+    public void close(Connection conn) {
+	if (conn != null) {
+	    try {
+		conn.close();
+	    } catch (final SQLException e) {
 
+	    }
 	}
     }
 
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Cancels actions in the database <br>
-     * 
-     * @throws SQLException
-     *             **************************************************************
-     *             ***********
-     */
-    public void rollback() throws SQLException {
-	dbconn.rollback();
-    }
-
-    public void alterSession() throws SnapshotingException {
-	Statement stmt;
+    public void alterSession(Connection conn) throws SnapshotingException {
+	Statement stmt = null;
 	String sqlStr1, sqlStr2, sqlStr3;
 	sqlStr1 = "alter session set NLS_NUMERIC_CHARACTERS = \". \"";
 	sqlStr2 = "alter session set NLS_TIMESTAMP_FORMAT = 'DD-MM-YYYY HH24:MI:SS.FF'";
 	sqlStr3 = "alter session set NLS_DATE_FORMAT = 'DD-MM-YYYY HH24:MI:SS'";
 	try {
-	    stmt = dbconn.createStatement();
+	    stmt = conn.createStatement();
 	    stmt.executeQuery(sqlStr1);
 	    stmt.executeQuery(sqlStr2);
 	    stmt.executeQuery(sqlStr3);
-	    stmt.close();
 	} catch (final SQLException e) {
 	    String message = "";
 	    if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
 		    || e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.ADB_CONNECTION_FAILURE;
+		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ADB_CONNECTION_FAILURE;
 	    } else {
-		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.STATEMENT_FAILURE;
+		message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.STATEMENT_FAILURE;
 	    }
 
 	    final String reason = GlobalConst.STATEMENT_FAILURE;
 	    final String desc = "Failed while executing DataBaseApi.alterSession() method...";
-	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this.getClass()
-		    .getName(), e);
-	}
-    }
-
-    private static void close(final ResultSet rset) throws SQLException {
-	if (rset != null) {
-	    rset.close();
+	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this.getClass().getName(), e);
+	} finally {
+	    if (stmt != null) {
+		try {
+		    stmt.close();
+		} catch (SQLException e) {
+		}
+	    }
 	}
     }
 
@@ -977,8 +590,8 @@ public class DataBaseAPI {
      *            The attribute's name
      * @return The <I>SnapDb</I>'s ID that caracterize the given attribute
      * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
+     *             *************************************************************
+     *             * *********
      */
     public int getAttID(final String att_name) throws SnapshotingException {
 	int attributesID = 0;
@@ -992,12 +605,13 @@ public class DataBaseAPI {
 	    // Preparing statement...
 	    selectString = "SELECT " + GlobalConst.TAB_DEF[0] + " FROM " + table_name + " WHERE "
 		    + GlobalConst.TAB_DEF[2] + " like ?";
-	    if (m_dataSource == null) {
-		ps_get_att_id = dbconn.prepareStatement(selectString);
-	    } else {
-		conn = m_dataSource.getConnection();
-		ps_get_att_id = conn.prepareStatement(selectString);
-	    }
+	    // if (m_dataSource == null) {
+	    conn = getConnection();
+	    ps_get_att_id = conn.prepareStatement(selectString);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // ps_get_att_id = conn.prepareStatement(selectString);
+	    // }
 	    final String field1 = att_name.trim();
 	    ps_get_att_id.setString(1, field1);
 	    rset = ps_get_att_id.executeQuery();
@@ -1007,8 +621,7 @@ public class DataBaseAPI {
 		ps_get_att_id.close();
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getAttID() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -1049,48 +662,38 @@ public class DataBaseAPI {
      *         database <I>snap</I>.
      * @throws SnapshotingException
      */
-    public int getMaxID() throws SnapshotingException {
+    public int getMaxContextID() throws SnapshotingException {
 	Statement stmt = null;
 	ResultSet rset = null;
 	String query;
-	final int new_ID = 0;
 	int res = 0;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
-	// Create and execute the SQL query string
-	// Build the query string
-	query = "SELECT MAX(" + GlobalConst.TAB_CONTEXT[0] + ") FROM " + getDbSchema() + "."
-		+ GlobalConst.TABS[1];
+	query = "SELECT MAX(" + GlobalConst.TAB_CONTEXT[0] + ") FROM " + getDbSchema() + "." + GlobalConst.TABS[1];
 
+	Connection conn = null;
 	try {
-	    stmt = dbconn.createStatement();
+	    conn = getConnection();
+	    stmt = conn.createStatement();
 	    rset = stmt.executeQuery(query);
 	    // Gets the result of the query
 	    if (rset.next()) {
 		res = rset.getInt(1);
 	    }
-	    if (res < new_ID) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
+	    if (res < 0) {
+		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 		final String reason = "Failed while executing DataBaseAPI.getMaxID() method...";
 		final String desc = "The table seem to be empty, please check it...";
-		System.out.println(new SnapshotingException(message, reason, ErrSeverity.WARN,
-			desc, "").toString());
-
-		res = new_ID;
+		System.out.println(new SnapshotingException(message, reason, ErrSeverity.WARN, desc, "").toString());
+		res = 0;
 	    }
-	    stmt.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getMaxID() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(stmt);
+	    closeConnection(conn);
 	}
 
 	return res;
@@ -1109,17 +712,19 @@ public class DataBaseAPI {
 	String query = "";
 	Statement stmt = null;
 	String select_field = "";
-	select_field = select_field + GlobalConst.TAB_CONTEXT[0] + ", "
-		+ GlobalConst.TAB_CONTEXT[1] + ", " + GlobalConst.TAB_CONTEXT[2] + ", "
-		+ GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4] + ", "
-		+ GlobalConst.TAB_CONTEXT[5];
+	select_field = select_field + GlobalConst.TAB_CONTEXT[0] + ", " + GlobalConst.TAB_CONTEXT[1] + ", "
+		+ GlobalConst.TAB_CONTEXT[2] + ", " + GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4]
+		+ ", " + GlobalConst.TAB_CONTEXT[5];
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[1];
 	final String clause_1 = " ORDER BY " + GlobalConst.TAB_CONTEXT[0];
 	query = "SELECT " + select_field + "  FROM " + table_1 + clause_1;
 
 	ResultSet resultSet = null;
+
+	Connection conn = null;
 	try {
-	    stmt = dbconn.createStatement();
+	    conn = getConnection();
+	    stmt = conn.createStatement();
 	    resultSet = stmt.executeQuery(query.toString());
 	    while (resultSet.next()) {
 		final SnapContext snapContext = new SnapContext();
@@ -1133,14 +738,14 @@ public class DataBaseAPI {
 	    }
 	    return contextList;
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getAllContext() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(stmt);
+	    closeConnection(conn);
 	}
     }
 
@@ -1154,29 +759,26 @@ public class DataBaseAPI {
      * @return a list of registered contexts (or 'snap-patterns)
      * @throws SnapshotingException
      */
-    public ArrayList getContext(final String clause, final int id_context)
-	    throws SnapshotingException {
+    public ArrayList getContext(final String clause, final int id_context) throws SnapshotingException {
 	Connection conn = null;
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
 	Statement stmt = null;
-
 	ArrayList contextList;
 	contextList = new ArrayList(512);
 	String query = "";
 	String select_field = "";
 	// Selection des champs des contexts a afficher.
-	select_field = select_field + GlobalConst.TAB_CONTEXT[0] + ", "
-		+ GlobalConst.TAB_CONTEXT[1] + ", " + GlobalConst.TAB_CONTEXT[2] + ", "
-		+ GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4] + ", "
-		+ GlobalConst.TAB_CONTEXT[5];
+	select_field = select_field + GlobalConst.TAB_CONTEXT[0] + ", " + GlobalConst.TAB_CONTEXT[1] + ", "
+		+ GlobalConst.TAB_CONTEXT[2] + ", " + GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4]
+		+ ", " + GlobalConst.TAB_CONTEXT[5];
 	// Choix de la table dans laquelle effectuer la requete SQL.
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[1];
 	// Affichage des resusltats par ordre croissant d'ID du context.
 	final String clause_1 = " ORDER BY " + GlobalConst.TAB_CONTEXT[0];
 	query = "SELECT " + select_field + " FROM " + table_1;
-
 	try {
+	    conn = getConnection();
 	    if (id_context != -1) {
 		// Cas ou l'id_context est donne.
 
@@ -1184,12 +786,12 @@ public class DataBaseAPI {
 
 		// System.out.println("query : " + query);
 
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
+		// if (m_dataSource == null) {
+		preparedStatement = conn.prepareStatement(query);
+		// } else {
+		// conn = m_dataSource.getConnection();
+		// preparedStatement = conn.prepareStatement(query);
+		// }
 
 		preparedStatement.setInt(1, id_context);
 		resultSet = preparedStatement.executeQuery();
@@ -1212,16 +814,9 @@ public class DataBaseAPI {
 		    query = query + clause_1;
 		} else {
 		    query = query + clause + clause_1;
-		    System.out.println("query : " + query);
-		}
-
-		if (m_dataSource == null) {
-		    stmt = dbconn.createStatement();
-		} else {
-		    conn = m_dataSource.getConnection();
-		    stmt = conn.createStatement();
 		}
 
+		stmt = conn.createStatement();
 		resultSet = stmt.executeQuery(query.toString());
 		while (resultSet.next()) {
 		    final SnapContext snapContext = new SnapContext();
@@ -1235,8 +830,7 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getContext() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -1246,7 +840,6 @@ public class DataBaseAPI {
 	    closeStatement(stmt);
 	    closeConnection(conn);
 	}
-
 	return contextList;
     }
 
@@ -1256,32 +849,31 @@ public class DataBaseAPI {
      * 
      * @return array of strings
      * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
+     *             *************************************************************
+     *             * *********
      */
     public String[] get_AttFromContext(final String nom_context) throws SnapshotingException {
 	final Vector argout_vect = new Vector();
 	String[] argout;
 	PreparedStatement preparedStatement = null;
 	ResultSet rset = null;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
+
 	// Create and execute the SQL query string
 	String query;
 	final String select_field = GlobalConst.TAB_DEF[2];
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[0];
-	final String clause_1 = GlobalConst.TABS[0] + "." + GlobalConst.TAB_DEF[0] + " = "
-		+ GlobalConst.TABS[3] + "." + GlobalConst.TAB_LIST[1];
-	final String clause_2 = GlobalConst.TABS[3] + "." + GlobalConst.TAB_SNAP[0] + " = "
-		+ GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0];
+	final String clause_1 = GlobalConst.TABS[0] + "." + GlobalConst.TAB_DEF[0] + " = " + GlobalConst.TABS[3] + "."
+		+ GlobalConst.TAB_LIST[1];
+	final String clause_2 = GlobalConst.TABS[3] + "." + GlobalConst.TAB_SNAP[0] + " = " + GlobalConst.TABS[1] + "."
+		+ GlobalConst.TAB_CONTEXT[0];
 	final String clause_3 = GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[2] + " = ?";
 
-	query = "SELECT DISTINCT " + select_field + " FROM " + table_1 + " WHERE " + clause_1
-		+ " AND " + clause_2 + " AND " + clause_3;
+	query = "SELECT DISTINCT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2
+		+ " AND " + clause_3;
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setString(1, nom_context);
 	    rset = preparedStatement.executeQuery();
 
@@ -1291,19 +883,16 @@ public class DataBaseAPI {
 	    }
 
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_ATT;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_ATT;
 	    final String reason = "Failed while executing DataBaseAPI.get_AttFromContext() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
+
 	// Returns the families list
 	argout = toStringArray(argout_vect);
 	return argout;
@@ -1316,18 +905,14 @@ public class DataBaseAPI {
      * @return array of strings
      * @throws SnapshotingException
      * @see SnapShotLight
-     *      *********************************************************************
-     *      ****
+     *      ********************************************************************
+     *      * ****
      */
-    public ArrayList getContextAssociatedSnapshots(final int id_context)
-	    throws SnapshotingException {
+    public ArrayList getContextAssociatedSnapshots(final int id_context) throws SnapshotingException {
 	final ArrayList associatedSnapshots = new ArrayList();
 	PreparedStatement preparedStatement = null;
 	ResultSet rset = null;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
+
 	// Create and execute the SQL query string
 	String query;
 	final String select_field = GlobalConst.TAB_SNAP[0] + ", " + GlobalConst.TAB_SNAP[2];
@@ -1336,9 +921,10 @@ public class DataBaseAPI {
 	final String clause_2 = GlobalConst.TABS[3] + "." + GlobalConst.TAB_SNAP[1] + " = ?";
 
 	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_2;
-
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, id_context);
 	    rset = preparedStatement.executeQuery();
 
@@ -1352,19 +938,16 @@ public class DataBaseAPI {
 		associatedSnapshots.add(snapShotLight);
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_SNAP;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_SNAP;
 	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedSnapshots() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
+
 	// Returns the names list
 
 	return associatedSnapshots;
@@ -1379,11 +962,11 @@ public class DataBaseAPI {
      * @return array of strings
      * @throws SnapshotingException
      * @see SnapShotLight
-     *      *********************************************************************
-     *      ****
+     *      ********************************************************************
+     *      * ****
      */
-    public ArrayList getContextAssociatedSnapshots(final String clause, final int id_context,
-	    final int id_snap) throws SnapshotingException {
+    public ArrayList getContextAssociatedSnapshots(final String clause, final int id_context, final int id_snap)
+	    throws SnapshotingException {
 	final ArrayList associatedSnapshots = new ArrayList();
 	// First connect with the database
 	/*
@@ -1409,6 +992,7 @@ public class DataBaseAPI {
 
 	query = "SELECT " + select_field + " FROM " + table_1 + clause;
 	try {
+	    conn = getConnection();
 	    if (id_context != -1 && id_snap != -1) {
 		// Cas ou l'id_context et l'id_snap sont donnes.
 		/*
@@ -1420,14 +1004,8 @@ public class DataBaseAPI {
 		 * clause_2 + " AND " + clause_3 + clause_4;
 		 */
 		query = query + clause_4;
-		// System.out.println("DataBaseApi.getContextAssociatedSnapshots/query  : "
-		// + query);
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
+
+		preparedStatement = conn.prepareStatement(query);
 		preparedStatement.setInt(1, id_snap);
 		preparedStatement.setInt(2, id_context);
 		rset = preparedStatement.executeQuery();
@@ -1453,15 +1031,8 @@ public class DataBaseAPI {
 		 * + " AND " + clause_2 + clause_4;
 		 */
 		query = query + clause_4;
-		// System.out.println("DataBaseApi.getContextAssociatedSnapshots/query  : "
-		// + query);
+		preparedStatement = conn.prepareStatement(query);
 
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
 		preparedStatement.setInt(1, id_context);
 		rset = preparedStatement.executeQuery();
 
@@ -1484,14 +1055,7 @@ public class DataBaseAPI {
 		 * + " AND " + clause_2 + clause_4;
 		 */
 		query = query + clause_4;
-		// System.out.println("DataBaseApi.getContextAssociatedSnapshots/query  : "
-		// + query);
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
+		preparedStatement = conn.prepareStatement(query);
 		preparedStatement.setInt(1, id_snap);
 		rset = preparedStatement.executeQuery();
 
@@ -1504,19 +1068,18 @@ public class DataBaseAPI {
 		    // commentaire
 		    associatedSnapshots.add(snapShotLight);
 		}
-		// preparedStatement.close();
 	    } else {
 		// Cas ou ni l'id_context ni l'id_snap ne sont donnes.
 		query = query + clause_4;
 		// System.out.println("DataBaseApi.getContextAssociatedSnapshots/query  : "
 		// + query);
 
-		if (m_dataSource == null) {
-		    stmt = dbconn.createStatement();
-		} else {
-		    conn = m_dataSource.getConnection();
-		    stmt = conn.createStatement();
-		}
+		// if (m_dataSource == null) {
+		stmt = conn.createStatement();
+		// } else {
+		// conn = m_dataSource.getConnection();
+		// stmt = conn.createStatement();
+		// }
 
 		rset = stmt.executeQuery(query.toString());
 		while (rset.next()) {
@@ -1529,14 +1092,12 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_SNAP;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_SNAP;
 	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedSnapshots() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} catch (final Exception e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_SNAP;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_SNAP;
 	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedSnapshots() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -1546,11 +1107,6 @@ public class DataBaseAPI {
 	    closeStatement(stmt);
 	    closeConnection(conn);
 	}
-
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
 	// Returns the names list
 	return associatedSnapshots;
     }
@@ -1561,32 +1117,29 @@ public class DataBaseAPI {
      * 
      * @return array of strings
      * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
+     *             *************************************************************
+     *             * *********
      */
     public double get_nbAttFromContext(final String nom_context) throws SnapshotingException {
 	double result = 0;
 	PreparedStatement preparedStatement = null;
 	ResultSet rset = null;
 
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
 	// Create and execute the SQL query string
 	String query;
 	final String select_field = " COUNT(*) ";
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[3];
-	final String clause_1 = GlobalConst.TABS[3] + "." + GlobalConst.TAB_SNAP[0] + " = "
-		+ GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0];
+	final String clause_1 = GlobalConst.TABS[3] + "." + GlobalConst.TAB_SNAP[0] + " = " + GlobalConst.TABS[1] + "."
+		+ GlobalConst.TAB_CONTEXT[0];
 	final String clause_2 = GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[2] + " = ?";
 
 	// the SQL request is : select count(*) from snap.list where
 	// list.id_context = context.id_context and context.name = 'nom';
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setString(1, nom_context);
 	    rset = preparedStatement.executeQuery();
 
@@ -1596,20 +1149,16 @@ public class DataBaseAPI {
 		preparedStatement.close();
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_ATT;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_ATT;
 	    final String reason = "Failed while executing DataBaseAPI.get_nbAttFromContext() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
 	// Returns the result
 	return result;
     }
@@ -1620,17 +1169,14 @@ public class DataBaseAPI {
      * 
      * @return the given attribute format
      * @throws SnapshotingException
-     *             **************************************************************
-     *             *********
+     *             *************************************************************
+     *             * *********
      */
     public int get_FormatFromAtt(final String nom_attribut) throws SnapshotingException {
 	int result = 0;
 	PreparedStatement preparedStatement = null;
 	ResultSet rset = null;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
+
 	// Create and execute the SQL query string
 	String query;
 	final String select_field = GlobalConst.TAB_DEF[9];
@@ -1639,8 +1185,10 @@ public class DataBaseAPI {
 
 	// the SQL request is : select data_format from AST where name = 'nom';
 	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1;
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setString(1, nom_attribut);
 	    rset = preparedStatement.executeQuery();
 
@@ -1650,20 +1198,16 @@ public class DataBaseAPI {
 		preparedStatement.close();
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.ERROR_RET_ATT;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.ERROR_RET_ATT;
 	    final String reason = "Failed while executing DataBaseAPI.get_FormatFromAtt() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
 	// Returns the result
 	return result;
     }
@@ -1682,10 +1226,12 @@ public class DataBaseAPI {
 	PreparedStatement statement = null;
 	final String table_name = getDbSchema() + "." + GlobalConst.TABS[3];
 	String query = "";
-	try { // Preparing statement...
-	    query = "SELECT " + GlobalConst.TAB_SNAP[2] + " FROM " + table_name + " WHERE "
-		    + GlobalConst.TAB_SNAP[0] + " like ?";
-	    statement = dbconn.prepareStatement(query);
+	Connection conn = null;
+	try {
+	    conn = getConnection();
+	    query = "SELECT " + GlobalConst.TAB_SNAP[2] + " FROM " + table_name + " WHERE " + GlobalConst.TAB_SNAP[0]
+		    + " like ?";
+	    statement = conn.prepareStatement(query);
 	    statement.setInt(1, snapID);
 	    rset = statement.executeQuery();
 	    // Gets the result of the query
@@ -1694,14 +1240,14 @@ public class DataBaseAPI {
 	    }
 	    statement.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getSnapRegistrationTime() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeResultSet(rset);
 	    closeStatement(statement);
+	    closeConnection(conn);
 	}
 	return time;
     }
@@ -1725,13 +1271,14 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[3];
 	final String clause_1 = GlobalConst.TAB_SNAP[0] + " like ?";
 	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1;
-	try { // Preparing preparedStatement...
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	try {
+	    conn = getConnection(); // Preparing preparedStatement...
+	    // if (m_dataSource == null) {
+	    preparedStatement = conn.prepareStatement(query);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // preparedStatement = conn.prepareStatement(query);
+	    // }
 	    preparedStatement.setInt(1, snapID);
 	    rset = preparedStatement.executeQuery();
 	    // Gets the result of the query
@@ -1742,8 +1289,7 @@ public class DataBaseAPI {
 	} catch (final SQLException e) {
 	    e.printStackTrace();
 
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getContextID() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -1755,29 +1301,27 @@ public class DataBaseAPI {
 	return res;
     }
 
-    public SnapAttributeExtract getSnapResult(final SnapAttributeLight snapAttributeLight,
-	    final int id_snap) {
-	final SnapAttributeExtract snapAttributeExtract = new SnapAttributeExtract(
-		snapAttributeLight);
+    public SnapAttributeExtract getSnapResult(final SnapAttributeExtract snapAttributeExtract, final int id_snap)
+	    throws SnapshotingException {
 	final int attID = snapAttributeExtract.getId_att();
 	switch (snapAttributeExtract.getData_format()) {
 	case AttrDataFormat._SCALAR:
 	    switch (snapAttributeExtract.getWritable()) {
 	    case AttrWriteType._READ:
-		snapAttributeExtract.setValue(extract_ScalarData_RO(id_snap, attID,
-			snapAttributeLight.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ScalarData_RO(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    case AttrWriteType._READ_WITH_WRITE:
-		snapAttributeExtract.setValue(extract_ScalarData_RW(id_snap, attID,
-			snapAttributeLight.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ScalarData_RW(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    case AttrWriteType._WRITE:
-		snapAttributeExtract.setValue(extract_ScalarData_WO(id_snap, attID,
-			snapAttributeLight.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ScalarData_WO(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    case AttrWriteType._READ_WRITE:
-		snapAttributeExtract.setValue(extract_ScalarData_RW(id_snap, attID,
-			snapAttributeLight.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ScalarData_RW(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    }
 	    break;
@@ -1800,18 +1344,17 @@ public class DataBaseAPI {
 	    switch (snapAttributeExtract.getWritable()) {
 	    case AttrWriteType._WRITE:
 	    case AttrWriteType._READ:
-		snapAttributeExtract.setValue(extract_ImageData_RO(id_snap, attID,
-			snapAttributeExtract.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ImageData_RO(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    case AttrWriteType._READ_WITH_WRITE:
 	    case AttrWriteType._READ_WRITE:
-		snapAttributeExtract.setValue(extract_ImageData_RW(id_snap, attID,
-			snapAttributeExtract.getData_type()));
+		snapAttributeExtract
+			.setValue(extract_ImageData_RW(id_snap, attID, snapAttributeExtract.getData_type()));
 		break;
 	    }
 	    break;
 	}
-
 	return snapAttributeExtract;
     }
 
@@ -1819,34 +1362,32 @@ public class DataBaseAPI {
      * @param snapID
      * @param snapAtt
      * @return
+     * @throws SnapshotingException
      */
-    private Object extract_ScalarData_RO(final int snapID, final int snapAtt, final int data_type) {
+    private Object extract_ScalarData_RO(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	Object value = null;
 	String query = "";
-	Connection conn = null;
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
 	String select_field = "";
 	select_field = select_field + GlobalConst.TAB_SC_RO_NUM[2];
-	final String table_1 = getDbSchema()
-		+ "."
-		+ (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[8]
-			: GlobalConst.TABS[10]);
+	final String table_1 = getDbSchema() + "."
+		+ (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[8] : GlobalConst.TABS[10]);
 	final String clause_1 = (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RO_NUM[0]
-		: GlobalConst.TAB_SC_RO_STR[0])
-		+ "=?";
+		: GlobalConst.TAB_SC_RO_STR[0]) + "=?";
 	final String clause_2 = (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RO_NUM[1]
-		: GlobalConst.TAB_SC_RO_STR[1])
-		+ "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+		: GlobalConst.TAB_SC_RO_STR[1]) + "=?";
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
+	Connection conn = null;
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	    conn = getConnection();
+	    // if (m_dataSource == null) {
+	    preparedStatement = conn.prepareStatement(query);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // preparedStatement = conn.prepareStatement(query);
+	    // }
 
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
@@ -1918,11 +1459,10 @@ public class DataBaseAPI {
 	} catch (final SQLException e) {
 	    e.printStackTrace();
 
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ScalarData_RO" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ScalarData_RO" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -1942,9 +1482,8 @@ public class DataBaseAPI {
 	} catch (final SQLException e) {
 	    e.printStackTrace();
 
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.closeResultSet" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.closeResultSet" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
 		    + "\t Description : \t " + e.getMessage());
 	}
     }
@@ -1959,9 +1498,8 @@ public class DataBaseAPI {
 	} catch (final SQLException e) {
 	    e.printStackTrace();
 
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.closeStatement" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.closeStatement" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
 		    + "\t Description : \t " + e.getMessage());
 	}
     }
@@ -1976,14 +1514,14 @@ public class DataBaseAPI {
 	} catch (final SQLException e) {
 	    e.printStackTrace();
 
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.closeConnection" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.closeConnection" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
 		    + "\t Description : \t " + e.getMessage());
 	}
     }
 
-    private Object[] extract_ScalarData_RW(final int snapID, final int snapAtt, final int data_type) {
+    private Object[] extract_ScalarData_RW(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	final Object[] value = new Object[2];
 	Object rvalue = null;
 	Object wvalue = null;
@@ -1992,27 +1530,22 @@ public class DataBaseAPI {
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
 	String select_field = "";
-	select_field = select_field + GlobalConst.TAB_SC_RW_NUM[2] + ", "
-		+ GlobalConst.TAB_SC_RW_NUM[3];
-	final String table_1 = getDbSchema()
-		+ "."
-		+ (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[9]
-			: GlobalConst.TABS[11]);
+	select_field = select_field + GlobalConst.TAB_SC_RW_NUM[2] + ", " + GlobalConst.TAB_SC_RW_NUM[3];
+	final String table_1 = getDbSchema() + "."
+		+ (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[9] : GlobalConst.TABS[11]);
 	final String clause_1 = (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RW_NUM[0]
-		: GlobalConst.TAB_SC_RW_STR[0])
-		+ "=?";
+		: GlobalConst.TAB_SC_RW_STR[0]) + "=?";
 	final String clause_2 = (data_type != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RW_NUM[1]
-		: GlobalConst.TAB_SC_RW_STR[1])
-		+ "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+		: GlobalConst.TAB_SC_RW_STR[1]) + "=?";
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	    conn = getConnection();
+	    // if (m_dataSource == null) {
+	    preparedStatement = conn.prepareStatement(query);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // preparedStatement = conn.prepareStatement(query);
+	    // }
 
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
@@ -2122,11 +1655,10 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ScalarData_RW" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ScalarData_RW" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -2138,7 +1670,8 @@ public class DataBaseAPI {
 	return value;
     }
 
-    private Object extract_ScalarData_WO(final int snapID, final int snapAtt, final int data_type) {
+    private Object extract_ScalarData_WO(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	Object value = null;
 	String query = "";
 	Connection conn = null;
@@ -2149,15 +1682,15 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[8];
 	final String clause_1 = GlobalConst.TAB_SC_WO_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_SC_WO_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	    conn = getConnection();
+	    // if (m_dataSource == null) {
+	    preparedStatement = conn.prepareStatement(query);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // preparedStatement = conn.prepareStatement(query);
+	    // }
 
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
@@ -2227,11 +1760,10 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ScalarData_WO" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ScalarData_WO" + "\r\n"
+		    + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -2241,7 +1773,8 @@ public class DataBaseAPI {
 	return value;
     }
 
-    private Object extract_SpectrumData_RO(final int snapID, final int snapAtt, final int data_type) {
+    private Object extract_SpectrumData_RO(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    return extract_SpectrumData_RO_MySQL(snapID, snapAtt, data_type);
 	} else {
@@ -2253,9 +1786,10 @@ public class DataBaseAPI {
      * @param snapID
      * @param snapAtt
      * @return
+     * @throws SnapshotingException
      */
-    private Object extract_SpectrumData_RO_Oracle(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object extract_SpectrumData_RO_Oracle(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String query = "";
 	Connection conn = null;
 	PreparedStatement preparedStatement = null;
@@ -2265,18 +1799,18 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[6];
 	final String clause_1 = GlobalConst.TAB_SP_RO_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_SP_RO_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 
 	String readString = null;
 
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	    conn = getConnection();
+	    // if (m_dataSource == null) {
+	    preparedStatement = conn.prepareStatement(query);
+	    // } else {
+	    // conn = m_dataSource.getConnection();
+	    // preparedStatement = conn.prepareStatement(query);
+	    // }
 
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
@@ -2291,11 +1825,10 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_SpectrumData_RO_Oracle" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_SpectrumData_RO_Oracle"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -2309,9 +1842,10 @@ public class DataBaseAPI {
      * @param snapID
      * @param snapAtt
      * @return
+     * @throws SnapshotingException
      */
-    private Object[] extract_SpectrumData_RO_MySQL(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_SpectrumData_RO_MySQL(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String value = "NaN";
 	String query = "";
 	PreparedStatement preparedStatement = null;
@@ -2322,15 +1856,10 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[6];
 	final String clause_1 = GlobalConst.TAB_SP_RO_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_SP_RO_NUM[1] + "=?";
-	query = "SELECT " + select_field2 + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field2 + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 	    resultSet = preparedStatement.executeQuery();
@@ -2341,11 +1870,10 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_SpectrumData_RO_MySQL" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_SpectrumData_RO_MySQL"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -2355,8 +1883,8 @@ public class DataBaseAPI {
 	return getSpectrumValue(value, null, data_type, false);
     }
 
-    private Object[] extract_SpectrumData_RW(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_SpectrumData_RW(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    return extract_SpectrumData_RW_MySQL(snapID, snapAtt, data_type);
 	} else {
@@ -2364,8 +1892,8 @@ public class DataBaseAPI {
 	}
     }
 
-    private Object[] extract_SpectrumData_RW_MySQL(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_SpectrumData_RW_MySQL(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String read_value = "NaN";
 	String write_value = "NaN";
 	String query = "";
@@ -2378,16 +1906,10 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[7];
 	final String clause_1 = GlobalConst.TAB_SP_RW_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_SP_RW_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
-
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 	    resultSet = preparedStatement.executeQuery();
@@ -2406,11 +1928,10 @@ public class DataBaseAPI {
 		// "CLA/extract_SpectrumData_RW_MySQL/dim_x/"+dim_x );
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_SpectrumData_RW_MySQL" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_SpectrumData_RW_MySQL"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
@@ -2420,24 +1941,25 @@ public class DataBaseAPI {
 	return getSpectrumValue(read_value, write_value, data_type, true);
     }
 
-    private Object[] extract_SpectrumData_RW_Oracle(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_SpectrumData_RW_Oracle(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String query = "";
 	String readString = null, writeString = null;
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
 	String select_field = "";
-	select_field = select_field + GlobalConst.TAB_SP_RW_NUM[3] + ", "
-		+ GlobalConst.TAB_SP_RW_NUM[4] + ", " + GlobalConst.TAB_SP_RW_NUM[2];
+	select_field = select_field + GlobalConst.TAB_SP_RW_NUM[3] + ", " + GlobalConst.TAB_SP_RW_NUM[4] + ", "
+		+ GlobalConst.TAB_SP_RW_NUM[2];
 
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[7];
 	final String clause_1 = GlobalConst.TAB_SP_RW_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_SP_RW_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 
@@ -2468,21 +1990,22 @@ public class DataBaseAPI {
 		// );
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_SpectrumData_RW_Oracle" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_SpectrumData_RW_Oracle"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
 	return getSpectrumValue(readString, writeString, data_type, true);
     }
 
-    private Object extract_ImageData_RO(final int snapID, final int snapAtt, final int data_type) {
+    private Object extract_ImageData_RO(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    return extract_ImageData_RO_MySQL(snapID, snapAtt, data_type);
 	} else {
@@ -2490,7 +2013,8 @@ public class DataBaseAPI {
 	}
     }
 
-    private Object[] extract_ImageData_RW(final int snapID, final int snapAtt, final int data_type) {
+    private Object[] extract_ImageData_RW(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    return extract_ImageData_RW_MySQL(snapID, snapAtt, data_type);
 	} else {
@@ -2502,9 +2026,10 @@ public class DataBaseAPI {
      * @param snapID
      * @param snapAtt
      * @return
+     * @throws SnapshotingException
      */
-    private Object extract_ImageData_RO_MySQL(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object extract_ImageData_RO_MySQL(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String value = null;
 	String query = "";
 	PreparedStatement preparedStatement = null;
@@ -2514,10 +2039,11 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[4];
 	final String clause_1 = GlobalConst.TAB_IM_RO_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_IM_RO_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 	    resultSet = preparedStatement.executeQuery();
@@ -2528,15 +2054,15 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ImageData_RO_MySQL" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ImageData_RO_MySQL"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
 	if (value != null) {
@@ -2550,9 +2076,10 @@ public class DataBaseAPI {
      * @param snapID
      * @param snapAtt
      * @return
+     * @throws SnapshotingException
      */
-    private Object extract_ImageData_RO_Oracle(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object extract_ImageData_RO_Oracle(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	String query = "";
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
@@ -2561,13 +2088,13 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[4];
 	final String clause_1 = GlobalConst.TAB_IM_RO_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_IM_RO_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 
 	String readString = null;
-
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 
@@ -2581,15 +2108,15 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ImageData_RO_Oracle" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ImageData_RO_Oracle"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
 	if (readString != null) {
@@ -2599,8 +2126,8 @@ public class DataBaseAPI {
 	}
     }
 
-    private Object[] extract_ImageData_RW_MySQL(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_ImageData_RW_MySQL(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	final Object[] imageValueRW = new Object[2];
 
 	String readValue = null;
@@ -2609,15 +2136,16 @@ public class DataBaseAPI {
 	PreparedStatement preparedStatement = null;
 	ResultSet resultSet = null;
 	String select_field = "";
-	select_field = select_field + "CAST(" + GlobalConst.TAB_IM_RW_NUM[4] + " AS CHAR)" + ", "
-		+ "CAST(" + GlobalConst.TAB_IM_RW_NUM[5] + " AS CHAR)";
+	select_field = select_field + "CAST(" + GlobalConst.TAB_IM_RW_NUM[4] + " AS CHAR)" + ", " + "CAST("
+		+ GlobalConst.TAB_IM_RW_NUM[5] + " AS CHAR)";
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[5];
 	final String clause_1 = GlobalConst.TAB_IM_RW_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_IM_RW_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 	    resultSet = preparedStatement.executeQuery();
@@ -2632,15 +2160,15 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ImageData_RW_MySQL" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ImageData_RW_MySQL"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
 	if (readValue != null) {
@@ -2658,8 +2186,8 @@ public class DataBaseAPI {
 	return imageValueRW;
     }
 
-    private Object[] extract_ImageData_RW_Oracle(final int snapID, final int snapAtt,
-	    final int data_type) {
+    private Object[] extract_ImageData_RW_Oracle(final int snapID, final int snapAtt, final int data_type)
+	    throws SnapshotingException {
 	final Object[] imageValueRW = new Object[2];
 
 	String query = "";
@@ -2670,14 +2198,15 @@ public class DataBaseAPI {
 	final String table_1 = getDbSchema() + "." + GlobalConst.TABS[5];
 	final String clause_1 = GlobalConst.TAB_IM_RW_NUM[0] + "=?";
 	final String clause_2 = GlobalConst.TAB_IM_RW_NUM[1] + "=?";
-	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND "
-		+ clause_2;
+	query = "SELECT " + select_field + " FROM " + table_1 + " WHERE " + clause_1 + " AND " + clause_2;
 
 	String readString = null;
 	String writeString = null;
 
+	Connection conn = null;
 	try {
-	    preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, snapID);
 	    preparedStatement.setInt(2, snapAtt);
 
@@ -2697,15 +2226,15 @@ public class DataBaseAPI {
 		}
 	    }
 	} catch (final SQLException e) {
-	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t "
-		    + "DataBaseAPI.extract_ImageData_RO_Oracle" + "\r\n" + "\t Reason : \t "
-		    + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
-		    + "\t Description : \t " + e.getMessage() + "\r\n"
-		    + "\t Additional information : \r\n" + "\t\t Statement : " + query + "\r\n");
+	    System.err.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "DataBaseAPI.extract_ImageData_RO_Oracle"
+		    + "\r\n" + "\t Reason : \t " + getDbSchema().toUpperCase().trim() + "_FAILURE" + "\r\n"
+		    + "\t Description : \t " + e.getMessage() + "\r\n" + "\t Additional information : \r\n"
+		    + "\t\t Statement : " + query + "\r\n");
 	    // throw e;
 	} finally {
 	    closeResultSet(resultSet);
 	    closeStatement(preparedStatement);
+	    closeConnection(conn);
 	}
 
 	if (readString != null) {
@@ -2723,8 +2252,8 @@ public class DataBaseAPI {
 	return imageValueRW;
     }
 
-    private Object[] getSpectrumValue(final String readStr, final String writeStr,
-	    final int data_type, final boolean returnAsReadWrite) {
+    private Object[] getSpectrumValue(final String readStr, final String writeStr, final int data_type,
+	    final boolean returnAsReadWrite) {
 	int readSize = 0, writeSize = 0;
 	StringTokenizer readTokenizer;
 	String readString = null, writeString = null;
@@ -2732,8 +2261,7 @@ public class DataBaseAPI {
 	    readTokenizer = null;
 	} else {
 	    readString = readStr.replaceAll("\\[", "").replaceAll("\\]", "");
-	    if ("".equals(readString) || "null".equals(readString)
-		    || "NaN".equalsIgnoreCase(readString)) {
+	    if ("".equals(readString) || "null".equals(readString) || "NaN".equalsIgnoreCase(readString)) {
 		readTokenizer = null;
 	    } else {
 		readTokenizer = new StringTokenizer(readString, GlobalConst.CLOB_SEPARATOR);
@@ -2746,8 +2274,7 @@ public class DataBaseAPI {
 	    writeTokenizer = null;
 	} else {
 	    writeString = writeStr.replaceAll("\\[", "").replaceAll("\\]", "");
-	    if ("".equals(writeString) || "null".equals(writeString)
-		    || "NaN".equalsIgnoreCase(writeString)) {
+	    if ("".equals(writeString) || "null".equals(writeString) || "NaN".equalsIgnoreCase(writeString)) {
 		writeTokenizer = null;
 	    } else {
 		writeTokenizer = new StringTokenizer(writeString, GlobalConst.CLOB_SEPARATOR);
@@ -2829,24 +2356,20 @@ public class DataBaseAPI {
 		switch (data_type) {
 		case TangoConst.Tango_DEV_BOOLEAN:
 		    try {
-			if (currentValRead == null || "".equals(currentValRead)
-				|| "null".equals(currentValRead)
+			if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 				|| "NaN".equalsIgnoreCase(currentValRead)) {
 			    bvalueArr_read[i] = null;
 			} else {
-			    bvalueArr_read[i] = new Boolean(Double.valueOf(currentValRead)
-				    .intValue() != 0);
+			    bvalueArr_read[i] = new Boolean(Double.valueOf(currentValRead).intValue() != 0);
 			}
 		    } catch (final NumberFormatException n) {
-			bvalueArr_read[i] = new Boolean("true".equalsIgnoreCase(currentValRead
-				.trim()));
+			bvalueArr_read[i] = new Boolean("true".equalsIgnoreCase(currentValRead.trim()));
 		    }
 		    break;
 		case TangoConst.Tango_DEV_CHAR:
 		case TangoConst.Tango_DEV_UCHAR:
 		    try {
-			if (currentValRead == null || "".equals(currentValRead)
-				|| "null".equals(currentValRead)
+			if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 				|| "NaN".equalsIgnoreCase(currentValRead)) {
 			    cvalueArr_read[i] = null;
 			} else {
@@ -2860,8 +2383,7 @@ public class DataBaseAPI {
 		case TangoConst.Tango_DEV_LONG:
 		case TangoConst.Tango_DEV_ULONG:
 		    try {
-			if (currentValRead == null || "".equals(currentValRead)
-				|| "null".equals(currentValRead)
+			if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 				|| "NaN".equalsIgnoreCase(currentValRead)) {
 			    lvalueArr_read[i] = null;
 			} else {
@@ -2874,8 +2396,7 @@ public class DataBaseAPI {
 		case TangoConst.Tango_DEV_SHORT:
 		case TangoConst.Tango_DEV_USHORT:
 		    try {
-			if (currentValRead == null || "".equals(currentValRead)
-				|| "null".equals(currentValRead)
+			if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 				|| "NaN".equalsIgnoreCase(currentValRead)) {
 			    svalueArr_read[i] = null;
 			} else {
@@ -2886,8 +2407,7 @@ public class DataBaseAPI {
 		    }
 		    break;
 		case TangoConst.Tango_DEV_FLOAT:
-		    if (currentValRead == null || "".equals(currentValRead)
-			    || "null".equals(currentValRead)
+		    if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 			    || "NaN".equalsIgnoreCase(currentValRead)) {
 			fvalueArr_read[i] = null;
 		    } else {
@@ -2895,19 +2415,16 @@ public class DataBaseAPI {
 		    }
 		    break;
 		case TangoConst.Tango_DEV_STRING:
-		    if (currentValRead == null || "".equals(currentValRead)
-			    || "null".equals(currentValRead)
+		    if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 			    || "NaN".equalsIgnoreCase(currentValRead)) {
 			stvalueArr_read[i] = null;
 		    } else {
-			stvalueArr_read[i] = StringFormater.formatStringToRead(new String(
-				currentValRead));
+			stvalueArr_read[i] = StringFormater.formatStringToRead(new String(currentValRead));
 		    }
 		    break;
 		case TangoConst.Tango_DEV_DOUBLE:
 		default:
-		    if (currentValRead == null || "".equals(currentValRead)
-			    || "null".equals(currentValRead)
+		    if (currentValRead == null || "".equals(currentValRead) || "null".equals(currentValRead)
 			    || "NaN".equalsIgnoreCase(currentValRead)) {
 			dvalueArr_read[i] = null;
 		    } else {
@@ -2928,24 +2445,20 @@ public class DataBaseAPI {
 		switch (data_type) {
 		case TangoConst.Tango_DEV_BOOLEAN:
 		    try {
-			if (currentValWrite == null || "".equals(currentValWrite)
-				|| "null".equals(currentValWrite)
+			if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 				|| "NaN".equalsIgnoreCase(currentValWrite)) {
 			    bvalueArr_write[i] = null;
 			} else {
-			    bvalueArr_write[i] = new Boolean(Double.valueOf(currentValWrite)
-				    .intValue() != 0);
+			    bvalueArr_write[i] = new Boolean(Double.valueOf(currentValWrite).intValue() != 0);
 			}
 		    } catch (final NumberFormatException n) {
-			bvalueArr_write[i] = new Boolean("true".equalsIgnoreCase(currentValWrite
-				.trim()));
+			bvalueArr_write[i] = new Boolean("true".equalsIgnoreCase(currentValWrite.trim()));
 		    }
 		    break;
 		case TangoConst.Tango_DEV_CHAR:
 		case TangoConst.Tango_DEV_UCHAR:
 		    try {
-			if (currentValWrite == null || "".equals(currentValWrite)
-				|| "null".equals(currentValWrite)
+			if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 				|| "NaN".equalsIgnoreCase(currentValWrite)) {
 			    cvalueArr_write[i] = null;
 			} else {
@@ -2959,8 +2472,7 @@ public class DataBaseAPI {
 		case TangoConst.Tango_DEV_LONG:
 		case TangoConst.Tango_DEV_ULONG:
 		    try {
-			if (currentValWrite == null || "".equals(currentValWrite)
-				|| "null".equals(currentValWrite)
+			if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 				|| "NaN".equalsIgnoreCase(currentValWrite)) {
 			    lvalueArr_write[i] = null;
 			} else {
@@ -2973,8 +2485,7 @@ public class DataBaseAPI {
 		case TangoConst.Tango_DEV_SHORT:
 		case TangoConst.Tango_DEV_USHORT:
 		    try {
-			if (currentValWrite == null || "".equals(currentValWrite)
-				|| "null".equals(currentValWrite)
+			if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 				|| "NaN".equalsIgnoreCase(currentValWrite)) {
 			    svalueArr_write[i] = null;
 			} else {
@@ -2985,8 +2496,7 @@ public class DataBaseAPI {
 		    }
 		    break;
 		case TangoConst.Tango_DEV_FLOAT:
-		    if (currentValWrite == null || "".equals(currentValWrite)
-			    || "null".equals(currentValWrite)
+		    if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 			    || "NaN".equalsIgnoreCase(currentValWrite)) {
 			fvalueArr_write[i] = null;
 		    } else {
@@ -2994,19 +2504,16 @@ public class DataBaseAPI {
 		    }
 		    break;
 		case TangoConst.Tango_DEV_STRING:
-		    if (currentValWrite == null || "".equals(currentValWrite)
-			    || "null".equals(currentValWrite)
+		    if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 			    || "NaN".equalsIgnoreCase(currentValWrite)) {
 			stvalueArr_write[i] = null;
 		    } else {
-			stvalueArr_write[i] = StringFormater.formatStringToRead(new String(
-				currentValWrite));
+			stvalueArr_write[i] = StringFormater.formatStringToRead(new String(currentValWrite));
 		    }
 		    break;
 		case TangoConst.Tango_DEV_DOUBLE:
 		default:
-		    if (currentValWrite == null || "".equals(currentValWrite)
-			    || "null".equals(currentValWrite)
+		    if (currentValWrite == null || "".equals(currentValWrite) || "null".equals(currentValWrite)
 			    || "NaN".equalsIgnoreCase(currentValWrite)) {
 			dvalueArr_write[i] = null;
 		    } else {
@@ -3099,8 +2606,7 @@ public class DataBaseAPI {
 	    valArray = new Object[rowSize];
 	    int i = 0;
 	    while (readTokenizer.hasMoreTokens()) {
-		valArray[i++] = readTokenizer.nextToken().trim().split(
-			GlobalConst.CLOB_SEPARATOR_IMAGE_COLS);
+		valArray[i++] = readTokenizer.nextToken().trim().split(GlobalConst.CLOB_SEPARATOR_IMAGE_COLS);
 	    }
 	    if (rowSize > 0) {
 		colSize = ((String[]) valArray[0]).length;
@@ -3121,18 +2627,16 @@ public class DataBaseAPI {
 	    for (int i = 0; i < rowSize; i++) {
 		for (int j = 0; j < colSize; j++) {
 		    try {
-			if (((String[]) valArray[i])[j] == null
-				|| "".equals(((String[]) valArray[i])[j])
+			if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 				|| "null".equals(((String[]) valArray[i])[j])
 				|| "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			    bvalueArr[i][j] = null;
 			} else {
-			    bvalueArr[i][j] = new Boolean(Double.valueOf(
-				    ((String[]) valArray[i])[j].trim()).intValue() != 0);
+			    bvalueArr[i][j] = new Boolean(
+				    Double.valueOf(((String[]) valArray[i])[j].trim()).intValue() != 0);
 			}
 		    } catch (final NumberFormatException n) {
-			bvalueArr[i][j] = new Boolean("true"
-				.equalsIgnoreCase(((String[]) valArray[i])[j].trim()));
+			bvalueArr[i][j] = new Boolean("true".equalsIgnoreCase(((String[]) valArray[i])[j].trim()));
 		    }
 		}
 	    }
@@ -3143,8 +2647,7 @@ public class DataBaseAPI {
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
 		    try {
-			if (((String[]) valArray[i])[j] == null
-				|| "".equals(((String[]) valArray[i])[j])
+			if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 				|| "null".equals(((String[]) valArray[i])[j])
 				|| "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			    cvalueArr[i][j] = null;
@@ -3152,8 +2655,7 @@ public class DataBaseAPI {
 			    cvalueArr[i][j] = Byte.valueOf(((String[]) valArray[i])[j].trim());
 			}
 		    } catch (final NumberFormatException n) {
-			cvalueArr[i][j] = new Byte(Double.valueOf(
-				((String[]) valArray[i])[j].trim()).byteValue());
+			cvalueArr[i][j] = new Byte(Double.valueOf(((String[]) valArray[i])[j].trim()).byteValue());
 		    }
 		}
 	    }
@@ -3165,8 +2667,7 @@ public class DataBaseAPI {
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
 		    try {
-			if (((String[]) valArray[i])[j] == null
-				|| "".equals(((String[]) valArray[i])[j])
+			if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 				|| "null".equals(((String[]) valArray[i])[j])
 				|| "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			    lvalueArr[i][j] = null;
@@ -3174,8 +2675,7 @@ public class DataBaseAPI {
 			    lvalueArr[i][j] = Integer.valueOf(((String[]) valArray[i])[j].trim());
 			}
 		    } catch (final NumberFormatException n) {
-			lvalueArr[i][j] = new Integer(Double.valueOf(
-				((String[]) valArray[i])[j].trim()).intValue());
+			lvalueArr[i][j] = new Integer(Double.valueOf(((String[]) valArray[i])[j].trim()).intValue());
 		    }
 		}
 	    }
@@ -3186,8 +2686,7 @@ public class DataBaseAPI {
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
 		    try {
-			if (((String[]) valArray[i])[j] == null
-				|| "".equals(((String[]) valArray[i])[j])
+			if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 				|| "null".equals(((String[]) valArray[i])[j])
 				|| "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			    svalueArr[i][j] = null;
@@ -3195,8 +2694,7 @@ public class DataBaseAPI {
 			    svalueArr[i][j] = Short.valueOf(((String[]) valArray[i])[j].trim());
 			}
 		    } catch (final NumberFormatException n) {
-			svalueArr[i][j] = new Short(Double.valueOf(
-				((String[]) valArray[i])[j].trim()).shortValue());
+			svalueArr[i][j] = new Short(Double.valueOf(((String[]) valArray[i])[j].trim()).shortValue());
 		    }
 		}
 	    }
@@ -3206,8 +2704,7 @@ public class DataBaseAPI {
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
 		    try {
-			if (((String[]) valArray[i])[j] == null
-				|| "".equals(((String[]) valArray[i])[j])
+			if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 				|| "null".equals(((String[]) valArray[i])[j])
 				|| "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			    fvalueArr[i][j] = null;
@@ -3215,8 +2712,7 @@ public class DataBaseAPI {
 			    fvalueArr[i][j] = Float.valueOf(((String[]) valArray[i])[j].trim());
 			}
 		    } catch (final NumberFormatException n) {
-			fvalueArr[i][j] = new Float(Double.valueOf(
-				((String[]) valArray[i])[j].trim()).floatValue());
+			fvalueArr[i][j] = new Float(Double.valueOf(((String[]) valArray[i])[j].trim()).floatValue());
 		    }
 		}
 	    }
@@ -3225,14 +2721,13 @@ public class DataBaseAPI {
 	    stvalueArr = new String[rowSize][colSize];
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
-		    if (((String[]) valArray[i])[j] == null
-			    || "".equals(((String[]) valArray[i])[j])
+		    if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 			    || "null".equals(((String[]) valArray[i])[j])
 			    || "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			stvalueArr[i][j] = null;
 		    } else {
-			stvalueArr[i][j] = StringFormater.formatStringToRead(new String(
-				((String[]) valArray[i])[j].trim()));
+			stvalueArr[i][j] = StringFormater.formatStringToRead(new String(((String[]) valArray[i])[j]
+				.trim()));
 		    }
 		}
 	    }
@@ -3242,8 +2737,7 @@ public class DataBaseAPI {
 	    dvalueArr = new Double[rowSize][colSize];
 	    for (int i = 0; i < valArray.length; i++) {
 		for (int j = 0; j < colSize; j++) {
-		    if (((String[]) valArray[i])[j] == null
-			    || "".equals(((String[]) valArray[i])[j])
+		    if (((String[]) valArray[i])[j] == null || "".equals(((String[]) valArray[i])[j])
 			    || "null".equals(((String[]) valArray[i])[j])
 			    || "NaN".equalsIgnoreCase(((String[]) valArray[i])[j])) {
 			dvalueArr[i][j] = null;
@@ -3273,11 +2767,11 @@ public class DataBaseAPI {
      *            the attribute to register
      * @throws SnapshotingException
      */
-    public void registerAttribute(final SnapAttributeHeavy snapAttributeHeavy)
-	    throws SnapshotingException {
+    public void registerAttribute(final SnapAttributeHeavy snapAttributeHeavy) throws SnapshotingException {
+	Connection conn = null;
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    PreparedStatement preparedStatement = null;
-	    Connection conn = null;
+
 	    final String tableName = getDbSchema() + "." + GlobalConst.TABS[0];
 
 	    // Create and execute the SQL query string
@@ -3294,21 +2788,13 @@ public class DataBaseAPI {
 	    }
 	    insert_values = insert_values + "?";
 
-	    final String query = "INSERT INTO " + tableName + " (" + insert_fields + ") "
-		    + " VALUES(" + insert_values + " ) ";
+	    final String query = "INSERT INTO " + tableName + " (" + insert_fields + ") " + " VALUES(" + insert_values
+		    + " ) ";
 
 	    try {
-
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
-		// preparedStatement.setInt(1,
-		// snapAttributeHeavy.getAttribute_id());
-		preparedStatement.setDate(1, new java.sql.Date(snapAttributeHeavy
-			.getRegistration_time().getTime()));
+		conn = getConnection();
+		preparedStatement = conn.prepareStatement(query);
+		preparedStatement.setDate(1, new java.sql.Date(snapAttributeHeavy.getRegistration_time().getTime()));
 		preparedStatement.setString(2, snapAttributeHeavy.getAttribute_complete_name());
 		preparedStatement.setString(3, snapAttributeHeavy.getAttribute_device_name());
 		preparedStatement.setString(4, snapAttributeHeavy.getDomain());
@@ -3328,8 +2814,7 @@ public class DataBaseAPI {
 		preparedStatement.executeUpdate();
 		// preparedStatement.close();
 	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
+		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 		final String reason = "Failed while executing DataBaseAPI.registerAttribute() method...";
 		final String desc = "";
 		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -3343,7 +2828,8 @@ public class DataBaseAPI {
 	    final String query = "{call " + getDbSchema() + "." + procName
 		    + "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
 	    try {
-		callableStatement = dbconn.prepareCall(query); // number of
+		conn = getConnection();
+		callableStatement = conn.prepareCall(query); // number of
 		// parameters :
 		// 16
 		callableStatement.setTimestamp(1, snapAttributeHeavy.getRegistration_time());
@@ -3365,13 +2851,13 @@ public class DataBaseAPI {
 		callableStatement.executeUpdate();
 		callableStatement.close();
 	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
+		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 		final String reason = "Failed while executing DataBaseAPI.registerAttribute() method...";
 		final String desc = "";
 		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	    } finally {
 		closeStatement(callableStatement);
+		closeConnection(conn);
 	    }
 	}
     }
@@ -3386,8 +2872,8 @@ public class DataBaseAPI {
      * @return An array containing the differents definition informations for
      *         the given attribute
      * @throws SnapshotingException
-     *             **************************************************************
-     *             ********
+     *             *************************************************************
+     *             * ********
      */
     public Vector getAttDefinitionData(final String att_name) throws SnapshotingException {
 	final Vector definitionsList = new Vector();
@@ -3395,10 +2881,7 @@ public class DataBaseAPI {
 	ResultSet rset = null;
 	// PreparedStatement preparedStatement;
 	Statement statement = null;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
+
 	// Create and execute the SQL query string
 	String query = "";
 	final String table_name = getDbSchema() + "." + GlobalConst.TABS[0];
@@ -3409,20 +2892,15 @@ public class DataBaseAPI {
 	    select_field_spec = " * ";
 	} else if (db_type == ConfigConst.BD_ORACLE) {
 	    for (int i = 0; i < GlobalConst.TAB_DEF.length - 1; i++) {
-		select_field_spec = select_field_spec + "to_char(" + GlobalConst.TAB_DEF[i] + ")"
-			+ ", ";
+		select_field_spec = select_field_spec + "to_char(" + GlobalConst.TAB_DEF[i] + ")" + ", ";
 	    }
-	    select_field_spec = select_field_spec + "to_char("
-		    + GlobalConst.TAB_DEF[GlobalConst.TAB_DEF.length - 1] + ")";
+	    select_field_spec = select_field_spec + "to_char(" + GlobalConst.TAB_DEF[GlobalConst.TAB_DEF.length - 1]
+		    + ")";
 	}
 	query = "SELECT " + select_field_spec + " FROM " + table_name + " WHERE " + clause_1;
 	try {
-	    if (m_dataSource == null) {
-		statement = dbconn.createStatement();
-	    } else {
-		conn = m_dataSource.getConnection();
-		statement = conn.createStatement();
-	    }
+	    conn = getConnection();
+	    statement = conn.createStatement();
 	    rset = statement.executeQuery(query);
 	    // Gets the result of the query
 	    while (rset.next()) {
@@ -3433,8 +2911,7 @@ public class DataBaseAPI {
 	    }
 	    statement.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getAttDefinitionData() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -3443,65 +2920,45 @@ public class DataBaseAPI {
 	    closeStatement(statement);
 	    closeConnection(conn);
 	}
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
 	// Returns the names list
 	return definitionsList;
     }
 
     /**
-     * Renvoi les diff�rentes informations de d�finition de l�attribut pass� en
-     * param�tre, qui verifie les conditions donnees. Author : Laure Garda
+     * Renvoi les diff�rentes informations de d�finition de l�attribut
+     * pass� en param�tre, qui verifie les conditions donnees. Author :
+     * Laure Garda
      * 
      * @param att_name
      * @param clause
      * @return
      * @throws SnapshotingException
      */
-    public ArrayList getAttDefinitionData(final String att_name, final String clause)
+    public List<SnapAttributeHeavy> getAttDefinitionData(final String att_name, final String clause)
 	    throws SnapshotingException {
-	final ArrayList definitionsList = new ArrayList(512);
+	final List<SnapAttributeHeavy> definitionsList = new ArrayList<SnapAttributeHeavy>();
 	Connection conn = null;
 	ResultSet rset = null;
 	// PreparedStatement preparedStatement;
 	Statement statement = null;
-	// First connect with the database
-	if (getAutoConnect()) {
-	    connect();
-	}
+
 	// Create and execute the SQL query string
 	String query = "";
 	final String table_name = getDbSchema() + "." + GlobalConst.TABS[0];
-	String select_field_spec = "";
 	final String clause_1 = GlobalConst.TAB_DEF[2] + " = " + "'" + att_name.trim() + "'";
 
-	select_field_spec = " * ";
-	/*
-	 * if ( db_type == ConfigConst.BD_MYSQL ) { select_field_spec = " * "; }
-	 * else if ( db_type == ConfigConst.BD_ORACLE ) { for ( int i = 0 ; i <
-	 * GlobalConst.TAB_DEF.length - 1 ; i++ ) { select_field_spec =
-	 * select_field_spec + "to_char(" + GlobalConst.TAB_DEF[ i ] + ")" +
-	 * ", "; } select_field_spec = select_field_spec + "to_char(" +
-	 * GlobalConst.TAB_DEF[ GlobalConst.TAB_DEF.length - 1 ] + ")"; } CLA
-	 * 05/04/07 corrected a bug: didn't work for Oracle
-	 */
+	String select_field_spec = " * ";
 
 	if (clause.equals("")) {
 	    query = "SELECT " + select_field_spec + " FROM " + table_name + " WHERE " + clause_1;
 	} else {
-	    query = "SELECT " + select_field_spec + " FROM " + table_name + clause + " AND "
-		    + clause_1;
+	    query = "SELECT " + select_field_spec + " FROM " + table_name + clause + " AND " + clause_1;
 	}
 
 	try {
-	    if (m_dataSource == null) {
-		statement = dbconn.createStatement();
-	    } else {
-		conn = m_dataSource.getConnection();
-		statement = conn.createStatement();
-	    }
+	    conn = getConnection();
+	    statement = conn.createStatement();
+
 	    rset = statement.executeQuery(query);
 	    // Gets the result of the query
 	    while (rset.next()) {
@@ -3529,8 +2986,7 @@ public class DataBaseAPI {
 	    }
 	    statement.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getAttDefinitionData() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -3540,70 +2996,11 @@ public class DataBaseAPI {
 	    closeConnection(conn);
 	}
 
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
 	// Returns the names list
 	// System.out.println("query : " + query);
 	return definitionsList;
     }
 
-    public int get_context_last_id(final SnapContext snapContext) throws SnapshotingException {
-	int contextID = -1;
-	PreparedStatement preparedStatement = null;
-	ResultSet rset = null;
-	Connection conn = null;
-	final String tableName = getDbSchema() + "." + GlobalConst.TABS[1];
-
-	// Create and execute the SQL query string
-	// Build the query string
-	String query;
-	final String select_fields = GlobalConst.TAB_CONTEXT[0];
-
-	final String where_fields = GlobalConst.TAB_CONTEXT[1] + " = ?" + " AND "
-		+ GlobalConst.TAB_CONTEXT[2] + " LIKE ?" + " AND " + GlobalConst.TAB_CONTEXT[3]
-		+ " LIKE ?" + " AND " + GlobalConst.TAB_CONTEXT[4] + " LIKE ?" + " AND "
-		+ GlobalConst.TAB_CONTEXT[5] + " LIKE ?";
-
-	query = "SELECT MAX(" + select_fields + ")" + " FROM " + tableName + " WHERE "
-		+ where_fields;
-
-	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
-
-	    // preparedStatement.setInt(1, snapContext.getId());
-	    preparedStatement.setDate(1, snapContext.getCreation_date());
-	    preparedStatement.setString(2, snapContext.getName());
-	    preparedStatement.setString(3, snapContext.getAuthor_name());
-	    preparedStatement.setString(4, snapContext.getReason());
-	    preparedStatement.setString(5, snapContext.getDescription());
-
-	    rset = preparedStatement.executeQuery();
-	    if (rset.next()) {
-		contextID = rset.getInt(1);
-		preparedStatement.close();
-	    }
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.get_context_last_id() method...";
-	    final String desc = "";
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeResultSet(rset);
-	    closeStatement(preparedStatement);
-	    closeConnection(conn);
-	}
-
-	return contextID;
-    }
-
     /**
      * This method registers a new context in the database for snapshots.
      * 
@@ -3614,163 +3011,326 @@ public class DataBaseAPI {
      * @throws SnapshotingException
      */
     public int create_context(final SnapContext snapContext) throws SnapshotingException {
-	System.out.println("DataBaseAPI.create_context");
-	int contextID = -1;
-	if (db_type == ConfigConst.BD_MYSQL) {
-	    Connection conn = null;
+	int contextID = snapContext.getId();
+	final String tableName = getDbSchema() + "." + GlobalConst.TABS[1];
+	java.util.List<Integer> contextIDList = new ArrayList<Integer>();
+	PreparedStatement prest = null;
+	Connection conn = null;
+	try {
+	    conn = getConnection();
+	    // check if context exists
+	    String queryCurrentContext = "select " + GlobalConst.TAB_CONTEXT[0] + " from " + tableName;
+	    prest = conn.prepareStatement(queryCurrentContext);
+	    ResultSet rs = prest.executeQuery();
+	    while (rs.next()) {
+		int contextIDDB = rs.getInt(1);
+		contextIDList.add(contextIDDB);
+	    }
 	    PreparedStatement preparedStatement = null;
-	    final String tableName = getDbSchema() + "." + GlobalConst.TABS[1];
+	    // context already exists, update its values
+	    if (contextIDList.contains(contextID)) {
+		// update snap.context SET name=?, author=?, reason=?,
+		// description=? where id =?;
+		String updateQuery = "UPDATE " + tableName + " SET " + GlobalConst.TAB_CONTEXT[2] + "= ?, "
+			+ GlobalConst.TAB_CONTEXT[3] + "= ?, " + GlobalConst.TAB_CONTEXT[4] + "= ?, "
+			+ GlobalConst.TAB_CONTEXT[5] + "= ? WHERE " + GlobalConst.TAB_CONTEXT[0] + "= ?";
+		System.out.println("update context " + snapContext.getName());
+		try {
 
-	    // Create and execute the SQL query string
-	    // Build the query string
-	    String query;
-	    final String insert_fields = // ConfigConst.TAB_CONTEXT[0] + ", " +
-	    GlobalConst.TAB_CONTEXT[1] + ", " + GlobalConst.TAB_CONTEXT[2] + ", "
-		    + GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4] + ", "
-		    + GlobalConst.TAB_CONTEXT[5];
-	    final String insert_values = "?,?,?,?,?";
-
-	    query = "INSERT INTO " + tableName + " (" + insert_fields + ")" + "VALUES ("
-		    + insert_values + ")";
-	    /*
-	     * query_lock = "LOCK TABLES " + tableName + " READ, " + tableName +
-	     * " WRITE"; query_unlock = "UNLOCK TABLES";
-	     */
-	    try {
-		/*
-		 * preparedStatement = dbconn.prepareStatement(query_lock);
-		 * preparedStatement.executeUpdate();
-		 */
+		    preparedStatement = conn.prepareStatement(updateQuery);
+		    preparedStatement.setString(1, snapContext.getName());
+		    preparedStatement.setString(2, snapContext.getAuthor_name());
+		    preparedStatement.setString(3, snapContext.getReason());
+		    preparedStatement.setString(4, snapContext.getDescription());
+		    preparedStatement.setInt(5, contextID);
 
-		if (m_dataSource == null) {
-		    preparedStatement = dbconn.prepareStatement(query);
-		} else {
-		    conn = m_dataSource.getConnection();
-		    preparedStatement = conn.prepareStatement(query);
-		}
-		// preparedStatement.setInt(1, snapContext.getId());
-		preparedStatement.setDate(1, snapContext.getCreation_date());
-		preparedStatement.setString(2, snapContext.getName());
-		preparedStatement.setString(3, snapContext.getAuthor_name());
-		preparedStatement.setString(4, snapContext.getReason());
-		preparedStatement.setString(5, snapContext.getDescription());
-		preparedStatement.executeUpdate();
+		    preparedStatement.executeUpdate();
 
-		/*
-		 * preparedStatement = dbconn.prepareStatement(query_unlock);
-		 * preparedStatement.executeUpdate();
-		 */
+		} catch (final SQLException e) {
+		    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+		    final String reason = "Failed while executing DataBaseAPI.create_context() method...";
+		    final String desc = "";
+		    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+		} finally {
+		    closeStatement(preparedStatement);
+		}
 
-		// preparedStatement.close();
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.create_context() method...";
-		final String desc = "";
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    } finally {
-		closeStatement(preparedStatement);
-		closeConnection(conn);
-	    }
+	    } else { // context does not exists, create it
+		if (db_type == ConfigConst.BD_MYSQL) {
+		    // Create and execute the SQL query string
+		    // Build the query string
+		    final String insert_fields = GlobalConst.TAB_CONTEXT[1] + ", " + GlobalConst.TAB_CONTEXT[2] + ", "
+			    + GlobalConst.TAB_CONTEXT[3] + ", " + GlobalConst.TAB_CONTEXT[4] + ", "
+			    + GlobalConst.TAB_CONTEXT[5];
+		    final String insert_values = "?,?,?,?,?";
 
-	    // todo r�cup�rer le last id
-	    contextID = get_context_last_id(snapContext);
-	    snapContext.setId(contextID);
-	    // contextID = snapContext.getId();
-	} else if (db_type == ConfigConst.BD_ORACLE) {
-	    CallableStatement callableStatement;
-	    final String procName = "register_context";
-	    final String query = "{? = call " + getDbSchema() + "." + procName + "(?, ?, ?, ?, ?)}";
+		    String query = "INSERT INTO " + tableName + " (" + insert_fields + ")" + "VALUES (" + insert_values
+			    + ")";
+		    try {
 
-	    try {
-		callableStatement = dbconn.prepareCall(query);
-		callableStatement.registerOutParameter(1, Types.INTEGER);
-
-		callableStatement.setDate(2, snapContext.getCreation_date());
-		callableStatement.setString(3, snapContext.getName());
-		callableStatement.setString(4, snapContext.getAuthor_name());
-		callableStatement.setString(5, snapContext.getReason());
-		callableStatement.setString(6, snapContext.getDescription());
-		callableStatement.executeQuery();
-		// Gets the result of the query
-		contextID = callableStatement.getInt(1);
-		snapContext.setId(contextID);
-		callableStatement.close();
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.create_context() method...";
-		final String desc = "";
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    }
+			preparedStatement = conn.prepareStatement(query);
+			preparedStatement.setDate(1, snapContext.getCreation_date());
+			preparedStatement.setString(2, snapContext.getName());
+			preparedStatement.setString(3, snapContext.getAuthor_name());
+			preparedStatement.setString(4, snapContext.getReason());
+			preparedStatement.setString(5, snapContext.getDescription());
+			preparedStatement.executeUpdate();
+			contextID = getMaxContextID();// (snapContext);
+			snapContext.setId(contextID);
+		    } catch (final SQLException e) {
+			final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+			final String reason = "Failed while executing DataBaseAPI.create_context() method...";
+			final String desc = "";
+			throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+		    } finally {
+			closeStatement(preparedStatement);
+		    }
+		} else if (db_type == ConfigConst.BD_ORACLE) {
+		    CallableStatement callableStatement = null;
+		    final String procName = "register_context";
+		    final String query = "{? = call " + getDbSchema() + "." + procName + "(?, ?, ?, ?, ?)}";
+		    try {
+			callableStatement = conn.prepareCall(query);
+			callableStatement.registerOutParameter(1, Types.INTEGER);
+			callableStatement.setInt(1, snapContext.getId());
+			callableStatement.setDate(2, snapContext.getCreation_date());
+			callableStatement.setString(3, snapContext.getName());
+			callableStatement.setString(4, snapContext.getAuthor_name());
+			callableStatement.setString(5, snapContext.getReason());
+			callableStatement.setString(6, snapContext.getDescription());
+			callableStatement.executeQuery();
+			// Gets the result of the query
+			contextID = callableStatement.getInt(1);
+			snapContext.setId(contextID);
+		    } catch (final SQLException e) {
+			final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+			final String reason = "Failed while executing DataBaseAPI.create_context() method...";
+			final String desc = "";
+			throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+		    } finally {
+			closeStatement(callableStatement);
+		    }
+		}
+	    }
+	} catch (SQLException e1) {
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+	    final String reason = "Failed while executing DataBaseAPI.create_context() method...";
+	    final String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e1);
+	} finally {
+	    closeStatement(prest);
+	    closeConnection(conn);
 	}
+
 	setContextAssociatedAttributes(snapContext);
 	return contextID;
     }
 
-    /**
-     * This method returns the list of attributes associated to a context
-     * 
-     * @param id_context
-     *            The given context's identifier
-     * @return The list of attributes associated to the given context
-     * @throws SnapshotingException
-     * @see SnapAttributeLight
-     */
-    public ArrayList getContextAssociatedAttributes(final int id_context)
+    public List<SnapAttributeHeavy> getContextAttributes(final int contextID, String whereClause)
 	    throws SnapshotingException {
-	final ArrayList attibutesList = new ArrayList(32);
-	PreparedStatement preparedStatement = null;
-	ResultSet rset = null;
-	Connection conn = null;
+	List<SnapAttributeHeavy> result = new ArrayList<SnapAttributeHeavy>();
 
 	// Create and execute the SQL query string
-	String query = "";
-	final String table_name_1 = getDbSchema() + "." + GlobalConst.TABS[0];
-	final String table_name_2 = getDbSchema() + "." + GlobalConst.TABS[1];
-	final String table_name_3 = getDbSchema() + "." + GlobalConst.TABS[2];
-	final String tables = table_name_1 + ", " + table_name_2 + ", " + table_name_3;
-	final String select_fields = GlobalConst.TAB_DEF[2] + ", " + // full_name
-		GlobalConst.TAB_DEF[0] + ", " + // attribute_id
+	final String ast = getDbSchema() + "." + GlobalConst.TABS[0];
+	final String context = getDbSchema() + "." + GlobalConst.TABS[1];
+	final String list = getDbSchema() + "." + GlobalConst.TABS[2];
+	final String tables = ast + ", " + context + ", " + list;
+	final String selectFields = GlobalConst.TAB_DEF[0] + ", " + // ID
+		ast + "." + GlobalConst.TAB_DEF[1] + ", " + // time
+		GlobalConst.TAB_DEF[2] + ", " + // full_name
+		GlobalConst.TAB_DEF[3] + ", " + // device
+		GlobalConst.TAB_DEF[4] + ", " + // domain
+		GlobalConst.TAB_DEF[5] + ", " + // family
+		GlobalConst.TAB_DEF[6] + ", " + // member
+		GlobalConst.TAB_DEF[7] + ", " + // att_name
 		GlobalConst.TAB_DEF[8] + ", " + // data_type
 		GlobalConst.TAB_DEF[9] + ", " + // data_format
-		GlobalConst.TAB_DEF[10]; // writable
-	final String clause_1 = GlobalConst.TABS[0] + "." + GlobalConst.TAB_DEF[0] + " = "
-		+ GlobalConst.TABS[2] + "." + GlobalConst.TAB_LIST[1];
-	final String clause_2 = GlobalConst.TABS[2] + "." + GlobalConst.TAB_LIST[0] + " = "
-		+ GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0];
-	final String clause_3 = GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0] + " = ?";
+		GlobalConst.TAB_DEF[10] + ", " + // writable
+		GlobalConst.TAB_DEF[11] + ", " + // max_dim_x
+		GlobalConst.TAB_DEF[12] + ", " + // max_dim_y
+		GlobalConst.TAB_DEF[13] + ", " + // levelg
+		GlobalConst.TAB_DEF[14] + ", " + // facility
+		GlobalConst.TAB_DEF[15] + ", " + // archivable
+		GlobalConst.TAB_DEF[16]; // substitute
+
+	// final String selectFields = "*";
+	final String clause1 = GlobalConst.TABS[0] + "." + GlobalConst.TAB_DEF[0] + " = " + GlobalConst.TABS[2] + "."
+		+ GlobalConst.TAB_LIST[1];
+	final String clause2 = GlobalConst.TABS[2] + "." + GlobalConst.TAB_LIST[0] + " = " + GlobalConst.TABS[1] + "."
+		+ GlobalConst.TAB_CONTEXT[0];
+	final String clause3 = GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0] + " = ?";
 	// 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';
-	query = "SELECT DISTINCT " + select_fields + " FROM " + tables + " WHERE " + clause_1
-		+ " AND " + clause_2 + " AND " + clause_3;
+	String query = "SELECT " + selectFields + " FROM " + tables + " WHERE " + clause1 + " AND " + clause2 + " AND "
+		+ clause3;
+	if (whereClause.equals("")) {
+	    query = "SELECT " + selectFields + " FROM " + tables + " WHERE " + clause1 + " AND " + clause2 + " AND "
+		    + clause3;
+	} else {
+	    query = "SELECT " + selectFields + " FROM " + tables + whereClause + " AND " + clause1 + " AND " + clause2
+		    + " AND " + clause3;
+	}
+	PreparedStatement statement = null;
+	ResultSet rset = null;
+	Connection conn = null;
 	try {
-	    if (m_dataSource != null) {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    } else {
-		preparedStatement = dbconn.prepareStatement(query);
-	    }
-
-	    preparedStatement.setInt(1, id_context);
-	    rset = preparedStatement.executeQuery();
+	    conn = getConnection();
+	    statement = conn.prepareStatement(query);
+	    statement.setInt(1, contextID);
+	    rset = statement.executeQuery();
 	    // Gets the result of the query
 	    while (rset.next()) {
-		final SnapAttributeLight snapAttributeLight = new SnapAttributeLight();
-		snapAttributeLight.setAttribute_complete_name(rset
-			.getString(GlobalConst.TAB_DEF[2]));
-		snapAttributeLight.setAttribute_id(rset.getInt(GlobalConst.TAB_DEF[0]));
-		snapAttributeLight.setData_type(rset.getInt(GlobalConst.TAB_DEF[8]));
-		snapAttributeLight.setData_format(rset.getInt(GlobalConst.TAB_DEF[9]));
-		snapAttributeLight.setWritable(rset.getInt(GlobalConst.TAB_DEF[10]));
-		attibutesList.add(snapAttributeLight);
+		final SnapAttributeHeavy snapAttributeHeavy = new SnapAttributeHeavy();
+		snapAttributeHeavy.setAttribute_id(rset.getInt(1));
+		snapAttributeHeavy.setRegistration_time(rset.getTimestamp(2));
+		snapAttributeHeavy.setAttribute_complete_name(rset.getString(3));
+		snapAttributeHeavy.setAttribute_device_name(rset.getString(4));
+		snapAttributeHeavy.setDomain(rset.getString(5));
+		snapAttributeHeavy.setFamily(rset.getString(6));
+		snapAttributeHeavy.setMember(rset.getString(7));
+		snapAttributeHeavy.setAttribute_name(rset.getString(8));
+		snapAttributeHeavy.setData_type(rset.getInt(9));
+		snapAttributeHeavy.setData_format(rset.getInt(10));
+		snapAttributeHeavy.setWritable(rset.getInt(11));
+		snapAttributeHeavy.setMax_dim_x(rset.getInt(12));
+		snapAttributeHeavy.setMax_dim_y(rset.getInt(13));
+		snapAttributeHeavy.setLevel(rset.getInt(14));
+		snapAttributeHeavy.setCtrl_sys(rset.getString(15)); // facility
+		snapAttributeHeavy.setArchivable(rset.getInt(16));
+		snapAttributeHeavy.setSubstitute(rset.getInt(17));
+		result.add(snapAttributeHeavy);
 	    }
-	    // preparedStatement.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedAttributes() method...";
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+	    final String reason = "Failed while executing DataBaseAPI.getAttDefinitionData() method...";
+	    final String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+	} finally {
+	    closeResultSet(rset);
+	    closeStatement(statement);
+	    closeConnection(conn);
+	}
+	return result;
+    }
+
+    /**
+     * Retrieve ID, data_type, data_format, writable of some attributes
+     * 
+     * @param attributeNames
+     *            The attribute names
+     * @return
+     * @throws SnapshotingException
+     */
+    public SnapAttributeExtract[] getAttributeConfig(String... attributeNames) throws SnapshotingException {
+	SnapAttributeExtract[] result = new SnapAttributeExtract[attributeNames.length];
+	final String selectFields = GlobalConst.TAB_DEF[2] + ", " + // full_name
+		GlobalConst.TAB_DEF[0] + ", " + // attribute_id
+		GlobalConst.TAB_DEF[8] + ", " + // data_type
+		GlobalConst.TAB_DEF[9] + ", " + // data_format
+		GlobalConst.TAB_DEF[10]; // writable
+	final String astTableName = getDbSchema() + "." + GlobalConst.TABS[0];
+	// SELECT ID, data_type, data_format, writable FROM snap.ast WHERE
+	// full_name = 'attributeName'
+	String query = "SELECT " + selectFields + " FROM " + astTableName + " WHERE ";
+	for (int i = 0; i < attributeNames.length; i++) {
+	    if (i > 0 && i < attributeNames.length) {
+		query = query + " OR ";
+	    }
+	    query = query + GlobalConst.TAB_DEF[2] + " = '" + attributeNames[i] + "'";
+	}
+	System.out.println(query);
+	PreparedStatement preparedStatement = null;
+	ResultSet rset = null;
+	Connection conn = null;
+	try {
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
+	    rset = preparedStatement.executeQuery();
+	    // Gets the result of the query
+	    int i = 0;
+	    while (rset.next()) {
+		final SnapAttributeLight snapAttributeLight = new SnapAttributeLight();
+		snapAttributeLight.setAttribute_complete_name(rset.getString(GlobalConst.TAB_DEF[2]));
+		snapAttributeLight.setAttribute_id(rset.getInt(GlobalConst.TAB_DEF[0]));
+		snapAttributeLight.setData_type(rset.getInt(GlobalConst.TAB_DEF[8]));
+		snapAttributeLight.setData_format(rset.getInt(GlobalConst.TAB_DEF[9]));
+		snapAttributeLight.setWritable(rset.getInt(GlobalConst.TAB_DEF[10]));
+		result[i++] = new SnapAttributeExtract(snapAttributeLight);
+	    }
+	    if (i != attributeNames.length) {
+		System.out.println("error");
+		throw new SnapshotingException(Arrays.toString(attributeNames) + "are not all in snapshot db");
+	    }
+	} catch (final SQLException e) {
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedAttributes() method...";
+	    final String desc = "";
+	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+	} finally {
+	    closeResultSet(rset);
+	    closeStatement(preparedStatement);
+	    closeConnection(conn);
+	}
+	return result;
+    }
+
+    /**
+     * This method returns the list of attributes associated to a context
+     * 
+     * @param id_context
+     *            The given context's identifier
+     * @return The list of attributes associated to the given context
+     * @throws SnapshotingException
+     * @see SnapAttributeLight
+     */
+    public List<SnapAttributeExtract> getContextAssociatedAttributes(final int id_context) throws SnapshotingException {
+	final List<SnapAttributeExtract> attibutesList = new ArrayList<SnapAttributeExtract>();
+	PreparedStatement preparedStatement = null;
+	ResultSet rset = null;
+	Connection conn = null;
+
+	// Create and execute the SQL query string
+	String query = "";
+	final String table_name_1 = getDbSchema() + "." + GlobalConst.TABS[0];
+	final String table_name_2 = getDbSchema() + "." + GlobalConst.TABS[1];
+	final String table_name_3 = getDbSchema() + "." + GlobalConst.TABS[2];
+	final String tables = table_name_1 + ", " + table_name_2 + ", " + table_name_3;
+	final String select_fields = GlobalConst.TAB_DEF[2] + ", " + // full_name
+		GlobalConst.TAB_DEF[0] + ", " + // attribute_id
+		GlobalConst.TAB_DEF[8] + ", " + // data_type
+		GlobalConst.TAB_DEF[9] + ", " + // data_format
+		GlobalConst.TAB_DEF[10]; // writable
+	final String clause_1 = GlobalConst.TABS[0] + "." + GlobalConst.TAB_DEF[0] + " = " + GlobalConst.TABS[2] + "."
+		+ GlobalConst.TAB_LIST[1];
+	final String clause_2 = GlobalConst.TABS[2] + "." + GlobalConst.TAB_LIST[0] + " = " + GlobalConst.TABS[1] + "."
+		+ GlobalConst.TAB_CONTEXT[0];
+	final String clause_3 = GlobalConst.TABS[1] + "." + GlobalConst.TAB_CONTEXT[0] + " = ?";
+	// 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';
+	query = "SELECT DISTINCT " + select_fields + " FROM " + tables + " WHERE " + clause_1 + " AND " + clause_2
+		+ " AND " + clause_3;
+
+	try {
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
+
+	    preparedStatement.setInt(1, id_context);
+	    rset = preparedStatement.executeQuery();
+	    // Gets the result of the query
+	    while (rset.next()) {
+		final SnapAttributeLight snapAttributeLight = new SnapAttributeLight();
+		snapAttributeLight.setAttribute_complete_name(rset.getString(GlobalConst.TAB_DEF[2]));
+		snapAttributeLight.setAttribute_id(rset.getInt(GlobalConst.TAB_DEF[0]));
+		snapAttributeLight.setData_type(rset.getInt(GlobalConst.TAB_DEF[8]));
+		snapAttributeLight.setData_format(rset.getInt(GlobalConst.TAB_DEF[9]));
+		snapAttributeLight.setWritable(rset.getInt(GlobalConst.TAB_DEF[10]));
+		attibutesList.add(new SnapAttributeExtract(snapAttributeLight));
+	    }
+	} catch (final SQLException e) {
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+	    final String reason = "Failed while executing DataBaseAPI.getContextAssociatedAttributes() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
@@ -3778,9 +3338,6 @@ public class DataBaseAPI {
 	    closeStatement(preparedStatement);
 	    closeConnection(conn);
 	}
-	// Close the connection with the database
-	// Returns the list
-	attibutesList.trimToSize();
 	return attibutesList;
     }
 
@@ -3790,50 +3347,52 @@ public class DataBaseAPI {
      * @param snapContext
      * @throws SnapshotingException
      */
-    public void setContextAssociatedAttributes(final SnapContext snapContext)
-	    throws SnapshotingException {
+    public void setContextAssociatedAttributes(final SnapContext snapContext) throws SnapshotingException {
 	final int id_context = snapContext.getId();
-	final ArrayList attList = snapContext.getAttributeList();
+	final List<SnapAttributeLight> attList = snapContext.getAttributeList();
+	System.out.println("setContextAssociatedAttributes " + attList);
 	PreparedStatement preparedStatement = null;
-	Connection conn = null;
 	final String tableName = getDbSchema() + "." + GlobalConst.TABS[2];
 
 	String query;
 	final String insert_fields = GlobalConst.TAB_LIST[0] + ", " + GlobalConst.TAB_LIST[1];
 	query = "INSERT INTO " + tableName + " (" + insert_fields + ")" + " VALUES (?,?)";
-
+	PreparedStatement prest = null;
+	Connection conn = null;
 	try {
-	    if (m_dataSource != null) {
-		conn = m_dataSource.getConnection();
+	    conn = getConnection();
+	    String selectQuery = "select " + GlobalConst.TAB_LIST[1] + " from " + tableName + " where "
+		    + GlobalConst.TAB_LIST[0] + " = " + id_context;
+	    prest = conn.prepareStatement(selectQuery);
+	    ResultSet rs = prest.executeQuery();
+	    List<Integer> attributeIDList = new ArrayList<Integer>();
+	    while (rs.next()) {
+		int attributeID = rs.getInt(1);
+		attributeIDList.add(attributeID);
 	    }
-
 	    for (int i = 0; i < attList.size(); i++) {
-		final String att_full_name = (String) attList.get(i);
+		final String att_full_name = attList.get(i).getAttribute_complete_name();
 		final int id_att = getAttID(att_full_name);
-
-		try {
-		    if (conn == null) {
-			preparedStatement = dbconn.prepareStatement(query);
-		    } else {
+		if (!attributeIDList.contains(id_att)) {
+		    System.out.println("add  " + att_full_name);
+		    System.out.println("add id_att  " + id_att);
+		    try {
 			preparedStatement = conn.prepareStatement(query);
+			preparedStatement.setInt(1, id_context);
+			preparedStatement.setInt(2, id_att);
+			preparedStatement.executeUpdate();
+		    } catch (final SQLException e) {
+			final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
+			final String reason = "Failed while executing DataBaseAPI.setContextAssociatedAttributes() method...";
+			final String desc = "";
+			throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
+		    } finally {
+			closeStatement(preparedStatement);
 		    }
-		    preparedStatement.setInt(1, id_context);
-		    preparedStatement.setInt(2, id_att);
-		    preparedStatement.executeUpdate();
-		    // preparedStatement.close();
-		} catch (final SQLException e) {
-		    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.QUERY_FAILURE;
-		    final String reason = "Failed while executing DataBaseAPI.setContextAssociatedAttributes() method...";
-		    final String desc = "";
-		    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-		} finally {
-		    closeStatement(preparedStatement);
 		}
 	    }
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.setContextAssociatedAttributes() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -3841,6 +3400,7 @@ public class DataBaseAPI {
 	    throw e;
 	} finally {
 	    closeConnection(conn);
+	    closeStatement(prest);
 	}
     }
 
@@ -3859,8 +3419,7 @@ public class DataBaseAPI {
      * @see #getSnapID(int id_context)
      * @see #updateSnapContextID(int id_snap, int initial_context_value)
      */
-    public SnapShot createNewSnap(final int contextID, final Timestamp timestamp)
-	    throws SnapshotingException {
+    public SnapShot createNewSnap(final int contextID, final Timestamp timestamp) throws SnapshotingException {
 	SnapShot snapShot = new SnapShot();
 	if (db_type == ConfigConst.BD_MYSQL) {
 	    snapShot = createNewSnapMySQL(contextID, timestamp);
@@ -3885,15 +3444,14 @@ public class DataBaseAPI {
      * @see #getSnapID(int id_context)
      * @see #updateSnapContextID(int id_snap, int initial_context_value)
      */
-    private SnapShot createNewSnapMySQL(final int contextID, final Timestamp timestamp)
-	    throws SnapshotingException {
+    private SnapShot createNewSnapMySQL(final int contextID, final Timestamp timestamp) throws SnapshotingException {
 	final SnapShot snapShot = new SnapShot();
 	// Here we use a special pattern to be sure of the unicity of the
 	// snapID...
 	int snapID = -1;
 
-	// int maxContextID = getMaxContextID();
-	final int maxContextID = getMaxContextIDMySql();
+	int maxContextID = getMaxContextID();
+	// final int maxContextID = getMaxContextIDMySql();
 	/*
 	 * -- M = max -- R = Nombre_aleatoire( compris entre 1 et 100000 ) + M
 	 * -- Ins�rons l'enregistrement, avec R � la place de id_context
@@ -3904,10 +3462,11 @@ public class DataBaseAPI {
 	final int pseudoContextRecord = maxContextID + alea;
 	registerSnap(pseudoContextRecord);
 
-	/*--  Nous r�cup�rons notre enregistrement --- > ID:*/
+	/*-- Nous r�cup�rons notre enregistrement --- > ID:*/
 	snapID = getSnapID(pseudoContextRecord);
 
-	// -- Pla�ons la valeur de l'index dans une variable ID, Et mettons �
+	// -- Pla�ons la valeur de l'index dans une variable ID, Et mettons
+	// �
 	// jour la valeur de id_context :
 	updateSnapContextID(snapID, contextID);
 	snapShot.setId_context(contextID);
@@ -3932,18 +3491,19 @@ public class DataBaseAPI {
      * @see #getSnapID(int id_context)
      * @see #updateSnapContextID(int id_snap, int initial_context_value)
      */
-    private SnapShot createNewSnapOracle(final int contextID, final Timestamp timestamp)
-	    throws SnapshotingException {
+    private SnapShot createNewSnapOracle(final int contextID, final Timestamp timestamp) throws SnapshotingException {
 	final SnapShot snapShot = new SnapShot();
 	int snapID = -1;
 	if (contextID > getMaxContextID()) {
 	    return null;
 	}
 	CallableStatement cstmt_register_snapshot = null;
-	final String query = "{? = call SNAP.register_snapshot(?, ?)}";
+	final String query = "{? = call " + getDbSchema() + ".register_snapshot(?, ?)}";
 
+	Connection conn = null;
 	try {
-	    cstmt_register_snapshot = dbconn.prepareCall(query);
+	    conn = getConnection();
+	    cstmt_register_snapshot = conn.prepareCall(query);
 	    cstmt_register_snapshot.registerOutParameter(1, Types.INTEGER);
 	    cstmt_register_snapshot.setInt(2, contextID);
 	    cstmt_register_snapshot.setTimestamp(3, timestamp);
@@ -3952,13 +3512,13 @@ public class DataBaseAPI {
 	    snapID = cstmt_register_snapshot.getInt(1);
 	    cstmt_register_snapshot.close();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.createNewSnapOracle() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
 	} finally {
 	    closeStatement(cstmt_register_snapshot);
+	    closeConnection(conn);
 	}
 
 	snapShot.setId_context(contextID);
@@ -3979,18 +3539,17 @@ public class DataBaseAPI {
      * @see #getSnapID(int id_context)
      * @see #createNewSnap(int contextID, Timestamp timestamp)
      */
-    private void updateSnapContextID(final int id_snap, final int initial_context_value)
-	    throws SnapshotingException {
+    private void updateSnapContextID(final int id_snap, final int initial_context_value) throws SnapshotingException {
 	PreparedStatement preparedStatement = null;
 	final String table = getDbSchema() + "." + GlobalConst.TABS[3];
 	final String setField = GlobalConst.TAB_SNAP[1];
 	final String refField = GlobalConst.TAB_SNAP[0];
-	final String query = "UPDATE " + table + " SET " + setField + "=? " + "WHERE " + refField
-		+ "=?";
+	final String query = "UPDATE " + table + " SET " + setField + "=? " + "WHERE " + refField + "=?";
 	Connection conn = null;
 
 	try {
-	    conn = m_dataSource.getConnection();
+
+	    conn = getConnection();
 
 	    // preparedStatement = dbconn.prepareStatement(query);
 	    preparedStatement = conn.prepareStatement(query);
@@ -3998,8 +3557,7 @@ public class DataBaseAPI {
 	    preparedStatement.setInt(2, id_snap);
 	    preparedStatement.executeUpdate();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.updateSnapContextID() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -4017,28 +3575,21 @@ public class DataBaseAPI {
      * @param new_comment
      * @throws SnapshotingException
      */
-    public void updateSnapComment(final int id_snap, final String new_comment)
-	    throws SnapshotingException {
+    public void updateSnapComment(final int id_snap, final String new_comment) throws SnapshotingException {
 	PreparedStatement preparedStatement = null;
 	Connection conn = null;
 	final String table = getDbSchema() + "." + GlobalConst.TABS[3];
 	final String setField = GlobalConst.TAB_SNAP[3];
 	final String refField = GlobalConst.TAB_SNAP[0];
-	final String query = "UPDATE " + table + " SET " + setField + " = '" + new_comment
-		+ "' WHERE " + refField + " = ?";
+	final String query = "UPDATE " + table + " SET " + setField + " = '" + new_comment + "' WHERE " + refField
+		+ " = ?";
 	try {
-	    if (m_dataSource == null) {
-		preparedStatement = dbconn.prepareStatement(query);
-	    } else {
-		conn = m_dataSource.getConnection();
-		preparedStatement = conn.prepareStatement(query);
-	    }
-
+	    conn = getConnection();
+	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, id_snap);
 	    preparedStatement.executeUpdate();
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.updateSnapComment() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -4070,9 +3621,7 @@ public class DataBaseAPI {
 	ResultSet rset = null;
 	Connection conn = null;
 	try {
-	    conn = m_dataSource.getConnection();
-
-	    // preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
 	    preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, id_context);
 	    rset = preparedStatement.executeQuery();
@@ -4083,8 +3632,7 @@ public class DataBaseAPI {
 
 	    return idSnap;
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.getSnapID() method...";
 	    final String desc = "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -4095,81 +3643,6 @@ public class DataBaseAPI {
 	}
     }
 
-    /**
-     * This method is used to generate a temporary and unique contextID
-     * 
-     * @return The biggest context identifier number
-     * @throws SnapshotingException
-     * @see #registerSnap(int id_context)
-     * @see #getSnapID(int id_context)
-     * @see #updateSnapContextID(int id_snap, int initial_context_value)
-     * @see #createNewSnap(int contextID, Timestamp timestamp)
-     */
-    private int getMaxContextID() throws SnapshotingException {
-	int max = -1;
-	Statement statement = null;
-	ResultSet rset = null;
-	final String table = getDbSchema() + "." + GlobalConst.TABS[1];
-	final String selectField = GlobalConst.TAB_SNAP[1];
-	final String query = "SELECT MAX(" + selectField + ") AS max FROM " + table;
-
-	try {
-	    dbconn.prepareStatement(query);
-	    statement = dbconn.createStatement();
-	    rset = statement.executeQuery(query);
-	    // Gets the result of the query
-	    if (rset.next()) {
-		max = rset.getInt(1);
-	    }
-	    statement.close();
-	    return max;
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.getMaxContextID() method...";
-	    final String desc = "";
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeResultSet(rset);
-	    closeStatement(statement);
-	}
-    }
-
-    private int getMaxContextIDMySql() throws SnapshotingException {
-	int max = -1;
-	Statement statement = null;
-	ResultSet rset = null;
-	Connection conn = null;
-	final String table = getDbSchema() + "." + GlobalConst.TABS[3];
-	final String selectField = GlobalConst.TAB_SNAP[1];
-	final String query = "SELECT MAX(" + selectField + ") AS max FROM " + table;
-
-	try {
-	    conn = m_dataSource.getConnection();
-
-	    conn.prepareStatement(query);
-	    statement = conn.createStatement();
-	    rset = statement.executeQuery(query);
-	    // Gets the result of the query
-	    if (rset.next()) {
-		max = rset.getInt(1);
-	    }
-	    statement.close();
-	    return max;
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.getMaxContextID() method...";
-	    final String desc = "";
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeResultSet(rset);
-	    closeStatement(statement);
-	    closeConnection(conn);
-
-	}
-    }
-
     /**
      * This methods registers a new snapShot in the database, but with a wrong
      * context identifier
@@ -4187,21 +3660,19 @@ public class DataBaseAPI {
 	final String table = getDbSchema() + "." + GlobalConst.TABS[3];
 	final String insert_fields = GlobalConst.TAB_SNAP[1] + ", " + GlobalConst.TAB_SNAP[2];
 	final String insert_values = "?, ?";
-	final String query = "INSERT INTO " + table + " (" + insert_fields + ") VALUES("
-		+ insert_values + ")";
+	final String query = "INSERT INTO " + table + " (" + insert_fields + ") VALUES(" + insert_values + ")";
 	Connection conn = null;
 
 	try {
-	    conn = m_dataSource.getConnection();
-	    // preparedStatement = dbconn.prepareStatement(query);
+	    conn = getConnection();
 	    preparedStatement = conn.prepareStatement(query);
+	    // preparedStatement = conn.prepareStatement(query);
 	    preparedStatement.setInt(1, id_context);
 	    preparedStatement.setTimestamp(2, time);
 	    preparedStatement.executeUpdate();
 	    return time;
 	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
+	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : " + GlobalConst.QUERY_FAILURE;
 	    final String reason = "Failed while executing DataBaseAPI.registerSnap() method...";
 	    final String desc = "" + "";
 	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
@@ -4211,1505 +3682,27 @@ public class DataBaseAPI {
 	}
     }
 
-    // todo Miscenelaous INSERTS
-
-    public void insert_ScalarData(final ScalarEvent scalarEvent) throws SnapshotingException {
-	PreparedStatement preparedStatement;
-	final StringBuffer tableName = new StringBuffer();
-	tableName.append(getDbSchema());
-	tableName.append(".");
-
-	final StringBuffer insert_fields = new StringBuffer();
-	final StringBuffer insert_values = new StringBuffer();
-	final StringBuffer query = new StringBuffer();
-
-	final Object value = scalarEvent.getValue();
-	switch (scalarEvent.getWritable()) {
-	case AttrWriteType._READ:
-	    tableName
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[8]
-			    : GlobalConst.TABS[10]);
-	    insert_fields
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RO_NUM[0]
-			    + ", "
-			    + GlobalConst.TAB_SC_RO_NUM[1]
-			    + ", "
-			    + GlobalConst.TAB_SC_RO_NUM[2]
-			    : GlobalConst.TAB_SC_RO_STR[0] + ", " + GlobalConst.TAB_SC_RO_STR[1]
-				    + ", " + GlobalConst.TAB_SC_RO_STR[2]);
-	    insert_values.append("?, ?, ?");
-	    break;
-	case AttrWriteType._READ_WITH_WRITE:
-	    tableName
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[9]
-			    : GlobalConst.TABS[11]);
-	    insert_fields
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RW_NUM[0]
-			    + ", "
-			    + GlobalConst.TAB_SC_RW_NUM[1]
-			    + ", "
-			    + GlobalConst.TAB_SC_RW_NUM[2] + ", " + GlobalConst.TAB_SC_RW_NUM[3]
-			    : GlobalConst.TAB_SC_RW_STR[0] + ", " + GlobalConst.TAB_SC_RW_STR[1]
-				    + ", " + GlobalConst.TAB_SC_RW_STR[2] + ", "
-				    + GlobalConst.TAB_SC_RW_STR[3]);
-	    insert_values.append("?, ?, ?, ?");
-	    break;
-	case AttrWriteType._WRITE:
-	    tableName
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[8]
-			    : GlobalConst.TABS[10]);
-
-	    insert_fields
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_WO_NUM[0]
-			    + ", "
-			    + GlobalConst.TAB_SC_WO_NUM[1]
-			    + ", "
-			    + GlobalConst.TAB_SC_WO_NUM[2]
-			    : GlobalConst.TAB_SC_WO_STR[0] + ", " + GlobalConst.TAB_SC_WO_STR[1]
-				    + ", " + GlobalConst.TAB_SC_WO_STR[2]);
-	    insert_values.append("?, ?, ?");
-	    break;
-	case AttrWriteType._READ_WRITE:
-	    tableName
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TABS[9]
-			    : GlobalConst.TABS[11]);
-
-	    insert_fields
-		    .append(scalarEvent.getData_type() != TangoConst.Tango_DEV_STRING ? GlobalConst.TAB_SC_RW_NUM[0]
-			    + ", "
-			    + GlobalConst.TAB_SC_RW_NUM[1]
-			    + ", "
-			    + GlobalConst.TAB_SC_RW_NUM[2] + ", " + GlobalConst.TAB_SC_RW_NUM[3]
-			    : GlobalConst.TAB_SC_RW_STR[0] + ", " + GlobalConst.TAB_SC_RW_STR[1]
-				    + ", " + GlobalConst.TAB_SC_RW_STR[2] + ", "
-				    + GlobalConst.TAB_SC_RW_STR[3]);
-	    insert_values.append("?, ?, ?, ?");
-	    break;
-	}
-	query.append("INSERT INTO ").append(tableName).append(" (").append(insert_fields).append(
-		")").append(" VALUES (").append(insert_values).append(")");
-	// System.out.println("DataBaseApi/insert_ScalarData/query/"+query.toString());
-	try {
-	    preparedStatement = dbconn.prepareStatement(query.toString());
-
-	    try {
-
-		preparedStatement.setInt(1, scalarEvent.getId_snap());
-		preparedStatement.setInt(2, scalarEvent.getId_att());
-		if (value != null) {
-		    if (scalarEvent.getWritable() == AttrWriteType._READ
-			    || scalarEvent.getWritable() == AttrWriteType._WRITE) {
-			switch (scalarEvent.getData_type()) {
-			case TangoConst.Tango_DEV_STRING:
-			    preparedStatement.setString(3, (String) value);
-			    break;
-			case TangoConst.Tango_DEV_STATE:
-			    preparedStatement.setInt(3, ((DevState) value).value());
-			    break;
-			case TangoConst.Tango_DEV_UCHAR:
-			    preparedStatement.setByte(3, ((Byte) value).byteValue());
-			    break;
-			case TangoConst.Tango_DEV_LONG:
-			    preparedStatement.setInt(3, ((Integer) value).intValue());
-			    break;
-			case TangoConst.Tango_DEV_ULONG:
-			    preparedStatement.setInt(3, ((Integer) value).intValue());
-			    break;
-			case TangoConst.Tango_DEV_BOOLEAN:
-			    preparedStatement.setBoolean(3, ((Boolean) value).booleanValue());
-			    break;
-			case TangoConst.Tango_DEV_SHORT:
-			    preparedStatement.setShort(3, ((Short) value).shortValue());
-			    break;
-			case TangoConst.Tango_DEV_FLOAT:
-			    preparedStatement.setFloat(3, ((Float) value).floatValue());
-			    break;
-			case TangoConst.Tango_DEV_DOUBLE:
-			    preparedStatement.setDouble(3, ((Double) value).doubleValue());
-			    break;
-			default:
-			    preparedStatement.setDouble(3, ((Double) value).doubleValue());
-			    break;
-			}
-		    } else { // if (writable == AttrWriteType._READ_WITH_WRITE
-			// || writable == AttrWriteType._READ_WRITE)
-			switch (scalarEvent.getData_type()) {
-			case TangoConst.Tango_DEV_STRING:
-			    if (((String[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.VARCHAR);
-			    } else {
-				preparedStatement.setString(3, ((String[]) value)[0]);
-			    }
-			    if (((String[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.VARCHAR);
-			    } else {
-				preparedStatement.setString(4, ((String[]) value)[1]);
-			    }
-			    break;
-			case TangoConst.Tango_DEV_STATE:
-			    if (((Integer[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(3, ((Integer[]) value)[0].intValue());
-			    }
-			    if (((Integer[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(4, ((Integer[]) value)[1].intValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_UCHAR:
-			    if (((Byte[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setByte(3, ((Byte[]) value)[0].byteValue());
-			    }
-			    if (((Byte[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setByte(4, ((Integer[]) value)[1].byteValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_LONG:
-			    if (((Integer[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(3, ((Integer[]) value)[0].intValue());
-			    }
-			    if (((Integer[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(4, ((Integer[]) value)[1].intValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_ULONG:
-			    if (((Integer[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(3, ((Integer[]) value)[0].intValue());
-			    }
-			    if (((Integer[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setInt(4, ((Integer[]) value)[1].intValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_BOOLEAN:
-			    if (((Boolean[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.BOOLEAN);
-			    } else {
-				preparedStatement.setBoolean(3, ((Boolean[]) value)[0]
-					.booleanValue());
-			    }
-			    if (((Boolean[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.BOOLEAN);
-			    } else {
-				preparedStatement.setBoolean(4, ((Boolean[]) value)[1]
-					.booleanValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_SHORT:
-			    if (((Short[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setShort(3, ((Short[]) value)[0].shortValue());
-			    }
-			    if (((Short[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setShort(4, ((Short[]) value)[1].shortValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_USHORT:
-			    if (((Short[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setShort(3, ((Short[]) value)[0].shortValue());
-			    }
-			    if (((Short[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setShort(4, ((Short[]) value)[1].shortValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_FLOAT:
-			    if (((Float[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setFloat(3, ((Float[]) value)[0].floatValue());
-			    }
-			    if (((Float[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setFloat(4, ((Float[]) value)[1].floatValue());
-			    }
-			    break;
-			case TangoConst.Tango_DEV_DOUBLE:
-			    if (((Double[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setDouble(3, ((Double[]) value)[0].doubleValue());
-			    }
-			    if (((Double[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setDouble(4, ((Double[]) value)[1].doubleValue());
-			    }
-			    break;
-			default:
-			    if (((Double[]) value)[0] == null) {
-				preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setDouble(3, ((Double[]) value)[0].doubleValue());
-			    }
-			    if (((Float[]) value)[1] == null) {
-				preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-			    } else {
-				preparedStatement.setDouble(4, ((Double[]) value)[1].doubleValue());
-			    }
-			    break;
-			}
-		    }
-
-		} else {
-		    if (scalarEvent.getWritable() == AttrWriteType._READ
-			    || scalarEvent.getWritable() == AttrWriteType._WRITE) {
-			preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-		    } else {
-			preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-			preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-		    }
-
-		}
-
-		preparedStatement.executeUpdate();
-	    } catch (final SQLException e) {
-		preparedStatement.close();
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.insert_ScalarData() method...";
-		final String desc = "Attribute name : " + scalarEvent.getAttribute_complete_name();
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    } finally {
-		closeStatement(preparedStatement);
-	    }
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX
-		    + " : "
-		    + (db_type == ConfigConst.BD_MYSQL ? GlobalConst.COMM_FAILURE_MYSQL
-			    : GlobalConst.COMM_FAILURE_ORACLE);
-	    final String reason = "Failed while executing DataBaseAPI.insert_ScalarData() method...";
-	    final String desc = "Attribute name : " + scalarEvent.getAttribute_complete_name();
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	}
-
-    }
-
-    /**
-     * Inserts a read only type scalar data intyo the snapshot database.
-     * 
-     * @param snapScalarEvent_RO
-     * @throws SnapshotingException
-     */
-    public void insert_ScalarData_RO(final SnapScalarEvent_RO snapScalarEvent_RO)
-	    throws SnapshotingException {
-	PreparedStatement preparedStatement = null;
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[8]);
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_SC_RO_NUM[0])
-		.append(", ").append(GlobalConst.TAB_SC_RO_NUM[1]).append(", ").append(
-			GlobalConst.TAB_SC_RO_NUM[2]);
-	final StringBuffer insert_values = new StringBuffer("?, ?, ?");
-	final StringBuffer query = new StringBuffer().append("INSERT INTO ").append(tableName)
-		.append(" (").append(insert_fields).append(")").append(" VALUES (").append(
-			insert_values).append(")");
-
-	try {
-	    preparedStatement = dbconn.prepareStatement(query.toString());
-	    preparedStatement.setInt(1, snapScalarEvent_RO.getId_snap());
-	    preparedStatement.setInt(2, snapScalarEvent_RO.getId_att());
-	    if (snapScalarEvent_RO.getScalarValueRO() != null
-		    && !snapScalarEvent_RO.getScalarValueRO().isNaN()) {
-		preparedStatement.setDouble(3, snapScalarEvent_RO.getScalarValueRO().doubleValue());
-	    } else {
-		preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-	    }
-	    preparedStatement.executeUpdate();
-	    // preparedStatement.close();
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.insert_ScalarData_RO() method...";
-	    final String desc = "Query : " + query;
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeStatement(preparedStatement);
-	}
-    }
-
     /**
-     * Inserts a write only type scalar data intyo the snapshot database.
+     * ************************************************************************
+     * <b>Description : </b> Build a array of String with the given String
+     * Vector
      * 
-     * @param snapScalarEvent_WO
-     * @throws SnapshotingException
+     * @param my_vector
+     *            The given String Vector
+     * @return a String type array that contains the differents vector's String
+     *         type elements <br>
+     *         *****************************************************************
+     *         * *******
      */
-    public void insert_ScalarData_WO(final SnapScalarEvent_WO snapScalarEvent_WO)
-	    throws SnapshotingException {
-	PreparedStatement preparedStatement = null;
-	final String tableName = getDbSchema() + "." + GlobalConst.TABS[8];
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_SC_WO_NUM[0])
-		.append(", ").append(GlobalConst.TAB_SC_WO_NUM[1]).append(", ").append(
-			GlobalConst.TAB_SC_WO_NUM[2]);
-	final StringBuffer insert_values = new StringBuffer("?, ?, ?");
-	final StringBuffer query = new StringBuffer().append("INSERT INTO ").append(tableName)
-		.append(" (").append(insert_fields).append(")").append(" VALUES (").append(
-			insert_values).append(")");
-
-	try {
-	    preparedStatement = dbconn.prepareStatement(query.toString());
-	    preparedStatement.setInt(1, snapScalarEvent_WO.getId_snap());
-	    preparedStatement.setInt(2, snapScalarEvent_WO.getId_att());
-	    if (!Double.isNaN(snapScalarEvent_WO.getScalarValueWO())) {
-		preparedStatement.setDouble(3, snapScalarEvent_WO.getScalarValueWO());
-	    } else {
-		preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-	    }
-	    preparedStatement.executeUpdate();
-	    // preparedStatement.close();
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.insert_ScalarData_WO() method...";
-	    final String desc = "Query : " + query;
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeStatement(preparedStatement);
+    private String[] toStringArray(final Vector my_vector) {
+	String[] my_array;
+	my_array = new String[my_vector.size()];
+	for (int i = 0; i < my_vector.size(); i++) {
+	    my_array[i] = (String) my_vector.elementAt(i);
 	}
+	return my_array;
     }
 
-    /**
-     * Inserts a read/write type scalar data intyo the snapshot database.
-     * 
-     * @param snapScalarEvent_RW
-     * @throws SnapshotingException
-     */
-    public void insert_ScalarData_RW(final SnapScalarEvent_RW snapScalarEvent_RW)
-	    throws SnapshotingException {
-	PreparedStatement preparedStatement = null;
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[9]);
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_SC_RW_NUM[0])
-		.append(", ").append(GlobalConst.TAB_SC_RW_NUM[1]).append(", ").append(
-			GlobalConst.TAB_SC_RW_NUM[2]).append(", ").append(
-			GlobalConst.TAB_SC_RW_NUM[3]);
-	final StringBuffer insert_values = new StringBuffer("?, ?, ?, ?");
-	final StringBuffer query = new StringBuffer().append("INSERT INTO ").append(tableName)
-		.append(" (").append(insert_fields).append(")").append(" VALUES (").append(
-			insert_values).append(")");
-
-	try {
-	    preparedStatement = dbconn.prepareStatement(query.toString());
-	    preparedStatement.setInt(1, snapScalarEvent_RW.getId_snap());
-	    preparedStatement.setInt(2, snapScalarEvent_RW.getId_att());
-	    if (snapScalarEvent_RW.getScalarValueRW()[0] != null
-		    && !snapScalarEvent_RW.getScalarValueRW()[0].isNaN()) {
-		preparedStatement.setDouble(3, snapScalarEvent_RW.getScalarValueRW()[0]
-			.doubleValue());
-	    } else {
-		preparedStatement.setNull(3, java.sql.Types.NUMERIC);
-	    }
-	    if (snapScalarEvent_RW.getScalarValueRW()[1] != null
-		    && !snapScalarEvent_RW.getScalarValueRW()[1].isNaN()) {
-		preparedStatement.setDouble(4, snapScalarEvent_RW.getScalarValueRW()[1]
-			.doubleValue());
-	    } else {
-		preparedStatement.setNull(4, java.sql.Types.NUMERIC);
-	    }
-	    preparedStatement.executeUpdate();
-	    // preparedStatement.close();
-	} catch (final SQLException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.QUERY_FAILURE;
-	    final String reason = "Failed while executing DataBaseAPI.insert_ScalarData_RW() method...";
-	    final String desc = "Query : " + query;
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	} finally {
-	    closeStatement(preparedStatement);
-	}
-
-    }
-
-    /**
-     * Inserts a read only type spectrum data intyo the snapshot database.
-     * 
-     * @param snapSpectrumEvent_RO
-     * @throws SnapshotingException
-     */
-    public void insert_SpectrumData_RO(final SnapSpectrumEvent_RO snapSpectrumEvent_RO)
-	    throws SnapshotingException {
-	int data_type = -1;
-	Double[] dvalue = null;
-	Float[] fvalue = null;
-	Integer[] lvalue = null;
-	Short[] svalue = null;
-	Byte[] cvalue = null;
-	Boolean[] bvalue = null;
-	String[] stvalue = null;
-	Statement statement;
-	if (snapSpectrumEvent_RO.getValue() instanceof Double[]) {
-	    dvalue = (Double[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_DOUBLE;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof Float[]) {
-	    fvalue = (Float[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_FLOAT;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof Integer[]) {
-	    lvalue = (Integer[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_LONG;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof Short[]) {
-	    svalue = (Short[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_SHORT;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof Byte[]) {
-	    cvalue = (Byte[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_CHAR;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof Boolean[]) {
-	    bvalue = (Boolean[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_BOOLEAN;
-	} else if (snapSpectrumEvent_RO.getValue() instanceof String[]) {
-	    stvalue = (String[]) snapSpectrumEvent_RO.getValue();
-	    data_type = TangoConst.Tango_DEV_STRING;
-	}
-
-	final int idSnap = snapSpectrumEvent_RO.getId_snap();
-	final int idAtt = snapSpectrumEvent_RO.getId_att();
-	final int dimX = snapSpectrumEvent_RO.getDim_x();
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[6]);
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_SP_RO_NUM[0])
-		.append(", ").append(GlobalConst.TAB_SP_RO_NUM[1]).append(", ").append(
-			GlobalConst.TAB_SP_RO_NUM[2]).append(", ").append(
-			GlobalConst.TAB_SP_RO_NUM[3]);
-	StringBuffer query = new StringBuffer();
-	final StringBuffer valueStr = new StringBuffer();
-	if (db_type == ConfigConst.BD_MYSQL) {
-	    valueStr.append("'[");
-	    switch (data_type) {
-	    case TangoConst.Tango_DEV_DOUBLE:
-		for (int i = 0; i < dvalue.length - 1; i++) {
-		    valueStr.append(dvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (dvalue.length > 0) {
-		    valueStr.append(dvalue[dvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_FLOAT:
-		for (int i = 0; i < fvalue.length - 1; i++) {
-		    valueStr.append(fvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (fvalue.length > 0) {
-		    valueStr.append(fvalue[fvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_LONG:
-		for (int i = 0; i < lvalue.length - 1; i++) {
-		    valueStr.append(lvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (lvalue.length > 0) {
-		    valueStr.append(lvalue[lvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_SHORT:
-		for (int i = 0; i < svalue.length - 1; i++) {
-		    valueStr.append(svalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (svalue.length > 0) {
-		    valueStr.append(svalue[svalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_CHAR:
-		for (int i = 0; i < cvalue.length - 1; i++) {
-		    valueStr.append(cvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (cvalue.length > 0) {
-		    valueStr.append(cvalue[cvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_BOOLEAN:
-		for (int i = 0; i < bvalue.length - 1; i++) {
-		    valueStr.append(bvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (bvalue.length > 0) {
-		    valueStr.append(bvalue[bvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_STRING:
-		for (int i = 0; i < stvalue.length - 1; i++) {
-		    valueStr.append(stvalue[i]).append(GlobalConst.CLOB_SEPARATOR).append(" ");
-		}
-		if (stvalue.length > 0) {
-		    valueStr.append(stvalue[stvalue.length - 1]);
-		}
-		break;
-	    }
-	    valueStr.append("]'");
-	    System.out.println("*********valueStr=" + valueStr.toString());
-	    query.append("INSERT INTO ").append(tableName).append(" (").append(insert_fields)
-		    .append(")").append(" VALUES (").append(idSnap).append(",").append(idAtt)
-		    .append(",").append(dimX).append(",").append(valueStr).append(")").toString();
-	    System.out.println("*********query=" + query.toString());
-
-	    try {
-		statement = dbconn.createStatement();
-		statement.executeUpdate(query.toString());
-		statement.close();
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.insert_SpectrumData_RO() method...";
-		final String desc = "Query : " + query;
-		e.printStackTrace();
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    }
-	} else if (db_type == ConfigConst.BD_ORACLE) {
-	    CallableStatement cstmt_ins_spectrum_ro;
-	    query = new StringBuffer().append("{call ").append(getDbSchema()).append(
-		    ".sn_sp_1val (?, ?, ?, ?)}");
-
-	    switch (data_type) {
-	    case TangoConst.Tango_DEV_DOUBLE:
-		for (int i = 0; i < dvalue.length - 1; i++) {
-		    valueStr.append(dvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (dvalue.length > 0) {
-		    valueStr.append(dvalue[dvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_FLOAT:
-		for (int i = 0; i < fvalue.length - 1; i++) {
-		    valueStr.append(fvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (fvalue.length > 0) {
-		    valueStr.append(fvalue[fvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_LONG:
-		for (int i = 0; i < lvalue.length - 1; i++) {
-		    valueStr.append(lvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (lvalue.length > 0) {
-		    valueStr.append(lvalue[lvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_SHORT:
-		for (int i = 0; i < svalue.length - 1; i++) {
-		    valueStr.append(svalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (svalue.length > 0) {
-		    valueStr.append(svalue[svalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_CHAR:
-		for (int i = 0; i < cvalue.length - 1; i++) {
-		    valueStr.append(cvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (cvalue.length > 0) {
-		    valueStr.append(cvalue[cvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_BOOLEAN:
-		for (int i = 0; i < bvalue.length - 1; i++) {
-		    valueStr.append(bvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (bvalue.length > 0) {
-		    valueStr.append(bvalue[bvalue.length - 1]);
-		}
-		break;
-
-	    case TangoConst.Tango_DEV_STRING:
-		for (int i = 0; i < stvalue.length - 1; i++) {
-		    valueStr.append(stvalue[i]).append(GlobalConst.CLOB_SEPARATOR);
-		}
-		if (stvalue.length > 0) {
-		    valueStr.append(stvalue[stvalue.length - 1]);
-		}
-		break;
-	    }
-	    try {
-
-		cstmt_ins_spectrum_ro = dbconn.prepareCall(query.toString());
-		cstmt_ins_spectrum_ro.setInt(1, idSnap);
-		cstmt_ins_spectrum_ro.setString(2, snapSpectrumEvent_RO
-			.getAttribute_complete_name());
-		cstmt_ins_spectrum_ro.setInt(3, snapSpectrumEvent_RO.getDim_x());
-		cstmt_ins_spectrum_ro.setString(4, valueStr.toString());
-
-		cstmt_ins_spectrum_ro.executeUpdate();
-		cstmt_ins_spectrum_ro.close();
-
-	    } catch (final SQLException e) {
-		String message = "";
-		if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_SpectrumData_RO() method..."
-			+ "\r\n\t\t Query : "
-			+ query
-			+ "\r\n\t\t Param 1 (Attribute name) : "
-			+ snapSpectrumEvent_RO.getAttribute_complete_name()
-			+ "\r\n\t\t Param 2 (Id Snap)      : "
-			+ idSnap
-			+ "\r\n\t\t Param 3 (Dimension)      : "
-			+ snapSpectrumEvent_RO.getDim_x()
-			+ "\r\n\t\t Param 4 (Value)          : "
-			+ valueStr.toString()
-			+ "\r\n\t\t Code d'erreur : "
-			+ e.getErrorCode()
-			+ "\r\n\t\t Message : "
-			+ e.getMessage()
-			+ "\r\n\t\t SQL state : "
-			+ e.getSQLState()
-			+ "\r\n\t\t Stack : ";
-		e.printStackTrace();
-
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e);
-	    }
-	}
-
-    }
-
-    /**
-     * Inserts a read only type spectrum data intyo the snapshot database.
-     * 
-     * @param snapSpectrumEvent_rw
-     * @throws SnapshotingException
-     */
-    public void insert_SpectrumData_RW(final SnapSpectrumEvent_RW snapSpectrumEvent_rw)
-	    throws SnapshotingException {
-	int data_type = -1;
-	Double[] dvalueRead = null, dvalueWrite = null;
-	Float[] fvalueRead = null, fvalueWrite = null;
-	Integer[] lvalueRead = null, lvalueWrite = null;
-	Short[] svalueRead = null, svalueWrite = null;
-	Byte[] cvalueRead = null, cvalueWrite = null;
-	Boolean[] bvalueRead = null, bvalueWrite = null;
-	String[] stvalueRead = null, stvalueWrite = null;
-	if (snapSpectrumEvent_rw.getValue() instanceof Double[]) {
-	    dvalueRead = (Double[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    dvalueWrite = (Double[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_DOUBLE;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof Float[]) {
-	    fvalueRead = (Float[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    fvalueWrite = (Float[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_FLOAT;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof Integer[]) {
-	    lvalueRead = (Integer[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    lvalueWrite = (Integer[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_LONG;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof Short[]) {
-	    svalueRead = (Short[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    svalueWrite = (Short[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_SHORT;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof Byte[]) {
-	    cvalueRead = (Byte[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    cvalueWrite = (Byte[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_CHAR;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof Boolean[]) {
-	    bvalueRead = (Boolean[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    bvalueWrite = (Boolean[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_BOOLEAN;
-	} else if (snapSpectrumEvent_rw.getValue() instanceof String[]) {
-	    stvalueRead = (String[]) snapSpectrumEvent_rw.getSpectrumValueRWRead();
-	    stvalueWrite = (String[]) snapSpectrumEvent_rw.getSpectrumValueRWWrite();
-	    data_type = TangoConst.Tango_DEV_STRING;
-	}
-	Statement statement;
-
-	final int idSnap = snapSpectrumEvent_rw.getId_snap();
-	final int idAtt = snapSpectrumEvent_rw.getId_att();
-	final int dimX = snapSpectrumEvent_rw.getDim_x();
-
-	// System.out.println (
-	// "CLA/DatabaseApi/insert_SpectrumData_RW/valueRead.length/"+valueRead.length+"/valueWrite.length/"+valueWrite.length+"/dimX/"+dimX
-	// );
-	// CLA/DatabaseApi/insert_SpectrumData_RW/valueRead.length/128/valueWrite.length/128/dimX/256
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[7]);
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_SP_RW_NUM[0])
-		.append(", ").append(GlobalConst.TAB_SP_RW_NUM[1]).append(", ").append(
-			GlobalConst.TAB_SP_RW_NUM[2]).append(", ").append(
-			GlobalConst.TAB_SP_RW_NUM[3]).append(", ").append(
-			GlobalConst.TAB_SP_RW_NUM[4]);
-	StringBuffer query = new StringBuffer();
-	final StringBuffer valueReadStr = new StringBuffer();
-	final StringBuffer valueWriteStr = new StringBuffer();
-	if (db_type == ConfigConst.BD_MYSQL) {
-	    valueReadStr.append("'[");
-	    valueWriteStr.append("'[");
-	    switch (data_type) {
-	    case TangoConst.Tango_DEV_DOUBLE:
-		for (int i = 0; i < dvalueRead.length - 1; i++) {
-		    valueReadStr.append(dvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(dvalueRead[dvalueRead.length - 1]);
-		for (int i = 0; i < dvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(dvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(dvalueWrite[dvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_FLOAT:
-		for (int i = 0; i < fvalueRead.length - 1; i++) {
-		    valueReadStr.append(fvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(fvalueRead[fvalueRead.length - 1]);
-		for (int i = 0; i < fvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(fvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(fvalueWrite[fvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_LONG:
-		for (int i = 0; i < lvalueRead.length - 1; i++) {
-		    valueReadStr.append(lvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(lvalueRead[lvalueRead.length - 1]);
-		for (int i = 0; i < lvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(lvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(lvalueWrite[lvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_SHORT:
-		for (int i = 0; i < svalueRead.length - 1; i++) {
-		    valueReadStr.append(svalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(svalueRead[svalueRead.length - 1]);
-		for (int i = 0; i < svalueWrite.length - 1; i++) {
-		    valueWriteStr.append(svalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(svalueWrite[svalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_CHAR:
-		for (int i = 0; i < cvalueRead.length - 1; i++) {
-		    valueReadStr.append(cvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(cvalueRead[cvalueRead.length - 1]);
-		for (int i = 0; i < cvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(cvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(cvalueWrite[cvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_BOOLEAN:
-		for (int i = 0; i < bvalueRead.length - 1; i++) {
-		    valueReadStr.append(bvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(bvalueRead[bvalueRead.length - 1]);
-		for (int i = 0; i < bvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(bvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(bvalueWrite[bvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_STRING:
-		for (int i = 0; i < stvalueRead.length - 1; i++) {
-		    valueReadStr.append(stvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(stvalueRead[stvalueRead.length - 1]);
-		for (int i = 0; i < stvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(stvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR)
-			    .append(" ");
-		}
-		valueWriteStr.append(stvalueWrite[stvalueWrite.length - 1]);
-		break;
-	    }
-
-	    valueReadStr.append("]'");
-	    valueWriteStr.append("]'");
-	    query.append("INSERT INTO ").append(tableName).append(" (").append(insert_fields)
-		    .append(")").append(" VALUES (").append(idSnap).append(",").append(idAtt)
-		    .append(",").append(dimX).append(",").append(valueReadStr).append(",").append(
-			    valueWriteStr).append(")").toString();
-
-	    // System.out.println("******query : |"+query.toString()+"|");
-	    try {
-		// System.out.println("*******insert_SpectrumData_RW test0");
-		statement = dbconn.createStatement();
-		// System.out.println("*******insert_SpectrumData_RW test1");
-		statement.executeUpdate(query.toString());
-		// System.out.println("*******insert_SpectrumData_RW test2");
-		statement.close();
-		// System.out.println("*******insert_SpectrumData_RW test3");
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.insert_SpectrumData_RW() method...";
-		final String desc = "Query : " + query;
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    }
-	} else if (db_type == ConfigConst.BD_ORACLE) {
-	    CallableStatement cstmt_ins_spectrum_rw;
-	    query = new StringBuffer().append("{call ").append(getDbSchema()).append(
-		    ".sn_sp_2val (?, ?, ?, ?, ?)}");
-
-	    switch (data_type) {
-	    case TangoConst.Tango_DEV_DOUBLE:
-		for (int i = 0; i < dvalueRead.length - 1; i++) {
-		    valueReadStr.append(dvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(dvalueRead[dvalueRead.length - 1]);
-		for (int i = 0; i < dvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(dvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(dvalueWrite[dvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_FLOAT:
-		for (int i = 0; i < fvalueRead.length - 1; i++) {
-		    valueReadStr.append(fvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(fvalueRead[fvalueRead.length - 1]);
-		for (int i = 0; i < fvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(fvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(fvalueWrite[fvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_LONG:
-		for (int i = 0; i < lvalueRead.length - 1; i++) {
-		    valueReadStr.append(lvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(lvalueRead[lvalueRead.length - 1]);
-		for (int i = 0; i < lvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(lvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(lvalueWrite[lvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_SHORT:
-		for (int i = 0; i < svalueRead.length - 1; i++) {
-		    valueReadStr.append(svalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(svalueRead[svalueRead.length - 1]);
-		for (int i = 0; i < svalueWrite.length - 1; i++) {
-		    valueWriteStr.append(svalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(svalueWrite[svalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_CHAR:
-		for (int i = 0; i < cvalueRead.length - 1; i++) {
-		    valueReadStr.append(cvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(cvalueRead[cvalueRead.length - 1]);
-		for (int i = 0; i < cvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(cvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(cvalueWrite[cvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_BOOLEAN:
-		for (int i = 0; i < bvalueRead.length - 1; i++) {
-		    valueReadStr.append(bvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(bvalueRead[bvalueRead.length - 1]);
-		for (int i = 0; i < bvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(bvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueWriteStr.append(bvalueWrite[bvalueWrite.length - 1]);
-		break;
-
-	    case TangoConst.Tango_DEV_STRING:
-		for (int i = 0; i < stvalueRead.length - 1; i++) {
-		    valueReadStr.append(stvalueRead[i]).append(GlobalConst.CLOB_SEPARATOR).append(
-			    " ");
-		}
-		valueReadStr.append(stvalueRead[stvalueRead.length - 1]);
-		for (int i = 0; i < stvalueWrite.length - 1; i++) {
-		    valueWriteStr.append(stvalueWrite[i]).append(GlobalConst.CLOB_SEPARATOR)
-			    .append(" ");
-		}
-		valueWriteStr.append(stvalueWrite[stvalueWrite.length - 1]);
-		break;
-	    }
-
-	    try {
-
-		cstmt_ins_spectrum_rw = dbconn.prepareCall(query.toString());
-		cstmt_ins_spectrum_rw.setInt(1, idSnap);
-		cstmt_ins_spectrum_rw.setString(2, snapSpectrumEvent_rw
-			.getAttribute_complete_name());
-		cstmt_ins_spectrum_rw.setInt(3, snapSpectrumEvent_rw.getDim_x());
-		cstmt_ins_spectrum_rw.setString(4, valueReadStr.toString());
-		cstmt_ins_spectrum_rw.setString(5, valueWriteStr.toString());
-
-		cstmt_ins_spectrum_rw.executeUpdate();
-		cstmt_ins_spectrum_rw.close();
-
-	    } catch (final SQLException e) {
-		String message = "";
-		if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_SpectrumData_RW() method..."
-			+ "\r\n\t\t Query : "
-			+ query
-			+ "\r\n\t\t Param 1 (Attribute name) : "
-			+ snapSpectrumEvent_rw.getAttribute_complete_name()
-			+ "\r\n\t\t Param 2 (Id Snap)      : "
-			+ idSnap
-			+ "\r\n\t\t Param 3 (Dimension)      : "
-			+ snapSpectrumEvent_rw.getDim_x()
-			+ "\r\n\t\t Param 4 (valueRead)          : "
-			+ valueReadStr.toString()
-			+ "\r\n\t\t Param 5 (valueWrite)          : "
-			+ valueWriteStr.toString()
-			+ "\r\n\t\t Code d'erreur : "
-			+ e.getErrorCode()
-			+ "\r\n\t\t Message : "
-			+ e.getMessage()
-			+ "\r\n\t\t SQL state : "
-			+ e.getSQLState()
-			+ "\r\n\t\t Stack : ";
-		e.printStackTrace();
-
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e);
-	    }
-	}
-
-    }
-
-    /**
-     * Inserts a read only type image data intyo the snapshot database.
-     * 
-     * @param snapImageEvent_RO
-     * @throws SnapshotingException
-     */
-    public void insert_ImageData_RO(final SnapImageEvent_RO snapImageEvent_RO)
-	    throws SnapshotingException {
-	// Runtime runtime = Runtime.getRuntime ();
-	// long freeMemory = runtime.freeMemory ();
-	// long maxMemory = runtime.maxMemory ();
-	// long totalMemory = runtime.totalMemory ();
-	// System.out.println (
-	// "\n*************\nGIR 0/freeMemory/"+freeMemory+"/maxMemory/"+maxMemory+"/totalMemory/"+totalMemory+"/\n*************"
-	// );
-
-	final int dim_x = snapImageEvent_RO.getDim_x();
-	final int dim_y = snapImageEvent_RO.getDim_y();
-	// int dim_x = 10;
-	// int dim_y = 10;
-	// System.out.println("dim_x,dim_y:"+dim_x+","+dim_y);
-
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[4]);
-
-	final StringBuffer valueStr = new StringBuffer();
-
-	Double[][] dvalue = null;
-
-	if (snapImageEvent_RO.getValue() instanceof Double[][]) {
-	    dvalue = (Double[][]) snapImageEvent_RO.getValue();
-	}
-
-	if (dvalue != null) {
-	    for (int i = 0; i < dim_y; i++) {
-		for (int j = 0; j < dim_x; j++) {
-		    valueStr.append(dvalue[i][j]);
-		    if (j < dim_x - 1) {
-			valueStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_COLS).append(" ");
-		    }
-		}
-
-		if (i < dim_y - 1) {
-		    valueStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_ROWS).append(" ");
-		}
-	    }
-	}
-	final StringBuffer query = new StringBuffer();
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_IM_RO_NUM[0])
-		.append(", ").append(GlobalConst.TAB_IM_RO_NUM[1]).append(", ").append(
-			GlobalConst.TAB_IM_RO_NUM[2]).append(", ").append(
-			GlobalConst.TAB_IM_RO_NUM[3]).append(", ").append(
-			GlobalConst.TAB_IM_RO_NUM[4]);
-	final StringBuffer insert_values = new StringBuffer("?, ?, ?, ?, ?");
-	if (db_type == ConfigConst.BD_MYSQL) {
-
-	    query.append("INSERT INTO ").append(tableName).append(" (").append(insert_fields)
-		    .append(")").append(" VALUES (").append(insert_values).append(")");
-	    // System.out.println("@@@@@@@@@@@@@@@@@@@@\n"+query.toString()+"\n@@@@@@@@@@@@@@@@@@@@");
-	    // System.out.println("@@@@@@@@@@@@@@@@@@@@\n"+valueStr.toString()+"\n@@@@@@@@@@@@@@@@@@@@");
-	    PreparedStatement preparedStatement = null;
-	    try {
-		preparedStatement = dbconn.prepareStatement(query.toString());
-		preparedStatement.setInt(1, snapImageEvent_RO.getId_snap());
-		preparedStatement.setInt(2, snapImageEvent_RO.getId_att());
-		preparedStatement.setInt(3, dim_x);
-		preparedStatement.setInt(4, dim_y);
-
-	    } catch (final SQLException e1) {
-		String message = "";
-		if (e1.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e1.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_ImageData_RO() method...";
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e1);
-	    }
-	    try {
-		if (dvalue != null) {
-		    preparedStatement.setString(5, valueStr.toString());
-		    // System.out.println("***********petit test : " +
-		    // valueStr.toString().split(GlobalConst.CLOB_SEPARATOR_IMAGE_ROWS).length);
-		    // System.out.println("***********petit test 2 : " +
-		    // valueStr.toString().split(GlobalConst.CLOB_SEPARATOR_IMAGE_ROWS)[0].split(GlobalConst.CLOB_SEPARATOR_IMAGE_COLS).length);
-		} else {
-		    preparedStatement.setNull(5, java.sql.Types.BLOB);
-		}
-		preparedStatement.executeUpdate();
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.insert_ImageData_RO() method...";
-		final String desc = "Query : " + query;
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    } finally {
-		closeStatement(preparedStatement);
-	    }
-	} else if (db_type == ConfigConst.BD_ORACLE) {
-	    CallableStatement cstmt_ins_image_ro = null;
-	    query.append("{call ").append(tableName).append(" (").append(insert_fields)
-		    .append(")}");
-
-	    try {
-		cstmt_ins_image_ro = dbconn.prepareCall(query.toString());
-		cstmt_ins_image_ro.setInt(1, snapImageEvent_RO.getId_snap());
-		cstmt_ins_image_ro.setString(2, snapImageEvent_RO.getAttribute_complete_name());
-		cstmt_ins_image_ro.setInt(3, dim_x);
-		cstmt_ins_image_ro.setInt(4, dim_y);
-		if (dvalue != null) {
-		    cstmt_ins_image_ro.setString(5, valueStr.toString());
-		} else {
-		    cstmt_ins_image_ro.setNull(5, java.sql.Types.CLOB);
-		}
-
-		cstmt_ins_image_ro.executeUpdate();
-	    } catch (final SQLException e) {
-		String message = "";
-		if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_ImageData_RO() method..."
-			+ "\r\n\t\t Query : "
-			+ query
-			+ "\r\n\t\t Param 1 (Attribute name) : "
-			+ snapImageEvent_RO.getAttribute_complete_name()
-			+ "\r\n\t\t Param 2 (Id Snap)        : "
-			+ snapImageEvent_RO
-			+ "\r\n\t\t Param 3 (X Dimension)    : "
-			+ snapImageEvent_RO.getDim_x()
-			+ "\r\n\t\t Param 4 (Y Dimension)    : "
-			+ snapImageEvent_RO.getDim_y()
-			+ "\r\n\t\t Param 5 (Value)          : "
-			+ (dvalue == null ? null : valueStr.toString())
-			+ "\r\n\t\t Error Code               : "
-			+ e.getErrorCode()
-			+ "\r\n\t\t Message                  : "
-			+ e.getMessage()
-			+ "\r\n\t\t SQL state                : "
-			+ e.getSQLState()
-			+ "\r\n\t\t Stack                    : ";
-		e.printStackTrace();
-
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e);
-	    } finally {
-		try {
-		    if (cstmt_ins_image_ro != null) {
-			cstmt_ins_image_ro.close();
-		    }
-		} catch (final SQLException e) {
-		    e.printStackTrace();
-		}
-	    }
-	}
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
-    }
-
-    /**
-     * Inserts a read write type image data intyo the snapshot database.
-     * 
-     * @param snapImageEvent_RW
-     * @throws SnapshotingException
-     */
-    public void insert_ImageData_RW(final SnapImageEvent_RW snapImageEvent_RW)
-	    throws SnapshotingException {
-	final int dim_x = snapImageEvent_RW.getDim_x();
-	final int dim_y = snapImageEvent_RW.getDim_y();
-
-	final int dim_x_write = snapImageEvent_RW.getDim_x_write();
-	final int dim_y_write = snapImageEvent_RW.getDim_y_write();
-
-	final StringBuffer tableName = new StringBuffer().append(getDbSchema()).append(".").append(
-		GlobalConst.TABS[5]);
-
-	final StringBuffer valueReadStr = new StringBuffer();
-	final StringBuffer valueWriteStr = new StringBuffer();
-
-	final Double[][] readValue = snapImageEvent_RW.getImageValueRWRead();
-	final Double[][] writeValue = snapImageEvent_RW.getImageValueRWWrite();
-
-	if (readValue != null) {
-	    for (int i = 0; i < dim_y; i++) {
-		for (int j = 0; j < dim_x; j++) {
-		    valueReadStr.append(readValue[i][j]);
-		    if (j < dim_x - 1) {
-			valueReadStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_COLS).append(" ");
-		    }
-		}
-
-		if (i < dim_y - 1) {
-		    valueReadStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_ROWS).append(" ");
-		}
-	    }
-	}
-
-	if (writeValue != null) {
-	    for (int i = 0; i < dim_y_write; i++) {
-		for (int j = 0; j < dim_x_write; j++) {
-		    valueWriteStr.append(writeValue[i][j]);
-		    if (j < dim_x_write - 1) {
-			valueWriteStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_COLS).append(" ");
-		    }
-		}
-
-		if (i < dim_y_write - 1) {
-		    valueWriteStr.append(GlobalConst.CLOB_SEPARATOR_IMAGE_ROWS).append(" ");
-		}
-	    }
-	}
-	final StringBuffer query = new StringBuffer();
-	final StringBuffer insert_fields = new StringBuffer().append(GlobalConst.TAB_IM_RW_NUM[0])
-		.append(", ").append(GlobalConst.TAB_IM_RW_NUM[1]).append(", ").append(
-			GlobalConst.TAB_IM_RW_NUM[2]).append(", ").append(
-			GlobalConst.TAB_IM_RW_NUM[3]).append(", ").append(
-			GlobalConst.TAB_IM_RW_NUM[4]).append(", ").append(
-			GlobalConst.TAB_IM_RW_NUM[5]);
-	final StringBuffer insert_values = new StringBuffer("?, ?, ?, ?, ?");
-	if (db_type == ConfigConst.BD_MYSQL) {
-
-	    query.append("INSERT INTO ").append(tableName).append(" (").append(insert_fields)
-		    .append(")").append(" VALUES (").append(insert_values).append(")");
-
-	    PreparedStatement preparedStatement = null;
-	    try {
-		preparedStatement = dbconn.prepareStatement(query.toString());
-		preparedStatement.setInt(1, snapImageEvent_RW.getId_snap());
-		preparedStatement.setInt(2, snapImageEvent_RW.getId_att());
-		preparedStatement.setInt(3, dim_x);
-		preparedStatement.setInt(4, dim_y);
-
-	    } catch (final SQLException e1) {
-		String message = "";
-		if (e1.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e1.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_ImageData_RO() method...";
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e1);
-	    }
-	    try {
-		if (readValue != null) {
-		    preparedStatement.setString(5, valueReadStr.toString());
-		} else {
-		    preparedStatement.setNull(5, java.sql.Types.BLOB);
-		}
-
-		if (writeValue != null) {
-		    preparedStatement.setString(6, valueWriteStr.toString());
-		} else {
-		    preparedStatement.setNull(6, java.sql.Types.BLOB);
-		}
-		preparedStatement.executeUpdate();
-	    } catch (final SQLException e) {
-		final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			+ GlobalConst.QUERY_FAILURE;
-		final String reason = "Failed while executing DataBaseAPI.insert_ImageData_RO() method...";
-		final String desc = "Query : " + query;
-		throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	    } finally {
-		closeStatement(preparedStatement);
-	    }
-	} else if (db_type == ConfigConst.BD_ORACLE) {
-	    CallableStatement cstmt_ins_image_rw = null;
-	    query.append("{call ").append(tableName).append(" (").append(insert_fields)
-		    .append(")}");
-
-	    try {
-		cstmt_ins_image_rw = dbconn.prepareCall(query.toString());
-		cstmt_ins_image_rw.setInt(1, snapImageEvent_RW.getId_snap());
-		cstmt_ins_image_rw.setString(2, snapImageEvent_RW.getAttribute_complete_name());
-		cstmt_ins_image_rw.setInt(3, dim_x);
-		cstmt_ins_image_rw.setInt(4, dim_y);
-		if (readValue != null) {
-		    cstmt_ins_image_rw.setString(5, valueReadStr.toString());
-		} else {
-		    cstmt_ins_image_rw.setNull(5, java.sql.Types.CLOB);
-		}
-
-		if (writeValue != null) {
-		    cstmt_ins_image_rw.setString(6, valueWriteStr.toString());
-		} else {
-		    cstmt_ins_image_rw.setNull(6, java.sql.Types.CLOB);
-		}
-
-		cstmt_ins_image_rw.executeUpdate();
-	    } catch (final SQLException e) {
-		String message = "";
-		if (e.getMessage().equalsIgnoreCase(GlobalConst.COMM_FAILURE_ORACLE)
-			|| e.getMessage().indexOf(GlobalConst.COMM_FAILURE_MYSQL) != -1) {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.ADB_CONNECTION_FAILURE;
-		} else {
-		    message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-			    + GlobalConst.STATEMENT_FAILURE;
-		}
-
-		final String reason = GlobalConst.INSERT_FAILURE;
-		final String desc = "Failed while executing DataBaseApi.insert_ImageData_RO() method..."
-			+ "\r\n\t\t Query : "
-			+ query
-			+ "\r\n\t\t Param 1 (Attribute name) : "
-			+ snapImageEvent_RW.getAttribute_complete_name()
-			+ "\r\n\t\t Param 2 (Id Snap)        : "
-			+ snapImageEvent_RW
-			+ "\r\n\t\t Param 3 (X Dimension)    : "
-			+ snapImageEvent_RW.getDim_x()
-			+ "\r\n\t\t Param 4 (Y Dimension)    : "
-			+ snapImageEvent_RW.getDim_y()
-			+ "\r\n\t\t Param 5 (Read Value)     : "
-			+ (readValue == null ? null : readValue.toString())
-			+ "\r\n\t\t Param 6 (Write Value)    : "
-			+ (writeValue == null ? null : writeValue.toString())
-			+ "\r\n\t\t Error Code               : "
-			+ e.getErrorCode()
-			+ "\r\n\t\t Message                  : "
-			+ e.getMessage()
-			+ "\r\n\t\t SQL state                : "
-			+ e.getSQLState()
-			+ "\r\n\t\t Stack                    : ";
-		e.printStackTrace();
-
-		throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, this
-			.getClass().getName(), e);
-	    } finally {
-		try {
-		    if (cstmt_ins_image_rw != null) {
-			cstmt_ins_image_rw.close();
-		    }
-		} catch (final SQLException e) {
-		    e.printStackTrace();
-		}
-	    }
-	}
-	// Close the connection with the database
-	if (getAutoConnect()) {
-	    close();
-	}
-    }
-
-    /**
-     * Method that writes a read only type image data into a file.
-     * 
-     * @param rootPath
-     *            the root directory path into wich the file will be writen
-     * @param snapImageEvent_ro
-     *            the read only type image data
-     * @return the full path to the file (directory + file name)
-     * @throws SnapshotingException
-     */
-    public String writeInFile_SnapImageEvent_RO(final String rootPath,
-	    final SnapImageEvent_RO snapImageEvent_ro) throws SnapshotingException {
-	// String contextPath = root_dir + File.separator +
-	// snapImageEvent_ro.getId_snap();
-	final File snapDir = new File(rootPath);
-	if (!snapDir.exists()) {
-	    snapDir.mkdirs();
-	}
-
-	final String full_file_path = snapDir + File.separator + "snap_"
-		+ snapImageEvent_ro.getId_snap() + "_" + snapImageEvent_ro.getId_att() + ".txt";
-	try {
-	    final FileWriter fileWriter = new FileWriter(full_file_path);
-	    final BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
-	    bufferedWriter.write(snapImageEvent_ro.getId_snap() + ",");
-	    bufferedWriter.newLine();
-	    bufferedWriter.write(snapImageEvent_ro.getId_att() + ",");
-	    bufferedWriter.newLine();
-	    bufferedWriter.write(snapImageEvent_ro.getDim_x() + ",");
-	    bufferedWriter.newLine();
-	    bufferedWriter.write(snapImageEvent_ro.getDim_y() + ",");
-	    bufferedWriter.newLine();
-	    bufferedWriter.flush();
-
-	    final Double[][] value = snapImageEvent_ro.getImageValueRO();
-	    for (final Double[] element : value) { // lignes
-		for (int j = 0; j < element.length - 1; j++) { // colonnes
-		    bufferedWriter.write(element[j] + "\t");
-		}
-		bufferedWriter.write(element[element.length - 1] + "");
-		bufferedWriter.newLine();
-		bufferedWriter.flush();
-	    }
-	    bufferedWriter.newLine();
-	    bufferedWriter.write("%%%");
-	    bufferedWriter.flush();
-	    bufferedWriter.close();
-	    fileWriter.close();
-	} catch (final IOException e) {
-	    final String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX + " : "
-		    + GlobalConst.WRITING_FILE_EXCEPTION;
-	    final String reason = "Failed while executing DataBaseAPI.writeInFile_SnapImageEvent_RO() method...";
-	    final String desc = "";
-	    throw new SnapshotingException(message, reason, ErrSeverity.PANIC, desc, "", e);
-	}
-	return full_file_path;
-    }
-
-    /*****************************************************************************
-     * 
-     * 
-     * Miscellaneous others methods used by the API
-     * 
-     * 
-     ****************************************************************************/
-
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Build a array of String with the given String
-     * Vector
-     * 
-     * @param my_vector
-     *            The given String Vector
-     * @return a String type array that contains the differents vector's String
-     *         type elements <br>
-     *         ******************************************************************
-     *         *******
-     */
-    private String[] toStringArray(final Vector my_vector) {
-	String[] my_array;
-	my_array = new String[my_vector.size()];
-	for (int i = 0; i < my_vector.size(); i++) {
-	    my_array[i] = (String) my_vector.elementAt(i);
-	}
-	return my_array;
-    }
-
-    /**
-     * ************************************************************************
-     * <b>Description : </b> Build a array of Double with the given Double
-     * Vector
-     * 
-     * @param my_vector
-     *            The given Double Vector
-     * @return a Double type array that contains the differents vector's Double
-     *         type elements <br>
-     *         ******************************************************************
-     *         *******
-     */
-    /*
-     * private double[] toDoubleArray(Vector my_vector) { double[] my_array;
-     * my_array = new double[ my_vector.size() ]; for ( int i = 0 ; i <
-     * my_vector.size() ; i++ ) { my_array[ i ] = ( ( Double )
-     * my_vector.elementAt(i) ).doubleValue(); } return my_array; }
-     * 
-     * private int[] toIntArray(Vector my_vector) { int[] my_array; my_array =
-     * new int[ my_vector.size() ]; for ( int i = 0 ; i < my_vector.size() ; i++
-     * ) { my_array[ i ] = ( ( Integer ) my_vector.elementAt(i) ).intValue(); }
-     * return my_array; }
-     * 
-     * private Object[] toArray(Vector my_vector) { Object[] my_array; my_array
-     * = new Object[ my_vector.size() ]; for ( int i = 0 ; i < my_vector.size()
-     * ; i++ ) { my_array[ i ] = ( ( Object ) my_vector.elementAt(i) ); } return
-     * my_array; }
-     */
-
     /**
      * @return Returns the currentSpectrumDimX.
      */
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/GetConf.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/GetConf.java
index 5ebe042..c215666 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/GetConf.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/GetConf.java
@@ -47,140 +47,128 @@ import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.GlobalConst;
 import fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapshotingException;
 
 public class GetConf {
-	private static final String m_hostProperty = "dbHost";
-	private static final String m_nameProperty = "dbName";
-	private static final String m_schemaProperty = "dbSchema";
-	private static final String m_typeProperty = "dbType";
-	// private static final String m_userProperty = "dbUser";
-	// private static final String m_passProperty = "dbPassword";
-	private static final String m_facilityProperty = "facility";
+    private static final String m_hostProperty = "dbHost";
+    private static final String m_nameProperty = "dbName";
+    private static final String m_schemaProperty = "dbSchema";
+    private static final String m_typeProperty = "dbType";
+    // private static final String m_userProperty = "dbUser";
+    // private static final String m_passProperty = "dbPassword";
+    private static final String m_facilityProperty = "facility";
+    private static final String IS_RAC = "isRac";
+    private static final String USER = "DbUser";
+    private static final String PWD = "DbPassword";
 
-	/**
-	 * return the host property define for the given class
-	 * 
-	 * @param className
-	 *            , the name of the class
-	 */
-	public static String getHost(String className) throws SnapshotingException {
-		String propname = m_hostProperty;
-		try {
-			Database dbase = ApiUtil.get_db_obj();
-			String property = new String();
-			DbDatum dbdatum = dbase.get_class_property(className, propname);
-			if (!dbdatum.is_empty())
-				property = dbdatum.extractString();
-			return property;
-		} catch (DevFailed devFailed) {
-			String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
-			String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or "
-					+ propname + " property missing...";
-			String desc = "Failed while executing GetConf.getHost() method...";
-			throw new SnapshotingException(message, reason, ErrSeverity.WARN,
-					desc, "", devFailed);
-		}
-	}
+    /**
+     * return the host property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     */
+    public static String getHost(String className) throws SnapshotingException {
+	return getClassProperty(className, m_hostProperty);
+    }
 
-	/**
-	 * return the name property define for the given class
-	 * 
-	 * @param className
-	 *            , the name of the class
-	 */
-	public static String getName(String className) throws SnapshotingException {
-		String propname = m_nameProperty;
-		try {
-			Database dbase = ApiUtil.get_db_obj();
-			String property = new String();
-			DbDatum dbdatum = dbase.get_class_property(className, propname);
-			if (!dbdatum.is_empty())
-				property = dbdatum.extractString();
-			return property;
-		} catch (DevFailed devFailed) {
-			String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
-			String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or "
-					+ propname + " property missing...";
-			String desc = "Failed while executing GetConf.getName() method...";
-			throw new SnapshotingException(message, reason, ErrSeverity.WARN,
-					desc, "", devFailed);
-		}
-	}
+    /**
+     * return the name property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     */
+    public static String getName(String className) throws SnapshotingException {
+	return getClassProperty(className, m_nameProperty);
+    }
+
+    /**
+     * return the name property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     */
+    public static String getSchema(String className) throws SnapshotingException {
+	return getClassProperty(className, m_schemaProperty);
+    }
+
+    public static String getUser(String className) throws SnapshotingException {
+	return getClassProperty(className, USER);
+    }
 
-	/**
-	 * return the name property define for the given class
-	 * 
-	 * @param className
-	 *            , the name of the class
-	 */
-	public static String getSchema(String className)
-			throws SnapshotingException {
-		String propname = m_schemaProperty;
-		try {
-			Database dbase = ApiUtil.get_db_obj();
-			String property = new String();
-			DbDatum dbdatum = dbase.get_class_property(className, propname);
-			if (!dbdatum.is_empty())
-				property = dbdatum.extractString();
-			return property;
-		} catch (DevFailed devFailed) {
-			String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
-			String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or "
-					+ propname + " property missing...";
-			String desc = "Failed while executing GetConf.getSchema() method...";
-			throw new SnapshotingException(message, reason, ErrSeverity.WARN,
-					desc, "", devFailed);
-		}
+    public static String getPwd(String className) throws SnapshotingException {
+	return getClassProperty(className, PWD);
+    }
+
+    /**
+     * return the name property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     */
+    public static String isRAC(String className) throws SnapshotingException {
+	return getClassProperty(className, IS_RAC);
+    }
+
+    private static String getClassProperty(String className, String propName) throws SnapshotingException {
+	try {
+	    Database dbase = ApiUtil.get_db_obj();
+	    String property = "";
+	    DbDatum dbdatum = dbase.get_class_property(className, propName);
+	    if (!dbdatum.is_empty()) {
+		property = dbdatum.extractString();
+	    }
+	    System.out.println(propName + ": " + property + " from class property " + className);
+	    return property;
+	} catch (DevFailed devFailed) {
+	    throw new SnapshotingException(devFailed);
 	}
+    }
 
-	/**
-	 * return the name property define for the given class
-	 * 
-	 * @param className
-	 *            , the name of the class
-	 */
-	public static int getType(String className) throws SnapshotingException {
-		String propname = m_typeProperty;
-		try {
-			Database dbase = ApiUtil.get_db_obj();
-			int property = ConfigConst.BD_MYSQL;
-			DbDatum dbdatum = dbase.get_class_property(className, propname);
-			if (!dbdatum.is_empty())
-				property = dbdatum.extractLong();
-			return property;
-		} catch (DevFailed devFailed) {
-			String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
-			String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or "
-					+ propname + " property missing...";
-			String desc = "Failed while executing GetConf.getType() method...";
-			throw new SnapshotingException(message, reason, ErrSeverity.WARN,
-					desc, "", devFailed);
-		}
+    /**
+     * return the name property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     */
+    public static int getType(String className) throws SnapshotingException {
+	String propname = m_typeProperty;
+	try {
+	    Database dbase = ApiUtil.get_db_obj();
+	    int property = ConfigConst.BD_MYSQL;
+	    DbDatum dbdatum = dbase.get_class_property(className, propname);
+	    if (!dbdatum.is_empty()) {
+		property = dbdatum.extractLong();
+	    }
+	    return property;
+	} catch (DevFailed devFailed) {
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
+	    String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or " + propname + " property missing...";
+	    String desc = "Failed while executing GetConf.getType() method...";
+	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, "", devFailed);
 	}
 
-	/**
-	 * return the facility property define for the given class
-	 * 
-	 * @param className
-	 *            , the name of the class
-	 * @throws SnapshotingException
-	 */
-	public static boolean getFacility(String className)
-			throws SnapshotingException {
-		String propname = m_facilityProperty;
-		try {
-			Database dbase = ApiUtil.get_db_obj();
-			boolean property = false;
-			propname = m_facilityProperty;
-			DbDatum dbdatum = dbase.get_class_property(className, propname);
-			if (!dbdatum.is_empty())
-				property = dbdatum.extractBoolean();
-			return property;
-		} catch (DevFailed devFailed) {
-			String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
-			String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or "
-					+ propname + " property missing...";
-			String desc = "Failed while executing GetConf.getFacility() method...";
-			throw new SnapshotingException(message, reason, ErrSeverity.WARN,
-					desc, "", devFailed);
-		}
+    }
+
+    /**
+     * return the facility property define for the given class
+     * 
+     * @param className
+     *            , the name of the class
+     * @throws SnapshotingException
+     */
+    public static boolean getFacility(String className) throws SnapshotingException {
+	String propname = m_facilityProperty;
+	try {
+	    Database dbase = ApiUtil.get_db_obj();
+	    boolean property = false;
+	    propname = m_facilityProperty;
+	    DbDatum dbdatum = dbase.get_class_property(className, propname);
+	    if (!dbdatum.is_empty()) {
+		property = dbdatum.extractBoolean();
+	    }
+	    return property;
+	} catch (DevFailed devFailed) {
+	    String message = GlobalConst.SNAPSHOTING_ERROR_PREFIX;
+	    String reason = GlobalConst.TANGO_COMM_EXCEPTION + " or " + propname + " property missing...";
+	    String desc = "Failed while executing GetConf.getFacility() method...";
+	    throw new SnapshotingException(message, reason, ErrSeverity.WARN, desc, "", devFailed);
 	}
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SnapshotPersistenceManagerFactory.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SnapshotPersistenceManagerFactory.java
index 2367b1c..7e6eeb2 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SnapshotPersistenceManagerFactory.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SnapshotPersistenceManagerFactory.java
@@ -25,32 +25,16 @@
 package fr.soleil.snapArchivingApi.SnapshotingApi.persistence;
 
 public class SnapshotPersistenceManagerFactory {
-	private static SnapshotPersistenceManagerFactory instance;
+    private static SnapshotPersistenceManagerFactory instance = new SnapshotPersistenceManagerFactory();
 
-	private String beansFileName;
-	private SnapshotPersistenceManager manager;
+    private SnapshotPersistenceManagerFactory() {
+    }
 
-	private SnapshotPersistenceManagerFactory(String _beansFileName) {
-		this.beansFileName = _beansFileName;
-	}
+    public static SnapshotPersistenceManagerFactory getInstance() {
+	return instance;
+    }
 
-	public static SnapshotPersistenceManagerFactory getInstance(
-			String _beansFileName) {
-		if (instance == null) {
-			instance = new SnapshotPersistenceManagerFactory(_beansFileName);
-		}
-		return instance;
-	}
-
-	public static SnapshotPersistenceManagerFactory getInstance() {
-		return getInstance(null);
-	}
-
-	public SnapshotPersistenceManager getManager() {
-		if (manager == null) {
-			manager = new SpringSnapshotPersistenceManagerImpl(
-					this.beansFileName);
-		}
-		return manager;
-	}
+    public SnapshotPersistenceManager getManager(String beansFileName, String userName, String password) {
+	return new SpringSnapshotPersistenceManagerImpl(beansFileName, userName, password);
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SpringSnapshotPersistenceManagerImpl.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SpringSnapshotPersistenceManagerImpl.java
index 941478c..f8d0e0a 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SpringSnapshotPersistenceManagerImpl.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/SpringSnapshotPersistenceManagerImpl.java
@@ -1,5 +1,7 @@
 package fr.soleil.snapArchivingApi.SnapshotingApi.persistence;
 
+import java.util.Arrays;
+
 import fr.esrf.Tango.AttrDataFormat;
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.TangoDs.TangoConst;
@@ -17,64 +19,61 @@ import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.ScStr2Va
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Sp1Val;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Sp2Val;
 
-public class SpringSnapshotPersistenceManagerImpl implements
-		SnapshotPersistenceManager {
-	private DAOBeansLoader beans;
-
-	SpringSnapshotPersistenceManagerImpl(String beansFileName) {
-		this.beans = new ClasspathDAOBeansLoader(beansFileName);
-	}
+public class SpringSnapshotPersistenceManagerImpl implements SnapshotPersistenceManager {
+    private final DAOBeansLoader beans;
 
-	public void store(AnyAttribute attribute,
-			PersistenceContext persistenceContext) throws Exception {
-		SnapshotPersistenceContext context = (SnapshotPersistenceContext) persistenceContext;
+    SpringSnapshotPersistenceManagerImpl(String beansFileName, String userName, String password) {
+	this.beans = new ClasspathDAOBeansLoader(beansFileName, userName, password);
+    }
 
-		switch (attribute.getFormat())// a remplacer par un
-										// AnyAttribute.getManager si possible??
-		{
-		case AttrDataFormat._SCALAR:
-			if (attribute.getWritable() == AttrWriteType._READ) {
-				if (attribute.getType() == TangoConst.Tango_DEV_STRING) {
-					beans.getScStr1ValDAO().create(
-							new ScStr1Val(attribute, context));
-				} else {
-					beans.getScNum1ValDAO().create(
-							new ScNum1Val(attribute, context));
-				}
-			} else {
-				if (attribute.getType() == TangoConst.Tango_DEV_STRING) {
-					beans.getScStr2ValDAO().create(
-							new ScStr2Val(attribute, context));
-				} else {
-					beans.getScNum2ValDAO().create(
-							new ScNum2Val(attribute, context));
-				}
-			}
-			break;
+    @Override
+    public void store(AnyAttribute attribute, PersistenceContext persistenceContext) throws Exception {
+	SnapshotPersistenceContext context = (SnapshotPersistenceContext) persistenceContext;
+	System.out.println("SpringSnapshotPersistenceManagerImpl.store " + attribute.getCompleteName() + " - values: "
+		+ Arrays.toString(attribute.getConvertedStringValuesTable()));
+	switch (attribute.getFormat())// a remplacer par un
+				      // AnyAttribute.getManager si possible??
+	{
+	case AttrDataFormat._SCALAR:
+	    if (attribute.getWritable() == AttrWriteType._READ) {
+		if (attribute.getType() == TangoConst.Tango_DEV_STRING) {
+		    beans.getScStr1ValDAO().create(new ScStr1Val(attribute, context));
+		} else {
+		    beans.getScNum1ValDAO().create(new ScNum1Val(attribute, context));
+		}
+	    } else {
+		if (attribute.getType() == TangoConst.Tango_DEV_STRING) {
+		    beans.getScStr2ValDAO().create(new ScStr2Val(attribute, context));
+		} else {
+		    beans.getScNum2ValDAO().create(new ScNum2Val(attribute, context));
+		}
+	    }
+	    break;
 
-		case AttrDataFormat._SPECTRUM:
-			if (attribute.getWritable() == AttrWriteType._READ) {
-				beans.getSp1ValDAO().create(new Sp1Val(attribute, context));
-			} else {
-				beans.getSp2ValDAO().create(new Sp2Val(attribute, context));
-			}
+	case AttrDataFormat._SPECTRUM:
+	    if (attribute.getWritable() == AttrWriteType._READ) {
+		beans.getSp1ValDAO().create(new Sp1Val(attribute, context));
+	    } else {
+		beans.getSp2ValDAO().create(new Sp2Val(attribute, context));
+	    }
 
-			break;
+	    break;
 
-		case AttrDataFormat._IMAGE:
-			if (attribute.getWritable() == AttrWriteType._READ) {
-				beans.getIm1ValDAO().create(new Im1Val(attribute, context));
-			} else {
-				beans.getIm2ValDAO().create(new Im2Val(attribute, context));
-			}
-			break;
-		}
+	case AttrDataFormat._IMAGE:
+	    if (attribute.getWritable() == AttrWriteType._READ) {
+		beans.getIm1ValDAO().create(new Im1Val(attribute, context));
+	    } else {
+		beans.getIm2ValDAO().create(new Im2Val(attribute, context));
+	    }
+	    break;
 	}
+    }
 
-	/**
-	 * @return the beansFileName
-	 */
-	public String getResourceName() {
-		return this.beans.getResourceName();
-	}
+    /**
+     * @return the beansFileName
+     */
+    @Override
+    public String getResourceName() {
+	return this.beans.getResourceName();
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/AbstractValDAO.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/AbstractValDAO.java
index 4f4f281..da8e735 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/AbstractValDAO.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/AbstractValDAO.java
@@ -7,25 +7,28 @@ import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Composit
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Val;
 
 public abstract class AbstractValDAO<V extends Val> implements ValDAO<V> {
-	protected HibernateTemplate hibernateTemplate;
+    protected HibernateTemplate hibernateTemplate;
 
-	public AbstractValDAO(SessionFactory sessionFactory) {
-		this.hibernateTemplate = new HibernateTemplate(sessionFactory);
-	}
+    public AbstractValDAO(SessionFactory sessionFactory) {
+	this.hibernateTemplate = new HibernateTemplate(sessionFactory);
+    }
 
-	public V create(V line) {
-		hibernateTemplate.save(line);
-		// throw new RuntimeException(); Uncomment to test correct rollback
-		// management
-		return line;
-	}
+    @Override
+    public V create(V line) {
+	System.out.println("AbstractValDAO. hibernate save " + line);
+	hibernateTemplate.save(line);
+	// throw new RuntimeException(); Uncomment to test correct rollback
+	// management
+	return line;
+    }
 
-	public V findByKey(CompositeId compositeId) {
-		Class<V> valueClass = this.getValueClass();
-		Object res = hibernateTemplate.get(valueClass, compositeId);
-		V line = valueClass.cast(res);
-		return line;
-	}
+    @Override
+    public V findByKey(CompositeId compositeId) {
+	Class<V> valueClass = this.getValueClass();
+	Object res = hibernateTemplate.get(valueClass, compositeId);
+	V line = valueClass.cast(res);
+	return line;
+    }
 
-	protected abstract Class<V> getValueClass();
+    protected abstract Class<V> getValueClass();
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/ClasspathDAOBeansLoader.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/ClasspathDAOBeansLoader.java
index 5c86bb3..60c478b 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/ClasspathDAOBeansLoader.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dao/ClasspathDAOBeansLoader.java
@@ -24,8 +24,10 @@
  */
 package fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dao;
 
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.apache.commons.dbcp.BasicDataSource;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ClassPathResource;
 
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Im1Val;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Im2Val;
@@ -37,103 +39,127 @@ import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Sp1Val;
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto.Sp2Val;
 
 public class ClasspathDAOBeansLoader implements DAOBeansLoader {
-	private static final String DEFAULT_BEANS_FILE_NAME = "beans.xml";
-	private String resourceName;
-
-	private ValDAO<ScNum1Val> scNum1ValDAO;
-	private ValDAO<ScNum2Val> scNum2ValDAO;
-	private ValDAO<ScStr1Val> scStr1ValDAO;
-	private ValDAO<ScStr2Val> scStr2ValDAO;
-	private ValDAO<Sp1Val> sp1ValDAO;
-	private ValDAO<Sp2Val> sp2ValDAO;
-	private ValDAO<Im1Val> im1ValDAO;
-	private ValDAO<Im2Val> im2ValDAO;
-
-	public ClasspathDAOBeansLoader(String _resourceName) {
-		boolean defaultResource = _resourceName == null
-				|| _resourceName.trim().length() == 0;
-		this.resourceName = defaultResource ? DEFAULT_BEANS_FILE_NAME
-				: _resourceName;
-
-		AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
-				this.resourceName);
-		// AbstractApplicationContext ctx = new FileSystemXmlApplicationContext
-		// ( this.resourceName );
-
-		ctx.registerShutdownHook();// Shuts down the Spring IoC container
-									// gracefully in non-web applications
-		this.instantiateBeans(ctx);
-	}
-
-	@SuppressWarnings("unchecked")
-	private void instantiateBeans(AbstractApplicationContext ctx) {
-		scNum1ValDAO = (ValDAO<ScNum1Val>) ctx.getBean("scNum1ValDAO");
-		scNum2ValDAO = (ValDAO<ScNum2Val>) ctx.getBean("scNum2ValDAO");
-		scStr1ValDAO = (ValDAO<ScStr1Val>) ctx.getBean("scStr1ValDAO");
-		scStr2ValDAO = (ValDAO<ScStr2Val>) ctx.getBean("scStr2ValDAO");
-		sp1ValDAO = (ValDAO<Sp1Val>) ctx.getBean("sp1ValDAO");
-		sp2ValDAO = (ValDAO<Sp2Val>) ctx.getBean("sp2ValDAO");
-		im1ValDAO = (ValDAO<Im1Val>) ctx.getBean("im1ValDAO");
-		im2ValDAO = (ValDAO<Im2Val>) ctx.getBean("im2ValDAO");
-	}
-
-	/**
-	 * @return the im1ValDAO
-	 */
-	public ValDAO<Im1Val> getIm1ValDAO() {
-		return this.im1ValDAO;
-	}
-
-	/**
-	 * @return the im2ValDAO
-	 */
-	public ValDAO<Im2Val> getIm2ValDAO() {
-		return this.im2ValDAO;
-	}
-
-	/**
-	 * @return the scNum1ValDAO
-	 */
-	public ValDAO<ScNum1Val> getScNum1ValDAO() {
-		return this.scNum1ValDAO;
-	}
-
-	/**
-	 * @return the scNum2ValDAO
-	 */
-	public ValDAO<ScNum2Val> getScNum2ValDAO() {
-		return this.scNum2ValDAO;
-	}
-
-	/**
-	 * @return the scStr1ValDAO
-	 */
-	public ValDAO<ScStr1Val> getScStr1ValDAO() {
-		return this.scStr1ValDAO;
-	}
-
-	/**
-	 * @return the scStr2ValDAO
-	 */
-	public ValDAO<ScStr2Val> getScStr2ValDAO() {
-		return this.scStr2ValDAO;
-	}
-
-	/**
-	 * @return the sp1ValDAO
-	 */
-	public ValDAO<Sp1Val> getSp1ValDAO() {
-		return this.sp1ValDAO;
-	}
-
-	/**
-	 * @return the sp2ValDAO
-	 */
-	public ValDAO<Sp2Val> getSp2ValDAO() {
-		return this.sp2ValDAO;
-	}
-
-	public String getResourceName() {
-		return this.resourceName;
+    private static final String DEFAULT_BEANS_FILE_NAME = "beans.xml";
+    private final String resourceName;
+
+    private ValDAO<ScNum1Val> scNum1ValDAO;
+    private ValDAO<ScNum2Val> scNum2ValDAO;
+    private ValDAO<ScStr1Val> scStr1ValDAO;
+    private ValDAO<ScStr2Val> scStr2ValDAO;
+    private ValDAO<Sp1Val> sp1ValDAO;
+    private ValDAO<Sp2Val> sp2ValDAO;
+    private ValDAO<Im1Val> im1ValDAO;
+    private ValDAO<Im2Val> im2ValDAO;
+
+    public ClasspathDAOBeansLoader(String _resourceName, String userName, String password) {
+	boolean defaultResource = _resourceName == null || _resourceName.trim().length() == 0;
+	this.resourceName = defaultResource ? DEFAULT_BEANS_FILE_NAME : _resourceName;
+	System.out.println("configure hibernate resource: " + _resourceName);
+	// AbstractApplicationContext ctx = new
+	// ClassPathXmlApplicationContext(this.resourceName);
+	BeanFactory factory = new XmlBeanFactory(new ClassPathResource(this.resourceName));
+	// AbstractApplicationContext ctx = new FileSystemXmlApplicationContext
+	// ( this.resourceName );
+	if (factory.getBean("dataSource") instanceof BasicDataSource) {
+	    BasicDataSource datasource = (BasicDataSource) factory.getBean("dataSource");
+	    System.out.println("configure dataSource userName: " + userName);
+	    System.out.println("configure dataSource password " + password);
+	    datasource.setUsername(userName);
+	    datasource.setPassword(password);
 	}
+	// factory.
+	// AbstractApplicationContext ctx = new
+	// ClassPathXmlApplicationContext(this.resourceName);
+	// factory.registerShutdownHook();// Shuts down the
+	// Spring IoC
+	// container
+	// gracefully in
+	// non-web
+	// applications
+	this.instantiateBeans(factory);
+	System.out.println("ClasspathDAOBeansLoader out");
+    }
+
+    @SuppressWarnings("unchecked")
+    private void instantiateBeans(BeanFactory ctx) {
+	System.out.println("instantiateBeans in");
+	scNum1ValDAO = (ValDAO<ScNum1Val>) ctx.getBean("scNum1ValDAO");
+	scNum2ValDAO = (ValDAO<ScNum2Val>) ctx.getBean("scNum2ValDAO");
+	scStr1ValDAO = (ValDAO<ScStr1Val>) ctx.getBean("scStr1ValDAO");
+	scStr2ValDAO = (ValDAO<ScStr2Val>) ctx.getBean("scStr2ValDAO");
+	sp1ValDAO = (ValDAO<Sp1Val>) ctx.getBean("sp1ValDAO");
+	sp2ValDAO = (ValDAO<Sp2Val>) ctx.getBean("sp2ValDAO");
+	im1ValDAO = (ValDAO<Im1Val>) ctx.getBean("im1ValDAO");
+	im2ValDAO = (ValDAO<Im2Val>) ctx.getBean("im2ValDAO");
+	System.out.println("instantiateBeans out");
+    }
+
+    /**
+     * @return the im1ValDAO
+     */
+    @Override
+    public ValDAO<Im1Val> getIm1ValDAO() {
+	return this.im1ValDAO;
+    }
+
+    /**
+     * @return the im2ValDAO
+     */
+    @Override
+    public ValDAO<Im2Val> getIm2ValDAO() {
+	return this.im2ValDAO;
+    }
+
+    /**
+     * @return the scNum1ValDAO
+     */
+    @Override
+    public ValDAO<ScNum1Val> getScNum1ValDAO() {
+	return this.scNum1ValDAO;
+    }
+
+    /**
+     * @return the scNum2ValDAO
+     */
+    @Override
+    public ValDAO<ScNum2Val> getScNum2ValDAO() {
+	return this.scNum2ValDAO;
+    }
+
+    /**
+     * @return the scStr1ValDAO
+     */
+    @Override
+    public ValDAO<ScStr1Val> getScStr1ValDAO() {
+	return this.scStr1ValDAO;
+    }
+
+    /**
+     * @return the scStr2ValDAO
+     */
+    @Override
+    public ValDAO<ScStr2Val> getScStr2ValDAO() {
+	return this.scStr2ValDAO;
+    }
+
+    /**
+     * @return the sp1ValDAO
+     */
+    @Override
+    public ValDAO<Sp1Val> getSp1ValDAO() {
+	return this.sp1ValDAO;
+    }
+
+    /**
+     * @return the sp2ValDAO
+     */
+    @Override
+    public ValDAO<Sp2Val> getSp2ValDAO() {
+	return this.sp2ValDAO;
+    }
+
+    @Override
+    public String getResourceName() {
+	return this.resourceName;
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/CompositeId.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/CompositeId.java
index fea6672..ff4f557 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/CompositeId.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/CompositeId.java
@@ -27,77 +27,85 @@ package fr.soleil.snapArchivingApi.SnapshotingApi.persistence.spring.dto;
 import java.io.Serializable;
 
 public class CompositeId implements Serializable {
-	private int idSnap;
-	private int idAtt;
+    private int idSnap;
+    private int idAtt;
 
-	public CompositeId() {
+    public CompositeId() {
 
-	}
+    }
 
-	@Override
-	public int hashCode() {
-		// using prime numbers to reduce odds of common product for different
-		// key fields (the odds don't have to be 0, but performance benefits
-		// from low odds)
-		return 7 * idAtt + 11 * idSnap;
-	}
+    @Override
+    public int hashCode() {
+	// using prime numbers to reduce odds of common product for different
+	// key fields (the odds don't have to be 0, but performance benefits
+	// from low odds)
+	return 7 * idAtt + 11 * idSnap;
+    }
 
-	@Override
-	public boolean equals(Object otherObject) {
-		if (otherObject == null) {
-			return false;
-		}
-
-		if (this == otherObject) {
-			return true;
-		}
-
-		if (this.getClass() != otherObject.getClass()) {
-			return false;
-		}
-
-		CompositeId other = (CompositeId) otherObject;
-		if (other.idAtt != this.idAtt) {
-			return false;
-		}
-		if (other.idSnap != this.idSnap) {
-			return false;
-		}
-
-		return true;
+    @Override
+    public boolean equals(Object otherObject) {
+	if (otherObject == null) {
+	    return false;
 	}
 
-	/**
-	 * @return the idAtt
-	 */
-	public int getIdAtt() {
-		return this.idAtt;
+	if (this == otherObject) {
+	    return true;
 	}
 
-	/**
-	 * @param idAtt
-	 *            the idAtt to set
-	 */
-	public void setIdAtt(int idAtt) {
-		this.idAtt = idAtt;
+	if (this.getClass() != otherObject.getClass()) {
+	    return false;
 	}
 
-	/**
-	 * @return the idSnap
-	 */
-	public int getIdSnap() {
-		return this.idSnap;
+	CompositeId other = (CompositeId) otherObject;
+	if (other.idAtt != this.idAtt) {
+	    return false;
 	}
-
-	/**
-	 * @param idSnap
-	 *            the idSnap to set
-	 */
-	public void setIdSnap(int idSnap) {
-		this.idSnap = idSnap;
+	if (other.idSnap != this.idSnap) {
+	    return false;
 	}
 
-	public void trace() {
-		System.out.println(this + "/idSnap/" + idSnap + "/idAtt/" + idAtt);
-	}
+	return true;
+    }
+
+    /**
+     * @return the idAtt
+     */
+    public int getIdAtt() {
+	return this.idAtt;
+    }
+
+    /**
+     * @param idAtt
+     *            the idAtt to set
+     */
+    public void setIdAtt(int idAtt) {
+	this.idAtt = idAtt;
+    }
+
+    /**
+     * @return the idSnap
+     */
+    public int getIdSnap() {
+	return this.idSnap;
+    }
+
+    /**
+     * @param idSnap
+     *            the idSnap to set
+     */
+    public void setIdSnap(int idSnap) {
+	this.idSnap = idSnap;
+    }
+
+    public void trace() {
+	System.out.println(this + "/idSnap/" + idSnap + "/idAtt/" + idAtt);
+    }
+
+    @Override
+    public String toString() {
+	StringBuilder sb = new StringBuilder();
+	sb.append("[idSnap=").append(idSnap);
+	sb.append(",idAtt=").append(idAtt).append("]");
+	return sb.toString();
+    }
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/Val.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/Val.java
index c867e9c..d88b1c7 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/Val.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingApi/persistence/spring/dto/Val.java
@@ -6,35 +6,43 @@ import fr.soleil.actiongroup.collectiveaction.onattributes.plugin.persistance.An
 import fr.soleil.snapArchivingApi.SnapshotingApi.persistence.context.SnapshotPersistenceContext;
 
 public class Val {
-	private CompositeId compositeId;
-
-	public Val() {
-		this.compositeId = new CompositeId();
-	}
-
-	public Val(AnyAttribute attribute, SnapshotPersistenceContext context) {
-		this();
-
-		int snapId = context.getSnapId();
-		Map<String, Integer> attributeIds = context.getAttributeIds();
-		int attributeId = attributeIds.get(attribute.getCompleteName());
-
-		this.compositeId.setIdSnap(snapId);
-		this.compositeId.setIdAtt(attributeId);
-	}
-
-	/**
-	 * @return the compositeId
-	 */
-	public CompositeId getCompositeId() {
-		return this.compositeId;
-	}
-
-	/**
-	 * @param compositeId
-	 *            the compositeId to set
-	 */
-	public void setCompositeId(CompositeId compositeId) {
-		this.compositeId = compositeId;
-	}
+    private CompositeId compositeId;
+
+    public Val() {
+	this.compositeId = new CompositeId();
+    }
+
+    public Val(AnyAttribute attribute, SnapshotPersistenceContext context) {
+	this();
+
+	int snapId = context.getSnapId();
+	Map<String, Integer> attributeIds = context.getAttributeIds();
+	int attributeId = attributeIds.get(attribute.getCompleteName());
+
+	this.compositeId.setIdSnap(snapId);
+	this.compositeId.setIdAtt(attributeId);
+    }
+
+    /**
+     * @return the compositeId
+     */
+    public CompositeId getCompositeId() {
+	return this.compositeId;
+    }
+
+    /**
+     * @param compositeId
+     *            the compositeId to set
+     */
+    public void setCompositeId(CompositeId compositeId) {
+	this.compositeId = compositeId;
+    }
+
+    @Override
+    public String toString() {
+	StringBuilder sb = new StringBuilder();
+	sb.append("compositeId=").append(compositeId);
+	return sb.toString();
+    }
+
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapContext.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapContext.java
index 0695b5a..76b1dcf 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapContext.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapContext.java
@@ -33,6 +33,7 @@
 package fr.soleil.snapArchivingApi.SnapshotingTools.Tools;
 
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * <p/>
@@ -58,336 +59,314 @@ import java.util.ArrayList;
  * @see fr.soleil.snapArchivingApi.SnapshotingTools.Tools.SnapAttributeHeavy
  */
 public class SnapContext {
-	private String author_name = "";
-	private String name = "";
-	private int id = 0;
-	private java.sql.Date creation_date = null;
-	private String reason = "";
-	private String description = "";
-	private ArrayList attributeList = null;
+    private String author_name = "";
+    private String name = "";
+    private int id = 0;
+    private java.sql.Date creation_date;
+    private String reason = "";
+    private String description = "";
+    private List<SnapAttributeLight> attributeList = new ArrayList<SnapAttributeLight>();
 
-	/**
-	 * Default constructor Creates a new instance of SnapAttributeHeavy
-	 * 
-	 * @see #SnapContext(String author_name, String name, java.sql.Date
-	 *      creation_date)
-	 * @see #SnapContext(String author_name, String name, int id, java.sql.Date
-	 *      creation_date, String reason, String description)
-	 */
-	public SnapContext() {
-	}
+    /**
+     * Default constructor Creates a new instance of SnapAttributeHeavy
+     * 
+     * @see #SnapContext(String author_name, String name, java.sql.Date
+     *      creation_date)
+     * @see #SnapContext(String author_name, String name, int id, java.sql.Date
+     *      creation_date, String reason, String description)
+     */
+    public SnapContext() {
+    }
 
-	/**
-	 * This constructor takes several parameters as inputs.
-	 * 
-	 * @param author_name
-	 *            the context <I>author's name</I>
-	 * @param name
-	 *            the context <I>name</I>
-	 * @param creation_date
-	 *            the context <I>creation date</I>
-	 * @see #SnapContext()
-	 * @see #SnapContext(String author_name, String name, java.sql.Date
-	 *      creation_date)
-	 * @see #SnapContext(String[] argin)
-	 */
-	public SnapContext(String author_name, String name,
-			java.sql.Date creation_date) {
-		this.author_name = author_name;
-		this.name = name;
-		this.creation_date = creation_date;
-	}
+    /**
+     * This constructor takes several parameters as inputs.
+     * 
+     * @param author_name
+     *            the context <I>author's name</I>
+     * @param name
+     *            the context <I>name</I>
+     * @param creation_date
+     *            the context <I>creation date</I>
+     * @see #SnapContext()
+     * @see #SnapContext(String author_name, String name, java.sql.Date
+     *      creation_date)
+     * @see #SnapContext(String[] argin)
+     */
+    public SnapContext(String author_name, String name, java.sql.Date creation_date) {
+	this.author_name = author_name;
+	this.name = name;
+	this.creation_date = creation_date;
+    }
 
-	/**
-	 * This constructor takes several parameters as inputs.
-	 * 
-	 * @param author_name
-	 *            the context <I>author's name</I>
-	 * @param name
-	 *            the context <I>name</I>
-	 * @param id
-	 *            the context <I>identifier</I>
-	 * @param creation_date
-	 *            the context <I>creation date</I>
-	 * @param reason
-	 *            the context <I>reason</I>
-	 * @param description
-	 *            the context <I>description</I>
-	 * @see #SnapContext()
-	 * @see #SnapContext(String author_name, String name, java.sql.Date
-	 *      creation_date)
-	 * @see #SnapContext(String[] argin)
-	 */
-	public SnapContext(String author_name, String name, int id,
-			java.sql.Date creation_date, String reason, String description) {
-		this.author_name = author_name;
-		this.name = name;
-		this.id = id;
-		this.creation_date = creation_date;
-		this.reason = reason;
-		this.description = description;
-	}
-
-	/**
-	 * This constructor takes several parameters as inputs.
-	 * 
-	 * @param author_name
-	 *            the context <I>author's name</I>
-	 * @param name
-	 *            the context <I>name</I>
-	 * @param id
-	 *            the context <I>identifier</I>
-	 * @param creation_date
-	 *            the context <I>creation date</I>
-	 * @param reason
-	 *            the context <I>reason</I>
-	 * @param description
-	 *            the context <I>description</I>
-	 * @param attributeList
-	 *            the <I>list of attributes</I> that are included in the
-	 *            context.
-	 * @see #SnapContext()
-	 * @see #SnapContext(String author_name, String name, java.sql.Date
-	 *      creation_date)
-	 * @see #SnapContext(String author_name, String name, int id, java.sql.Date
-	 *      creation_date, String reason, String description, ArrayList
-	 *      attributeList)
-	 * @see #SnapContext(String[] argin)
-	 */
-	public SnapContext(String author_name, String name, int id,
-			java.sql.Date creation_date, String reason, String description,
-			ArrayList attributeList) {
-		this.author_name = author_name;
-		this.name = name;
-		this.id = id;
-		this.creation_date = creation_date;
-		this.reason = reason;
-		this.description = description;
-		this.attributeList = attributeList;
-	}
+    /**
+     * This constructor takes several parameters as inputs.
+     * 
+     * @param author_name
+     *            the context <I>author's name</I>
+     * @param name
+     *            the context <I>name</I>
+     * @param id
+     *            the context <I>identifier</I>
+     * @param creation_date
+     *            the context <I>creation date</I>
+     * @param reason
+     *            the context <I>reason</I>
+     * @param description
+     *            the context <I>description</I>
+     * @see #SnapContext()
+     * @see #SnapContext(String author_name, String name, java.sql.Date
+     *      creation_date)
+     * @see #SnapContext(String[] argin)
+     */
+    public SnapContext(String author_name, String name, int id, java.sql.Date creation_date, String reason,
+	    String description) {
+	this.author_name = author_name;
+	this.name = name;
+	this.id = id;
+	this.creation_date = creation_date;
+	this.reason = reason;
+	this.description = description;
+    }
 
-	/**
-	 * This constructor builds an SnapContext from an array
-	 * 
-	 * @param argin
-	 *            an array that contains the SnapContext's author's name, name,
-	 *            identifier, creation date, reason, description and, the
-	 *            <I>list of attributes</I> that are included in the context.
-	 */
-	public SnapContext(String[] argin) {
-		setAuthor_name(argin[0]);
-		setName(argin[1]);
-		setId(Integer.parseInt(argin[2]));
-		setCreation_date(java.sql.Date.valueOf(argin[3]));
-		setReason(argin[4]);
-		setDescription(argin[5]);
-		// Attribute list construction
-		ArrayList attList = new ArrayList(32);
-		for (int i = 6; i < argin.length; i++) {
-			attList.add(argin[i]);
-		}
-		attList.trimToSize();
-		setAttributeList(attList);
-	}
+    /**
+     * This constructor takes several parameters as inputs.
+     * 
+     * @param author_name
+     *            the context <I>author's name</I>
+     * @param name
+     *            the context <I>name</I>
+     * @param id
+     *            the context <I>identifier</I>
+     * @param creation_date
+     *            the context <I>creation date</I>
+     * @param reason
+     *            the context <I>reason</I>
+     * @param description
+     *            the context <I>description</I>
+     * @param attributeList
+     *            the <I>list of attributes</I> that are included in the
+     *            context.
+     * @see #SnapContext()
+     * @see #SnapContext(String author_name, String name, java.sql.Date
+     *      creation_date)
+     * @see #SnapContext(String author_name, String name, int id, java.sql.Date
+     *      creation_date, String reason, String description, ArrayList
+     *      attributeList)
+     * @see #SnapContext(String[] argin)
+     */
+    public SnapContext(String author_name, String name, int id, java.sql.Date creation_date, String reason,
+	    String description, List<SnapAttributeLight> attributeList) {
+	this.author_name = author_name;
+	this.name = name;
+	this.id = id;
+	this.creation_date = creation_date;
+	this.reason = reason;
+	this.description = description;
+	this.attributeList = attributeList;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>author's name</I>.
-	 * 
-	 * @return the SnapContext's <I>author's name</I>.
-	 */
-	public String getAuthor_name() {
-		return author_name;
+    /**
+     * This constructor builds an SnapContext from an array
+     * 
+     * @param argin
+     *            an array that contains the SnapContext's author's name, name,
+     *            identifier, creation date, reason, description and, the
+     *            <I>list of attributes</I> that are included in the context.
+     */
+    public SnapContext(String[] argin) {
+	setAuthor_name(argin[0]);
+	setName(argin[1]);
+	setId(Integer.parseInt(argin[2]));
+	setCreation_date(java.sql.Date.valueOf(argin[3]));
+	setReason(argin[4]);
+	setDescription(argin[5]);
+	// Attribute list construction
+	for (int i = 6; i < argin.length; i++) {
+	    attributeList.add(new SnapAttributeLight(argin[i]));
 	}
+    }
 
-	/**
-	 * Sets the context <I>author's name</I>.
-	 * 
-	 * @param author_name
-	 *            the context <I>author's name</I>.
-	 */
-	public void setAuthor_name(String author_name) {
-		this.author_name = author_name;
-	}
+    /**
+     * Returns the SnapContext's <I>author's name</I>.
+     * 
+     * @return the SnapContext's <I>author's name</I>.
+     */
+    public String getAuthor_name() {
+	return author_name;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>name</I>.
-	 * 
-	 * @return the SnapContext's <I>name</I>.
-	 */
-	public String getName() {
-		return name;
-	}
+    /**
+     * Sets the context <I>author's name</I>.
+     * 
+     * @param author_name
+     *            the context <I>author's name</I>.
+     */
+    public void setAuthor_name(String author_name) {
+	this.author_name = author_name;
+    }
 
-	/**
-	 * Sets the context <I>name</I>.
-	 * 
-	 * @param name
-	 *            the context <I>name</I>.
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
+    /**
+     * Returns the SnapContext's <I>name</I>.
+     * 
+     * @return the SnapContext's <I>name</I>.
+     */
+    public String getName() {
+	return name;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>identifier</I>.
-	 * 
-	 * @return the SnapContext's <I>identifier</I>.
-	 */
-	public int getId() {
-		return id;
-	}
+    /**
+     * Sets the context <I>name</I>.
+     * 
+     * @param name
+     *            the context <I>name</I>.
+     */
+    public void setName(String name) {
+	this.name = name;
+    }
 
-	/**
-	 * Sets the context <I>identifier</I>.
-	 * 
-	 * @param id
-	 *            the context <I>identifier</I>.
-	 */
-	public void setId(int id) {
-		this.id = id;
-	}
+    /**
+     * Returns the SnapContext's <I>identifier</I>.
+     * 
+     * @return the SnapContext's <I>identifier</I>.
+     */
+    public int getId() {
+	return id;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>creation date</I>.
-	 * 
-	 * @return the SnapContext's <I>creation date</I>.
-	 */
-	public java.sql.Date getCreation_date() {
-		return creation_date;
-	}
+    /**
+     * Sets the context <I>identifier</I>.
+     * 
+     * @param id
+     *            the context <I>identifier</I>.
+     */
+    public void setId(int id) {
+	this.id = id;
+    }
 
-	/**
-	 * Sets the context <I>creation date</I>.
-	 * 
-	 * @param creation_date
-	 *            the context <I>creation date</I>.
-	 */
-	public void setCreation_date(java.sql.Date creation_date) {
-		this.creation_date = creation_date;
-	}
+    /**
+     * Returns the SnapContext's <I>creation date</I>.
+     * 
+     * @return the SnapContext's <I>creation date</I>.
+     */
+    public java.sql.Date getCreation_date() {
+	return creation_date;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>reason</I>.
-	 * 
-	 * @return the SnapContext's <I>reason</I>.
-	 */
-	public String getReason() {
-		return reason;
-	}
+    /**
+     * Sets the context <I>creation date</I>.
+     * 
+     * @param creation_date
+     *            the context <I>creation date</I>.
+     */
+    public void setCreation_date(java.sql.Date creation_date) {
+	this.creation_date = creation_date;
+    }
 
-	/**
-	 * Sets the context <I>reason</I>.
-	 * 
-	 * @param reason
-	 *            the context <I>reason</I>.
-	 */
-	public void setReason(String reason) {
-		this.reason = reason;
-	}
+    /**
+     * Returns the SnapContext's <I>reason</I>.
+     * 
+     * @return the SnapContext's <I>reason</I>.
+     */
+    public String getReason() {
+	return reason;
+    }
 
-	/**
-	 * Returns the SnapContext's <I>description</I>.
-	 * 
-	 * @return the SnapContext's <I>description</I>.
-	 */
-	public String getDescription() {
-		return description;
-	}
+    /**
+     * Sets the context <I>reason</I>.
+     * 
+     * @param reason
+     *            the context <I>reason</I>.
+     */
+    public void setReason(String reason) {
+	this.reason = reason;
+    }
 
-	/**
-	 * Sets the context <I>description</I>.
-	 * 
-	 * @param description
-	 *            the context <I>description</I>.
-	 */
-	public void setDescription(String description) {
-		this.description = description;
-	}
+    /**
+     * Returns the SnapContext's <I>description</I>.
+     * 
+     * @return the SnapContext's <I>description</I>.
+     */
+    public String getDescription() {
+	return description;
+    }
 
-	/**
-	 * Returns the <I>list of attributes</I> that are included in the context.
-	 * 
-	 * @return the <I>list of attributes</I> that are included in the context.
-	 */
-	public ArrayList getAttributeList() {
-		return attributeList;
-	}
+    /**
+     * Sets the context <I>description</I>.
+     * 
+     * @param description
+     *            the context <I>description</I>.
+     */
+    public void setDescription(String description) {
+	this.description = description;
+    }
 
-	/**
-	 * Sets the SnapContext's <I>list of attributes</I> included in the context.
-	 * 
-	 * @param attributeList
-	 *            the <I>list of attributes</I> that are included in the
-	 *            context.
-	 */
-	public void setAttributeList(ArrayList attributeList) {
-		this.attributeList = attributeList;
-	}
+    /**
+     * Returns the <I>list of attributes</I> that are included in the context.
+     * 
+     * @return the <I>list of attributes</I> that are included in the context.
+     */
+    public List<SnapAttributeLight> getAttributeList() {
+	return attributeList;
+    }
 
-	/**
-	 * Returns an array representation of the object <I>SnapContext</I>. In this
-	 * order, array fields are :
-	 * <ol>
-	 * <li>the context <I>author's name</I>,
-	 * <li>the context <I>name</I>
-	 * <li>the context <I>identifier</I>
-	 * <li>the context <I>creation date</I>
-	 * <li>the context <I>reason</I>
-	 * <li>the context <I>description</I>
-	 * <li>The suite table describes the context's <I>list of attributes</I>
-	 * </ol>
-	 * 
-	 * @return an array representation of the object <I>SnapContext</I>.
-	 */
-	public String[] toArray() {
-		String[] snapContext;
-		snapContext = new String[6 + attributeList.size()];
+    /**
+     * Sets the SnapContext's <I>list of attributes</I> included in the context.
+     * 
+     * @param attributeList
+     *            the <I>list of attributes</I> that are included in the
+     *            context.
+     */
+    public void setAttributeList(List<SnapAttributeLight> attributeList) {
+	this.attributeList = attributeList;
+    }
 
-		snapContext[0] = author_name;
-		snapContext[1] = name;
-		snapContext[2] = Integer.toString(id);
-		snapContext[3] = creation_date.toString();
-		snapContext[4] = reason;
-		snapContext[5] = description;
+    /**
+     * Returns an array representation of the object <I>SnapContext</I>. In this
+     * order, array fields are :
+     * <ol>
+     * <li>the context <I>author's name</I>,
+     * <li>the context <I>name</I>
+     * <li>the context <I>identifier</I>
+     * <li>the context <I>creation date</I>
+     * <li>the context <I>reason</I>
+     * <li>the context <I>description</I>
+     * <li>The suite table describes the context's <I>list of attributes</I>
+     * </ol>
+     * 
+     * @return an array representation of the object <I>SnapContext</I>.
+     */
+    public String[] toArray() {
+	String[] snapContext;
+	snapContext = new String[6 + attributeList.size()];
 
-		for (int i = 0; i < attributeList.size(); i++) {
-			snapContext[i + 6] = attributeList.get(i).toString();
-		}
+	snapContext[0] = author_name;
+	snapContext[1] = name;
+	snapContext[2] = Integer.toString(id);
+	snapContext[3] = creation_date.toString();
+	snapContext[4] = reason;
+	snapContext[5] = description;
 
-		return snapContext;
+	for (int i = 0; i < attributeList.size(); i++) {
+	    snapContext[i + 6] = attributeList.get(i).getAttribute_complete_name();
 	}
 
-	public String toString() {
-		String snapString = new String("");
-		snapString = "Context" + "\r\n" + "Id : \t" + id + "\r\n"
-				+ "Author name : \t" + author_name + "\r\n"
-				+ "Context name : \t" + name + "\r\n" + "Creation date : \t"
-				+ creation_date + "\r\n" + "Reason : \t" + reason + "\r\n"
-				+ "Description : \t" + description + "\r\n" + "Attribute(s) : "
-				+ "\r\n";
-		if (attributeList != null) {
-			for (int i = 0; i < attributeList.size(); i++) {
-				SnapAttributeLight snapAttributeLight = (SnapAttributeLight) attributeList
-						.get(i);
-				String attribute_name = (String) snapAttributeLight
-						.getAttribute_complete_name();
-				int attribute_type = (int) snapAttributeLight.getData_type();
-				int attribute_format = (int) snapAttributeLight
-						.getData_format();
-				int attribute_writable = (int) snapAttributeLight.getWritable();
-				snapString = snapString + "\t\t" + "[" + i + "]" + "\t"
-						+ attribute_name + "\r\n";
-				snapString = snapString + "\t\t\t" + "type : \t"
-						+ attribute_type + "\r\n";
-				snapString = snapString + "\t\t\t" + "format : \t"
-						+ attribute_format + "\r\n";
-				snapString = snapString + "\t\t\t" + "writable : \t"
-						+ attribute_writable + "\r\n";
-			}
-		} else {
-			snapString = snapString + "\t\t" + "NULL" + "\r\n";
-		}
-		return snapString;
+	return snapContext;
+    }
+
+    @Override
+    public String toString() {
+	String snapString = new String("");
+	snapString = "Context" + "\r\n" + "Id : \t" + id + "\r\n" + "Author name : \t" + author_name + "\r\n"
+		+ "Context name : \t" + name + "\r\n" + "Creation date : \t" + creation_date + "\r\n" + "Reason : \t"
+		+ reason + "\r\n" + "Description : \t" + description + "\r\n" + "Attribute(s) : " + "\r\n";
+	if (attributeList != null) {
+	    for (int i = 0; i < attributeList.size(); i++) {
+		snapString = snapString + "\t\t" + "[" + i + "]" + "\t" + attributeList.get(i) + "\r\n";
+	    }
+	} else {
+	    snapString = snapString + "\t\t" + "NULL" + "\r\n";
 	}
+	return snapString;
+    }
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapShot.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapShot.java
index 675dcfe..1c96e6f 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapShot.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapShot.java
@@ -53,6 +53,7 @@
 package fr.soleil.snapArchivingApi.SnapshotingTools.Tools;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import fr.esrf.Tango.AttrWriteType;
 import fr.esrf.Tango.DevFailed;
@@ -76,363 +77,336 @@ import fr.esrf.Tango.ErrSeverity;
  * @see SnapContext
  */
 public class SnapShot {
-	private int id_context = -1; // Identifier for the related context
-	private int id_snap = -1; // Identifier for this snapshot
-	private java.sql.Timestamp snap_date = null; // Timestamp asociated to this
-	// snapshot
-	private ArrayList attribute_List = null; // Attribute list associated to
-
-	// this snapshot
-
-	/**
-	 * Default constructor Creates a new instance of SnapShot
-	 * 
-	 * @see #SnapShot(int, java.sql.Timestamp)
-	 * @see #SnapShot(String[])
+    private int id_context = -1; // Identifier for the related context
+    private int id_snap = -1; // Identifier for this snapshot
+    private java.sql.Timestamp snap_date = null; // Timestamp asociated to this
+    // snapshot
+    private List<SnapAttributeExtract> attribute_List = new ArrayList<SnapAttributeExtract>();
+
+    // this snapshot
+
+    /**
+     * Default constructor Creates a new instance of SnapShot
+     * 
+     * @see #SnapShot(int, java.sql.Timestamp)
+     * @see #SnapShot(String[])
+     */
+    public SnapShot() {
+    }
+
+    /**
+     * This constructor takes several parameters as inputs.
+     * 
+     * @param idContext
+     *            the associated context identifier
+     * @param snapDate
+     *            the timestamp associated to this snapshot
+     * @see #SnapShot()
+     * @see #SnapShot(String[])
+     */
+    public SnapShot(int idContext, java.sql.Timestamp snapDate) {
+	id_context = idContext;
+	snap_date = snapDate;
+    }
+
+    /**
+     * This constructor takes several parameters as inputs.
+     * 
+     * @param idContext
+     *            the associated context identifier
+     * @param snapDate
+     *            the timestamp associated to this snapshot
+     * @param attributeList
+     *            the attribute list associated to this snapshot
+     * @see #SnapShot()
+     * @see #SnapShot(String[])
+     */
+    public SnapShot(int idContext, java.sql.Timestamp snapDate, List<SnapAttributeExtract> attributeList) {
+	id_context = idContext;
+	snap_date = snapDate;
+	attribute_List = attributeList;
+    }
+
+    /**
+     * This constructor builds an SnapContext from an array
+     * 
+     * @param argin
+     *            an array that contains the SnapContext's author's name, name,
+     *            identifier, creation date, reason, description and, the
+     *            <I>list of attributes</I> that are included in the context.
+     */
+    public SnapShot(String[] argin) {
+	// System.out.println("Snapshot test 0");
+	setId_context(Integer.parseInt(argin[0]));
+	// System.out.println("Snapshot test 1");
+	setId_snap(Integer.parseInt(argin[1]));
+	// System.out.println("Snapshot test 2");
+	setSnap_date(java.sql.Timestamp.valueOf(argin[2]));
+	// System.out.println("Snapshot test 3");
+	attribute_List = new ArrayList<SnapAttributeExtract>((argin.length - 3) / 7);
+	// System.out.println("Snapshot test 4");
+
+	int k = 3;
+	/*
+	 * System.out.println("Snapshot test 5 : argin.length = " +
+	 * argin.length); for (int i = 0; i < argin.length; i++) {
+	 * System.out.println("argin["+i+"] = |"+argin[i]+"|"); }
 	 */
-	public SnapShot() {
-	}
 
-	/**
-	 * This constructor takes several parameters as inputs.
-	 * 
-	 * @param idContext
-	 *            the associated context identifier
-	 * @param snapDate
-	 *            the timestamp associated to this snapshot
-	 * @see #SnapShot()
-	 * @see #SnapShot(String[])
-	 */
-	public SnapShot(int idContext, java.sql.Timestamp snapDate) {
-		id_context = idContext;
-		snap_date = snapDate;
+	while (k < argin.length) {
+	    // System.out.println("Little test 0 : k="+k);
+	    String[] snapAttributeExtractArray = { argin[k], argin[k + 1], argin[k + 2], argin[k + 3], argin[k + 4],
+		    argin[k + 5], argin[k + 6] };
+	    // System.out.println("Little test 1");
+	    SnapAttributeExtract snapAttributeExtract = new SnapAttributeExtract(snapAttributeExtractArray);
+	    // System.out.println("Little test 2");
+	    attribute_List.add(snapAttributeExtract);
+	    // System.out.println("Little test 3");
+	    k = k + 7;
 	}
-
-	/**
-	 * This constructor takes several parameters as inputs.
-	 * 
-	 * @param idContext
-	 *            the associated context identifier
-	 * @param snapDate
-	 *            the timestamp associated to this snapshot
-	 * @param attributeList
-	 *            the attribute list associated to this snapshot
-	 * @see #SnapShot()
-	 * @see #SnapShot(String[])
-	 */
-	public SnapShot(int idContext, java.sql.Timestamp snapDate,
-			ArrayList attributeList) {
-		id_context = idContext;
-		snap_date = snapDate;
-		attribute_List = attributeList;
+    }
+
+    public static SnapShot getPartialSnapShot(String[] argin, int snapId,
+	    SnapAttributeExtract[] snapAttributeExtractArray) throws SnapshotingException {
+	SnapShot snapShot = new SnapShot();
+	snapShot.attribute_List = new ArrayList<SnapAttributeExtract>();
+
+	SnapshotingException snapExcept = new SnapshotingException("CONFIGURATION_ERROR", "Wrong parameter",
+		ErrSeverity.ERR, "SnapShot.getPartialSnapShot", "SnapManager.SetEquipments");
+
+	snapShot.id_snap = snapId;
+
+	int option = 0;
+	int attributesNumberToSet = 0;
+	if (GlobalConst.STORED_READ_VALUE.equals(argin[1]) || GlobalConst.STORED_WRITE_VALUE.equals(argin[1])) {
+	    option = 1;
+	} else {
+	    try {
+		attributesNumberToSet = Integer.parseInt(argin[1]);
+	    } catch (NumberFormatException e) {
+		e.printStackTrace();
+		throw snapExcept;
+	    }
+	    option = 2;
 	}
 
-	/**
-	 * This constructor builds an SnapContext from an array
-	 * 
-	 * @param argin
-	 *            an array that contains the SnapContext's author's name, name,
-	 *            identifier, creation date, reason, description and, the
-	 *            <I>list of attributes</I> that are included in the context.
-	 */
-	public SnapShot(String[] argin) {
-		// System.out.println("Snapshot test 0");
-		setId_context(Integer.parseInt(argin[0]));
-		// System.out.println("Snapshot test 1");
-		setId_snap(Integer.parseInt(argin[1]));
-		// System.out.println("Snapshot test 2");
-		setSnap_date(java.sql.Timestamp.valueOf(argin[2]));
-		// System.out.println("Snapshot test 3");
-		attribute_List = new ArrayList((argin.length - 3) / 7);
-		// System.out.println("Snapshot test 4");
-
-		int k = 3;
-		/*
-		 * System.out.println("Snapshot test 5 : argin.length = " +
-		 * argin.length); for (int i = 0; i < argin.length; i++) {
-		 * System.out.println("argin["+i+"] = |"+argin[i]+"|"); }
-		 */
-
-		while (k < argin.length) {
-			// System.out.println("Little test 0 : k="+k);
-			String[] snapAttributeExtractArray = { argin[k], argin[k + 1],
-					argin[k + 2], argin[k + 3], argin[k + 4], argin[k + 5],
-					argin[k + 6] };
-			// System.out.println("Little test 1");
-			SnapAttributeExtract snapAttributeExtract = new SnapAttributeExtract(
-					snapAttributeExtractArray);
-			// System.out.println("Little test 2");
-			attribute_List.add(snapAttributeExtract);
-			// System.out.println("Little test 3");
-			k = k + 7;
-		}
-	}
+	try {
+	    switch (option) {
+	    case 1:
+		String storedValueType = argin[1];
 
-	public static SnapShot getPartialSnapShot(String[] argin, int snapId,
-			SnapAttributeExtract[] snapAttributeExtractArray)
-			throws SnapshotingException {
-		SnapShot snapShot = new SnapShot();
-		snapShot.attribute_List = new ArrayList();
-
-		SnapshotingException snapExcept = new SnapshotingException(
-				"CONFIGURATION_ERROR", "Wrong parameter", ErrSeverity.ERR,
-				"SnapShot.getPartialSnapShot", "SnapManager.SetEquipments");
-
-		snapShot.id_snap = snapId;
-
-		int option = 0;
-		int attributesNumberToSet = 0;
-		if ((GlobalConst.STORED_READ_VALUE).equals(argin[1])
-				|| (GlobalConst.STORED_WRITE_VALUE).equals(argin[1]))
-			option = 1;
-		else {
-			try {
-				attributesNumberToSet = Integer.parseInt(argin[1]);
-			} catch (NumberFormatException e) {
-				e.printStackTrace();
-				throw snapExcept;
+		if (GlobalConst.STORED_READ_VALUE.equals(storedValueType)) {
+		    for (int i = 0; i < snapAttributeExtractArray.length; i++) {
+			if (snapAttributeExtractArray[i].getWritable() != AttrWriteType._WRITE
+				&& snapAttributeExtractArray[i].getWritable() != AttrWriteType._READ) {
+			    snapAttributeExtractArray[i].setWriteValue(snapAttributeExtractArray[i].getReadValue());
 			}
-			option = 2;
-		}
-
-		try {
-			switch (option) {
-			case 1:
-				String storedValueType = argin[1];
-
-				if ((GlobalConst.STORED_READ_VALUE).equals(storedValueType)) {
-					for (int i = 0; i < snapAttributeExtractArray.length; i++) {
-						if (snapAttributeExtractArray[i].getWritable() != AttrWriteType._WRITE
-								&& snapAttributeExtractArray[i].getWritable() != AttrWriteType._READ) {
-							snapAttributeExtractArray[i]
-									.setWriteValue(snapAttributeExtractArray[i]
-											.getReadValue());
-						}
-						snapShot.attribute_List
-								.add(snapAttributeExtractArray[i]);
-
-					}
-
-				} else if ((GlobalConst.STORED_WRITE_VALUE)
-						.equals(storedValueType)) {
-					for (int i = 0; i < snapAttributeExtractArray.length; i++) {
-						if (snapAttributeExtractArray[i].getWritable() != AttrWriteType._READ)
-							snapShot.attribute_List
-									.add(snapAttributeExtractArray[i]);
-					}
-				}
-				break;
+			snapShot.attribute_List.add(snapAttributeExtractArray[i]);
 
-			case 2:
-				if (argin.length <= 2) {
-					throw snapExcept;
-				}
-				// int attributesNumberToSet = Integer.parseInt(argin[1]);
-				int attributesNumber = 0,
-				arginI = 2;
-
-				do {
-					for (int snapAttrI = 0; snapAttrI < snapAttributeExtractArray.length
-							&& attributesNumber < attributesNumberToSet
-							&& arginI < argin.length; snapAttrI++) {
-
-						if ((snapAttributeExtractArray[snapAttrI]
-								.getAttribute_complete_name())
-								.equals(argin[arginI + 1])) {
-							if (snapAttributeExtractArray[snapAttrI]
-									.getWritable() != AttrWriteType._READ) {
-								Object newValue = null;
-
-								if ((GlobalConst.NEW_VALUE)
-										.equals(argin[arginI])) {
-									newValue = snapAttributeExtractArray[snapAttrI]
-											.getNewValue(argin[arginI + 2]);
-
-								} else if ((GlobalConst.STORED_READ_VALUE)
-										.equals(argin[arginI])) {
-									newValue = snapAttributeExtractArray[snapAttrI]
-											.getReadValue();
-
-								} else if ((GlobalConst.STORED_WRITE_VALUE)
-										.equals(argin[arginI])) {
-									newValue = snapAttributeExtractArray[snapAttrI]
-											.getWriteValue();
-								}
-
-								snapAttributeExtractArray[snapAttrI]
-										.setWriteValue(newValue);
-								snapShot.attribute_List
-										.add(snapAttributeExtractArray[snapAttrI]);
-							}
-							attributesNumber++;
-
-							if ((GlobalConst.NEW_VALUE).equals(argin[arginI])) {
-								arginI += 3;
-							} else {
-								arginI += 2;
-							}
-						}
-
-					}
-				} while (attributesNumber < attributesNumberToSet
-						&& arginI < argin.length);
-				break;
-
-			default:
-				break;
-			}
+		    }
 
-		} catch (SnapshotingException e) {
-			throw e;
-		} catch (Throwable t) {
-			// Tools.printIfDevFailed ( t );
-			if (t instanceof DevFailed) {
-				// throw (DevFailed) t;
-			} else {
-				throw snapExcept;
+		} else if (GlobalConst.STORED_WRITE_VALUE.equals(storedValueType)) {
+		    for (int i = 0; i < snapAttributeExtractArray.length; i++) {
+			if (snapAttributeExtractArray[i].getWritable() != AttrWriteType._READ) {
+			    snapShot.attribute_List.add(snapAttributeExtractArray[i]);
 			}
+		    }
 		}
+		break;
 
-		return snapShot;
-	}
+	    case 2:
+		if (argin.length <= 2) {
+		    throw snapExcept;
+		}
+		// int attributesNumberToSet = Integer.parseInt(argin[1]);
+		int attributesNumber = 0,
+		arginI = 2;
 
-	/**
-	 * Returns the identifier of the context associated to this Snapshot
-	 * 
-	 * @return the identifier of the context associated to this Snapshot
-	 */
-	public int getId_context() {
-		return id_context;
-	}
+		do {
+		    for (int snapAttrI = 0; snapAttrI < snapAttributeExtractArray.length
+			    && attributesNumber < attributesNumberToSet && arginI < argin.length; snapAttrI++) {
 
-	/**
-	 * Sets the identifier of the context associated to this Snapshot
-	 * 
-	 * @param id_context
-	 *            the identifier of the context associated to this Snapshot
-	 */
-	public void setId_context(int id_context) {
-		this.id_context = id_context;
-	}
+			if (snapAttributeExtractArray[snapAttrI].getAttribute_complete_name().equals(argin[arginI + 1])) {
+			    if (snapAttributeExtractArray[snapAttrI].getWritable() != AttrWriteType._READ) {
+				Object newValue = null;
 
-	/**
-	 * Returns the identifier associated to this Snapshot
-	 * 
-	 * @return the identifier associated to this Snapshot
-	 */
-	public int getId_snap() {
-		return id_snap;
-	}
+				if (GlobalConst.NEW_VALUE.equals(argin[arginI])) {
+				    newValue = snapAttributeExtractArray[snapAttrI].getNewValue(argin[arginI + 2]);
 
-	/**
-	 * Sets the identifier associated to this Snapshot
-	 * 
-	 * @param id_snap
-	 *            the identifier associated to this Snapshot
-	 */
-	public void setId_snap(int id_snap) {
-		this.id_snap = id_snap;
-	}
+				} else if (GlobalConst.STORED_READ_VALUE.equals(argin[arginI])) {
+				    newValue = snapAttributeExtractArray[snapAttrI].getReadValue();
 
-	/**
-	 * Returns the timestamp associated to this Snapshot
-	 * 
-	 * @return the timestamp associated to this Snapshot
-	 */
-	public java.sql.Timestamp getSnap_date() {
-		return snap_date;
-	}
+				} else if (GlobalConst.STORED_WRITE_VALUE.equals(argin[arginI])) {
+				    newValue = snapAttributeExtractArray[snapAttrI].getWriteValue();
+				}
 
-	/**
-	 * Sets the timestamp associated to this Snapshot
-	 * 
-	 * @param snap_date
-	 *            the timestamp associated to this Snapshot
-	 */
-	public void setSnap_date(java.sql.Timestamp snap_date) {
-		this.snap_date = snap_date;
-	}
+				snapAttributeExtractArray[snapAttrI].setWriteValue(newValue);
+				snapShot.attribute_List.add(snapAttributeExtractArray[snapAttrI]);
+			    }
+			    attributesNumber++;
 
-	/**
-	 * Returns the attribute list associated to this Snapshot
-	 * 
-	 * @return the attribute list associated to this Snapshot
-	 */
-	public ArrayList getAttribute_List() {
-		return attribute_List;
-	}
+			    if (GlobalConst.NEW_VALUE.equals(argin[arginI])) {
+				arginI += 3;
+			    } else {
+				arginI += 2;
+			    }
+			}
 
-	/**
-	 * Sets the attribute list associated to this Snapshot
-	 * 
-	 * @param attribute_List
-	 *            the attribute list associated to this Snapshot
-	 */
-	public void setAttribute_List(ArrayList attribute_List) {
-		this.attribute_List = attribute_List;
+		    }
+		} while (attributesNumber < attributesNumberToSet && arginI < argin.length);
+		break;
+
+	    default:
+		break;
+	    }
+
+	} catch (SnapshotingException e) {
+	    throw e;
+	} catch (Throwable t) {
+	    // Tools.printIfDevFailed ( t );
+	    if (t instanceof DevFailed) {
+		// throw (DevFailed) t;
+	    } else {
+		throw snapExcept;
+	    }
 	}
 
-	/**
-	 * Returns an array representation of the object <I>Snapshot</I>. In this
-	 * order, array fields are :
-	 * <ol>
-	 * <li>the <I>identifier of the associated context</I>,
-	 * <li>the <I>identifier of this snapshot</I>,
-	 * <li>the <I>Timestamp</I> asociated to this snapshot
-	 * <li>The <I>Attribute list associated to this snapshot</I> (with all the
-	 * needed informations (data type, data format, writable))
-	 * </ol>
-	 * 
-	 * @return an array representation of the object <I>SnapContext</I>.
-	 */
-	public String[] toArray() {
-		String[] snapShot;
-		snapShot = new String[3 + (7 * attribute_List.size())]; // Multiplied by
-		// 5 because the
-		// size of an
-		// attribute is
-		// 5.
-
-		snapShot[0] = Integer.toString(id_context);
-		snapShot[1] = Integer.toString(id_snap);
-		snapShot[2] = snap_date.toString();
-		int k = 3;
-
-		for (int i = 0; i < attribute_List.size(); i++) {
-			SnapAttributeExtract snapAttributeExtract = (SnapAttributeExtract) attribute_List
-					.get(i);
-			// System.out.println("test0");
-			String[] snapAttributeExtractArray = snapAttributeExtract.toArray();
-			// System.out.println("test1");
-			snapShot[k] = snapAttributeExtractArray[0];
-			snapShot[k + 1] = snapAttributeExtractArray[1];
-			snapShot[k + 2] = snapAttributeExtractArray[2];
-			snapShot[k + 3] = snapAttributeExtractArray[3];
-			snapShot[k + 4] = snapAttributeExtractArray[4];
-			snapShot[k + 5] = snapAttributeExtractArray[5];
-			snapShot[k + 6] = snapAttributeExtractArray[6];
-			k = k + 7;
-		}
-		return snapShot;
+	return snapShot;
+    }
+
+    /**
+     * Returns the identifier of the context associated to this Snapshot
+     * 
+     * @return the identifier of the context associated to this Snapshot
+     */
+    public int getId_context() {
+	return id_context;
+    }
+
+    /**
+     * Sets the identifier of the context associated to this Snapshot
+     * 
+     * @param id_context
+     *            the identifier of the context associated to this Snapshot
+     */
+    public void setId_context(int id_context) {
+	this.id_context = id_context;
+    }
+
+    /**
+     * Returns the identifier associated to this Snapshot
+     * 
+     * @return the identifier associated to this Snapshot
+     */
+    public int getId_snap() {
+	return id_snap;
+    }
+
+    /**
+     * Sets the identifier associated to this Snapshot
+     * 
+     * @param id_snap
+     *            the identifier associated to this Snapshot
+     */
+    public void setId_snap(int id_snap) {
+	this.id_snap = id_snap;
+    }
+
+    /**
+     * Returns the timestamp associated to this Snapshot
+     * 
+     * @return the timestamp associated to this Snapshot
+     */
+    public java.sql.Timestamp getSnap_date() {
+	return snap_date;
+    }
+
+    /**
+     * Sets the timestamp associated to this Snapshot
+     * 
+     * @param snap_date
+     *            the timestamp associated to this Snapshot
+     */
+    public void setSnap_date(java.sql.Timestamp snap_date) {
+	this.snap_date = snap_date;
+    }
+
+    /**
+     * Returns the attribute list associated to this Snapshot
+     * 
+     * @return the attribute list associated to this Snapshot
+     */
+    public List<SnapAttributeExtract> getAttribute_List() {
+	return attribute_List;
+    }
+
+    /**
+     * Sets the attribute list associated to this Snapshot
+     * 
+     * @param attribute_List
+     *            the attribute list associated to this Snapshot
+     */
+    public void setAttribute_List(List<SnapAttributeExtract> attribute_List) {
+	this.attribute_List = attribute_List;
+    }
+
+    /**
+     * Returns an array representation of the object <I>Snapshot</I>. In this
+     * order, array fields are :
+     * <ol>
+     * <li>the <I>identifier of the associated context</I>,
+     * <li>the <I>identifier of this snapshot</I>,
+     * <li>the <I>Timestamp</I> asociated to this snapshot
+     * <li>The <I>Attribute list associated to this snapshot</I> (with all the
+     * needed informations (data type, data format, writable))
+     * </ol>
+     * 
+     * @return an array representation of the object <I>SnapContext</I>.
+     */
+    public String[] toArray() {
+	String[] snapShot;
+	snapShot = new String[3 + 7 * attribute_List.size()]; // Multiplied by
+	// 5 because the
+	// size of an
+	// attribute is
+	// 5.
+
+	snapShot[0] = Integer.toString(id_context);
+	snapShot[1] = Integer.toString(id_snap);
+	snapShot[2] = snap_date.toString();
+	int k = 3;
+
+	for (int i = 0; i < attribute_List.size(); i++) {
+	    SnapAttributeExtract snapAttributeExtract = attribute_List.get(i);
+	    // System.out.println("test0");
+	    String[] snapAttributeExtractArray = snapAttributeExtract.toArray();
+	    // System.out.println("test1");
+	    snapShot[k] = snapAttributeExtractArray[0];
+	    snapShot[k + 1] = snapAttributeExtractArray[1];
+	    snapShot[k + 2] = snapAttributeExtractArray[2];
+	    snapShot[k + 3] = snapAttributeExtractArray[3];
+	    snapShot[k + 4] = snapAttributeExtractArray[4];
+	    snapShot[k + 5] = snapAttributeExtractArray[5];
+	    snapShot[k + 6] = snapAttributeExtractArray[6];
+	    k = k + 7;
 	}
-
-	public String toString() {
-		String snapString = new String("");
-		snapString = "SnapShot" + "\r\n" + "Associated  Context Id : \t"
-				+ id_context + "\r\n" + "Snapshot Id : \t" + id_snap + "\r\n"
-				+ "SnapShot time : \t" + snap_date.toString() + "\r\n"
-				+ "Attribute(s) : " + "\r\n";
-		if (attribute_List != null) {
-			for (int i = 0; i < attribute_List.size(); i++) {
-				SnapAttributeExtract snapAttributeExtract = (SnapAttributeExtract) attribute_List
-						.get(i);
-				snapString = snapString + "\t\t" + "[" + i + "]" + "\t"
-						+ snapAttributeExtract.toString() + "\r\n";
-			}
-		} else {
-			snapString = snapString + "\t\t" + "NULL" + "\r\n";
-		}
-		return snapString;
+	return snapShot;
+    }
+
+    @Override
+    public String toString() {
+	String snapString = new String("");
+	snapString = "SnapShot" + "\r\n" + "Associated  Context Id : \t" + id_context + "\r\n" + "Snapshot Id : \t"
+		+ id_snap + "\r\n" + "SnapShot time : \t" + snap_date.toString() + "\r\n" + "Attribute(s) : " + "\r\n";
+	if (attribute_List != null) {
+	    for (int i = 0; i < attribute_List.size(); i++) {
+		SnapAttributeExtract snapAttributeExtract = attribute_List.get(i);
+		snapString = snapString + "\t\t" + "[" + i + "]" + "\t" + snapAttributeExtract.toString() + "\r\n";
+	    }
+	} else {
+	    snapString = snapString + "\t\t" + "NULL" + "\r\n";
 	}
+	return snapString;
+    }
 
 }
diff --git a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapshotingException.java b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapshotingException.java
index 219e647..ebf0ebc 100644
--- a/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapshotingException.java
+++ b/src/main/java/fr/soleil/snapArchivingApi/SnapshotingTools/Tools/SnapshotingException.java
@@ -48,302 +48,268 @@ import fr.esrf.Tango.ErrSeverity;
 //-======================================================================
 
 public class SnapshotingException extends Exception {
-	private String archExcepMessage;
-	private DevError[] devErrorTab;
-	private static final String TIMEOUT = "org.omg.CORBA.TIMEOUT";
-	private boolean isDueToATimeOut = false;
+    private String archExcepMessage;
+    private DevError[] devErrorTab;
+    private static final String TIMEOUT = "org.omg.CORBA.TIMEOUT";
+    private boolean isDueToATimeOut = false;
 
-	public SnapshotingException() {
-		super();
-		archExcepMessage = "";
-		devErrorTab = null;
-	}
+    public SnapshotingException() {
+	super();
+	archExcepMessage = "";
+	devErrorTab = null;
+    }
 
-	/**
-	 * @param message
-	 *            deprecated
-	 */
-	public SnapshotingException(String message) {
-		super(message);
-		archExcepMessage = message;
-		String reason = "Unknown reason";
-		ErrSeverity archSeverity = ErrSeverity.WARN;
-		String desc = "Unknown exception";
-		String origin = this.getClass().toString();
-		DevError devError = new DevError(reason, archSeverity, desc, origin);
-		devErrorTab = new DevError[1];
-		devErrorTab[0] = devError;
-	}
+    /**
+     * @param message
+     *            deprecated
+     */
+    public SnapshotingException(String message) {
+	super(message);
+	archExcepMessage = message;
+	String reason = "Unknown reason";
+	ErrSeverity archSeverity = ErrSeverity.WARN;
+	String desc = message;
+	String origin = this.getClass().toString();
+	DevError devError = new DevError(reason, archSeverity, desc, origin);
+	devErrorTab = new DevError[1];
+	devErrorTab[0] = devError;
+    }
 
-	/**
-	 * This class can be instanciated when exceptions in the archiving service.
-	 * Exceptions can be : ConnectionException, ATKException
-	 */
-	public SnapshotingException(String message, String reason,
-			ErrSeverity archSeverity, String desc, String origin) {
-		super(message);
-		archExcepMessage = message;
-		String _reason = (reason == null || reason.equals("")) ? "Unknown reason"
-				: reason;
-		ErrSeverity _archSeverity = (archSeverity == null) ? ErrSeverity.WARN
-				: archSeverity;
-		String _desc = (desc == null || desc.equals("")) ? "Unknown exception"
-				: desc;
-		String _origin = (origin == null || origin.equals("")) ? "Unknown origin"
-				: origin;
-		DevError devError = new DevError(_reason, _archSeverity, _desc, _origin);
-		devErrorTab = new DevError[1];
-		devErrorTab[0] = devError;
-	}
+    /**
+     * This class can be instanciated when exceptions in the archiving service.
+     * Exceptions can be : ConnectionException, ATKException
+     */
+    public SnapshotingException(String message, String reason, ErrSeverity archSeverity, String desc, String origin) {
+	super(message);
+	archExcepMessage = message;
+	String _reason = reason == null || reason.equals("") ? "Unknown reason" : reason;
+	ErrSeverity _archSeverity = archSeverity == null ? ErrSeverity.WARN : archSeverity;
+	String _desc = desc == null || desc.equals("") ? "Unknown exception" : desc;
+	String _origin = origin == null || origin.equals("") ? "Unknown origin" : origin;
+	DevError devError = new DevError(_reason, _archSeverity, _desc, _origin);
+	devErrorTab = new DevError[1];
+	devErrorTab[0] = devError;
+    }
 
-	public SnapshotingException(DevFailed devFailed) {
-		super(devFailed);
-		archExcepMessage = "";
+    public SnapshotingException(DevFailed devFailed) {
+	super(devFailed);
+	archExcepMessage = "";
 
-		// The current stack is initialized
-		DevError[] errors = devFailed.errors;
-		int l = errors == null ? 0 : devFailed.errors.length;
-		devErrorTab = new DevError[l];
-		// The stack of the catched error copied
-		if (errors != null) {
-			System.arraycopy(errors, 0, devErrorTab, 0, l);
-		}
+	// The current stack is initialized
+	DevError[] errors = devFailed.errors;
+	int l = errors == null ? 0 : devFailed.errors.length;
+	devErrorTab = new DevError[l];
+	// The stack of the catched error copied
+	if (errors != null) {
+	    System.arraycopy(errors, 0, devErrorTab, 0, l);
 	}
+    }
 
-	public SnapshotingException(String message, String reason,
-			ErrSeverity archSeverity, String desc, String origin, Exception e) {
-		super(e);
-		archExcepMessage = message;
+    public SnapshotingException(String message, String reason, ErrSeverity archSeverity, String desc, String origin,
+	    Exception e) {
+	super(e);
+	archExcepMessage = message;
 
-		if (e instanceof DevFailed) {
-			// The current stack is initialized
-			DevError[] errors = ((DevFailed) e).errors;
-			int l = errors == null ? 0 : ((DevFailed) e).errors.length;
-			devErrorTab = new DevError[l + 1];
-			// The stack of the catched error copied
-			if (errors != null) {
-				System.arraycopy(errors, 0, devErrorTab, 0, l);
-			}
-			// A new DevError object is built with the given parameters
-			String _reason = (reason == null || reason.equals("")) ? "Unknown reason"
-					: reason;
-			ErrSeverity _archSeverity = (archSeverity == null) ? ErrSeverity.WARN
-					: archSeverity;
-			String _desc = (desc == null || desc.equals("")) ? "DevFailed EXCEPTION"
-					: desc;
-			String _origin = (origin == null || origin.equals("")) ? e
-					.getClass().getName() : origin;
-			DevError devError = new DevError(_reason, _archSeverity, _desc,
-					_origin);
-			// The DevError object is added at the end of the stack
-			devErrorTab[devErrorTab.length - 1] = devError;
-		} else if (e instanceof SnapshotingException) {
-			// The current stack is initialized
-			devErrorTab = new DevError[((SnapshotingException) e).devErrorTab.length + 1];
-			// The stack of the catched error copied
-			System.arraycopy(((SnapshotingException) e).devErrorTab, 0,
-					devErrorTab, 0,
-					((SnapshotingException) e).devErrorTab.length);
-			// A new DevError object is built with the given parameters
-			String _reason = (reason == null || reason.equals("")) ? "Unknown reason"
-					: reason;
-			ErrSeverity _archSeverity = (archSeverity == null) ? ErrSeverity.WARN
-					: archSeverity;
-			String _desc = (desc == null || desc.equals("")) ? "Unknown exception"
-					: desc;
-			String _origin = (origin == null || origin.equals("")) ? e
-					.getClass().getName() : origin;
-			DevError devError = new DevError(_reason, _archSeverity, _desc,
-					_origin);
+	if (e instanceof DevFailed) {
+	    // The current stack is initialized
+	    DevError[] errors = ((DevFailed) e).errors;
+	    int l = errors == null ? 0 : ((DevFailed) e).errors.length;
+	    devErrorTab = new DevError[l + 1];
+	    // The stack of the catched error copied
+	    if (errors != null) {
+		System.arraycopy(errors, 0, devErrorTab, 0, l);
+	    }
+	    // A new DevError object is built with the given parameters
+	    String _reason = reason == null || reason.equals("") ? "Unknown reason" : reason;
+	    ErrSeverity _archSeverity = archSeverity == null ? ErrSeverity.WARN : archSeverity;
+	    String _desc = desc == null || desc.equals("") ? "DevFailed EXCEPTION" : desc;
+	    String _origin = origin == null || origin.equals("") ? e.getClass().getName() : origin;
+	    DevError devError = new DevError(_reason, _archSeverity, _desc, _origin);
+	    // The DevError object is added at the end of the stack
+	    devErrorTab[devErrorTab.length - 1] = devError;
+	} else if (e instanceof SnapshotingException) {
+	    // The current stack is initialized
+	    devErrorTab = new DevError[((SnapshotingException) e).devErrorTab.length + 1];
+	    // The stack of the catched error copied
+	    System.arraycopy(((SnapshotingException) e).devErrorTab, 0, devErrorTab, 0,
+		    ((SnapshotingException) e).devErrorTab.length);
+	    // A new DevError object is built with the given parameters
+	    String _reason = reason == null || reason.equals("") ? "Unknown reason" : reason;
+	    ErrSeverity _archSeverity = archSeverity == null ? ErrSeverity.WARN : archSeverity;
+	    String _desc = desc == null || desc.equals("") ? "Unknown exception" : desc;
+	    String _origin = origin == null || origin.equals("") ? e.getClass().getName() : origin;
+	    DevError devError = new DevError(_reason, _archSeverity, _desc, _origin);
 
-			// The DevError object is added at the end of the stack
-			devErrorTab[devErrorTab.length - 1] = devError;
-		} else {
-			// The current stack is initialized
-			devErrorTab = new DevError[2];
-			// A new DevError object is built for the catched exception
-			// (Original exception)
-			String reason_original = e.getMessage();
-			ErrSeverity archSeverity_original = ErrSeverity.WARN;
-			String desc_original = e.getLocalizedMessage();
-			String origin_original = e.getClass().getName();
-			DevError devError_original = new DevError(reason_original,
-					archSeverity_original, desc_original, origin_original);
-			// A new DevError object is built with the given parameters
-			String _reason = (reason == null || reason.equals("")) ? "Unknown reason"
-					: reason;
-			ErrSeverity _archSeverity = ((archSeverity == null) ? ErrSeverity.WARN
-					: archSeverity);
-			String _desc = (desc == null || desc.equals("")) ? "Unknown exception"
-					: desc;
-			String _origin = (origin == null || origin.equals("")) ? e
-					.getClass().getName() : origin;
-			DevError devError = new DevError(_reason, _archSeverity, _desc,
-					_origin);
+	    // The DevError object is added at the end of the stack
+	    devErrorTab[devErrorTab.length - 1] = devError;
+	} else {
+	    // The current stack is initialized
+	    devErrorTab = new DevError[2];
+	    // A new DevError object is built for the catched exception
+	    // (Original exception)
+	    String reason_original = e.getMessage();
+	    ErrSeverity archSeverity_original = ErrSeverity.WARN;
+	    String desc_original = e.getLocalizedMessage();
+	    String origin_original = e.getClass().getName();
+	    DevError devError_original = new DevError(reason_original, archSeverity_original, desc_original,
+		    origin_original);
+	    // A new DevError object is built with the given parameters
+	    String _reason = reason == null || reason.equals("") ? "Unknown reason" : reason;
+	    ErrSeverity _archSeverity = archSeverity == null ? ErrSeverity.WARN : archSeverity;
+	    String _desc = desc == null || desc.equals("") ? "Unknown exception" : desc;
+	    String _origin = origin == null || origin.equals("") ? e.getClass().getName() : origin;
+	    DevError devError = new DevError(_reason, _archSeverity, _desc, _origin);
 
-			// The DevError objects are added at the end of the stack
-			devErrorTab[0] = devError_original;
-			devErrorTab[1] = devError;
-		}
+	    // The DevError objects are added at the end of the stack
+	    devErrorTab[0] = devError_original;
+	    devErrorTab[1] = devError;
 	}
+    }
 
-	public void addStack(String message, String reason,
-			ErrSeverity archSeverity, String desc, String origin,
-			SnapshotingException e) {
-		archExcepMessage = message;
-		// new SnapshotingException
-		String _reason = (reason == null || reason.equals("")) ? "Unknown reason"
-				: reason;
-		ErrSeverity _archSeverity = ((archSeverity == null) ? ErrSeverity.WARN
-				: archSeverity);
-		String _desc = (desc == null || desc.equals("")) ? "Unknown exception"
-				: desc;
-		String _origin = (origin == null || origin.equals("")) ? e.getClass()
-				.getName() : origin;
-		DevError _devError = new DevError(_reason, _archSeverity, _desc,
-				_origin);
-		// The current stack is cloned
-		DevError[] devErrorTabClone = devErrorTab;
+    public void addStack(String message, String reason, ErrSeverity archSeverity, String desc, String origin,
+	    SnapshotingException e) {
+	archExcepMessage = message;
+	// new SnapshotingException
+	String _reason = reason == null || reason.equals("") ? "Unknown reason" : reason;
+	ErrSeverity _archSeverity = archSeverity == null ? ErrSeverity.WARN : archSeverity;
+	String _desc = desc == null || desc.equals("") ? "Unknown exception" : desc;
+	String _origin = origin == null || origin.equals("") ? e.getClass().getName() : origin;
+	DevError _devError = new DevError(_reason, _archSeverity, _desc, _origin);
+	// The current stack is cloned
+	DevError[] devErrorTabClone = devErrorTab;
 
-		if (devErrorTabClone != null) {
-			// The current stack is re-initialized
-			devErrorTab = new DevError[devErrorTabClone.length
-					+ e.devErrorTab.length + 1];
-			// The cloned is copied again
-			System.arraycopy(devErrorTabClone, 0, devErrorTab, 0,
-					devErrorTabClone.length);
-			// The stack of the catched error copied
-			System.arraycopy(e.devErrorTab, 0, devErrorTab,
-					devErrorTabClone.length, e.devErrorTab.length);
-			// The DevError builded with the given parameters is added at the
-			// end of the stack
-			devErrorTab[devErrorTabClone.length + e.devErrorTab.length] = _devError;
-		} else {
-			// The current stack is re-initialized
-			devErrorTab = new DevError[e.devErrorTab.length + 1];
-			// The stack of the catched error copied
-			System.arraycopy(e.devErrorTab, 0, devErrorTab, 0,
-					e.devErrorTab.length);
-			// The DevError builded with the given parameters is added at the
-			// end of the stack
-			devErrorTab[e.devErrorTab.length] = _devError;
-		}
+	if (devErrorTabClone != null) {
+	    // The current stack is re-initialized
+	    devErrorTab = new DevError[devErrorTabClone.length + e.devErrorTab.length + 1];
+	    // The cloned is copied again
+	    System.arraycopy(devErrorTabClone, 0, devErrorTab, 0, devErrorTabClone.length);
+	    // The stack of the catched error copied
+	    System.arraycopy(e.devErrorTab, 0, devErrorTab, devErrorTabClone.length, e.devErrorTab.length);
+	    // The DevError builded with the given parameters is added at the
+	    // end of the stack
+	    devErrorTab[devErrorTabClone.length + e.devErrorTab.length] = _devError;
+	} else {
+	    // The current stack is re-initialized
+	    devErrorTab = new DevError[e.devErrorTab.length + 1];
+	    // The stack of the catched error copied
+	    System.arraycopy(e.devErrorTab, 0, devErrorTab, 0, e.devErrorTab.length);
+	    // The DevError builded with the given parameters is added at the
+	    // end of the stack
+	    devErrorTab[e.devErrorTab.length] = _devError;
 	}
+    }
 
-	public String getMessage() {
-		return archExcepMessage;
-	}
+    @Override
+    public String getMessage() {
+	return archExcepMessage;
+    }
 
-	public String getLastExceptionMessage() {
-		return devErrorTab[0].desc;
-	}
+    public String getLastExceptionMessage() {
+	return devErrorTab[0].desc;
+    }
 
-	/**
-	 * @return the devErrorTab
-	 */
-	public DevError[] getDevErrorTab() {
-		return devErrorTab;
-	}
+    /**
+     * @return the devErrorTab
+     */
+    public DevError[] getDevErrorTab() {
+	return devErrorTab;
+    }
 
-	/**
-	 * @param devErrorTab
-	 *            the devErrorTab to set
-	 */
-	public void setDevErrorTab(DevError[] devErrorTab) {
-		this.devErrorTab = devErrorTab;
-	}
+    /**
+     * @param devErrorTab
+     *            the devErrorTab to set
+     */
+    public void setDevErrorTab(DevError[] devErrorTab) {
+	this.devErrorTab = devErrorTab;
+    }
 
-	public String toString() {
-		StringBuffer stringBuffer = new StringBuffer();
-		stringBuffer.append("Message : ").append(archExcepMessage).append(
-				"\r\n");
-		for (int i = 0; i < devErrorTab.length; i++) {
-			DevError devError = devErrorTab[i];
-			stringBuffer.append("\t [").append(i + 1).append("] : ").append(
-					"\r\n");
-			stringBuffer.append("\t").append("\t").append("Reason : ").append(
-					devError.reason).append("\r\n");
-			stringBuffer.append("\t").append("\t").append("Severity : ")
-					.append(errorSeverityToString(devError.severity)).append(
-							"\r\n");
-			stringBuffer.append("\t").append("\t").append("Description : ")
-					.append(devError.desc).append("\r\n");
-			stringBuffer.append("\t").append("\t").append("Origin : ").append(
-					devError.origin).append("\r\n");
-		}
-		return stringBuffer.toString();
+    @Override
+    public String toString() {
+	StringBuffer stringBuffer = new StringBuffer();
+	stringBuffer.append("Message : ").append(archExcepMessage).append("\r\n");
+	for (int i = 0; i < devErrorTab.length; i++) {
+	    DevError devError = devErrorTab[i];
+	    stringBuffer.append("\t [").append(i + 1).append("] : ").append("\r\n");
+	    stringBuffer.append("\t").append("\t").append("Reason : ").append(devError.reason).append("\r\n");
+	    stringBuffer.append("\t").append("\t").append("Severity : ")
+		    .append(errorSeverityToString(devError.severity)).append("\r\n");
+	    stringBuffer.append("\t").append("\t").append("Description : ").append(devError.desc).append("\r\n");
+	    stringBuffer.append("\t").append("\t").append("Origin : ").append(devError.origin).append("\r\n");
 	}
+	return stringBuffer.toString();
+    }
 
-	private String errorSeverityToString(ErrSeverity errSeverity) {
-		if (errSeverity == null)
-			return "WARNING";
-		switch (errSeverity.value()) {
-		case ErrSeverity._ERR:
-			return "ERROR";
-		case ErrSeverity._PANIC:
-			return "PANIC";
-		default:
-			return "WARNING";
-		}
-
+    private String errorSeverityToString(ErrSeverity errSeverity) {
+	if (errSeverity == null) {
+	    return "WARNING";
 	}
-
-	public DevFailed toTangoException() {
-		DevFailed devFailed = new DevFailed(archExcepMessage, devErrorTab);
-		return devFailed;
+	switch (errSeverity.value()) {
+	case ErrSeverity._ERR:
+	    return "ERROR";
+	case ErrSeverity._PANIC:
+	    return "PANIC";
+	default:
+	    return "WARNING";
 	}
 
-	public int stackSize() {
-		if (devErrorTab == null)
-			return 0;
-		else
-			return devErrorTab.length;
+    }
+
+    public DevFailed toTangoException() {
+	return new DevFailed(devErrorTab);
+    }
+
+    public int stackSize() {
+	if (devErrorTab == null) {
+	    return 0;
+	} else {
+	    return devErrorTab.length;
 	}
+    }
 
-	public boolean computeIsDueToATimeOut() {
-		Throwable cause = this.getCause();
-		if (cause instanceof DevFailed) {
-			DevFailed devFailedCause = (DevFailed) cause;
-			DevError[] errs = devFailedCause.errors;
-			if (errs != null) {
-				for (int i = 0; i < errs.length; i++) {
-					DevError nextErr = errs[i];
-					/*
-					 * String desc = nextErr.desc; String origin =
-					 * nextErr.origin;
-					 */
-					String reason = nextErr.reason;
+    public boolean computeIsDueToATimeOut() {
+	Throwable cause = this.getCause();
+	if (cause instanceof DevFailed) {
+	    DevFailed devFailedCause = (DevFailed) cause;
+	    DevError[] errs = devFailedCause.errors;
+	    if (errs != null) {
+		for (int i = 0; i < errs.length; i++) {
+		    DevError nextErr = errs[i];
+		    /*
+		     * String desc = nextErr.desc; String origin =
+		     * nextErr.origin;
+		     */
+		    String reason = nextErr.reason;
 
-					/*
-					 * System.out.println("CLA/DevFailed/desc/"+desc+"/");
-					 * System.out.println("CLA/DevFailed/origin/"+origin+"/");
-					 * System.out.println("CLA/DevFailed/reason/"+reason+"/");
-					 */
+		    /*
+		     * System.out.println("CLA/DevFailed/desc/"+desc+"/");
+		     * System.out.println("CLA/DevFailed/origin/"+origin+"/");
+		     * System.out.println("CLA/DevFailed/reason/"+reason+"/");
+		     */
 
-					if (reason.indexOf(TIMEOUT) != -1) {
-						this.setDueToATimeOut(true);
-						return true;
-					}
-				}
-			}
+		    if (reason.indexOf(TIMEOUT) != -1) {
+			this.setDueToATimeOut(true);
+			return true;
+		    }
 		}
-
-		this.setDueToATimeOut(false);
-		return false;
+	    }
 	}
 
-	/**
-	 * @return Returns the isDueToATimeOut.
-	 */
-	public boolean isDueToATimeOut() {
-		return this.isDueToATimeOut;
-	}
+	this.setDueToATimeOut(false);
+	return false;
+    }
 
-	/**
-	 * @param isDueToATimeOut
-	 *            The isDueToATimeOut to set.
-	 */
-	public void setDueToATimeOut(boolean isDueToATimeOut) {
-		this.isDueToATimeOut = isDueToATimeOut;
-	}
+    /**
+     * @return Returns the isDueToATimeOut.
+     */
+    public boolean isDueToATimeOut() {
+	return this.isDueToATimeOut;
+    }
+
+    /**
+     * @param isDueToATimeOut
+     *            The isDueToATimeOut to set.
+     */
+    public void setDueToATimeOut(boolean isDueToATimeOut) {
+	this.isDueToATimeOut = isDueToATimeOut;
+    }
 }
-- 
GitLab