Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/ExtendedPropertiesSupport.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/ExtendedPropertiesSupport.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/ExtendedPropertiesSupport.java	(revision 43828)
@@ -25,6 +25,10 @@
 
 import java.util.Map;
 
+/**
+ * 
+ * @deprecated use org.gvsig.tools.util.PropertiesSupport
+ */
 public interface ExtendedPropertiesSupport {
 
     /**
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 43828)
@@ -895,4 +895,6 @@
      * @return
      */
     SpatialIndex wrapSpatialIndex(SpatialIndex index);
+    
+    public FeatureReference getFeatureReference(String code);
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureReference.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 43828)
@@ -63,4 +63,6 @@
 	 * @return true if not in the original store
 	 */
 	public boolean isNewFeature();
+        
+        public String getCode();
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 43828)
@@ -2707,4 +2707,10 @@
       SpatialIndex wrappedIndex = new WrappedSpatialIndex(index, this);
       return wrappedIndex;
   }
+
+    @Override
+    public FeatureReference getFeatureReference(String code) {
+        FeatureReference featureReference = new DefaultFeatureReference(this, code);
+        return featureReference;
+    }
 }
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 43828)
@@ -25,6 +25,7 @@
 
 import java.lang.ref.WeakReference;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.List;
 import org.apache.commons.lang3.ArrayUtils;
 
@@ -40,6 +41,8 @@
 import org.gvsig.tools.persistence.Persistent;
 import org.gvsig.tools.persistence.PersistentState;
 import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.json.JSONArray;
+import org.json.JSONObject;
 
 public class DefaultFeatureReference implements
 		FeatureReferenceProviderServices, Persistent {
@@ -52,6 +55,15 @@
 	private boolean isNewFeature;
 	private String featureTypeId;
 	 
+        
+        private final int OID_INDEX = 0;
+        private final int MYHASHCODE_INDEX = 1;
+        private final int ISNEWFEATURE_INDEX = 2;
+        private final int FEATURETYPEID_INDEX = 3;
+        private final int PKNAMES_SIZE_INDEX = 4;
+        private final int PKNAMES_INDEX = 5;
+        private final int PK_INDEX = 6;
+        
 	/**
      * Constructor used by the persistence manager. Don't use directly.
      * After to invoke this method, the persistence manager calls 
@@ -108,7 +120,61 @@
 		this.storeRef = new WeakReference(store);
 	}
 
-	private DefaultFeatureStore getStore() {
+	public DefaultFeatureReference(FeatureStore store, String code) {
+            this.storeRef = new WeakReference(store);
+            
+            String json = new String(Base64.getDecoder().decode(code.getBytes()));
+            
+            JSONArray x = new JSONArray(json);
+            this.oid = x.get(OID_INDEX);
+            if( x.get(MYHASHCODE_INDEX)==JSONObject.NULL ) {
+                this.myHashCode = null;
+            } else {
+                this.myHashCode = x.getInt(MYHASHCODE_INDEX);
+            }
+            this.isNewFeature = x.getBoolean(ISNEWFEATURE_INDEX);
+            this.featureTypeId = x.getString(FEATURETYPEID_INDEX);
+            int pkNames_size = x.getInt(PKNAMES_SIZE_INDEX);
+            if( pkNames_size<0 ) {
+                this.pk = null;
+                this.pkNames = null;
+            } else {
+                this.pk = new Object[pkNames_size];
+                this.pkNames = new String[pkNames_size];
+                JSONArray xx = x.getJSONArray(PKNAMES_INDEX);
+                for( int i=0; i<xx.length(); i++ ) {
+                    this.pkNames[i] = xx.getString(i);
+                }
+                xx = x.getJSONArray(PKNAMES_INDEX);
+                for( int i=0; i<xx.length(); i++ ) {
+                    this.pk[i] = xx.get(i);
+                }
+            }
+            
+//            JSONObject x = new JSONObject(json);
+//            this.oid = x.get("oid");
+//            this.myHashCode = x.getInt("myHashCode");
+//            this.isNewFeature = x.getBoolean("isNewFeature");
+//            this.featureTypeId = x.getString("featureTypeId");
+//            int pkNames_size = x.getInt("pkNames_size");
+//            if( pkNames_size<0 ) {
+//                this.pk = null;
+//                this.pkNames = null;
+//            } else {
+//                this.pk = new Object[pkNames_size];
+//                this.pkNames = new String[pkNames_size];
+//                JSONArray xx = x.getJSONArray("pkNames");
+//                for( int i=0; i<xx.length(); i++ ) {
+//                    this.pkNames[i] = xx.getString(i);
+//                }
+//                xx = x.getJSONArray("pk");
+//                for( int i=0; i<xx.length(); i++ ) {
+//                    this.pk[i] = xx.get(i);
+//                }
+//            }
+        }
+        
+        private DefaultFeatureStore getStore() {
 		return (DefaultFeatureStore) this.storeRef.get();
 	}
 
@@ -263,6 +329,44 @@
 		}
 
 	}
+        
+        @Override
+        public String getCode() {
+//            JSONObject x = new JSONObject();
+////            x.put("store", (Persistent) storeRef.get());
+//            x.put("oid", oid);
+//            x.put("myHashCode", myHashCode);
+//            x.put("isNewFeature", isNewFeature);
+//            x.put("featureTypeId", featureTypeId);
+//            if( this.pk == null ) {
+//                x.put("pkNames_size", -1);
+//                x.put("pkNames", JSONObject.NULL);
+//                x.put("pk", JSONObject.NULL);
+//            } else {
+//                x.put("pkNames_size", pkNames.length);
+//                x.put("pkNames", new JSONArray(this.pkNames));
+//                x.put("pk", new JSONArray(this.pk));
+//            }
+//
+            Object[] data = new Object[7];
+            data[OID_INDEX] = this.oid;
+            data[MYHASHCODE_INDEX] = this.myHashCode;
+            data[ISNEWFEATURE_INDEX] = this.isNewFeature;
+            data[FEATURETYPEID_INDEX] = this.featureTypeId;
+            if( this.pk == null ) {
+                data[PKNAMES_SIZE_INDEX] = -1;
+                data[PKNAMES_INDEX] = JSONObject.NULL;
+                data[PK_INDEX] = JSONObject.NULL;
+            } else {
+                data[PKNAMES_SIZE_INDEX] = pkNames.length;
+                data[PKNAMES_INDEX] = new JSONArray(this.pkNames);
+                data[PK_INDEX] = new JSONArray(this.pk);            
+            }            
+            String s = new JSONArray(data).toString();
+            String r = Base64.getEncoder().encodeToString(s.getBytes());
+            
+            return r;
+        }
 
 	public static void registerPersistent() {
 		DynStruct definition = ToolsLocator.getPersistenceManager().addDefinition(
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/messages/NotificationManager.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/messages/NotificationManager.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/messages/NotificationManager.java	(revision 43828)
@@ -87,8 +87,12 @@
      * @see com.iver.mdiApp.Notification#addError(java.lang.String)
      */
     public static synchronized void addError(final String err, Throwable e) {
-    	logger.error(err, e);
-        dispatchError(err, e);
+        logger.error(err, e);
+        try {
+            dispatchError(err, e);
+        } catch(Exception ex) {
+            
+        }
     }
     
     public static synchronized void dispatchError(final String err, Throwable e) {
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java	(revision 43828)
@@ -37,6 +37,8 @@
 import java.util.Set;
 import java.util.prefs.Preferences;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
 import javax.imageio.ImageIO;
 
@@ -446,73 +448,95 @@
 		return writeProject(file, p, true);
 	}
 
-	/**
-	 * Escribe el proyecto en XML. Pero permite decidir si se pide confirmación
-	 * para sobreescribir
-	 *
-	 * @param file
-	 *            Fichero.
-	 * @param p
-	 *            Proyecto.
-	 * @param askConfirmation
-	 *            boolean
-	 */
-	public boolean writeProject(File file, Project p, boolean askConfirmation) {
-		if (askConfirmation && file.exists()) {
-			int resp = JOptionPane.showConfirmDialog((Component) PluginServices
-					.getMainFrame(), PluginServices.getText(this,
-					"fichero_ya_existe_seguro_desea_guardarlo"), PluginServices
-					.getText(this, "guardar"), JOptionPane.YES_NO_OPTION);
-			if (resp != JOptionPane.YES_OPTION) {
-				return false;
-			}
-		}
-		NotificationManager.addInfo(PluginServices.getText(this,
-				"writing_project") + ": " + file.getName());
+    /**
+     * Escribe el proyecto en disco. 
+     * Pero permite decidir si se pide confirmación para sobreescribir
+     *
+     * @param file Fichero.
+     * @param p Proyecto.
+     * @param askConfirmation boolean
+     * @return
+     */
+public boolean writeProject(File file, Project p, boolean askConfirmation) {
+        I18nManager i18n = ToolsLocator.getI18nManager();
+        ApplicationManager application = ApplicationLocator.getManager();
+        if (askConfirmation && file.exists()) {
+            int resp = application.confirmDialog(
+                    i18n.getTranslation("fichero_ya_existe_seguro_desea_guardarlo"), 
+                    i18n.getTranslation("guardar"), 
+                    JOptionPane.YES_NO_OPTION, 
+                    JOptionPane.QUESTION_MESSAGE, 
+                    "Overwrite_project_file"
+            );
+            if (resp != JOptionPane.YES_OPTION) {
+                return false;
+            }
+        }
+        FileOutputStream fout=null;
+        ZipOutputStream zout=null;
+        LOG.info("Writing project '"+ file.getAbsolutePath()+"'.");
+        try {
+            fireBeforeSavingFileEvent(new SaveEvent(this,SaveEvent.BEFORE_SAVING, file));
 
-		// write it out as XML
-		try {
-			fireBeforeSavingFileEvent(new SaveEvent(this,
-					SaveEvent.BEFORE_SAVING, file));
-            
-            FileOutputStream fout = new FileOutputStream(file);
-            ZipOutputStream zout = new ZipOutputStream(fout);
-            p.saveState(zout);
-            
+            fout = new FileOutputStream(file);
+            zout = new ZipOutputStream(fout);
+            p.saveState(zout, file.getParentFile());
+
             zout.putNextEntry(new ZipEntry("preview.jpg"));
             BufferedImage img = ApplicationLocator.getManager().getUIManager().getImagePreview();
             img = scale(img, 0.40);
             try {
                 ImageIO.write(img, "jpg", zout);
             } catch (IOException ex) {
-                LOG.warn("Can't save preview image'.",ex);
+                LOG.warn("Can't save preview image'.", ex);
             }
-            
+            fireAfterSavingFileEvent(new SaveEvent(this, SaveEvent.AFTER_SAVING, file));
             IOUtils.closeQuietly(zout);
             IOUtils.closeQuietly(fout);
+
+            if( !isValidZIP(file) ) {
+                throw new ZipException("Invalid project file '"+file.getAbsolutePath()+"'");
+            }
             
-			fireAfterSavingFileEvent(new SaveEvent(this,
-					SaveEvent.AFTER_SAVING, file));
+            PluginServices.getMainFrame().setTitle(file.getName());
+            setPath(file.toString());
 
-			PluginServices.getMainFrame().setTitle(file.getName());
-			setPath(file.toString());
+        } catch (Exception e) {
+            application.messageDialog(
+                    i18n.getTranslation("_Problems_saving_the_project_XnlX_It_is_possible_that_this_was_not_saved_properly_and_can_not_be_loaded_again"), 
+                    null, 
+                    i18n.getTranslation("guardar"), 
+                    JOptionPane.ERROR_MESSAGE, 
+                    "Problems_saving_the_project"
+            );
+            LOG.warn("Error writing project '"+file.getAbsolutePath()+"'.", e);
+            return false;
+        } finally {
+            IOUtils.closeQuietly(zout);
+            IOUtils.closeQuietly(fout);
+        }
+        
+        LOG.warn("Wrote project '"+file.getAbsolutePath()+"'.");
+        return true;
+    }
 
-		} catch (PersistenceException e) {
-			String messagestack = e.getLocalizedMessageStack();
-			NotificationManager.addError(
-					PluginServices.getText(this, "error_writing_project")
-							+ ": " + file.getName() + "\n" + messagestack, e);
-			return false;
-		} catch (Exception e) {
-			NotificationManager.addError(
-					PluginServices.getText(this, "error_writing_project")
-							+ ": " + file.getName(), e);
-			return false;
-		}
-		NotificationManager.addInfo(PluginServices.getText(this,
-				"wrote_project") + ": " + file.getName());
-		return true;
-	}
+    boolean isValidZIP(final File file) {
+        ZipFile zipfile = null;
+        try {
+            zipfile = new ZipFile(file);
+            return true;
+        } catch (IOException e) {
+            return false;
+        } finally {
+            try {
+                if (zipfile != null) {
+                    zipfile.close();
+                    zipfile = null;
+                }
+            } catch (IOException e) {
+            }
+        }
+    }
 
     private BufferedImage scale(BufferedImage before, double factor) {
         int w = (int) (before.getWidth()*factor);
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/Project.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/Project.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/Project.java	(revision 43828)
@@ -180,6 +180,8 @@
 	public void saveState(File out) throws PersistenceException;
 
 	public void saveState(OutputStream out) throws PersistenceException;
+        
+	public void saveState(OutputStream out, File rootFolder) throws PersistenceException;
 
 	public void loadState(InputStream in);
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/DefaultProject.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/DefaultProject.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/DefaultProject.java	(revision 43828)
@@ -30,6 +30,7 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
@@ -44,6 +45,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
 
 import org.cresques.cts.IProjection;
 
@@ -69,7 +72,6 @@
 import org.gvsig.fmap.mapcontext.layers.FLayers;
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.dynobject.DynStruct;
-import org.gvsig.tools.exception.ListBaseException;
 import org.gvsig.tools.observer.ObservableHelper;
 import org.gvsig.tools.observer.Observer;
 import org.gvsig.tools.persistence.PersistenceManager;
@@ -542,10 +544,31 @@
         } catch (FileNotFoundException e) {
             throw new PersistenceException(e);
         }
+        if( !isValidZIP(out) ) {
+            throw new PersistenceException(new ZipException());
+        }
         this.fname = out;
         notifyObservers(ProjectNotification.AFTER_SAVE_TO_FILE, out);
     }
 
+    boolean isValidZIP(final File file) {
+        ZipFile zipfile = null;
+        try {
+            zipfile = new ZipFile(file);
+            return true;
+        } catch (IOException e) {
+            return false;
+        } finally {
+            try {
+                if (zipfile != null) {
+                    zipfile.close();
+                    zipfile = null;
+                }
+            } catch (IOException e) {
+            }
+        }
+    }
+   
     public File getFile() {
         return this.fname;
     }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 43828)
@@ -1287,4 +1287,5 @@
 _Change_view_projection=CRS Vista
 _Change_view_projection_to_projection_of_the_selected_item_in_the_list=Cambia la proyecci\u00f3n de la Vista a la proyecci\u00f3n del item seleccionado en la lista.
 _precision_comparing_decimal_numbers=Precisi\u00f3n de comparaci\u00f3n de n\u00fameros decimales
-_default_expression_evaluator=Evaluador de expresiones por defecto
\ No newline at end of file
+_default_expression_evaluator=Evaluador de expresiones por defecto
+_Problems_saving_the_project_XnlX_It_is_possible_that_this_was_not_saved_properly_and_can_not_be_loaded_again=Problemas guardando el proyecto.\nEs posible que este no se haya guardado correctamente y no se pueda volver a cargar.
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 43828)
@@ -1206,4 +1206,5 @@
 _Change_view_projection=CRS View
 _Change_view_projection_to_projection_of_the_selected_item_in_the_list=Change View projection to the projection of the selected item in the list
 _precision_comparing_decimal_numbers=Precision comparing decimal numbers
-_default_expression_evaluator=Default expression evaluator
\ No newline at end of file
+_default_expression_evaluator=Default expression evaluator
+_Problems_saving_the_project_XnlX_It_is_possible_that_this_was_not_saved_properly_and_can_not_be_loaded_again=Problems saving the project.\nIt is possible that this was not saved properly and can not be loaded again.
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 43828)
@@ -1 +1 @@
-org.gvsig.temporarystorage.TemporaryStorageManagerLibrary
\ No newline at end of file
+org.gvsig.temporarystorage.TemporaryStorageLibrary
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/java/org/gvsig/temporarystorage/TemporaryStorageLocator.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/java/org/gvsig/temporarystorage/TemporaryStorageLocator.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.api/src/main/java/org/gvsig/temporarystorage/TemporaryStorageLocator.java	(revision 43828)
@@ -36,7 +36,7 @@
         return LOCATOR_NAME;
     }
 
-    public static TemporaryStorageManager getManager() throws LocatorException {
+    public static TemporaryStorageManager getTemporaryStorageManager() throws LocatorException {
         return (TemporaryStorageManager) getInstance().get(MANAGER_NAME);
     }
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageManagerImplLibrary.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageManagerImplLibrary.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageManagerImplLibrary.java	(revision 43828)
@@ -1,26 +0,0 @@
-package org.gvsig.temporarystorage.impl;
-
-
-import org.gvsig.temporarystorage.TemporaryStorageLibrary;
-import org.gvsig.temporarystorage.TemporaryStorageLocator;
-import org.gvsig.tools.library.AbstractLibrary;
-import org.gvsig.tools.library.LibraryException;
-
-public class TemporaryStorageManagerImplLibrary extends AbstractLibrary {
-
-    @Override
-    public void doRegistration() {
-        registerAsImplementationOf(TemporaryStorageLibrary.class);
-    }
-
-    @Override
-    protected void doInitialize() throws LibraryException {
-        TemporaryStorageLocator.registerManager(DefaultTemporaryStorageManager.class);
-    }
-
-    @Override
-    protected void doPostInitialize() throws LibraryException {
-
-    }
-}
-
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageImplLibrary.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageImplLibrary.java	(revision 0)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/java/org/gvsig/temporarystorage/impl/TemporaryStorageImplLibrary.java	(revision 43828)
@@ -0,0 +1,26 @@
+package org.gvsig.temporarystorage.impl;
+
+
+import org.gvsig.temporarystorage.TemporaryStorageLibrary;
+import org.gvsig.temporarystorage.TemporaryStorageLocator;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+public class TemporaryStorageImplLibrary extends AbstractLibrary {
+
+    @Override
+    public void doRegistration() {
+        registerAsImplementationOf(TemporaryStorageLibrary.class);
+    }
+
+    @Override
+    protected void doInitialize() throws LibraryException {
+        TemporaryStorageLocator.registerManager(DefaultTemporaryStorageManager.class);
+    }
+
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+
+    }
+}
+
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.temporarystorage/org.gvsig.temporarystorage.lib/org.gvsig.temporarystorage.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library	(revision 43828)
@@ -1 +1 @@
-org.gvsig.temporarystorage.impl.TemporaryStorageManagerImplLibrary
\ No newline at end of file
+org.gvsig.temporarystorage.impl.TemporaryStorageImplLibrary
\ No newline at end of file
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/SymbolTable.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/SymbolTable.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/SymbolTable.java	(revision 43828)
@@ -2,8 +2,10 @@
 
 import java.util.Iterator;
 
-public interface SymbolTable extends Iterable<Function>{
+import org.gvsig.tools.lang.Cloneable;
 
+public interface SymbolTable extends Iterable<Function>, Cloneable {
+
     public Function function(String name);
     
     public boolean exists(String name);
@@ -13,4 +15,9 @@
     public Iterator<String> itervars();
     
     public Iterator<Function> iterfuncs();
+
+    @Override
+    public SymbolTable clone() throws CloneNotSupportedException;
+    
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/CodeBuilder.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/CodeBuilder.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/CodeBuilder.java	(revision 43828)
@@ -5,8 +5,13 @@
 import org.gvsig.expressionevaluator.Code.Constant;
 import org.gvsig.expressionevaluator.Code.Identifier;
 
-public interface CodeBuilder {
-        
+import org.gvsig.tools.lang.Cloneable;
+
+public interface CodeBuilder extends Cloneable {
+
+    @Override
+    public CodeBuilder clone() throws CloneNotSupportedException;    
+    
     Constant constant(Object value);
 
     Identifier identifier(String name);
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionEvaluator.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionEvaluator.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/ExpressionEvaluator.java	(revision 43828)
@@ -1,8 +1,9 @@
 package org.gvsig.expressionevaluator;
 
 import org.gvsig.tools.evaluator.EvaluatorWithDescriptions;
+import org.gvsig.tools.lang.Cloneable;
 
-public interface ExpressionEvaluator extends EvaluatorWithDescriptions {
+public interface ExpressionEvaluator extends EvaluatorWithDescriptions, Cloneable  {
 
     public void compile();
 
@@ -31,5 +32,10 @@
     public Double getAccuracy();
     
     public void setAccuracy(Double accuracy);     
+
+    @Override
+    public ExpressionEvaluator clone() throws CloneNotSupportedException;
     
+    
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Interpreter.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Interpreter.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Interpreter.java	(revision 43828)
@@ -1,7 +1,9 @@
 package org.gvsig.expressionevaluator;
 
-public interface Interpreter {
+import org.gvsig.tools.lang.Cloneable;
 
+public interface Interpreter extends Cloneable {
+
     public interface Cache {
         
         public Object get(Object context, Object key);
@@ -28,4 +30,9 @@
     public Code getCurrentCode();
     
     public Cache getCache();
+
+    @Override
+    public Interpreter clone() throws CloneNotSupportedException;
+    
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/LexicalAnalyzer.java	(revision 43828)
@@ -1,9 +1,13 @@
 package org.gvsig.expressionevaluator;
 
-public interface LexicalAnalyzer {
 
-    public interface Token {
+import org.gvsig.tools.lang.Cloneable;
 
+
+public interface LexicalAnalyzer extends Cloneable {
+
+    public interface Token extends Cloneable {
+
         public static final int EOF = -1;
         public static final int IDENTIFIER = 0;
         public static final int STRING_LITERAL = 1;
@@ -37,6 +41,9 @@
         public static final int PARENTHESIS_CLOSE = 31;
         public static final int COMA = 32;
 
+        @Override
+        public Token clone() throws CloneNotSupportedException;
+        
         public void set(int type, String literal);
 
         public void set(int type, String literal, Object value);
@@ -55,4 +62,8 @@
 
     public Token next();
 
+    @Override
+    public LexicalAnalyzer clone() throws CloneNotSupportedException;
+
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/MutableSymbolTable.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/MutableSymbolTable.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/MutableSymbolTable.java	(revision 43828)
@@ -14,4 +14,7 @@
     public void removeVar(String name);
     
     public void removeFunction(String name);
+    
+    @Override
+    public MutableSymbolTable clone() throws CloneNotSupportedException;
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Code.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Code.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Code.java	(revision 43828)
@@ -27,8 +27,6 @@
 
         public interface Arguments extends Iterable<Code>, Visitable {
 
-            public void add(Code arg);
-
             public int count();
 
             @Override
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Compiler.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Compiler.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.api/src/main/java/org/gvsig/expressionevaluator/Compiler.java	(revision 43828)
@@ -1,12 +1,19 @@
 package org.gvsig.expressionevaluator;
 
+import org.gvsig.tools.lang.Cloneable;
 
-public interface Compiler {
+public interface Compiler extends Cloneable {
     
     public void setLexicalAnalyzer(LexicalAnalyzer lex);
     
     public void setCodeBuilder(CodeBuilder codeBuilder);
     
+    public CodeBuilder getCodeBuilder();
+    
     public Code compileExpression(String expression);
 
+    @Override
+    public Compiler clone() throws CloneNotSupportedException;
+
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultInterpreter.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultInterpreter.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultInterpreter.java	(revision 43828)
@@ -75,14 +75,24 @@
     private SymbolTable symbolTable = null;
     private Double accuracy;
     private Code currentCode;
-    private final Cache cache;
+    private Cache cache;
 
     public DefaultInterpreter() {
-        this.symbolTable = SQLSymbolTable.getInstance();
         this.cache = new DefaultCache();
     }
 
     @Override
+    public Interpreter clone() throws CloneNotSupportedException {
+        DefaultInterpreter other = (DefaultInterpreter) super.clone();
+        other.cache = new DefaultCache();
+        if( this.symbolTable!=null ) {
+            other.symbolTable = this.symbolTable.clone();
+        }
+        
+        return other;
+    }
+            
+    @Override
     public Cache getCache() {
         return this.cache;
     }
@@ -94,6 +104,9 @@
 
     @Override
     public SymbolTable getSymbolTable() {
+        if( this.symbolTable==null ) {
+            this.symbolTable = SQLSymbolTable.getInstance();
+        }
         return this.symbolTable;
     }
     @Override
@@ -124,7 +137,7 @@
         if( code instanceof Caller ) {
             Caller caller = (Caller) code;
             if( caller.function() == null ) {
-                caller.function(this.symbolTable.function(caller.name()));
+                caller.function(this.getSymbolTable().function(caller.name()));
             }
             if( caller.args() != null ) {
                 for( Code arg : caller.args() ) {
@@ -144,17 +157,17 @@
 
         case Code.IDENTIFIER:
             String name = ((Identifier) code).name();
-            if( !symbolTable.exists(name) ) {
+            if( !this.getSymbolTable().exists(name) ) {
                 throw new RuntimeException("Variable '" + name + "' not found.");
             }
-            value = symbolTable.value(name);
+            value = this.getSymbolTable().value(name);
             break;
 
         case Code.CALLER:
             Caller caller = (Caller) code;
             Function function = caller.function();
             if( function == null ) {
-                function = this.symbolTable.function(caller.name());
+                function = this.getSymbolTable().function(caller.name());
                 if( function == null ) {
                     throw new RuntimeException("Function '" + caller.name() + "' not found.");
                 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/AbstractLexicalAnalyzer.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/AbstractLexicalAnalyzer.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/AbstractLexicalAnalyzer.java	(revision 43828)
@@ -7,10 +7,11 @@
 import java.util.Locale;
 import java.util.Map;
 import java.util.Stack;
+import org.gvsig.tools.lang.Cloneable;
 
 public abstract class AbstractLexicalAnalyzer implements LexicalAnalyzer {
 
-    protected class Buffer {
+    protected class Buffer implements Cloneable {
 
         StringBuilder builder;
 
@@ -18,6 +19,13 @@
             this.builder = new StringBuilder();
         }
 
+        @Override
+        public Buffer clone() throws CloneNotSupportedException {
+            Buffer other = (Buffer) super.clone(); 
+            other.builder = new StringBuilder(builder);
+            return other;
+        }
+
         public void clear() {
             builder.delete(0, builder.length());
         }
@@ -38,15 +46,15 @@
 
     protected static final char EOF = 0;
     
-    private final NumberFormat nf;
-    private final ParsePosition nfPos;
-    private final Stack<Integer> states;
+    private NumberFormat nf;
+    private ParsePosition nfPos;
+    private Stack<Integer> states;
     private String source;
     private int position;
 
-    protected final Buffer buffer;
-    protected final DefaultToken token;
-    protected final Map<String, Integer> tokens;
+    protected Buffer buffer;
+    protected DefaultToken token;
+    protected Map<String, Integer> tokens;
 
     public AbstractLexicalAnalyzer(String source) {
         this.position = 0;
@@ -66,6 +74,19 @@
     }
 
     @Override
+    public LexicalAnalyzer clone() throws CloneNotSupportedException {
+        AbstractLexicalAnalyzer other = (AbstractLexicalAnalyzer) super.clone();
+        other.nf = NumberFormat.getInstance(Locale.UK);
+        other.nfPos = new ParsePosition(0);
+        other.buffer = buffer.clone();
+        other.token = (DefaultToken) token.clone();
+        other.states = new Stack<>();
+        other.states.addAll(states);
+        other.tokens = new HashMap<>(tokens);
+        return other;
+    }
+    
+    @Override
     public void setSource(String source) {
         this.source = source;
         this.position = 0;
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLSymbolTable.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLSymbolTable.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLSymbolTable.java	(revision 43828)
@@ -224,6 +224,14 @@
         addFunction(new STYFunction());
         addFunction(new STZFunction());
     }
+
+    @Override
+    @SuppressWarnings("CloneDoesntCallSuperClone")
+    public SymbolTable clone() throws CloneNotSupportedException {
+        // SQLSymbolTable is singleton and immutable, so we just return 
+        // the same instance.
+        return this;
+    }
     
     private void addFunction(Function function) {
         this.functions.put(function.name().toLowerCase(), function);
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCompiler.java	(revision 43828)
@@ -21,6 +21,15 @@
     }
 
     @Override
+    public Compiler clone() throws CloneNotSupportedException {
+        DefaultCompiler other = (DefaultCompiler) super.clone();
+        other.lexer = lexer.clone();
+        other.codeBuilder = codeBuilder.clone();
+        
+        return other;
+    }
+
+    @Override
     public void setLexicalAnalyzer(LexicalAnalyzer lexer) {
         this.lexer = lexer;
     }
@@ -29,7 +38,13 @@
     public void setCodeBuilder(CodeBuilder codeBuilder) {
         this.codeBuilder = codeBuilder;
     }
+
     @Override
+    public CodeBuilder getCodeBuilder() {
+        return this.codeBuilder;
+    }
+    
+    @Override
     public Code compileExpression(String expression) {
         this.lexer.setSource(expression);
         return parseExpression();
@@ -255,7 +270,7 @@
                 if( args == null ) {
                     args = codeBuilder.args();
                 }
-                args.add(arg);
+                ((DefaultCodeBuilder.BaseArguments)args).add(arg);
             }
             Token next = lexer.look();
             switch( next.getType() ) {
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultExpressionEvaluatorManager.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultExpressionEvaluatorManager.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultExpressionEvaluatorManager.java	(revision 43828)
@@ -10,8 +10,8 @@
 import org.gvsig.expressionevaluator.MutableSymbolTable;
 import org.gvsig.expressionevaluator.SymbolTable;
 import org.gvsig.fmap.dal.EvaluatorFactory;
-import org.gvsig.integration.DefaultEvaluatorFactory;
-import org.gvsig.integration.DefaultExpressionEvaluator;
+import org.gvsig.expressionevaluator.integration.DefaultEvaluatorFactory;
+import org.gvsig.expressionevaluator.integration.DefaultExpressionEvaluator;
 
 
 public class DefaultExpressionEvaluatorManager implements ExpressionEvaluatorManager {
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultSymbolTable.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultSymbolTable.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultSymbolTable.java	(revision 43828)
@@ -11,12 +11,12 @@
 
 public class DefaultSymbolTable implements MutableSymbolTable {
 
-    private SymbolTable symbolTable;
-    private final Map<String,Object> vars;
-    private final Map<String,Function> functions;
+    private SymbolTable delegatedSymbolTable;
+    private Map<String,Object> vars;
+    private Map<String,Function> functions;
     
-    public DefaultSymbolTable(SymbolTable symbolTable) {
-        this.symbolTable = symbolTable;
+    public DefaultSymbolTable(SymbolTable delegatedSymbolTable) {
+        this.delegatedSymbolTable = delegatedSymbolTable;
         this.vars = new HashMap<>();
         this.functions = new HashMap<>();
     }
@@ -24,6 +24,17 @@
     public DefaultSymbolTable() {
         this(null);
     }
+
+    @Override
+    public MutableSymbolTable clone() throws CloneNotSupportedException {
+        DefaultSymbolTable other = (DefaultSymbolTable) super.clone();
+        if( this.delegatedSymbolTable!=null ) {
+            other.delegatedSymbolTable = this.delegatedSymbolTable.clone();
+        }
+        other.vars = new HashMap<>(vars);
+        other.functions = new HashMap<>(functions);
+        return other;
+    }
     
     @Override
     public void addVar(String name, Object value) {
@@ -38,8 +49,8 @@
     @Override
     public Function function(String name) {
         Function fn = this.functions.get(name);
-        if( fn == null && this.symbolTable != null ) {
-            fn = this.symbolTable.function(name);
+        if( fn == null && this.delegatedSymbolTable != null ) {
+            fn = this.delegatedSymbolTable.function(name);
         }
         return fn;
     }
@@ -48,7 +59,7 @@
     public boolean exists(String name) {
         boolean e = this.vars.containsKey(name);
         if( !e ) {
-            e = this.symbolTable.exists(name);
+            e = this.delegatedSymbolTable.exists(name);
         }
         return e;
     }
@@ -58,17 +69,17 @@
         if( this.vars.containsKey(name) ) {
             return this.vars.get(name);
         }
-        return this.symbolTable.value(name);
+        return this.delegatedSymbolTable.value(name);
     }
 
     @Override
     public void setSymbolTable(SymbolTable symbolTable) {
-        this.symbolTable = symbolTable;
+        this.delegatedSymbolTable = symbolTable;
     }
 
     @Override
     public SymbolTable getSymbolTable() {
-        return this.symbolTable;
+        return this.delegatedSymbolTable;
     }
 
     @Override
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultToken.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultToken.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultToken.java	(revision 43828)
@@ -2,36 +2,53 @@
 
 import org.gvsig.expressionevaluator.LexicalAnalyzer.Token;
 
-
 public class DefaultToken implements Token {
 
     private int type;
-    String literal;
+    private String literal;
     private Object value;
 
     public DefaultToken() {
     }
 
+    @Override
+    public Token clone() throws CloneNotSupportedException {
+        // We will assume that the properties of the class are immutable, so 
+        // it would suffice to call the super class.
+        DefaultToken other = (DefaultToken) super.clone(); 
+        return other;
+    }
+
+    
+    @Override
     public void set(int type, String literal) {
         this.set(type, literal, literal);
     }
 
+    @Override
     public void set(int type, String literal, Object value) {
         this.literal = literal;
         this.type = type;
         this.value = value;
     }
 
+    @Override
     public int getType() {
         return type;
     }
 
+    @Override
     public Object getValue() {
         return value;
     }
 
+    @Override
     public String getLiteral() {
         return literal;
     }
     
+    public void setLiteral(String literal) {
+        this.literal = literal;
+    }
+    
 }
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultCodeBuilder.java	(revision 43828)
@@ -153,7 +153,6 @@
             return this.args.size();
         }
 
-        @Override
         public void add(Code arg) {
             this.args.add(arg);
         }
@@ -266,6 +265,14 @@
     }
 
     @Override
+    public CodeBuilder clone() throws CloneNotSupportedException {
+        // This implementation of CodeBuilder does not maintain state, so 
+        // we only call the super class.
+        DefaultCodeBuilder other = (DefaultCodeBuilder) super.clone();
+        return other;
+    }
+
+    @Override
     public Constant constant(Object value) {
         return new BaseConstant(value);
     }
@@ -293,15 +300,15 @@
     @Override
     public Caller operator(String name, Code arg1) {
         Arguments args = args();
-        args.add(arg1);
+        ((BaseArguments)args).add(arg1);
         return function(name, Caller.UNARY_OPERATOR, args);
     }
 
     @Override
     public Caller operator(String name, Code arg1, Code arg2) {
         Arguments args = args();
-        args.add(arg1);
-        args.add(arg2);
+        ((BaseArguments)args).add(arg1);
+        ((BaseArguments)args).add(arg2);
         return function(name, Caller.BINARY_OPERATOR, args);
     }
 
Index: branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLLexicalAnalyzer.java
===================================================================
--- branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLLexicalAnalyzer.java	(revision 43827)
+++ branches/org.gvsig.desktop-2018a/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/SQLLexicalAnalyzer.java	(revision 43828)
@@ -1,5 +1,7 @@
 package org.gvsig.expressionevaluator.impl;
 
+import org.gvsig.expressionevaluator.LexicalAnalyzer;
+
 public class SQLLexicalAnalyzer extends AbstractLexicalAnalyzer {
 
     public SQLLexicalAnalyzer(String source) {
@@ -23,6 +25,16 @@
     }
 
     @Override
+    public LexicalAnalyzer clone() throws CloneNotSupportedException {
+        // As this implementation does not add state to the abstract class, we 
+        // just call the super class.
+        SQLLexicalAnalyzer other = (SQLLexicalAnalyzer) super.clone();
+
+        return other;
+    }
+
+    
+    @Override
     protected Token getToken() {
         skipblanks();
         char ch = getch();
@@ -88,7 +100,7 @@
             }
             ungetch();
             parseNumber();
-            token.literal = "+" + token.literal;
+            token.setLiteral("+" + token.getLiteral());
             return token;
         case '-':
             ch = getch();

Property changes on: branches/org.gvsig.desktop-2018a
___________________________________________________________________
Modified: svn:ignore
   - .maven-howto.rst.kate-swp
.maven-howto.rst.swp
.classpath
nb-configuration.xml
.pom.xml.swp
.incorrent_layer_name.patch.swp
target/**
.project
.directory
.settings/**
.settings
target

   + .maven-howto.rst.kate-swp
org.gvsig.app.mainpligin#4835.diff
.maven-howto.rst.swp
.classpath
nb-configuration.xml
.incorrent_layer_name.patch.swp
.project
.directory
.settings/**
target
.pom.xml.swp
target/**
.settings

Added: svn:mergeinfo
   Merged /trunk/org.gvsig.desktop:r43792-43826

