Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java	(revision 35988)
@@ -0,0 +1,139 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the class {@link ExtentHistory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ExtentHistoryTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#put(java.awt.geom.Rectangle2D)}
+	 * .
+	 */
+	public void testPut() {
+		ExtentHistory history = new ExtentHistory();
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+		Rectangle2D rectangle3 = new Rectangle2D.Double(3, 3, 4, 4);
+		history.put(rectangle3);
+		history.put(rectangle2);
+		history.put(rectangle);
+
+		assertEquals(rectangle, history.get());
+
+		history = new ExtentHistory(2);
+
+		history.put(rectangle);
+		history.put(rectangle2);
+		history.put(rectangle3);
+
+		assertEquals(rectangle3, history.get());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#hasPrevious()}.
+	 */
+	public void testHasPrevious() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertFalse(history.hasPrevious());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		history.put(rectangle);
+
+		assertTrue(history.hasPrevious());
+
+		history.removePrev();
+		assertFalse(history.hasPrevious());
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.fmap.mapcontext.ExtentHistory#get()}.
+	 */
+	public void testGet() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertNull("The ExtentHistory has got an element without adding one",
+				history.get());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+
+		history.put(rectangle);
+		assertEquals(rectangle, history.get());
+
+		history.put(rectangle2);
+		assertEquals(rectangle2, history.get());
+
+		history.removePrev();
+		assertEquals(rectangle, history.get());
+
+		history.removePrev();
+		assertNull("The ExtentHistory has got an element, "
+				+ "but all have been previously removed", history.get());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#removePrev()}.
+	 */
+	public void testRemovePrev() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertNull(
+				"The ExtentHistory allows removing an element without adding "
+						+ "at least one", history.removePrev());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+
+		history.put(rectangle);
+		history.put(rectangle2);
+
+		history.removePrev();
+		assertEquals(rectangle, history.get());
+
+		history.removePrev();
+		assertNull("The ExtentHistory allows to remove the last element, "
+				+ "but all have been previously removed", history.removePrev());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java	(revision 35988)
@@ -0,0 +1,158 @@
+package org.gvsig.fmap.mapcontext.rendering.symbol;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+import java.util.ArrayList;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+public class DummySymbol implements ISymbol {
+
+	private Color color = Color.GREEN;
+	private int type = TYPES.SOLID;
+	
+	public DummySymbol(Color c, int geomtype) {
+		color = c;
+		type = geomtype;
+	}
+	
+	public Object clone() {
+		return null;
+	}
+	
+	public void draw(Graphics2D g, AffineTransform affineTransform,
+			Geometry geom, Feature f, Cancellable cancel) {
+		
+		g.setColor(color);
+		
+		if (geom instanceof Point) {
+			Point p = (Point) geom;
+			p.transform(affineTransform);
+			g.drawRect((int) p.getX(), (int) p.getY(), 3, 3);
+		} else {
+			PathIterator piter = geom.getPathIterator(affineTransform); 
+			drawPathIterator(g, piter);
+		}
+	}
+
+	public void drawInsideRectangle(Graphics2D g,
+			AffineTransform scaleInstance, Rectangle r,
+			PrintAttributes properties) throws SymbolDrawingException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Color getColor() {
+		return color;
+	}
+
+	public String getDescription() {
+		return "a dummy symbol";
+	}
+
+	public int getOnePointRgb() {
+		return color.getRGB();
+	}
+
+	public void getPixExtentPlus(Geometry geom, float[] distances,
+			ViewPort viewPort, int dpi) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public ISymbol getSymbolForSelection() {
+		return new DummySymbol(Color.YELLOW, type);
+	}
+
+	public int getSymbolType() {
+		return type;
+	}
+
+	public boolean isOneDotOrPixel(Geometry geom,
+			double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isShapeVisible() {
+		return true;
+	}
+
+	public boolean isSuitableFor(Geometry geom) {
+		return type == geom.getType();
+	}
+
+	public void setColor(Color c) {
+		color = c;
+	}
+
+	public void setDescription(String desc) {
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+	}
+
+	public void print(Graphics2D g, AffineTransform at, Geometry shape,
+			PrintAttributes properties) {
+	}
+	
+	
+	
+	/**
+	 * Draws the general path on the graphics object with the given affine transformation
+	 * @param g the graphics object
+	 * @param gp the general path
+	 */
+	public static void drawPathIterator(Graphics2D g, PathIterator pit) {
+		
+		ArrayList x = new ArrayList();
+		ArrayList y = new ArrayList();
+		double[] current = new double[6];
+		
+		while (!pit.isDone()) {
+			pit.currentSegment(current);
+			x.add(new Integer((int) current[0]));
+			y.add(new Integer((int) current[1]));
+			pit.next();
+		}
+		
+		int[] gx = integerArrayListToIntArray(x);
+		int[] gy = integerArrayListToIntArray(y);
+
+		g.drawPolyline(gx, gy, gx.length);
+	}
+	
+	
+	/**
+	 * Converts array list of Integer objects into array of int
+	 * @param l
+	 * @return array of int
+	 */
+	public static int[] integerArrayListToIntArray(ArrayList l) {
+
+		int size = l.size();
+		int[] resp = new int[size];
+		for (int i=0; i<size; i++) {
+			resp[i] = ((Integer) l.get(i)).intValue();
+		}
+		return resp;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java	(revision 35988)
@@ -0,0 +1,208 @@
+package org.gvsig.fmap.mapcontext.rendering.symbol;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+public class DummyVectorLegend implements IVectorLegend {
+
+    private long shpType = -1;
+
+    private ISymbol sym = new DummySymbol(Color.RED, TYPES.SOLID);
+
+    public DummyVectorLegend() {
+        shpType = System.currentTimeMillis() % 1000000;
+    }
+
+    public DummyVectorLegend(int type) {
+        shpType = type; // System.currentTimeMillis() % 1000000;
+    }
+
+    public void draw(BufferedImage image, Graphics2D graphics2D,
+        ViewPort viewPort, Cancellable cancel, double scale,
+        Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery) throws LegendException {
+
+    }
+    public void draw(BufferedImage image, Graphics2D graphics2D,
+        ViewPort viewPort, Cancellable cancel, double scale,
+        Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore) throws LegendException {
+
+        try {
+            FeatureSet fs = featureStore.getFeatureSet();
+            Iterator iter = fs.iterator();
+            Feature feat = null;
+            ISymbol symb = null;
+            while (iter.hasNext()) {
+                feat = (Feature) iter.next();
+                symb = this.getSymbolByFeature(feat);
+                symb.draw(graphics2D, viewPort.getAffineTransform(), feat.getDefaultGeometry(), feat, null);
+            }
+        } catch (DataException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        // TODO Auto-generated method stub
+
+    }
+
+    public int getShapeType() {
+        // TODO Auto-generated method stub
+        return (int) shpType;
+    }
+
+    public ISymbol getSymbolByFeature(Feature feat) {
+        return sym;
+    }
+
+    public boolean isSuitableForShapeType(int shapeType) {
+        return sym.getSymbolType() == shapeType;
+    }
+
+    public boolean isUseDefaultSymbol() {
+        return true;
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Object object, ICoordTrans coordTrans,
+        FeatureStore featureStore, Evaluator evaluator, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setDefaultSymbol(ISymbol s) throws IllegalArgumentException {
+        sym = s;
+    }
+
+    public void setShapeType(int shapeType) {
+        shpType = shapeType;
+    }
+
+    public void useDefaultSymbol(boolean b) {
+    }
+
+    public void addLegendListener(LegendContentsChangedListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public ILegend cloneLegend() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public ISymbol getDefaultSymbol() {
+        return sym;
+    }
+
+    public LegendContentsChangedListener[] getListeners() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void removeLegendListener(LegendContentsChangedListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public String getClassName() {
+        return this.getClass().getName();
+    }
+
+
+
+
+    public void addDrawingObserver(Observer observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteDrawingObserver(Observer observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteDrawingObservers() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+        shpType = state.getLong("shpType");
+    }
+
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+        state.set("shpType", shpType);
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public static void registerPersistent() {
+        PersistenceManager manager = ToolsLocator.getPersistenceManager();
+        DynStruct definition = manager.addDefinition(
+            DummyVectorLegend.class,
+            "DummyVectorLegend",
+            "DummyVectorLegend Persistence definition",
+            null, 
+            null
+        );
+        definition.addDynFieldLong("shpType")
+        .setMandatory(true);
+    }
+
+
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:eol-style
   + native

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java	(revision 35988)
@@ -0,0 +1,99 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Color;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link ColorPersistenceFactory}.
+ * 
+ * @author gvSIG team
+ */
+public class ColorPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private ColorPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Color color;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (ColorPersistenceFactory) persistenceManager.getFactories()
+				.get(Color.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		color = Color.magenta;
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_RED), color.getRed());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_GREEN), color.getGreen());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_BLUE), color.getBlue());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_ALPHA), color.getAlpha());
+		stateControl.replay();
+
+		Color newColor = (Color) factory.createFromState(state);
+		assertTrue(newColor.equals(color));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(ColorPersistenceFactory.FIELD_RED, color.getRed());
+		state.set(ColorPersistenceFactory.FIELD_GREEN, color.getGreen());
+		state.set(ColorPersistenceFactory.FIELD_BLUE, color.getBlue());
+		state.set(ColorPersistenceFactory.FIELD_ALPHA, color.getAlpha());
+		stateControl.replay();
+
+		factory.saveToState(state, color);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java	(revision 35988)
@@ -0,0 +1,94 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Point2D;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link Point2DPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class Point2DPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private Point2DPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Point2D point;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (Point2DPersistenceFactory) persistenceManager.getFactories()
+				.get(Point2D.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		double x = Math.random() * 1000d;
+		double y = Math.random() * 1000d;
+		point = new Point2D.Double(x, y);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#createFromState(PersistentState, Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getDouble(Point2DPersistenceFactory.FIELD_X), point.getX());
+		stateControl.expectAndReturn(state
+				.getDouble(Point2DPersistenceFactory.FIELD_Y), point.getY());
+		stateControl.replay();
+
+		Point2D newPoint = (Point2D) factory.createFromState(state);
+		assertTrue(newPoint.equals(point));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(Point2DPersistenceFactory.FIELD_X, point.getX());
+		state.set(Point2DPersistenceFactory.FIELD_Y, point.getY());
+		stateControl.replay();
+
+		factory.saveToState(state, point);
+
+		stateControl.verify();
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java	(revision 35988)
@@ -0,0 +1,95 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Dimension;
+
+import org.easymock.MockControl;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link DimensionPersistenceFactory}.
+ * 
+ * @author gvSIG team
+ */
+public class DimensionPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private DimensionPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Dimension dimension;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (DimensionPersistenceFactory) persistenceManager
+				.getFactories().get(Dimension.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		dimension = new Dimension(320, 200);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getInt(DimensionPersistenceFactory.FIELD_WIDTH), dimension.width);			
+		stateControl.expectAndReturn(state
+				.getInt(DimensionPersistenceFactory.FIELD_HEIGHT), dimension.height);				
+		stateControl.replay();
+
+		Dimension newDimension = (Dimension) factory.createFromState(state);
+		assertTrue(newDimension.equals(dimension));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(DimensionPersistenceFactory.FIELD_WIDTH, dimension.width);
+		state.set(DimensionPersistenceFactory.FIELD_HEIGHT, dimension.height);
+				
+		stateControl.replay();
+
+		factory.saveToState(state, dimension);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java	(revision 35988)
@@ -0,0 +1,95 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Font;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link FontPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class FontPersistenceFactoryTest extends AbstractLibraryAutoInitTestCase {
+
+	private FontPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Font font;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (FontPersistenceFactory) persistenceManager.getFactories()
+				.get(Font.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		font = new Font("Arial", Font.BOLD, 18);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getString(FontPersistenceFactory.FIELD_NAME), font.getName());
+		stateControl.expectAndReturn(state
+				.getInt(FontPersistenceFactory.FIELD_STYLE), font.getStyle());
+		stateControl.expectAndReturn(state
+				.getInt(FontPersistenceFactory.FIELD_SIZE), font.getSize());
+		stateControl.replay();
+
+		Font newFont = (Font) factory.createFromState(state);
+		assertTrue(newFont.equals(font));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(FontPersistenceFactory.FIELD_NAME, font.getName());
+		state.set(FontPersistenceFactory.FIELD_STYLE, font.getStyle());
+		state.set(FontPersistenceFactory.FIELD_SIZE, font.getSize());
+		stateControl.replay();
+
+		factory.saveToState(state, font);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java	(revision 35988)
@@ -0,0 +1,120 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Rectangle2D;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link Rectangle2DPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class Rectangle2DPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private Rectangle2DPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Rectangle2D rectangle;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (Rectangle2DPersistenceFactory) persistenceManager
+				.getFactories().get(Rectangle2D.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		double x = Math.random() * 1000d;
+		double y = Math.random() * 1000d;
+		rectangle = new Rectangle2D.Double(x, y, 320, 200);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#createFromState(PersistentState, Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_X), rectangle
+				.getX());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_Y), rectangle
+				.getY());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_WIDTH),
+				rectangle.getWidth());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_HEIGHT),
+				rectangle.getHeight());
+		stateControl.replay();
+
+		Rectangle2D newRectangle = (Rectangle2D) factory.createFromState(state);
+
+		System.out.println("Orig x = " + rectangle.getX() + " - New x = "
+				+ newRectangle.getX());
+		assertEquals(rectangle.getX(), newRectangle.getX(), 0.0d);
+		System.out.println("Orig y = " + rectangle.getY() + " - New y = "
+				+ newRectangle.getY());
+		assertEquals(rectangle.getY(), newRectangle.getY(), 0.0d);
+		System.out.println("Orig width = " + rectangle.getWidth()
+				+ " - New width = " + newRectangle.getWidth());
+		assertEquals(rectangle.getWidth(), newRectangle.getWidth(), 0.0d);
+		System.out.println("Orig height = " + rectangle.getHeight()
+				+ " - New height = " + newRectangle.getHeight());
+		assertEquals(rectangle.getHeight(), newRectangle.getHeight(), 0.0d);
+
+		assertTrue(newRectangle.equals(rectangle));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(Rectangle2DPersistenceFactory.FIELD_X, rectangle.getX());
+		state.set(Rectangle2DPersistenceFactory.FIELD_Y, rectangle.getY());
+		state.set(Rectangle2DPersistenceFactory.FIELD_WIDTH, rectangle
+				.getWidth());
+		state.set(Rectangle2DPersistenceFactory.FIELD_HEIGHT, rectangle
+				.getHeight());
+		stateControl.replay();
+
+		factory.saveToState(state, rectangle);
+
+		stateControl.verify();
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java	(revision 35988)
@@ -0,0 +1,321 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultMapContextManagerTest extends
+AbstractLibraryAutoInitTestCase {
+
+    private DefaultMapContextManager manager;
+
+    protected void doSetUp() throws Exception {
+        manager = new DefaultMapContextManager();
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+        manager.setDefaultVectorLegend("DummyLegend");
+        manager.registerLegendReader("Dummy", DummyLegendReader.class);
+        manager.registerLegendWriter("DummyLegend", "Dummy", DummyLegendWriter.class);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#createDefaultMapContextDrawerInstance()}
+     * .
+     */
+    public void testGetDefaultMapContextDrawerInstance() throws Exception {
+
+        manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class);
+
+        MapContextDrawer drawer = manager
+        .createDefaultMapContextDrawerInstance();
+
+        assertNotNull("The created MapContextDrawer instance can't be null",
+            drawer);
+        assertTrue(
+            "The created MapContextDrawer is not instance of the registered class"
+            + DummyMapContextDrawer.class,
+            drawer instanceof DummyMapContextDrawer);
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#setDefaultMapContextDrawer(java.lang.Class)}
+     * .
+     */
+    public void testSetDefaultMapContextDrawer() throws Exception {
+
+        // First, try to register an invalid class
+        try {
+            manager.setDefaultMapContextDrawer(Object.class);
+            fail("Error, a class that does not implement the MapContextDrawer "
+                + "interface has been accepted");
+        } catch (MapContextRuntimeException e) {
+            // OK
+        }
+
+        // Next, try to register a valid class
+        manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class);
+    }
+
+    public void testCreateGraphicsLayer() throws Exception {
+        assertNotNull(manager.createGraphicsLayer(CRSFactory.getCRS("EPSG:23030")));
+    }
+
+    public void testCreateDefaultVectorLegend() throws Exception {
+
+        IVectorLegend legend = manager.createDefaultVectorLegend(1);
+        assertNotNull(legend);
+        assertTrue(legend instanceof DummyVectorLegend);
+    }
+
+    public void testRegisterCreateLegend() throws Exception {
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+
+        ILegend legend = manager.createLegend("DummyLegend");
+        assertNotNull(legend);
+        assertTrue(legend instanceof DummyVectorLegend);
+
+        assertNull(manager.createLegend("NONE"));
+    }
+
+    public void testRegisterCreateLegendReader() throws Exception {
+
+        manager.registerLegendReader("Dummy", DummyLegendReader.class);
+
+        ILegendReader legendReader = manager.createLegendReader("Dummy");
+        assertNotNull(legendReader);
+        assertTrue(legendReader instanceof DummyLegendReader);
+
+        assertNull(manager.createLegendReader("NONE"));
+    }
+
+    public void testRegisterCreateLegendWriter() throws Exception {
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+
+        manager.registerLegendWriter("DummyLegend", "Dummy",
+            DummyLegendWriter.class);
+
+        // Test the registered writer is created
+        ILegendWriter legendWriter = manager.createLegendWriter("DummyLegend",
+        "Dummy");
+        assertNotNull(legendWriter);
+        assertTrue(legendWriter instanceof DummyLegendWriter);
+
+        // Test non registered cases
+        assertNull(manager.createLegendWriter("NONE", "Dummy"));
+        assertNull(manager.createLegendWriter("DummyLegend", "NONE"));
+        assertNull(manager.createLegendWriter("NONE", "NONE"));
+    }
+
+    public static class DummyMapContextDrawer implements MapContextDrawer {
+
+        public void dispose() {
+        }
+
+        public void draw(FLayers root, BufferedImage image, Graphics2D g,
+            Cancellable cancel, double scale) throws ReadException {
+        }
+
+        public void print(FLayers root, Graphics2D g, Cancellable cancel,
+            double scale, PrintAttributes properties) throws ReadException {
+        }
+
+        public void setMapContext(MapContext mapContext) {
+        }
+
+        public void setViewPort(ViewPort viewPort) {
+        }
+
+    }
+
+    public static class DummyLegendReader implements ILegendReader {
+
+    }
+
+    public static class DummyLegendWriter implements ILegendWriter {
+
+    }
+
+    public static class DummyVectorLegend implements IVectorLegend {
+
+        public void draw(BufferedImage image, Graphics2D graphics2d,
+            ViewPort viewPort, Cancellable cancel, double scale,
+            Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, FeatureQuery featureQuery) throws LegendException {
+            // Empty method
+        }
+
+        public void draw(BufferedImage image, Graphics2D graphics2d,
+            ViewPort viewPort, Cancellable cancel, double scale,
+            Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore) throws LegendException {
+            // Empty method
+        }
+
+        public int getShapeType() {
+            // Empty method
+            return 0;
+        }
+
+        public ISymbol getSymbolByFeature(Feature feat)
+        throws MapContextException {
+            // Empty method
+            return null;
+        }
+
+        public boolean isSuitableForShapeType(int shapeType) {
+            // Empty method
+            return false;
+        }
+
+        public boolean isUseDefaultSymbol() {
+            // Empty method
+            return false;
+        }
+
+        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, PrintAttributes properties)
+        throws LegendException {
+            // Empty method
+        }
+
+        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties)
+        throws LegendException {
+            // Empty method
+        }
+
+        public void setDefaultSymbol(ISymbol s) {
+            // Empty method
+        }
+
+        public void setShapeType(int shapeType) {
+            // Empty method
+        }
+
+        public void useDefaultSymbol(boolean b) {
+            // Empty method
+        }
+
+        public void addLegendListener(LegendContentsChangedListener listener) {
+            // Empty method
+        }
+
+        public ILegend cloneLegend() {
+            // Empty method
+            return null;
+        }
+
+        public Object clone() throws CloneNotSupportedException {
+            // TODO Auto-generated method stub
+            return super.clone();
+        }
+
+        public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) {
+            // Empty method
+        }
+
+        public ISymbol getDefaultSymbol() {
+            // Empty method
+            return null;
+        }
+
+        public LegendContentsChangedListener[] getListeners() {
+            // Empty method
+            return null;
+        }
+
+        public void removeLegendListener(LegendContentsChangedListener listener) {
+            // Empty method
+        }
+
+        public void loadFromState(PersistentState state)
+        throws PersistenceException {
+            // Empty method
+        }
+
+        public void saveToState(PersistentState state)
+        throws PersistenceException {
+            // Empty method
+        }
+
+        public void addDrawingObserver(Observer observer) {
+            // Empty method
+        }
+
+        public void deleteDrawingObserver(Observer observer) {
+            // Empty method
+        }
+
+        public void deleteDrawingObservers() {
+            // Empty method
+        }
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java	(revision 35988)
@@ -0,0 +1,1320 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureRules;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.visitor.Visitor;
+
+public class DummyFileFeatureStore implements FeatureStore {
+
+	public static class DummyFeatureAttributeDescriptor implements
+			FeatureAttributeDescriptor {
+
+		public boolean allowNull() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Object getAdditionalInfo(String infoName) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getCopy() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public DataType getDataType() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public String getDataTypeName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public DateFormat getDateFormat() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object getDefaultValue() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Evaluator getEvaluator() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getGeometrySubType() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getGeometryType() {
+			return Geometry.TYPES.POINT;
+		}
+
+		public int getIndex() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getMaximumOccurrences() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getMinimumOccurrences() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public String getName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Class getObjectClass() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getPrecision() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public IProjection getSRS() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getSize() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getType() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public boolean isAutomatic() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean isPrimaryKey() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean isReadOnly() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+      
+        public String getSubtype() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public int getTheTypeOfAvailableValues() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+        public boolean isContainer() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isHidden() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isMandatory() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isPersistent() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public DynField setAvailableValues(DynObjectValueItem[] values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setAvailableValues(List values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setClassOfItems(Class theClass)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setClassOfValue(Class theClass)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDefaultDynValue(Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDefaultFieldValue(Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDescription(String description) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setElementsType(int type)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setElementsType(DynStruct type)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setGroup(String groupName) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setHidden(boolean hidden) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMandatory(boolean mandatory) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMaxValue(Object maxValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMinValue(Object minValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setOrder(int order) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setPersistent(boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setReadOnly(boolean isReadOnly) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setSubtype(String subtype) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setTheTypeOfAvailableValues(int type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setType(int type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setType(DataType type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void validate(Object value) throws DynFieldValidateException {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public Object coerce(Object value) throws CoercionException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynObjectValueItem[] getAvailableValues() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Class getClassOfItems() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Class getClassOfValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getDescription() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField getElementsType() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getGroup() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Object getMaxValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Object getMinValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public int getOder() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+        public boolean isTime() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public FeatureAttributeGetter getFeatureAttributeGetter() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void setFeatureAttributeGetter(
+            FeatureAttributeGetter featureAttributeGetter) {
+            // TODO Auto-generated method stub
+            
+        }
+
+	}
+
+	public static class DummyFeatureType implements FeatureType {
+
+		public boolean allowAutomaticValues() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Object get(String name) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object get(int index) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getAttributeDescriptor(String name) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getAttributeDescriptor(int index) {
+			return new DummyFeatureAttributeDescriptor();
+		}
+
+		public FeatureAttributeDescriptor[] getAttributeDescriptors() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureType getCopy() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getDefaultGeometryAttribute() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getDefaultGeometryAttributeIndex() {
+			return 0;
+		}
+
+		public String getDefaultGeometryAttributeName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public IProjection getDefaultSRS() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public EditableFeatureType getEditable() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public String getId() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getIndex(String name) {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public FeatureAttributeDescriptor[] getPrimaryKey() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureRules getRules() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public List getSRSs() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public boolean hasEvaluators() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean hasOID() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Iterator iterator() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int size() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+        public DynClass[] getSuperDynClasses() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void removeDynMethod(String name) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynField addDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldArray(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldBoolean(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldChoice(String name, int type,
+            Object defaultValue, DynObjectValueItem[] values,
+            boolean mandatory, boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldChoice(String name, int type,
+            Object defaultValue, DynObjectValueItem[] values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldDate(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldDouble(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFile(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFloat(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFolder(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldInt(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldList(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldLong(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldMap(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldObject(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldRange(String name, int type,
+            Object defaultValue, Object min, Object max, boolean mandatory,
+            boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldRange(String name, int type,
+            Object defaultValue, Object min, Object max) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSet(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSingle(String name, int type,
+            Object defaultValue, boolean mandatory, boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSingle(String name, int type,
+            Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldString(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldURI(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldURL(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void extend(DynStruct struct) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void extend(String namespace, String structName) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void extend(String structName) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynField getDeclaredDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField[] getDeclaredDynFields() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getDescription() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField getDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField[] getDynFields() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getFullName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getNamespace() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynStruct[] getSuperDynStructs() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public boolean isInstance(DynObject dynObject) {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public DynObject newInstance() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void removeDynField(String name) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void setDescription(String description) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void setNamespace(String namespace) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void validate(DynObject object)
+            throws DynObjectValidateException {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void addDynMethod(DynMethod dynMethod) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynMethod getDeclaredDynMethod(String name)
+            throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod[] getDeclaredDynMethods() throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod getDynMethod(String name) throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod getDynMethod(int code) throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod[] getDynMethods() throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public boolean isExtendable(DynStruct dynStruct) {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+		public void extend(DynStruct[] structs) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void remove(DynStruct superDynStruct) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void removeAll(DynStruct[] superDynStruct) {
+			// TODO Auto-generated method stub
+			
+		}
+
+        public FeatureAttributeDescriptor getDefaultTimeAttribute() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+	}
+
+	private String name = "[empty]";
+	
+	public DummyFileFeatureStore() {
+		
+	}
+	
+	public DummyFileFeatureStore(String id) {
+		name = "[FILE FEATURE STORE - " + id + "]";
+	}
+	
+	public boolean allowWrite() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void beginEditingGroup(String description)
+			throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void cancelEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureQuery createFeatureQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSelection createFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			Feature defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			boolean defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(boolean defaultValues)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delete(Feature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endEditingGroup() throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void finishEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getDefaultFeatureType() throws DataException {
+		return new DummyFeatureType();
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference,
+			FeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getFeatureCount() throws DataException {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public FeatureSelection getFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet(FeatureQuery featureQuery)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getFeatureSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getFeatureType(String featureTypeId)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getFeatureTypes() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndexes getIndexes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureLocks getLocks() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataStoreParameters getParameters() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public IProjection getSRSDefaultGeometry() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureStoreTransforms getTransforms() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean isAppendModeSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isAppending() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isEditing() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isLocksSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void setSelection(FeatureSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void validateFeatures(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataQuery createQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet createSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Iterator getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getDataSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getDataSet(DataQuery dataQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public DataSet getSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void refresh() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setSelection(DataSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void beginComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void disableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void enableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObservers() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		name = state.getString("name");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("name", name);
+	}
+
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delegate(DynObject dynObject) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DynClass getDynClass() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean hasDynValue(String name) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void implement(DynClass dynClass) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canRedo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean canUndo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public List getRedoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getUndoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void redo() throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void redo(int num) throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo() throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo(int num) throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+	
+	
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				DummyFileFeatureStore.class,
+				"DummyFileFeatureStore",
+				"DummyFileFeatureStore Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name")
+			.setMandatory(true);
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void createCache(String name, DynObject parameters)
+			throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public FeatureCache getCache() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void clear() {
+		// Nothing to do
+	}
+
+	public void export(DataServerExplorer explorer, String provider,
+			NewFeatureStoreParameters params) throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public String getProviderName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getFullName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public boolean isKnownEnvelope() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean hasRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int getRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Interval getInterval() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java	(revision 35988)
@@ -0,0 +1,350 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.impl.Envelope2D;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbol.DummyVectorLegend;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MapContextPersistenceTest extends AbstractLibraryAutoInitTestCase {
+
+	final static private Logger logger =
+			LoggerFactory.getLogger(MapContextPersistenceTest.class);
+
+	protected void doSetUp() throws Exception {
+		DummyVectorLegend.registerPersistent();
+		DummyDBFeatureStore.registerPersistent();
+		DummyFileFeatureStore.registerPersistent();
+
+		MapContextLocator.getMapContextManager().registerLegend("DummyLegend",
+				DummyVectorLegend.class);
+		MapContextLocator.getMapContextManager().setDefaultVectorLegend(
+				"DummyLegend");
+	}
+	
+	private File getTempFile() throws Exception {
+
+		File tempFile = File.createTempFile("persisted_mapcontext", ".xml");
+		if (tempFile.exists())
+			tempFile.delete();
+		tempFile.createNewFile();
+		
+		System.out.println("TEMP FILE: " + tempFile.getAbsolutePath());
+		return tempFile;
+	}
+	
+	public void testMapContext() throws Exception {
+		ViewPort vp = getViewPort();
+		logger.debug("Creating mapcontext...");
+		MapContext mc = new MapContext(vp);
+		addDummyLayers(mc);
+		doTestPersist(mc);
+	}
+
+	public void noTestFLyrs() throws Exception {
+		
+		int lyr_count = 3;
+		// testPersist(mc);
+		FLyrVect[] lyr = new FLyrVect[lyr_count];
+		FeatureStore[] fs = new FeatureStore[lyr_count];
+		FLayers lyrs = new FLayers();
+		
+		for (int i=0; i<lyr_count; i++) {
+			fs[i] = new DummyFileFeatureStore("" + System.currentTimeMillis());
+			lyr[i] = createLayer(fs[i]);
+			lyr[i].setName("Layer " + (i+System.currentTimeMillis()));
+			lyr[i].setIsLabeled(false);
+			try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) {
+				assertTrue("Error while creating legend: " + e.getMessage(), false);
+			}
+			lyrs.addLayer(lyr[i]);
+			lyr[i].dispose();
+		}
+		
+		for (int i=0; i<lyr_count; i++) {
+			fs[i] = new DummyDBFeatureStore("" + System.currentTimeMillis());
+			lyr[i] = createLayer(fs[i]);
+			lyr[i].setName("Layer " + (10000 + i + System.currentTimeMillis()));
+			lyr[i].setIsLabeled(false);
+			try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) {
+				assertTrue("Error while creating legend: " + e.getMessage(), false);
+			}
+			lyrs.addLayer(lyr[i]);
+			lyr[i].dispose();
+		}
+		
+		doTestPersist(lyrs);
+	}
+	
+	
+	
+	private ViewPort getViewPort() {
+		
+		ViewPort vp = new ViewPort(CRSFactory.getCRS("EPSG:4326"));
+		vp.setImageSize(new Dimension(640, 480));
+		Envelope env = new Envelope2D(0, 0, 1000000, 1000000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(200000, 200000, 500000, 500000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(300000, 300000, 300000, 300000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(400000, 400000, 200000, 200000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(440000, 440000, 100000, 100000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(480000, 480000, 30000, 30000);
+		vp.setEnvelope(env);
+		vp.setBackColor(Color.YELLOW);
+		vp.setClipRect(new Rectangle2D.Double(0, 0, 10, 10));
+		return vp;
+	}
+
+	private void addDummyLayers(MapContext mcon) throws Exception {
+		
+		FLayers resp = new FLayers();
+		resp.setMapContext(mcon);
+		resp.setName("root layer");
+		
+		FLayers aux = new FLayers();
+		aux.setMapContext(mcon);
+		aux.setName("Group");
+		
+		FLyrVect lyr = null;
+		IVectorLegend lgn = null;
+		FeatureStore fs = null;
+		
+		logger.debug("Adding dummy layers...");
+			
+		fs = new DummyFileFeatureStore("1");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 1");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+		
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyDBFeatureStore("A");
+		lyr = createLayer(fs);
+		lyr.setName("Layer A");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyFileFeatureStore("2");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 2");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyDBFeatureStore("B");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 1");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+		
+		resp.addLayer(lyr);
+		resp.addLayer(aux);
+		lyr.dispose();
+		aux.dispose();
+		
+		mcon.getLayers().addLayer(resp);
+		resp.dispose();
+	}
+
+	private FLyrVect createLayer(FeatureStore fs) throws Exception {
+		
+		FLyrVect resp = new FLyrVect();
+		resp.setDataStore(fs);
+		resp.wakeUp();
+		resp.load();
+		return resp;
+	}
+
+	private void doTestPersist(Persistent p) throws Exception {
+		
+		System.out.println("Starting persistence test for class: " + p.getClass().getName());
+
+		File perfile = getTempFile();
+		FileOutputStream fos = new FileOutputStream(perfile);
+		System.out.println("Getting state for class: " + p.getClass().getName());
+		PersistentState pst = ToolsLocator.getPersistenceManager().getState(p);
+		System.out.println("Saving state...");
+
+		System.out.println("Saving state...");
+		ToolsLocator.getPersistenceManager().saveState(pst, fos);
+		System.out.println("Saving state... done.");
+
+		fos.close();
+
+		// ==============================================
+		// ==============================================
+		System.out.println("Is now persisted: " + p.getClass().getName());
+		// ==============================================
+
+		// if (true) return;
+
+		System.out.println("Opening persistence file...");
+		FileInputStream fis = new FileInputStream(perfile);
+
+		System.out.println("Loading state from file...");
+		pst = ToolsLocator.getPersistenceManager().loadState(fis);
+
+		System.out.println("Instantiating " + p.getClass().getName()
+				+ " from state, pst = " + pst);
+		Object p2 = ToolsLocator.getPersistenceManager().create(pst);
+
+		System.out.println("Comparing original and current...");
+		comparePersistent(p, p2);
+
+		System.out.println("Successful mapcontext persistence test!");
+		
+	}
+
+	
+	// FeatureStore, ILegend, ViewPort
+	private void comparePersistent(Persistent p, Object p2) {
+		
+		if (p2.getClass().getName().compareTo(p.getClass().getName()) == 0) {
+			
+			if (p instanceof MapContext) {
+				compareMapContexts((MapContext) p, (MapContext) p2);
+			} else {
+				if (p instanceof FLayer) {
+					compareLayers((FLayer) p, (FLayer) p2);
+				} else {
+					if (p instanceof FeatureStore) {
+						compareStore((FeatureStore) p, (FeatureStore) p2);
+					} else {
+						if (p instanceof ILegend) {
+							compareLegend((ILegend) p, (ILegend) p2);
+						} else {
+							if (p instanceof ViewPort) {
+								compareViewPorts((ViewPort) p, (ViewPort) p2);
+							} else {
+								fail("Did not compare: " + p.getClass().getName());
+							}
+						}
+					}
+				}
+			}
+		} else {
+			fail("Comparing different classes (?)");
+		}
+		
+	}
+
+	private void compareMapContexts(MapContext m1, MapContext m2) {
+		
+		logger.debug("Getting viewports to compare...");
+		ViewPort vp1 = m1.getViewPort();
+		ViewPort vp2 = m2.getViewPort();
+		
+		compareViewPorts(vp1, vp2);
+
+		logger.debug("Getting root flayers to compare...");
+		FLayers lyr1 = m1.getLayers();
+		FLayers lyr2 = m2.getLayers();
+		compareLayers(lyr1, lyr2);
+	}
+
+	private void compareLayers(FLayer l1, FLayer l2) {
+		
+		logger.debug("Comparing layers...");
+
+		assertTrue("Layers of diff type!", l1.getClass().getName().compareTo(l2.getClass().getName()) == 0);
+		if (l1 instanceof FLayers) {
+			
+			logger.debug("(type FLayers)...");
+			FLayers ls1 = (FLayers) l1;
+			FLayers ls2 = (FLayers) l2;
+			assertEquals(ls1.getLayersCount(), ls2.getLayersCount());
+			int sz = ls2.getLayersCount();
+			for (int i=0; i<sz; i++) {
+				compareLayers(ls1.getLayer(i), ls2.getLayer(i));
+			}
+			
+		} else {
+			if (l1 instanceof FLyrVect) {
+				
+				logger.debug("(type FLyrVect)...");
+				FLyrVect ls1 = (FLyrVect) l1;
+				FLyrVect ls2 = (FLyrVect) l2;
+				compareVectLayers(ls1, ls2);
+				
+			} else {
+				
+			}
+		}
+
+	}
+
+	private void compareVectLayers(FLyrVect l1, FLyrVect l2) {
+		compareLegend(l1.getLegend(), l2.getLegend());
+		compareStore(l1.getFeatureStore(), l2.getFeatureStore());
+	}
+
+	private void compareStore(FeatureStore fs1,
+			FeatureStore fs2) {
+		
+		logger.debug("Comparing stores...");
+		assertTrue("Diff stores!", fs1.getName().compareTo(fs2.getName()) == 0);
+	}
+
+	private void compareLegend(ILegend l1, ILegend l2) {
+
+		logger.debug("Comparing legends...");
+		IVectorLegend vl1 = (IVectorLegend) l1;
+		IVectorLegend vl2 = (IVectorLegend) l2;
+		assertTrue("Diff legends!", vl1.getShapeType() == vl2.getShapeType());
+		
+	}
+
+	private void compareViewPorts(ViewPort vp1, ViewPort vp2) {
+
+
+		logger.debug("Comparing viewports...");
+		
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMinimum(0),
+				vp2.getAdjustedEnvelope().getMinimum(0),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMinimum(1),
+				vp2.getAdjustedEnvelope().getMinimum(1),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMaximum(0),
+				vp2.getAdjustedEnvelope().getMaximum(0),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMaximum(1),
+				vp2.getAdjustedEnvelope().getMaximum(1),
+				0.00000000000001);
+	}
+	
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:mergeinfo
Added: svn:eol-style
   + native

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java	(revision 35988)
@@ -0,0 +1,593 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.visitor.Visitor;
+
+public class DummyDBFeatureStore implements FeatureStore {
+
+	private String name = "[empty]";
+
+	public DummyDBFeatureStore() {
+		
+	}
+	
+	public DummyDBFeatureStore(String id) {
+		name = "[DATABASE FEATURE STORE - " + id + "]";
+	}
+
+	public boolean allowWrite() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void beginEditingGroup(String description)
+			throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void cancelEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureQuery createFeatureQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSelection createFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			Feature defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			boolean defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(boolean defaultValues)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delete(Feature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endEditingGroup() throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void export(DataServerExplorer explorer,
+			String providerName,
+			NewFeatureStoreParameters params) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void finishEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getDefaultFeatureType() throws DataException {
+		return new DummyFileFeatureStore.DummyFeatureType();
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference,
+			FeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getFeatureCount() throws DataException {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public FeatureSelection getFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet(FeatureQuery featureQuery)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getFeatureSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getFeatureType(String featureTypeId)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getFeatureTypes() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndexes getIndexes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureLocks getLocks() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataStoreParameters getParameters() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public IProjection getSRSDefaultGeometry() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureStoreTransforms getTransforms() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean isAppendModeSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isAppending() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isEditing() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isLocksSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void setSelection(FeatureSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void validateFeatures(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataQuery createQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet createSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Iterator getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getDataSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getDataSet(DataQuery dataQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getName() {
+		// TODO Auto-generated method stub
+		return name;
+	}
+
+	public DataSet getSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void refresh() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setSelection(DataSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void beginComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void disableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void enableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObservers() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		name = state.getString("name");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("name", name);
+	}
+
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delegate(DynObject dynObject) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DynClass getDynClass() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean hasDynValue(String name) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void implement(DynClass dynClass) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canRedo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean canUndo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public List getRedoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getUndoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void redo() throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void redo(int num) throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo() throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo(int num) throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+	
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				DummyDBFeatureStore.class,
+				"DummyDBFeatureStore",
+				"DummyDBFeatureStore Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name");
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void createCache(String name, DynObject parameters)
+			throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public FeatureCache getCache() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void clear() {
+		// Nothing to do
+	}
+
+	public String getProviderName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getFullName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public boolean isKnownEnvelope() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean hasRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int getRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Interval getInterval() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources-test/log4j.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources-test/log4j.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources-test/log4j.xml	(revision 35988)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+		<layout class="org.apache.log4j.PatternLayout">
+			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
+		</layout>
+	</appender>
+
+	<category name="org.gvsig.tools">
+		<priority value="DEBUG" />
+	</category>
+	<category name="org.gvsig.fmap.mapcontext">
+		<priority value="DEBUG" /> 
+	</category>
+
+	<root>
+		<priority value="INFO" />
+		<appender-ref ref="CONSOLE" />
+	</root>
+</log4j:configuration>
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java	(revision 35988)
@@ -0,0 +1,161 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DrawInts extends GeometryOperation {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	public static final String NAME = "drawInts";
+	public static int CODE = Integer.MIN_VALUE;
+
+	final static private Logger logger = LoggerFactory.getLogger(DrawInts.class);
+
+	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException{
+		DrawOperationContext doc=(DrawOperationContext)ctx;
+		ViewPort viewPort = doc.getViewPort();
+		ISymbol symbol = doc.getSymbol();
+		Graphics2D g=doc.getGraphics();
+		Cancellable cancel=doc.getCancellable();
+		//		 make the symbol to resize itself with the current rendering context
+		try {
+			if (doc.hasDPI()){
+				double previousSize = ((CartographicSupport)symbol).
+				toCartographicSize(viewPort, doc.getDPI(), geom);
+				// draw it as normally
+				Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform());
+				symbol.draw(g, viewPort.getAffineTransform(), decimatedShape,
+						doc.getFeature(), cancel);
+				// restore previous size
+				((CartographicSupport)symbol).setCartographicSize(previousSize, geom);
+			}else{
+				Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform());
+				symbol.draw(g, viewPort.getAffineTransform(), decimatedShape,
+						doc.getFeature(), cancel);
+			}
+		} catch (CreateGeometryException e) {
+			e.printStackTrace();
+			throw new GeometryOperationException(e);
+		}
+
+		return null;
+	}
+
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	private Geometry transformToInts(Geometry gp, AffineTransform at) throws CreateGeometryException {
+		GeneralPathX newGp = new GeneralPathX();
+		double[] theData = new double[6];
+		double[] aux = new double[6];
+
+		// newGp.reset();
+		PathIterator theIterator;
+		int theType;
+		int numParts = 0;
+
+		java.awt.geom.Point2D ptDst = new java.awt.geom.Point2D.Double();
+		java.awt.geom.Point2D ptSrc = new java.awt.geom.Point2D.Double();
+		boolean bFirst = true;
+		int xInt, yInt, antX = -1, antY = -1;
+
+
+		theIterator = gp.getPathIterator(null); //, flatness);
+		int numSegmentsAdded = 0;
+		while (!theIterator.isDone()) {
+			theType = theIterator.currentSegment(theData);
+
+			switch (theType) {
+			case PathIterator.SEG_MOVETO:
+				numParts++;
+				ptSrc.setLocation(theData[0], theData[1]);
+				at.transform(ptSrc, ptDst);
+				antX = (int) ptDst.getX();
+				antY = (int) ptDst.getY();
+				newGp.moveTo(antX, antY);
+				numSegmentsAdded++;
+				bFirst = true;
+				break;
+
+			case PathIterator.SEG_LINETO:
+				ptSrc.setLocation(theData[0], theData[1]);
+				at.transform(ptSrc, ptDst);
+				xInt = (int) ptDst.getX();
+				yInt = (int) ptDst.getY();
+				if ((bFirst) || ((xInt != antX) || (yInt != antY)))
+				{
+					newGp.lineTo(xInt, yInt);
+					antX = xInt;
+					antY = yInt;
+					bFirst = false;
+					numSegmentsAdded++;
+				}
+				break;
+
+			case PathIterator.SEG_QUADTO:
+				at.transform(theData,0,aux,0,2);
+				newGp.quadTo(aux[0], aux[1], aux[2], aux[3]);
+				numSegmentsAdded++;
+				break;
+
+			case PathIterator.SEG_CUBICTO:
+				at.transform(theData,0,aux,0,3);
+				newGp.curveTo(aux[0], aux[1], aux[2], aux[3], aux[4], aux[5]);
+				numSegmentsAdded++;
+				break;
+
+			case PathIterator.SEG_CLOSE:
+				if (numSegmentsAdded < 3) {
+					newGp.lineTo(antX, antY);
+				}
+				newGp.closePath();
+
+				break;
+			} //end switch
+
+			theIterator.next();
+		} //end while loop
+
+		Geometry geom = null;
+		switch (gp.getType()) {
+		case Geometry.TYPES.POINT:
+			geom = geomManager.createPoint(ptDst.getX(), ptDst.getY(), SUBTYPES.GEOM2D);
+			break;
+		case Geometry.TYPES.CURVE:
+		case Geometry.TYPES.ARC:
+			geom = geomManager.createCurve(newGp, SUBTYPES.GEOM2D);
+			break;
+
+		case Geometry.TYPES.SURFACE:
+		case Geometry.TYPES.CIRCLE:
+		case Geometry.TYPES.ELLIPSE:
+
+			geom = geomManager.createSurface(newGp, SUBTYPES.GEOM2D);
+			break;
+		}
+		return geom;
+	}
+
+	public static void register() {
+		
+		GeometryManager gm = GeometryLocator.getGeometryManager();
+		CODE = gm.getGeometryOperationCode(NAME);
+		geomManager.registerGeometryOperation(NAME, new DrawInts());
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java	(revision 35988)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.geom.AffineTransform;
+
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.GeometryLocator;
+
+public class Draw extends GeometryOperation{
+	public static final String NAME = "draw";
+	public static int CODE = Integer.MIN_VALUE;
+
+	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
+		DrawOperationContext doc = (DrawOperationContext)ctx;
+		AffineTransform at = doc.getViewPort().getAffineTransform();		
+		doc.getSymbol().draw(doc.getGraphics(), at, geom, doc.getFeature(),
+				doc.getCancellable());
+		return null;
+	}
+
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	public static void register() {
+		
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+		CODE = geoMan.getGeometryOperationCode(NAME);
+		geoMan.registerGeometryOperation(NAME, new Draw());
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java	(revision 35988)
@@ -0,0 +1,96 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.aggregate.Aggregate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class AggregateDrawInts extends GeometryOperation {
+	public static final String NAME = "drawInts";
+	public static int CODE = Integer.MIN_VALUE;
+
+	
+	final static private Logger logger = LoggerFactory
+			.getLogger(DrawInts.class);
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex()
+	 */
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext)
+	 */
+	public Object invoke(Geometry geom, GeometryOperationContext ctx)
+			throws GeometryOperationException {
+
+		Aggregate aggregate = (Aggregate) geom;
+		for (int i=0;i<aggregate.getPrimitivesNumber();i++){
+			Geometry prim = aggregate.getPrimitiveAt(i);
+			try {
+				prim.invokeOperation(CODE, ctx);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new GeometryOperationException(e);
+			}
+		}
+		return null;
+	}
+
+	public static void register() {
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+
+		CODE = geoMan.getGeometryOperationCode(NAME);
+		
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.AGGREGATE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTIPOINT);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTICURVE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTISURFACE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTISOLID);
+
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java	(revision 35988)
@@ -0,0 +1,75 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+
+
+public class DrawOperationContext extends GeometryOperationContext{
+	private ISymbol symbol=null;
+	private Graphics2D graphics=null;
+	private Cancellable cancellable;
+	private double dpi;
+	private double scale;
+	private boolean hasDPI=false;
+	private ViewPort viewPort;
+	private Feature feature;
+	
+	public ViewPort getViewPort() {
+		return viewPort;
+	}
+	public void setViewPort(ViewPort viewPort) {
+		this.viewPort = viewPort;
+	}
+	public Graphics2D getGraphics() {
+		return graphics;
+	}
+	public void setGraphics(Graphics2D graphics) {
+		this.graphics = graphics;
+	}
+	public ISymbol getSymbol() {
+		return symbol;
+	}
+	public void setSymbol(ISymbol symbol) {
+		this.symbol = symbol;
+	}
+	public void setCancellable(Cancellable cancel) {
+		this.cancellable=cancel;
+
+	}
+	public Cancellable getCancellable() {
+		return cancellable;
+	}
+	public void setDPI(double dpi) {
+		this.hasDPI=true;
+		this.dpi=dpi;
+	}
+	public double getDPI(){
+		return dpi;
+	}
+	public boolean hasDPI() {
+		return hasDPI;
+	}
+	/**
+	 * @param scale the scale to set
+	 */
+	public void setScale(double scale) {
+		this.scale = scale;
+	}
+	/**
+	 * @return the scale
+	 */
+	public double getScale() {
+		return scale;
+	}
+	public Feature getFeature() {
+		return feature;
+	}
+	public void setFeature(Feature feature) {
+		this.feature = feature;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java	(revision 35988)
@@ -0,0 +1,58 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.mapcontext.MapContextLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class MapContextGeomOperationsLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsServiceOf(MapContextLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		// Register Draw Operations
+		Draw.register();
+		DrawInts.register();
+		AggregateDrawInts.register();
+		AggregateDraw.register();
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java	(revision 35988)
@@ -0,0 +1,96 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.aggregate.Aggregate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class AggregateDraw extends GeometryOperation {
+	
+	public static final String NAME = "draw";
+	public static int CODE = Integer.MIN_VALUE;
+
+	final static private Logger logger = LoggerFactory
+	.getLogger(AggregateDraw.class);
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex()
+	 */
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext)
+	 */
+	public Object invoke(Geometry geom, GeometryOperationContext ctx)
+	throws GeometryOperationException {
+
+		Aggregate aggregate = (Aggregate) geom;
+		for (int i=0;i<aggregate.getPrimitivesNumber();i++){
+			Geometry prim = aggregate.getPrimitiveAt(i);
+			try {
+				prim.invokeOperation(CODE, ctx);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new GeometryOperationException(e);
+			}
+		}
+		return null;
+	}
+
+	public static void register() {
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+		
+		CODE = geoMan.getGeometryOperationCode(NAME);
+
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.AGGREGATE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTIPOINT);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTICURVE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTISURFACE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTISOLID);
+
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java	(revision 35988)
@@ -0,0 +1,127 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IZoomConstraints.java 10815 2007-03-20 16:16:20Z jaume $
+ * $Log$
+ * Revision 1.3  2007-03-20 16:16:20  jaume
+ * refactored to use ISymbol instead of FSymbol
+ *
+ * Revision 1.2  2007/03/09 08:33:43  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+ * Isymbol moved
+ *
+ *
+ */
+
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.tools.persistence.Persistent;
+
+
+/**
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IZoomConstraints extends Persistent {
+	/**
+	 * Uses the same constraints than the layer. Which is the same than no constraints.
+	 */
+	public static final int DEFINED_BY_THE_LAYER = 0;
+
+	/**
+	 * The user defines when the labes will be drawn.
+	 * Notice that if the layer is not drawn it does not take effect.
+	 */
+	public static final int DEFINED_BY_THE_USER = 1;
+
+	/**
+	 * Sets the mode of the zoom constraints.
+	 * @param mode, int one of DEFINED_BY_THE_LAYER or DEFINED_BY_THE_USER.
+	 */
+	public abstract void setMode(int mode);
+
+	/**
+	 * Returns the max scale limit of the constraints.
+	 * @return   float, max limit
+	 * @uml.property  name="maxScale"
+	 */
+	public abstract long getMaxScale();
+
+	/**
+	 * Sets the max scale limit of the constraints
+	 * @param   maxScale, float
+	 * @uml.property  name="maxScale"
+	 */
+	public abstract void setMaxScale(long maxScale);
+
+	/**
+	 * Returns the min scale limit of the constraints.
+	 * @return   float, min limit
+	 * @uml.property  name="minScale"
+	 */
+	public abstract long getMinScale();
+
+	/**
+	 * Sets the min scale limit of the constraints
+	 * @param   minScale, float
+	 * @uml.property  name="minScale"
+	 */
+	public abstract void setMinScale(long minScale);
+
+	/**
+	 * Returns <b>true</b> if the mode is DEFINED_BY_THE_USER.
+	 * @return
+	 */
+	public abstract boolean isUserDefined();
+
+	/**
+	 * Returns <b>true</b> if the mode is DEFINED_BY_THE_USER.
+	 * @return
+	 */
+	public abstract boolean isLayerDefined();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java	(revision 35988)
@@ -0,0 +1,131 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelingMethod.java 13913 2007-09-20 09:36:02Z jaume $
+* $Log$
+* Revision 1.4  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.3  2007/03/21 11:01:28  jaume
+* javadoc
+*
+* Revision 1.2  2007/03/09 08:33:43  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.2  2007/02/01 11:42:47  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.tools.persistence.Persistent;
+
+
+/**
+ * Interface that defines provides support to a ILabelingStrategy to supply
+ * the set of <b>LabelClass</b>(es) that handle the label's style, content, etc..
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelingMethod extends Persistent {
+
+	/**
+	 * Returns all the labels defined by this Labeling Method
+	 * @return all the labels in this labeling method;
+	 */
+	public ILabelClass[] getLabelClasses();
+
+	/**
+	 * Returns the LabelClass contained by this ILabelingMethod whose name matches
+	 * with the string passed in <b>labelName</b>.
+	 * @param labelName
+	 * @return
+	 */
+	public ILabelClass getLabelClassByName(String labelName);
+
+	/**
+	 * Adds a LabelClass to the set of LabelClass contained by this ILabelingMethod.
+	 * @param lbl
+	 */
+	public void addLabelClass(ILabelClass lbl);
+
+	/**
+	 * Removes the LabelClass from the set of LabelClasses contained by this
+	 * ILabelingMethod.
+	 * @param lbl, the LabelClass to be removed
+	 */
+	public void deleteLabelClass(ILabelClass lbl);
+
+	/**
+	 * Returns <b>true</b> if this ILabelingMethod allos the definition of more
+	 * LabelClasses than just the default LabelClass.
+	 * @return boolean
+	 */
+	public boolean allowsMultipleClass();
+
+	/**
+	 * Changes the mane of a given LabelClass
+	 * @param lbl, the LabelClass
+	 * @param newName, the new name
+	 */
+	public void renameLabelClass(ILabelClass lbl, String newName);
+
+	public FeatureSet getFeatureIteratorByLabelClass(FLyrVect layer, ILabelClass lc, ViewPort viewPort, String[] usedFields)
+	throws DataException;
+
+	public boolean definesPriorities();
+
+	public void setDefinesPriorities(boolean flag);
+
+	public void clearAllClasses();
+
+	public ILabelingMethod cloneMethod();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Point;
+import java.awt.geom.Point2D;
+
+public interface ILabelLocationMetrics {
+
+	Point2D getAnchor();
+
+	void setAnchor(Point anchor);
+
+	double getRotation();
+
+	void setRotation(double rotation);
+
+	boolean isFixed();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java	(revision 35988)
@@ -0,0 +1,177 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelingStrategy.java 13913 2007-09-20 09:36:02Z jaume $
+* $Log$
+* Revision 1.7  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.6  2007/09/19 16:25:39  jaume
+* ReadExpansionFileException removed from this context and removed unnecessary imports
+*
+* Revision 1.5  2007/05/17 09:32:06  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2007/03/26 14:40:07  jaume
+* added print method
+*
+* Revision 1.3  2007/03/09 11:20:57  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.2  2007/03/09 08:33:43  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.4  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.3  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * A LabelingStrategy is a way to define how the labels are painted in a map, or potentially other object implementing ILabelable. It contains methods for allowing the definition of labeling classes through the labeling method (see <b>ILabelingMethod</b>), the placement of such labels (see <b>IPlacementConstraints</b>), and the zoom properties (see <b>ZoomConstraints</b>)
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelingStrategy extends Persistent {
+
+	/**
+	 * Returns the labeling method currently in use. The labeling method handles
+	 * a list of LabelClass that allows to handle several definition of labels
+	 * in the layer.
+	 * @return ILabelingMethod, the current one.
+	 * @see ILabelingMethod
+	 */
+	public ILabelingMethod getLabelingMethod();
+
+	/**
+	 * Sets the labeling method that will be used the next time the the draw is invoked.
+	 * @param   method, the new labeling method
+	 */
+	public void setLabelingMethod(ILabelingMethod method);
+
+
+	/**
+	 * Returns the current placement constraints that determine the position
+	 * where the label is placed.
+	 * @return
+	 */
+	public IPlacementConstraints getPlacementConstraints();
+
+	/**
+	 * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
+	 * @param  constraints
+	 */
+	public void setPlacementConstraints(IPlacementConstraints constraints);
+
+	/**
+	 * Returns the current placement constraints that determine the position
+	 * where the label is placed.
+	 * @return
+	 */
+	public IZoomConstraints getZoomConstraints();
+
+	/**
+	 * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
+	 * @param  constraints
+	 */
+	public void setZoomConstraints(IZoomConstraints constraints);
+
+	/** Causes the labels to be drawn. The policy of process is determined by
+	 * the LabelingStrategy previously set.
+	 *
+	 * @param mapImage
+	 * @param mapGraphics
+	 * @param viewPort
+	 * @param cancel
+	 * @param dpi TODO
+	 * @throws ReadException
+	 */
+	public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort,
+			Cancellable cancel, double dpi) throws ReadException;
+
+	/**
+	 * Applies the printer properties to the rendering process to match its attributes.
+	 * The result is manifested in the Graphics2D g which is the object sent to the printer.
+	 * @param g
+	 * @param viewPort
+	 * @param cancel
+	 * @param properties
+	 * @throws ReadException
+	 */
+	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintAttributes properties)
+	throws ReadException;
+
+	/**
+	 * Returns a non-null String[] containing the names of the fields involved in the
+	 * labeling. If this strategy contains more than one LabelClass the result is an
+	 * array with all the names of the fields used by all the LabelClass, with no duplicates.
+	 * @return
+	 */
+	public String[] getUsedFields();
+
+	public void setLayer(FLayer layer) ;
+
+	public boolean shouldDrawLabels(double scale);
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java	(revision 35988)
@@ -0,0 +1,171 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IPlacementConstraints.java 13913 2007-09-20 09:36:02Z jaume $
+ * $Log$
+ * Revision 1.12  2007-09-20 09:33:15  jaume
+ * Refactored: fixed name of IPersistAnce to IPersistence
+ *
+ * Revision 1.11  2007/09/10 15:47:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.10  2007/07/18 06:54:34  jaume
+ * continuing with cartographic support
+ *
+ * Revision 1.9  2007/04/18 15:35:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.8  2007/04/13 12:42:32  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.7  2007/04/13 11:59:30  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.6  2007/04/12 16:01:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.5  2007/04/12 14:28:43  jaume
+ * basic labeling support for lines
+ *
+ * Revision 1.4  2007/04/11 16:01:08  jaume
+ * maybe a label placer refactor
+ *
+ * Revision 1.3  2007/04/02 16:34:56  jaume
+ * Styled labeling (start commiting)
+ *
+ * Revision 1.2  2007/03/09 08:33:43  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+ * Isymbol moved
+ *
+ *
+ */
+
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.tools.persistence.Persistent;
+
+
+
+/**
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IPlacementConstraints extends Persistent, Cloneable {
+	public static int DefaultDuplicateLabelsMode = IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART;
+
+	// constants regarding label duplication
+	public static final int REMOVE_DUPLICATE_LABELS             =       2;
+	public static final int ONE_LABEL_PER_FEATURE               =       3;
+	public static final int ONE_LABEL_PER_FEATURE_PART          =       4;
+
+	// constants regarding point settings
+	public static final int OFFSET_HORIZONTALY_AROUND_THE_POINT =       5;
+	public static final int ON_TOP_OF_THE_POINT                 =       6;
+	public static final int AT_SPECIFIED_ANGLE                  =       7;
+	public static final int AT_ANGLE_SPECIFIED_BY_A_FIELD       =       8;
+
+	// constants regarding polygon settings (also apply for lines)
+	public static final int HORIZONTAL                          =       9;
+	public static final int PARALLEL                            =      10;
+
+	// constants regarding line settings
+	public static final int FOLLOWING_LINE                      =      11;
+	public static final int PERPENDICULAR                 	    =      12;
+
+	// constants regarding the location along the line
+	public static final int AT_THE_END_OF_THE_LINE              =      13;
+	public static final int AT_THE_MIDDLE_OF_THE_LINE           =      14;
+	public static final int AT_THE_BEGINING_OF_THE_LINE         =      15;
+	public static final int AT_BEST_OF_LINE 					=	   16;
+
+	public abstract void setPlacementMode(int mode);
+
+	// regarding label position along the line
+	public abstract boolean isBelowTheLine();
+	public abstract void setBelowTheLine(boolean b);
+	public abstract boolean isAboveTheLine();
+	public abstract void setAboveTheLine(boolean b);
+	public abstract boolean isOnTheLine();
+	public abstract void setOnTheLine(boolean b);
+	public abstract void setLocationAlongTheLine(int location);
+
+
+	// regarding the orientation system
+	public abstract boolean isPageOriented();
+	public abstract void setPageOriented(boolean b);
+
+	// regarding the label duplication
+	public abstract void setDuplicateLabelsMode(int mode);
+	public abstract int getDuplicateLabelsMode();
+
+
+	public abstract boolean isParallel();
+
+	public abstract boolean isFollowingLine();
+
+	public abstract boolean isPerpendicular();
+
+	public abstract boolean isHorizontal();
+
+	public abstract boolean isAtTheBeginingOfLine();
+
+	public abstract boolean isInTheMiddleOfLine();
+
+	public abstract boolean isAtTheEndOfLine();
+
+	public boolean isAtBestOfLine();
+
+	public abstract boolean isOnTopOfThePoint();
+
+	public abstract boolean isAroundThePoint();
+
+	public boolean isFitInsidePolygon();
+
+	public void setFitInsidePolygon(boolean b);
+
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java	(revision 35988)
@@ -0,0 +1,122 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelable.java 21103 2008-06-03 10:04:57Z vcaballero $
+* $Log$
+* Revision 1.2  2007-03-09 11:20:57  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.5  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.4  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+* Revision 1.1.2.3  2007/02/02 16:21:24  jaume
+* start commiting labeling stuff
+*
+* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * This interface enables support for labeling an object such as a layer, but also others, if any. It gives support for detecting if labeling is being applied (<code>isLabeled()</code> and <code>setIsLabeled()</code>), to manage the labeling strategy (<code>getLabelingStrategy()</code> and <code>setLabelingStrategy</code>). The labeling is performed by the <code>drawLabels(..)</code> method.
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelable {
+	/**
+	 * Returns <b>true</b> if labels are drawn, or <b>false</b> otherwise.
+	 * @return <b>boolean</b> telling if labels are drawn
+	 */
+	public boolean isLabeled();
+
+	/**
+	 * Enables or disables the label drawing.
+	 * @param isLabeled, if true then labels will be drawn
+	 */
+	public void setIsLabeled(boolean isLabeled);
+
+	/**
+	 * Returns the current labeling strategy
+	 * @return ILabelingStrategy
+	 * @see ILabelingStrategy
+	 */
+	public ILabelingStrategy getLabelingStrategy();
+
+	/**
+	 * Sets the new labeling strategy. Changes on the results will take effect next time the drawLabels(...) method is invoked.
+	 * @param  strategy
+	 * @uml.property  name="labelingStrategy"
+	 */
+	public void setLabelingStrategy(ILabelingStrategy strategy);
+
+    /**
+     * Causes the labels to be drawn. The policy of process is determined by the
+     * LabelingStrategy previously set.
+     * 
+     * @param image
+     * @param g
+     * @param viewPort
+     * @param cancel
+     * @param scale
+     * @param dpi
+     * @throws ReadException
+     */
+	public void drawLabels(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, double dpi) throws ReadException;
+	public void printLabels(Graphics2D g, ViewPort viewPort,
+    		Cancellable cancel, double scale, PrintAttributes properties) throws ReadException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java	(revision 35988)
@@ -0,0 +1,158 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle;
+import org.gvsig.tools.persistence.Persistent;
+
+public interface ILabelClass extends  Persistent, CartographicSupport{
+
+	/**
+	 * Returns true if the label will be showed in the map
+	 *
+	 * @return isVisible boolean
+	 */
+	boolean isVisible();
+
+	/**
+	 * Sets the visibility of the label in the map.
+	 *
+	 * @param isVisible boolean
+	 */
+	void setVisible(boolean isVisible);
+
+	/**
+	 * Returns the expression that defines the text which will be showed in
+	 * the label
+	 *
+	 * @return labelExpression String
+	 */
+	String getLabelExpression();
+
+	/**
+	 * Stablishes the expresion that, when it is evaluated, returns the text
+	 * which will be showed by the label.
+	 *
+	 * @param labelExpression String
+	 */
+	void setLabelExpression(String labelExpression);
+
+	/**
+	 * Returns the text symbol that is being used for the text(the font,
+	 * size,style,aligment)
+	 *
+	 * @return label ITextSymbol
+	 */
+	ITextSymbol getTextSymbol();
+
+	/**
+	 * Stablishes the text symbol that is going to be used for the text(the
+	 * font,size,style,aligment)
+	 *
+	 * @param textSymbol ITextSymbol
+	 */
+	void setTextSymbol(ITextSymbol textSymbol);
+
+	/**
+	 * Stablishes the style for the label.
+	 *
+	 * @param labelStyle ILabelStyle
+	 */
+	void setLabelStyle(ILabelStyle labelStyle);
+
+	/**
+	 * Returns the style of the label
+	 *
+	 */
+	ILabelStyle getLabelStyle();
+
+	/**
+	 * Returns the name of the label
+	 *
+	 */
+	String getName();
+
+	/**
+	 * Stablishes the name of the label
+	 * @param name
+	 */
+	void setName(String name);
+
+	String toString();
+
+	/**
+	 * Sets the text for the label
+	 *
+	 * @param texts String[]
+	 */
+	void setTexts(String[] texts);
+
+	/**
+	 * Return the text for the label
+	 *
+	 * @param texts String[]
+	 */
+	String[] getTexts();
+
+	/**
+	 * <p>
+	 * LabelLocationMetrics, contains the anchor point, rotation, and some
+	 * other geometric calculations computed by the PlacementManager.
+	 * </p>
+	 *
+	 * <p>
+	 * The shp argument is passed as an accessory for subclasses of this
+	 * class in case they need futher geometric calculations
+	 * </p>
+	 * @param graphics, graphics to use to paint the label.
+	 * @param llm, concrete settings of the placement of this layer
+	 * @param shp, the Shape over whose the label is painted
+	 */
+	void draw(Graphics2D graphics, ILabelLocationMetrics llm, Geometry geom);
+
+	/**
+	 * Useful to render a Label with size inside little rectangles.
+	 *
+	 * @param graphics Graphics2D
+	 * @param bounds Rectangle
+	 * @throws SymbolDrawingException
+	 */
+	void drawInsideRectangle(Graphics2D graphics, Rectangle bounds)
+			throws SymbolDrawingException;
+
+	int getPriority();
+
+	void setPriority(int priority);
+
+	Geometry getShape(ILabelLocationMetrics llm) throws CreateGeometryException;
+
+	String getClassName();
+
+	double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	int getReferenceSystem();
+
+	int getUnit();
+
+	void setCartographicSize(double cartographicSize, Geometry geom);
+
+	void setReferenceSystem(int referenceSystem);
+
+	void setUnit(int unitIndex);
+
+	double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	Rectangle getBounds();
+
+	String getSQLQuery();
+
+	void setSQLQuery(String sqlQuery);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java	(revision 35988)
@@ -0,0 +1,5 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.driver;
+
+public interface ILegendReader {
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java	(revision 35988)
@@ -0,0 +1,5 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.driver;
+
+public interface ILegendWriter {
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Legend related exceptions.
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class LegendException extends MapContextException {
+
+	private static final long serialVersionUID = -5441479826620031136L;
+
+	/**
+	 * @see BaseException#BaseException(String, String, long)
+	 */
+	public LegendException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	/**
+	 * @see BaseException#BaseException(String, Throwable, String, long)
+	 */
+	public LegendException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java	(revision 35988)
@@ -0,0 +1,53 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend;
+
+
+/**
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IClassifiedRasterLegend extends IRasterLegend,
+		IClassifiedLegend {
+
+	// The interface does not add any new methods.
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java	(revision 35988)
@@ -0,0 +1,100 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * Interface that offers the methods to classify the legend.
+ */
+public interface IClassifiedVectorLegend extends IClassifiedLegend, IVectorLegend{
+	/**
+	 * Deletes all the information of classification:
+	 * intervals, values, or other classifying elements
+	 */
+	public abstract void clear();
+
+	/**
+	 * Returns the name of the field
+	 *
+	 * @return Name of the field.
+	 *
+	 * TODO refactor to allow more than one field name
+	 */
+	public abstract String[] getClassifyingFieldNames();
+
+	/**
+	 * Inserts the name of the field
+	 *
+	 * @param fieldNames Names of the fields.
+	 * TODO refactor to allow more than one field name
+	 */
+	public abstract void setClassifyingFieldNames(String[] fieldNames);
+
+	 /**
+     * Inserts a symbol.
+     *
+     * @param key.
+     * @param symbol.
+     */
+	public abstract void addSymbol(Object key, ISymbol symbol);
+
+    /**
+     * Deletes a symbol using for that its key which is the parameter of the
+     * method.
+     *
+     * @param key clave.
+     */
+	public abstract void delSymbol(Object key);
+
+	/**
+	 * Removes <b>oldSymbol</b> from the Legend and substitutes it with the <b>newSymbol</b>
+	 * @param oldSymbol
+	 * @param newSymbol
+	 */
+	public abstract void replace(ISymbol oldSymbol, ISymbol newSymbol);
+
+	public int[] getClassifyingFieldTypes();
+
+	public void setClassifyingFieldTypes(int[] fieldTypes);
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java	(revision 35988)
@@ -0,0 +1,354 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.IntervalLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LabelLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.ValueLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * Class ZSort is used in order to store information about the symbols
+ * which are placed in the Z axis (because a level of symbols has been
+ * used).
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class ZSort implements LegendContentsChangedListener {
+	// private static final String COLUMN_SEPARATOR = ",";
+	// private static final String ROW_SEPARATOR = ";";
+	private int[][] matrix;
+	private boolean usingZSort;
+	private Map symbols = new HashMap();
+
+	public ZSort(ILegend legend) {
+		initialize(legend);
+	}
+
+	private void initialize(ILegend legend) {
+		ISymbol[] symbols;
+		if (legend instanceof IClassifiedLegend) {
+			symbols = ((IClassifiedLegend) legend).getSymbols();
+
+		} else {
+			symbols = new ISymbol[] {legend.getDefaultSymbol()};
+		}
+		matrix = new int[symbols.length][];
+
+		for (int i = 0; i < symbols.length; i++) {
+			this.symbols.put(symbols[i], new Integer(i));
+			int rowLength =  symbols[i] instanceof IMultiLayerSymbol ?
+                  	 ((IMultiLayerSymbol) symbols[i]).getLayerCount() :
+	                 1;
+			matrix[i] = new int[rowLength];
+		}
+		legend.addLegendListener(this);
+	}
+
+	private void addSymbol(ISymbol sym){
+		if (!symbols.containsKey(sym)) {
+			int rowLength =  sym instanceof IMultiLayerSymbol ?
+					((IMultiLayerSymbol) sym).getLayerCount() : 1;
+			int[][] auxMatrix = new int[matrix.length+1][];
+			int newIndex = matrix.length;
+			for (int i=0; i<newIndex; i++){
+				auxMatrix[i] = matrix[i];
+			}
+			int[] row = new int[rowLength];
+			for (int i=0; i<rowLength; i++){
+				row[i] = 0;
+			}
+			auxMatrix[newIndex] = row;
+			matrix = auxMatrix;
+			this.symbols.put(sym, new Integer(newIndex));
+		}
+	}
+
+	public void legendChanged(LegendChangedEvent e) throws MapContextException {
+		symbols.clear();
+		usingZSort = false;
+		initialize(e.getNewLegend());
+
+	}
+
+	public String getClassName() {
+		return getClass().getName();
+	}
+
+	public int getLevelCount() {
+		int count = -1;
+		for (int i = 0; i < matrix.length; i++) {
+			for (int j = 0; j < matrix[i].length; j++) {
+				count = Math.max(count, matrix[i][j]);
+			}
+		}
+		return count + 1;
+	}
+
+
+	public void setUsingZSort(boolean usingZSort) {
+		this.usingZSort = usingZSort;
+	}
+
+	public void setLevels(ISymbol sym, int[] values) {
+		setLevels(((Integer)symbols.get(sym)).intValue(), values);
+	}
+
+
+	public void setLevels(int row, int[] values) {
+		matrix[row] = values;
+	}
+
+	public int[] getLevels(ISymbol sym) {
+		Integer row = (Integer) symbols.get(sym);
+		if (row != null) {
+			return getLevels(row.intValue());
+		} else {
+			ISymbol[] theSymbols = getSymbols();
+			for (int i = 0; i < theSymbols.length; i++) {
+				ISymbol auxSymbol = theSymbols[i];
+				if (auxSymbol.equals(sym)){
+					return getLevels(((Integer)symbols.get(auxSymbol)).intValue());
+				}
+			}
+		}
+		return null;
+	}
+
+
+	public int[] getLevels(int row) {
+		return matrix[row];
+	}
+
+
+	public boolean isUsingZSort() {
+		return usingZSort;
+	}
+
+
+	public ISymbol[] getSymbols() {
+		return (ISymbol[])symbols.keySet().toArray(new ISymbol[0]);
+	}
+
+
+	public String[] getDescriptions() {
+		ISymbol[] symbols = getSymbols();
+		String[] descs = new String[symbols.length];
+		for (int i = 0; i < descs.length; i++) {
+			descs[i] = symbols[i].getDescription();
+		}
+		return descs;
+	}
+
+	/*
+	 * [PACO] Comentarizado porque no hace lo que se esperar�a de �l.
+	 * Si tenemos una leyenda con un simbolo Multilayer compuesto
+	 * por, entre otros, un simbolo simple que coincide con otro de
+	 * los simbolos de la leyenda, este metodo devuelve el nivel
+	 * del s�mbolo que encuentra primero.
+	 *
+	 * Se ha eliminado cualquier referencia a este metodo en el resto
+	 * del workspace, sustituyendola convenientemente por
+	 * referencias a getLevels.
+	 */
+//	public int getSymbolLevel(ISymbol layer) {
+//		ISymbol[] theSymbols = getSymbols();
+//
+//		for (int i = 0; i < theSymbols.length; i++) {
+//			ISymbol mySymbol = theSymbols[i];
+//
+//			if (mySymbol instanceof IMultiLayerSymbol) {
+//				IMultiLayerSymbol multiSym = (IMultiLayerSymbol) mySymbol;
+//				for (int j = 0; j < multiSym.getLayerCount(); j++) {
+//					ISymbol myInnerSymbol = multiSym.getLayer(j);
+//					if (myInnerSymbol.equals(layer)) {
+//						int row = ((Integer)symbols.get(multiSym)).intValue();
+//						return matrix[row][j];
+//					}
+//				}
+//			} else {
+//				if (mySymbol.equals(layer)) {
+//					return matrix[((Integer)symbols.get(layer)).intValue()][0];
+//				}
+//			}
+//		}
+//
+////		return 0;
+//		return -1;
+//	}
+
+	public int getTopLevelIndexAllowed() {
+		ISymbol[] symbols = getSymbols();
+		int count=0;
+		for (int i = 0; i < symbols.length; i++) {
+			if (symbols[i] instanceof IMultiLayerSymbol) {
+				IMultiLayerSymbol mSymbol = (IMultiLayerSymbol) symbols[i];
+				count = Math.max(count, mSymbol.getLayerCount());
+			} else
+				count = Math.max(count, 1);
+		}
+		return count;
+	}
+
+	public String toString() {
+		String out = "Symbols:\n---------\n\n";
+		ISymbol[] syms = getSymbols();
+		for (int i = 0; i < syms.length; i++) {
+			out += syms.getClass()+":\t"+syms[i].getDescription();
+		}
+		out += "\nMatrix:\n--------\n\n";
+		out += "    \t";
+		for (int i = 0; i < getTopLevelIndexAllowed(); i++) {
+			out += "column"+i+"\t\t";
+		}
+		out += "\n";
+		for (int i = 0; i < matrix.length; i++) {
+			out += "row "+i+":\t";
+			for (int j = 0; j < matrix[i].length; j++) {
+				out += matrix[i][j]+"\t\t";
+			}
+			out += "\n";
+		}
+		return out;
+	}
+
+	private void replaceSymbol(ISymbol oldSymbol, ISymbol newSymbol) {
+		if (oldSymbol == newSymbol) return;
+
+		if(oldSymbol != null){
+
+			Integer value = (Integer)symbols.get(oldSymbol);
+			if (value != null){
+
+				int intValue=value.intValue();
+				if (newSymbol == null) {
+					// emptying
+					symbols.remove(oldSymbol);
+					matrix[intValue] = new int[1];
+				} else {
+					symbols.remove(oldSymbol);
+
+					symbols.put(newSymbol, value);
+
+					// update matrix values if need
+					int newArrayLength = newSymbol instanceof IMultiLayerSymbol ?
+							((IMultiLayerSymbol) newSymbol).getLayerCount() : 1;
+
+							int[] newRow = new int[newArrayLength];
+							if (matrix[intValue].length == newArrayLength) {
+								/*
+								 * the new row is exactly the same long than the
+								 * old one. Will use the old values
+								 */
+								newRow = matrix[intValue];
+							} else	if (matrix[intValue].length < newArrayLength) {
+								/*
+								 * the new row is larger than the old one,
+								 * let's copy all the first values and fill
+								 * the rest with the last copied value
+								 */
+								int val=0;
+								for (int i = 0; i < newRow.length; i++) {
+									if (i<matrix[intValue].length) {
+										val = matrix[intValue][i];
+									}
+
+									newRow[i] = val;
+								}
+							} else if (matrix[intValue].length > newArrayLength) {
+								/*
+								 * the new row is smaller than the old one,
+								 * let's copy the first values
+								 */
+								for (int i = 0; i < newRow.length; i++) {
+									newRow[i] = matrix[intValue][i];
+								}
+							}
+							matrix[intValue] = newRow;
+				}
+			}
+		} else {
+			addSymbol(newSymbol);
+		}
+	}
+
+	public boolean symbolChanged(SymbolLegendEvent e) {
+		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
+		return true;
+	}
+
+
+	public boolean classifiedSymbolChange(SymbolLegendEvent e) {
+		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
+		return true;
+	}
+
+	public boolean intervalChange(IntervalLegendEvent e) {
+		return false;
+	}
+
+	public boolean valueChange(ValueLegendEvent e) {
+		System.out.println("log ValueLegendEvent:"+e.getOldValue()+"->"+e.getNewValue());
+		return false;
+	}
+
+	// TODO should not exist here
+	public boolean labelFieldChange(LabelLegendEvent e) {
+		return false;
+	}
+
+
+	public void legendCleared(LegendClearEvent event) {
+//		this.usingZSort = false;
+//		symbols.clear();
+//		matrix = null;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java	(revision 35988)
@@ -0,0 +1,70 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+
+/**
+ * <p>Event produced on a classified legend.</p>
+ *
+ * @author Vicente Caballero Navarro
+ * @author jaume domimguez faus - jaume.dominguez@iver.es
+ */
+public class ClassificationLegendEvent extends LegendEvent {
+	/**
+	 * <p>Gets the index of the class where the classification has changed.</p>
+	 *
+	 * @return index of the class where the classification has changed
+	 */
+	public int getClassIndex() {
+		//TODO Implementar bien
+		return -1;
+	}
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_CLASSIFICATION_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_CLASSIFICATION_CHANGED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java	(revision 35988)
@@ -0,0 +1,62 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+
+
+/**
+ * Interfaz con los eventos que puede realizar una leyenda.
+ */
+public interface LegendContentsChangedListener {
+
+	/**
+	 * Invocado cuando se cambia en el legend el s�mbolo por defecto. Si
+	 * cualquiera de los listeners devuelve false, el cambio no se realiza
+	 *
+	 * @param e SymbolLegendEvent
+	 *
+	 * @return True si ha sido correcto.
+	 */
+	boolean symbolChanged(SymbolLegendEvent e);
+
+	void legendCleared(LegendClearEvent event);
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java	(revision 35988)
@@ -0,0 +1,104 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.ClassificationLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+/**
+ * <p>Event produced when changes any value of a legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class ValueLegendEvent extends ClassificationLegendEvent {
+	/**
+	 * <p>Previous legend value.</p>
+	 */
+	private Object oldValue;
+
+	/**
+	 * <p>New legend value.</p>
+	 */
+	private Object newValue;
+
+	/**
+	 * <p>Creates a new value legend event.</p>
+	 *
+	 * @param oldValue previous legend value
+	 * @param newValue new legend value
+	 */
+	public ValueLegendEvent(Object oldValue, Object newValue) {
+		this.oldValue = oldValue;
+		this.newValue = newValue;
+	}
+
+	/**
+	 * <p>Gets the previous value.</p>
+	 *
+	 * @return the previous value
+	 */
+	public Object getOldValue() {
+		return oldValue;
+	}
+
+	/**
+	 * <p>Gets the new value.</p>
+	 *
+	 * @return the new value
+	 */
+	public Object getNewValue() {
+		return newValue;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_VALUE_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_VALUE_CHANGED;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java	(revision 35988)
@@ -0,0 +1,16 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+
+public interface FeatureDrawnNotification {
+
+	Feature getFeature();
+
+	/**
+	 * @return the {@link Geometry} to be finally drawn, as it may
+	 * have been reprojected
+	 */
+	Geometry getDrawnGeometry();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java	(revision 35988)
@@ -0,0 +1,93 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+
+/**
+ * <p>Event produced when changes the value in the field of labeling of a legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LabelLegendEvent extends LegendEvent {
+	/**
+	 * <p>Previous field value.</p>
+	 */
+	private int oldFieldId;
+	
+	/**
+	 * <p>New field value.</p>
+	 */
+	private int newFieldId;
+
+	/**
+	 * <p>Creates a new legend label event.</p>
+	 *
+	 * @param oldFieldId previous field value
+	 * @param newFieldId new field value
+	 */
+	public LabelLegendEvent(int oldFieldId, int newFieldId) {
+		this.oldFieldId = oldFieldId;
+		this.newFieldId = newFieldId;
+	}
+
+	/**
+	 * <p>Gets the new field value.</p>
+	 *
+	 * @return the new field value
+	 */
+	public int getNewFieldId() {
+		return newFieldId;
+	}
+
+	/**
+	 * <p>Gets the previous field value.</p>
+	 *
+	 * @return the previous field value
+	 */
+	public int getOldFieldId() {
+		return oldFieldId;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java	(revision 35988)
@@ -0,0 +1,109 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+
+
+
+
+/**
+ * <p><code>LegendEvent</code> represents an event produced at a legend in a layer.</p>
+ * 
+ * @see FMapEvent
+ */
+public class LegendEvent extends FMapEvent {
+	/**
+	 * <p>Identifies this event as a change of the value of a legend.</p>
+	 */
+	public static final int LEGEND_VALUE_CHANGED = 200;
+
+	/**
+	 * <p>Identifies this event as a change of the symbol of a legend.</p>
+	 */
+	public static final int LEGEND_SYMBOL_CHANGED = 201;
+
+	/**
+	 * <p>Identifies this event as a legend interval change.</p>
+	 */
+	public static final int LEGEND_INTERVAL_CHANGED = 202;
+
+	/**
+	 * <p>Identifies this event as a clear of a legend.</p>
+	 */
+	public static final int LEGEND_CLEARED = 203;
+
+	/**
+	 * <p>Identifies this event as a change on the classification of a legend.</p>
+	 */
+	public static final int LEGEND_CLASSIFICATION_CHANGED = 204;
+
+	/**
+	 * Layer of the legend where the event was produced.
+	 * 
+	 * @see #getLayer()
+	 * @see #setLayer(ClassifiableVectorial)
+	 */
+	private ClassifiableVectorial layer;
+
+	/**
+	 * <p>Returns the layer of the legend where the event was produced, as a classifiable and vector layer.</p>
+	 *
+	 * @return the layer where the event was produced, as classifiable vector
+	 * 
+	 * @see #setLayer(ClassifiableVectorial)
+	 */
+	public ClassifiableVectorial getLayer() {
+		return layer;
+	}
+
+	/**
+	 * <p>Sets the layer of the legend where the event was produced, as a classifiable and vector layer.</p>
+	 *
+	 * @param layer the layer where the event was produced, as classifiable vector
+	 * 
+	 * @see #getLayer()
+	 */
+	public void setLayer(ClassifiableVectorial layer) {
+		this.layer = layer;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java	(revision 35988)
@@ -0,0 +1,103 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.IInterval;
+
+
+/**
+ * <p>Event produced when changes the interval value of a classification legend.</p>
+ * 
+ * @see FMapEvent
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class IntervalLegendEvent extends ClassificationLegendEvent {
+	/**
+	 * <p>Previous legend interval.</p> 
+	 */
+	private IInterval oldInterval;
+	/**
+	 * <p>Previous legend interval.</p> 
+	 */
+	private IInterval newInterval;
+
+	/**
+	 * <p>Creates a new legend interval event.</p>
+	 *
+	 * @param oldInterval previous legend interval
+	 * @param newInterval new legend interval
+	 */
+	public IntervalLegendEvent(IInterval oldInterval, IInterval newInterval) {
+		this.oldInterval = oldInterval;
+		this.newInterval = newInterval;
+	}
+
+	/**
+	 * <p>Gets the previous legend interval.</p>
+	 *
+	 * @return the previous legend interval
+	 */
+	public IInterval getOldInterval() {
+		return oldInterval;
+	}
+
+	/**
+	 * <p>Gets the new legend interval.</p>
+	 *
+	 * @return the new legend interval
+	 */
+	public IInterval getNewInterval() {
+		return newInterval;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_INTERVAL_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_INTERVAL_CHANGED;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java	(revision 35988)
@@ -0,0 +1,103 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * <p>Event produced when changes one of the symbols of a classified legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class SymbolLegendEvent extends ClassificationLegendEvent {
+/**
+	 * <p>Previous symbol style.</p>
+	 */
+	private ISymbol oldSymbol;
+	
+	/**
+	 * <p>New symbol style.</p>
+	 */
+	private ISymbol newSymbol;
+
+	/**
+	 * <p>Creates a new symbol legend event.</p>
+	 *
+	 * @param oldValue previous symbol style
+	 * @param newValue new symbol style
+	 */
+	public SymbolLegendEvent(ISymbol oldSymbol, ISymbol newSymbol) {
+		this.oldSymbol = oldSymbol;
+		this.newSymbol = newSymbol;
+	}
+
+	/**
+	 * <p>Gets the previous symbol style.</p>
+	 *
+	 * @return the previous symbol style
+	 */
+	public ISymbol getOldSymbol() {
+		return oldSymbol;
+	}
+
+	/**
+	 * <p>Gets the new symbol style.</p>
+	 *
+	 * @return the new symbol style
+	 */
+	public ISymbol getNewSymbol() {
+		return newSymbol;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_SYMBOL_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_SYMBOL_CHANGED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java	(revision 35988)
@@ -0,0 +1,35 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * <p>The class <code>LegendClearEvent</code> stores all necessary information of an event 
+ * produced when a legend is cleared.</p>
+ * 
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LegendClearEvent extends ClassificationLegendEvent {
+	private ISymbol[] oldSymbols;
+	/**
+	 * Constructor method
+	 * @param oldSymbols
+	 */
+	public LegendClearEvent(ISymbol[] oldSymbols) {
+		this.oldSymbols = oldSymbols;
+	}
+	/**
+	 * Obtains the old symbols of the legend
+	 * @return
+	 */
+	public ISymbol[] getOldSymbols() {
+		return oldSymbols;
+	}
+	/**
+	 * Returns the type of the event
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_CLEARED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java	(revision 35988)
@@ -0,0 +1,60 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events.listeners;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+
+
+
+/**
+ * Interfaz con los eventos que puede realizar una leyenda.
+ */
+public interface LegendListener {
+
+	/**
+     * Called when the legend of a vector layer has changed.
+     *
+     * @param e the <code>LegendChangedEvent</code> contains contextual information about the event
+     */
+    void legendChanged(LegendChangedEvent e);
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java	(revision 35988)
@@ -0,0 +1,136 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+
+
+
+/**
+ * <p>Event or set of events produced when changes a legend.</p>
+ * 
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LegendChangedEvent extends LegendEvent {
+	/**
+	 * <p>Identifies this event as a changed of a legend.</p>
+ 	 */
+	private static final int LEGEND_CHANGED = 0;
+
+	/**
+	 * <p>Previous vector legend.</p>
+	 */
+	private ILegend oldLegend;
+
+	/**
+	 * <p>New vector legend.</p>
+	 */
+	private ILegend newLegend;
+
+	/**
+	 * <p>Events that constitute this one.</p>
+	 */
+	private LegendChangedEvent[] events;
+
+	/**
+	 * <p>Creates a new legend change event.</p>
+	 * 
+	 * @param oldLegend previous vector legend
+	 * @param newLegend new vector legend
+	 * 
+	 * @return a new legend change event
+	 */
+	public static LegendChangedEvent createLegendChangedEvent(ILegend oldLegend,
+			ILegend newLegend){
+		return new LegendChangedEvent(oldLegend, newLegend, LEGEND_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new legend change event.</p>
+	 *
+	 * @param oldLegend previous vector legend
+	 * @param newLegend new vector legend
+	 */
+	private LegendChangedEvent(ILegend oldLegend,
+			ILegend newLegend, int eventType) {
+		this.oldLegend = oldLegend;
+		this.newLegend = newLegend;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the previous vector legend.</p>
+	 *
+	 * @return the previous vector legend
+	 */
+	public ILegend getOldLegend() {
+		return oldLegend;
+	}
+
+	/**
+	 * <p>Gets the new vector legend.</p>
+	 *
+	 * @return the new vector legend
+	 */
+	public ILegend getNewLegend() {
+		return newLegend;
+	}
+
+	/**
+	 * <p>Gets the events that constitute this one.</p>
+	 *
+	 * @return an array with the events that constitute this one
+	 */
+	public LegendChangedEvent[] getEvents() {
+		return events;
+	}
+
+	/**
+	 * <p>Sets the events that constitute this one.</p>
+	 *
+	 * @param events an array with the events that constitute this one
+	 */
+	public void setEvents(LegendChangedEvent[] events) {
+		this.events = events;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java	(revision 35988)
@@ -0,0 +1,94 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.awt.Color;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Interface that allows the methods to classify the legend through intervals.
+ *
+ */
+public interface IVectorialIntervalLegend extends IClassifiedVectorLegend {
+	
+	public static final String LEGEND_NAME = "VectorialInterval";
+
+    public void setDefaultSymbol(ISymbol s);
+
+    public IInterval getInterval(Object v) ;
+    public int getIntervalType();
+
+	/**
+	 *
+	 * Returns the symbol starting from an interval
+	 *
+	 * @param key interval.
+	 *
+	 * @return symbol.
+	 */
+    public ISymbol getSymbolByInterval(IInterval key);
+
+
+    /**
+     * Inserts the type of the classification of the intervals.
+	 *
+	 * @param tipoClasificacion type of the classification.
+	 */
+    public void setIntervalType(int tipoClasificacion);
+
+    /**
+	 * Inserts the initial color
+	 * @param startColor initial color.
+	 */
+	public void setStartColor(Color startColor);
+
+    /**
+	 * Inserts the final color.
+	 * @param endColor final color.
+	 */
+	public void setEndColor(Color endColor);
+
+    /**
+	 * Returns the initial color.
+	 * @return  Color initial color.
+	 */
+	public Color getStartColor();
+
+    /**
+	 * Returns the final color
+	 * @return Color  final color.
+	 */
+	public Color getEndColor();
+
+	public IInterval[] calculateIntervals(FeatureStore featureStore,
+			String selectedItem, int intervalCount, int shapeType)
+			throws DataException;
+
+
+//    public ISymbol getSymbol(FeatureReference id) throws DataException;
+
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java	(revision 35988)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+/**
+ * Interface of raster legend.
+ */
+public interface IRasterLegend extends ILegend {
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java	(revision 35988)
@@ -0,0 +1,199 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * Interface of a vectorial legend.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public interface IVectorLegend extends ILegend, DrawingObservable {
+	/**
+	 * Inserts the DataSource.
+	 *
+	 * @param ds DataSource.
+	 * @throws DataException TODO
+	 * @throws FieldNotFoundException when the field is not found.
+	 */
+//	void setFeatureStore(FeatureStore fs)
+//		throws DataException;
+
+	/**
+	 * Returns the symbol to be used to represent the feature in the i-th
+	 * record in the DataSource
+	 * @param i, the record index
+	 *
+	 * @return ISymbol.
+	 */
+//	ISymbol getSymbol(int i) throws ReadException;
+	/**
+     * Returns a symbol starting from an IFeature.
+	 *
+	 * TAKE CARE!! When we are using a feature iterator as a database
+	 * the only field that will be filled is the fieldID.
+	 * The rest of fields will be null to reduce the time of creation
+	 *
+	 * @param feat IFeature.
+	 *
+	 * @return S�mbolo.
+	 * @throws MapContextException 
+	 */
+    ISymbol getSymbolByFeature(Feature feat) throws MapContextException;
+
+	/**
+	 * Returns the type of the shape.
+	 *
+	 * @return Returns the type of the shapes that the legend is ready to use.
+	 *
+	 */
+	int getShapeType();
+
+	/**
+	 * Defines the type of the shape.
+	 *
+	 * @param shapeType type of the shape.
+	 */
+	void setShapeType(int shapeType);
+
+	/**
+	 * Establishes the default symbol of a legend. In a SingleSymbolLegend the symbol
+	 * is established by calling this method.
+	 *
+	 * @param s default symbol.
+	 */
+	void setDefaultSymbol(ISymbol s);
+
+	/**
+     * Returns true or false depending on if the rest of values are used.
+	 *
+	 * @return  True if the rest of values are used.
+	 */
+    public boolean isUseDefaultSymbol();
+
+    void useDefaultSymbol(boolean b);
+
+//   jjdc los eliminamos, y debe quedar dependiente de la implementacion y n de api
+//   public ZSort getZSort();
+//
+//	public void setZSort(ZSort zSort);
+//
+	public boolean isSuitableForShapeType(int shapeType);
+
+	/**
+	 * Draws the {@link FeatureStore} data using this legend simbology.
+	 * 
+	 * @param image
+	 *            the base image to draw over
+	 * @param graphics2D
+	 *            the {@link Graphics2D} to draw to
+	 * @param viewPort
+	 *            the ViewPort to use
+	 * @param cancel
+	 *            the {@link Cancellable} delegate object
+	 * @param scale
+	 *            the scale of the view
+	 * @param queryParameters
+	 *            the query parameters
+	 * @param coordTrans
+	 *            the transformation coordinates to use for reprojection
+	 * @param featureStore
+	 * 			  {@link FeatureStore} to load the data to draw from
+	 * @throws LegendException
+	 */
+	void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
+			Cancellable cancel, double scale, Map queryParameters,
+			ICoordTrans coordTrans, FeatureStore featureStore)
+			throws LegendException;
+	
+	 /**
+     * Draws the {@link FeatureStore} data using this legend simbology.
+     * 
+     * @param image
+     *            the base image to draw over
+     * @param graphics2D
+     *            the {@link Graphics2D} to draw to
+     * @param viewPort
+     *            the ViewPort to use
+     * @param cancel
+     *            the {@link Cancellable} delegate object
+     * @param scale
+     *            the scale of the view
+     * @param queryParameters
+     *            the query parameters
+     * @param coordTrans
+     *            the transformation coordinates to use for reprojection
+     * @param featureStore
+     *            {@link FeatureStore} to load the data to draw from
+     * @param featureQuery 
+     *            the query used to filter the features.
+     * @throws LegendException
+     */
+    void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
+            Cancellable cancel, double scale, Map queryParameters,
+            ICoordTrans coordTrans, FeatureStore featureStore, FeatureQuery featureQuery)
+            throws LegendException;
+
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+			double scale, Map queryParameters, ICoordTrans coordTrans,
+			FeatureStore featureStore, PrintAttributes properties) throws LegendException;
+	
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties) throws LegendException;
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java	(revision 35988)
@@ -0,0 +1,53 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+public interface IInterval extends Persistent, Cloneable {
+
+	/**
+	 * Returns if the given value is included into the interval.
+	 * 
+	 * @param v
+	 *            value to check. Must be instance of {@link Number}
+	 * 
+	 * @return if the given value is included into the interval
+	 */
+	boolean isInInterval(Object v);
+
+	/**
+	 * Returns the interval minimum included value.
+	 * 
+	 * @return the minimum value
+	 */
+	double getMin();
+
+	/**
+	 * Returns the interval maximum included value.
+	 * 
+	 * @return the maximum value
+	 */
+	double getMax();
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java	(revision 35988)
@@ -0,0 +1,72 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Information of the legend that allows to be represented graphically to the user
+ * 
+ */
+public interface IClassifiedLegend extends ILegend {
+	/**
+	 * Obtains the descriptions of the classes that are in the classification
+	 * @return DOCUMENT ME!
+	 */
+	String[] getDescriptions();
+
+	/**
+	 * Obtains the symbols of each class of the classification for the user.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	ISymbol[] getSymbols();
+
+	/**
+	 * Obtains the values in relation with each class of the classification
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	Object[] getValues();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java	(revision 35988)
@@ -0,0 +1,44 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+
+/**
+ * Legend based on one single symbol to use while rendering.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface ISingleSymbolLegend extends IVectorLegend {
+	
+	public static final String LEGEND_NAME = "SingleSymbol";
+	
+	ZSort getZSort();
+
+	void setZSort(ZSort zSort);
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.tools.observer.Observer;
+
+/**
+ * Interface for observable drawing operations.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface DrawingObservable {
+
+	/**
+	 * Adds a new {@link Observer}.
+	 * 
+	 * @param observer
+	 *            the {@link Observer} to add
+	 */
+	void addDrawingObserver(Observer observer);
+
+	/**
+	 * Deletes a registered drawing {@link Observer} from the list of registered
+	 * ones.
+	 * 
+	 * @param observer
+	 *            to delete from the registered ones
+	 */
+	void deleteDrawingObserver(Observer observer);
+
+	/**
+	 * Deletes all the registered drawing {@link Observer} objects. 
+	 */
+	void deleteDrawingObservers();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java	(revision 35988)
@@ -0,0 +1,106 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import java.awt.Color;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Interface for the legend with unique values.
+ *
+ */
+public interface IVectorialUniqueValueLegend extends IClassifiedVectorLegend {
+	
+	public static final String LEGEND_NAME = "VectorialUniqueValue";
+	
+    /**
+     * Establishes the symbol for the value which is the argument of the function.
+     *
+     * @param id index.
+     * @param symbol symbol.
+     */
+    void setValueSymbolByID(int id, ISymbol symbol);
+
+
+    /**
+     * Returns the symbols starting from an ID. It looks in m_ArrayKeys for the
+     * element ID and with this key obtains the FSymbol.
+
+     * @param key ID.
+     *
+     * @return symbol associated with the ID
+     */
+
+    // public FSymbol getSymbolByID(int ID);
+
+    /**
+     * Returns the symbols starting from its key.
+     *
+     * @param key ID.
+     *
+     * @return symbol associated with the key.
+     * @throws MapContextException 
+     */
+    public ISymbol getSymbolByValue(Object key);
+
+	/**
+	 * Returns the key related to a registered {@link ISymbol} or null if it is
+	 * not registered.
+	 * 
+	 * @param symbol
+	 *            to look for
+	 * @return the related key
+	 */
+	Object getSymbolKey(ISymbol symbol);
+
+	ZSort getZSort();
+
+	void setZSort(ZSort zSort);
+
+	Color[] getColorScheme();
+
+	void setColorScheme(Color[] colors);
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java	(revision 35988)
@@ -0,0 +1,94 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Information about the legend to be represented in the interface.
+ *
+ */
+public interface ILegend extends Persistent, Cloneable {
+	/**
+	 * Obtains the default symbol of the legend.
+	 *
+	 * @return default symbol.
+	 */
+	ISymbol getDefaultSymbol();
+
+	/**
+	 * Clones the legend.
+	 *
+	 * @return Cloned legend.
+	 *
+	 * @throws XMLException
+	 */
+	ILegend cloneLegend();
+	/**
+	 * Adds a new listener to the legend.
+	 *
+	 * @param listener to be added
+	 */
+	void addLegendListener(LegendContentsChangedListener listener);
+	/**
+	 * Removes a listener from the legend.
+	 *
+	 * @param listener to be removed
+	 */
+	public void removeLegendListener(LegendContentsChangedListener listener);
+	/**
+	 * Executed when the default symbol of a legend is changed.
+	 *
+	 * @param event
+	 */
+	public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event);
+	/**
+	 * Obtains the listeners of a legend.
+	 *
+	 * @return LegendListener[] array composed by the listeners of a legend.
+	 */
+	public LegendContentsChangedListener[] getListeners();
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java	(revision 35988)
@@ -0,0 +1,217 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.lang.Cloneable;
+
+
+/**
+ *
+ * Interface for symbols.It is the most general one which is implemented by other
+ * specific symbols.For this reason this interface has a method to obtain the derived
+ * version of a common symbol(apart from others). The main purpose is to offer a set of
+ * symbols that will be part of the FMap kernel and allow the developer to add new symbols
+ * without changes in the initial implementation.
+ *
+ *
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ISymbol extends Persistent, IPrintable, Cloneable {
+
+	public static Color SELECTION_COLOR = Color.YELLOW;
+
+	/**
+	 * Returns the derived version of the symbol that will be used to draw the
+	 * feature when it is selected.
+	 * @return <b>ISymbol</b> applied to a feature when it has been selected.
+	 */
+	public ISymbol getSymbolForSelection();
+
+	/**
+	 * Used when a symbol is going to be drawn.The method to do
+	 * it will depend on the derived version of the symbol.
+	 * @param g
+	 * @param affineTransform
+	 * @param shp
+	 * @param cancel TODO
+	 */
+	public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel);
+
+	/**
+	 * <p>
+	 * Returns <b>the distance between the shape's bounding box and the
+	 * symbol-that-represents-this-shape's bounding box</b> in a two-length-float
+	 * array passed as parameter.<br>
+	 * </p>
+	 * <p>
+	 * After this method returns, the float array passed will contain two values
+	 * representing <b>the amount of pixels</b> separating each of the X (first element)
+	 * and Y (second element) axes.<br>
+	 * </p>
+	 * <p>
+	 * This distance maybe dependent on:
+	 * 	<ol>
+	 * 		<li>
+	 * 			<b>The ViewPort</b>: if the symbol is an instance of CartographicSupport
+	 * 			the units it uses are not pixels and the reference system is
+	 * 			CarthographicSupport.WORLD.
+	 * 		</li>
+	 * 		<li>
+	 * 			<b>The target rendering context's dpi (dots-per-inch)</b>: if the symbol
+	 * 			is an instance of CartographicSupport the units it uses are not pixels and
+	 * 			CarthographicSupport.PAPER.
+	 * 		</li>
+	 * 	</ol>
+	 * <br>
+	 * </p>
+	 * <p>
+	 * And in any other case, if the unit of the symbol is pixels or the symbol is not
+	 * even an instance of CartographicSupport, the returning values are only
+	 * defined by the symbol and are not calculated.
+	 * </p>
+	 * @param ViewPort viewPort
+	 * @param Shape shp
+	 * @param int dpi
+	 * @param float[] distances, the array of floats where to store the distances in x and y axis
+	 */
+	public void getPixExtentPlus(Geometry geom, float[] distances, ViewPort viewPort, int dpi);
+	
+	
+	/**
+	 * Informs that the geometry will be represented with that symbol in just one pixel or dot
+	 * 
+	 * 
+	 * 
+	 * @param geom
+	 * @param positionOfDotOrPixel (out) filled with pixel or dot location
+	 * @param viewPort
+	 * @param dpi
+	 * @return
+	 */
+	public boolean isOneDotOrPixel(Geometry geom, double[] positionOfDotOrPixel,
+			ViewPort viewPort, int dpi);
+
+	/**
+	 * Returns the rgb of the symbol when it is drawn like a point.
+	 *
+	 * @return rgb of the symbol.
+	 */
+	public int getOnePointRgb();
+
+
+
+
+
+	/**
+	 * The description is a human-readable text used to label it when show in a symbol menu or something like that.
+	 * @return   description of this symbol.
+	 * @uml.property  name="description"
+	 */
+	public String getDescription();
+
+	/**
+	 * Tells whether the shape of the symbol will be drawn or not.
+	 *
+	 * @return <b>true</b> if Shape must be drawn. Useful if you are labelling
+	 */
+	public boolean isShapeVisible();
+
+	/**
+	 * Sets the description of this symbol
+	 * @param   desc, a string with the description
+	 * @see   ISymbol.getDescription();
+	 * @uml.property  name="description"
+	 */
+	public void setDescription(String desc);
+
+	/**
+	 * The use of this method -and its mechanism- is being valorated. It probably
+	 * will be <b>deprecated</b>.
+	 * @return FSymbol constants. I think it is better to use isSuitableFor
+	 *
+	 */
+	public int getSymbolType();
+
+	/**
+	 * True if this symbol is ok for the geometry. For example, a FillSymbol will
+	 * be suitable for a Polygon.
+	 * @param geom
+	 * @return
+	 */
+	public boolean isSuitableFor(Geometry geom);
+
+	/**
+	 * Useful to render the symbol inside the TOC, or inside little
+	 * rectangles. For example, think about rendering a Label with size
+	 * in meters => You will need to specify a size in pixels.
+	 * Of course, you can also to choose to render a prepared image, etc.
+	 * @param scaleInstance
+	 * @param r
+	 * @param properties TODO
+	 * @param g2
+	 * @throws SymbolDrawingException TODO
+	 */
+	public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException;
+	
+	/**
+	 * Returns the {@link Color} to use to render the symbol.
+	 * @param 
+	 * @return  the {@link Color} to use to render the symbol
+	 */
+	public Color getColor();
+	
+	/**
+	 * Sets the {@link Color} to use to render the symbol.
+	 * @param color to render the symbol
+	 */
+	public void setColor(Color color);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java	(revision 35988)
@@ -0,0 +1,37 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.mapcontext.Messages;
+
+/**
+ * Exception thrown when a symbol cannot be drawn. The type of the exception
+ * will determine the cause.
+ * <ol>
+ * 	<li><b>Unsupported set of settings</b>: getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS</li>
+ * 	<li><b>Shape type mismatch</b>: getType() == SymbolDrawingException.SHAPETYPE_MISMATCH</li>
+ * </ol>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class SymbolDrawingException extends Exception {
+	private static final long serialVersionUID = 4059410328246182074L;
+	public static final int UNSUPPORTED_SET_OF_SETTINGS = 0;
+	public static final int SHAPETYPE_MISMATCH = 1;
+	public static final String STR_UNSUPPORTED_SET_OF_SETTINGS = Messages.getString("unsupported_set_of_settings");
+	
+	private int type;
+	
+	public int getType() {
+		return type;
+	}
+	/**
+	 * Creates a new instance of this exception.
+	 * <ol>
+	 * 	<li><b>Unsupported set of settings</b>: getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS</li>
+	 * 	<li><b>Shape type mismatch</b>: getType() == SymbolDrawingException.SHAPETYPE_MISMATCH</li>
+	 * </ol>
+	 */ 
+	public SymbolDrawingException(int type) {
+		this.type = type;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java	(revision 35988)
@@ -0,0 +1,276 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileFilter;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+/**
+ * Symbols management: creation, registration, etc.
+ * 
+ * @author gvSIG team
+ */
+public interface SymbolManager {
+
+	/**
+	 * Loads the symbols persisted into a folder. It loads the symbols through
+	 * the use of the current {@link PersistenceManager}, loading all files
+	 * found into the folder.
+	 * 
+	 * @param folder
+	 *            to load the persisted symbols from
+	 * @return the list of loaded symbols
+	 * @throws SymbolException
+	 *             if there is an error loading the symbols
+	 */
+	ISymbol[] loadSymbols(File folder) throws SymbolException;
+
+	/**
+	 * Loads the symbols persisted into a folder. It loads the symbols through
+	 * the use of the current {@link PersistenceManager}, loading the files
+	 * found into the folder which apply to the provided filter.
+	 * 
+	 * @param folder
+	 *            to load the persisted symbols from
+	 * @param filter
+	 *            to apply to know which files to load
+	 * @return the list of loaded symbols
+	 * @throws SymbolException
+	 *             if there is an error loading the symbols
+	 */
+	ISymbol[] loadSymbols(File folder, FileFilter filter)
+			throws SymbolException;
+
+	/**
+	 * Persists a {@link ISymbol} into the given folder, with the given file
+	 * name.
+	 * 
+	 * @param symbol
+	 *            to persist
+	 * @param fileName
+	 *            of the file to create
+	 * @param folder
+	 *            where to create the file
+	 * @throws SymbolException
+	 *             if there is an error persisting the symbol, or the file to
+	 *             create already exists
+	 */
+	void saveSymbol(ISymbol symbol, String fileName, File folder)
+			throws SymbolException;
+
+	/**
+	 * Persists a {@link ISymbol} into the given folder, with the given file
+	 * name.
+	 * 
+	 * @param symbol
+	 *            to persist
+	 * @param fileName
+	 *            of the file to create
+	 * @param folder
+	 *            where to create the file
+	 * @param overwrite
+	 *            what to do if the file to create already exists
+	 * @throws SymbolException
+	 *             if there is an error persisting the symbol, or the file to
+	 *             create already exists and overwrite is false
+	 */
+	void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException;
+
+	/**
+	 * Returns the current {@link SymbolPreferences}.
+	 * 
+	 * @return the current {@link SymbolPreferences}
+	 */
+	SymbolPreferences getSymbolPreferences();
+
+	/**
+	 * Creates a new {@link ISymbol}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(String symbolName) throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} which can be used to render the given
+	 * {@link Geometry} type.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(int geomType) throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} with the given {@link Color}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @param color
+	 *            the color for the symbol
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} which can be used to render the given
+	 * {@link Geometry} type, with the given {@link Color}.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @param color
+	 *            the color for the symbol
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(int geomType, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link IMultiLayerSymbol}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @return a new {@link IMultiLayerSymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link IMultiLayerSymbol} which can be used to render the
+	 * given {@link Geometry} type.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @return a new {@link IMultiLayerSymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(int geomType)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link ISymbol} implementation class with a name. This way
+	 * the symbol class is not related to any geometry type, so it can be
+	 * created only through the {@link #createSymbol(String)} method.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the ISymbol
+	 *             interface
+	 */
+	void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link ISymbol} implementation class with a name and a list
+	 * of geometry types which the symbol is able to render.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param geomTypes
+	 *            the list of geometry types the symbol is able to render
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the ISymbol
+	 *             interface
+	 */
+	void registerSymbol(String symbolName, int[] geomTypes, Class symbolClass)
+			throws MapContextException;
+
+	/**
+	 * Registers a {@link IMultiLayerSymbol} implementation class with a name.
+	 * This way the symbol class is not related to any geometry type, so it can
+	 * be created only through the {@link #createMultiLayerSymbol(String)}
+	 * method.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the
+	 *             {@link IMultiLayerSymbol} interface
+	 */
+	void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link IMultiLayerSymbol} implementation class with a name
+	 * and a list of geometry types which the symbol is able to render.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param geomTypes
+	 *            the list of geometry types the symbol is able to render
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the
+	 *             {@link IMultiLayerSymbol} interface
+	 */
+	void registerMultiLayerSymbol(String symbolName, int[] geomTypes,
+			Class symbolClass) throws MapContextRuntimeException;
+
+	/**
+	 * Returns an instance of {@link IWarningSymbol}.
+	 * 
+	 * TODO: revisar el uso de esto, a ver si es necesario o se puede ocultar
+	 * dentro de la implementaci�n.
+	 * 
+	 * @param message
+	 * @param symbolDesc
+	 * @param symbolDrawExceptionType
+	 * @return the warning symbol
+	 * @throws MapContextRuntimeException
+	 */
+	IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException;
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java	(revision 35988)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when there is an error while a symbol is being persisted. 
+ * @author gvSIG team
+ */
+public class SaveSymbolException extends SymbolException {
+
+	private static final long serialVersionUID = 2386696269496820720L;
+
+	private static final String KEY = "SaveSymbolException";
+
+    private static final String MESSAGE = "Error while persisting a symbol";
+    
+	public SaveSymbolException(Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java	(revision 35988)
@@ -0,0 +1,48 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG} {Create Symbol management API}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when there is an error while a persisted symbol is being
+ * loaded.
+ * 
+ * @author gvSIG team
+ */
+public class LoadSymbolException extends SymbolException {
+
+	private static final long serialVersionUID = 3182880573327780775L;
+
+	private static final String KEY = "LoadSymbolException";
+
+	private static final String MESSAGE = "Error while loading a persisted symbol";
+
+	public LoadSymbolException(Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java	(revision 35988)
@@ -0,0 +1,299 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.impl.InvalidRegisteredClassException;
+import org.gvsig.fmap.mapcontext.impl.RegisteredClassInstantiationException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+/**
+ * Default {@link SymbolManager} implementation.
+ * 
+ * @author gvSIG team
+ */
+public class DefaultSymbolManager implements SymbolManager {
+
+	private SymbolPreferences symbolPreferences =
+			new DefaultSymbolPreferences();
+
+	private Map symbolsByName = Collections.synchronizedMap(new HashMap());
+
+	private Map symbolsByShapeType = Collections.synchronizedMap(new HashMap());
+
+	private Map multiLineSymbolsByName =
+			Collections.synchronizedMap(new HashMap());
+
+	private Map multiLineSymbolsByShapeType =
+			Collections.synchronizedMap(new HashMap());
+
+	private IWarningSymbol warningSymbol;
+
+	private Object warningSymbolLock = new Object();
+
+	public ISymbol[] loadSymbols(File folder) throws SymbolException {
+		return loadSymbols(folder, null);
+	}
+
+	public ISymbol[] loadSymbols(File folder, FileFilter fileFilter)
+			throws SymbolException {
+		// TODO: add symbol caching
+
+		if (folder.exists()) {
+
+			File[] symbolFiles = null;
+			if (fileFilter == null) {
+				symbolFiles = folder.listFiles();
+			} else {
+				symbolFiles = folder.listFiles(fileFilter);
+			}
+
+			if (symbolFiles != null) {
+				ISymbol[] symbols = new ISymbol[symbolFiles.length];
+				for (int i = 0; i < symbolFiles.length; i++) {
+					symbols[i] = loadSymbol(symbolFiles[i]);
+				}
+				return symbols;
+			}
+		}
+
+		return null;
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder)
+			throws SymbolException {
+		saveSymbol(symbol, fileName, folder, false);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException {
+		// TODO: add symbol caching
+
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+
+		File symbolFile = new File(folder, fileName);
+		if (!overwrite && symbolFile.exists()) {
+			throw new SymbolFileAlreadyExistsException(symbolFile);
+		}
+
+		try {
+			FileOutputStream fos = new FileOutputStream(symbolFile);
+
+			persistenceManager.saveState(persistenceManager.getState(symbol),
+					fos);
+
+			fos.flush();
+			fos.close();
+		} catch (PersistenceException e) {
+			throw new SaveSymbolException(e);
+		} catch (IOException e) {
+			throw new SaveSymbolException(e);
+		}
+	}
+
+	/**
+	 * Loads a persisted symbol from the given file.
+	 */
+	private ISymbol loadSymbol(File file) throws SymbolException {
+		if (file.exists()) {
+			try {
+				FileInputStream fis = new FileInputStream(file);
+
+				PersistenceManager persistenceManager = ToolsLocator
+						.getPersistenceManager();
+
+				PersistentState state = persistenceManager.loadState(fis);
+				ISymbol symbol = (ISymbol) persistenceManager.create(state);
+
+				fis.close();
+				return symbol;
+			} catch (PersistenceException e) {
+				throw new LoadSymbolException(e);
+			} catch (IOException e) {
+				throw new LoadSymbolException(e);
+			}
+		}
+
+		return null;
+	}
+
+	public SymbolPreferences getSymbolPreferences() {
+		return symbolPreferences;
+	}
+
+	public ISymbol createSymbol(String symbolName)
+			throws MapContextRuntimeException {
+		return createSymbol(symbolName, (Class) symbolsByName.get(symbolName),
+				ISymbol.class);
+	}
+
+	public ISymbol createSymbol(int shapeType)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) symbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createSymbol(symbolName);
+	}
+
+	public ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException {
+		ISymbol symbol = createSymbol(symbolName);
+
+		if (symbol != null) {
+			symbol.setColor(color);
+		}
+
+		return symbol;
+	}
+
+	public ISymbol createSymbol(int shapeType, Color color)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) symbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createSymbol(symbolName, color);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException {
+		return (IMultiLayerSymbol) createSymbol(symbolName,
+				(Class) multiLineSymbolsByName.get(symbolName),
+				IMultiLayerSymbol.class);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) multiLineSymbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createMultiLayerSymbol(symbolName);
+	}
+
+	public void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException {
+		if (symbolClass == null || !ISymbol.class.isAssignableFrom(symbolClass)) {
+			throw new InvalidRegisteredClassException(ISymbol.class,
+					symbolClass, symbolName);
+		}
+		symbolsByName.put(symbolName, symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		registerSymbol(symbolName, symbolClass);
+		if (shapeTypes != null) {
+			for (int i = 0; i < shapeTypes.length; i++) {
+				symbolsByShapeType.put(new Integer(shapeTypes[i]), symbolName);
+			}
+		}
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException {
+		if (symbolClass == null
+				|| !IMultiLayerSymbol.class.isAssignableFrom(symbolClass)) {
+			throw new InvalidRegisteredClassException(IMultiLayerSymbol.class,
+					symbolClass, symbolName);
+		}
+
+		multiLineSymbolsByName.put(symbolName, symbolClass);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		registerMultiLayerSymbol(symbolName, symbolClass);
+		if (shapeTypes != null) {
+			for (int i = 0; i < shapeTypes.length; i++) {
+				multiLineSymbolsByShapeType.put(new Integer(shapeTypes[i]),
+						symbolName);
+			}
+		}
+	}
+
+	public IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException {
+		synchronized (warningSymbolLock) {
+			if (warningSymbol == null) {
+				warningSymbol = (IWarningSymbol) createSymbol("warning");
+			}
+		}
+
+		// TODO: set those values as parameter values in the draw method.
+		warningSymbol.setDescription(symbolDesc);
+		warningSymbol.setMessage(message);
+		warningSymbol.setDrawExceptionType(symbolDrawExceptionType);
+
+		return warningSymbol;
+	}
+
+	private ISymbol createSymbol(String symbolName, Class symbolClass,
+			Class expectedType) throws MapContextRuntimeException {
+		ISymbol symbol;
+		try {
+			symbol =
+					(ISymbol) (symbolClass == null ? null
+							: symbolClass.newInstance());
+		} catch (InstantiationException e) {
+			throw new RegisteredClassInstantiationException(expectedType,
+					symbolClass, symbolName, e);
+		} catch (IllegalAccessException e) {
+			throw new RegisteredClassInstantiationException(expectedType,
+					symbolClass, symbolName, e);
+		}
+
+		// Perform this initialization into the Symbol implementation
+		// if (symbol instanceof CartographicSupport) {
+		// CartographicSupport cs = (CartographicSupport) symbol;
+		// cs.setUnit(getDefaultCartographicSupportMeasureUnit());
+		// cs
+		// .setReferenceSystem(getDefaultCartographicSupportReferenceSystem();
+		// }
+
+		return symbol;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java	(revision 35988)
@@ -0,0 +1,51 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.io.File;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when a symbol file is going to be created and the file
+ * already exists. 
+ * @author gvSIG team
+ */
+public class SymbolFileAlreadyExistsException extends SymbolException {
+
+	private static final long serialVersionUID = 2327496845968384363L;
+
+    private static final String KEY = "SymbolFileAlreadyExistsException";
+
+    private static final String MESSAGE = "A symbol was going to be stored on " +
+    		"the file %(file), which already exists";
+    
+	public SymbolFileAlreadyExistsException(File symbolFile) {
+		super(MESSAGE, KEY, serialVersionUID);
+		setValue("file", symbolFile);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java	(revision 35988)
@@ -0,0 +1,165 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.File;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+
+/**
+ * Default {@link SymbolPreferences} implementation based on object attributes.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultSymbolPreferences implements SymbolPreferences {
+
+	private String symbolFileExtension = ".gvssym";
+
+	private Color defaultSymbolColor;
+
+	private Color defaultSymbolFillColor;
+
+	private boolean defaultSymbolFillColorAleatory;
+
+	private Font defaultSymbolFont;
+
+	private String symbolLibraryPath;
+
+	/**
+	 * The unit that will be used when creating new symbols with Cartographic
+	 * support.
+	 */
+	private int defaultCartographicSupportMeasureUnit = -1;
+
+	/**
+	 * The reference system that will be used when creating new symbols with
+	 * Cartographic support.
+	 */
+	private int defaultCartographicSupportReferenceSystem =
+			CartographicSupport.WORLD;
+
+	public DefaultSymbolPreferences() {
+		resetDefaultSymbolColor();
+		resetDefaultSymbolFillColor();
+		resetDefaultSymbolFillColorAleatory();
+		resetSymbolLibraryPath();
+		resetDefaultSymbolFont();
+	}
+
+	public String getSymbolFileExtension() {
+		return symbolFileExtension;
+	}
+
+	public void setSymbolFileExtension(String symbolFileExtension) {
+		this.symbolFileExtension = symbolFileExtension;
+	}
+	public String getSymbolLibraryPath() {
+		return symbolLibraryPath;
+	}
+
+	public void setSymbolLibraryPath(String symbolLibraryPath) {
+		this.symbolLibraryPath = symbolLibraryPath;
+	}
+
+	public void resetSymbolLibraryPath() {
+		symbolLibraryPath =
+				System.getProperty("user.home") + File.separator + "gvSIG"
+						+ File.separator + "Symbols";
+	}
+
+	public Color getDefaultSymbolColor() {
+		return defaultSymbolColor;
+	}
+
+	public void setDefaultSymbolColor(Color defaultSymbolColor) {
+		this.defaultSymbolColor = defaultSymbolColor;
+	}
+
+	public void resetDefaultSymbolColor() {
+		defaultSymbolColor = Color.GRAY;
+	}
+
+	public Color getDefaultSymbolFillColor() {
+		return defaultSymbolFillColor;
+	}
+
+	public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
+		this.defaultSymbolFillColor = defaultSymbolFillColor;
+	}
+
+	public void resetDefaultSymbolFillColor() {
+		defaultSymbolFillColor = new Color(60, 235, 235);
+	}
+
+	public boolean isDefaultSymbolFillColorAleatory() {
+		return defaultSymbolFillColorAleatory;
+	}
+
+	public void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory) {
+		this.defaultSymbolFillColorAleatory = defaultSymbolFillColorAleatory;
+	}
+
+	public void resetDefaultSymbolFillColorAleatory() {
+		defaultSymbolFillColorAleatory = false;
+	}
+
+	public Font getDefaultSymbolFont() {
+		return defaultSymbolFont;
+	}
+
+	public void setDefaultSymbolFont(Font defaultSymbolFont) {
+		this.defaultSymbolFont = defaultSymbolFont;
+	}
+
+	public void resetDefaultSymbolFont() {
+		defaultSymbolFont = new Font("Serif", Font.PLAIN, 8);
+	}
+
+	public int getDefaultCartographicSupportMeasureUnit() {
+		return defaultCartographicSupportMeasureUnit;
+	}
+
+	public void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit) {
+		this.defaultCartographicSupportMeasureUnit =
+				defaultCartographicSupportMeasureUnit;
+	}
+
+	public int getDefaultCartographicSupportReferenceSystem() {
+		return defaultCartographicSupportReferenceSystem;
+	}
+
+	public void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem) {
+		this.defaultCartographicSupportReferenceSystem =
+				defaultCartographicSupportReferenceSystem;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java	(revision 35988)
@@ -0,0 +1,149 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.ViewPort;
+
+/**
+ * <p>This interface enables Cartographic support for those graphical elements that require
+ * additional runtime information rather than the feature itself geometric definitions.<br></p>
+ *
+ * <p>It allows to realworld's measure units dimensioning.<br></p>
+ *
+ * <p>It also supplies a toolkit to perform operations with centralized static methods.
+ * @see CartographicSupportToolkit inner class' methods<br></p>
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface CartographicSupport {
+	public static final int WORLD = 0;
+	public static final int PAPER = 1;
+
+	/**
+	 * Defines the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
+	 * @param unitIndex, the index of the unit in the MapContext.NAMES array
+	 */
+	public abstract void setUnit(int unitIndex);
+	/**
+	 * Returns the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
+	 * @returns an <b>int</b> with the index of the unit in the MapContext.NAMES array, or -1 if the size is specified in pixel
+	 */
+	public abstract int getUnit();
+
+	/**
+	 * Returns the <b>Reference System</b> used to draw the elements of the image.<br>
+	 * <p>
+	 * The elements have to be scaled to <b>pixel</b> when the image is bein drawn in
+	 * order to compose the map. The elements of the map may define its size in
+	 * other units than pixel.<br>
+	 * </p>
+	 * <p><b>CartographicSupport</b> enables the elements to define the size in
+	 * measure units but these units may refer to different reference system. Two
+	 * kinds of Reference Systems are allowed in this context: <b>CartographicSupport.WORLD</b>,
+	 * and <b>CartographicSupport.PAPER</b>.
+	 * <br></p>
+	 * <p>
+	 * Depending on which <b>Reference System</b> is used the unit used by this element
+	 * refers to distances in the real world (then they are map's CRS-dependant)
+	 * or screen or printer output (then they are output DPI-dependant)<br>
+	 * </p>
+	 * <p>
+	 * In case the unit used is <b>pixel</b> then the reference system does not
+	 * have any effect since the source unit is the same than the target unit.
+	 * <br>
+	 * </p>
+	 * @return
+	 */
+	public abstract int getReferenceSystem();
+
+	/**
+	 * Sets the <b>Reference System</b> that defines how this units have to be
+	 * handled. Possible values are:
+	 * <ol>
+	 *   <li><b>CartographySupport.WORLD</b>: Defines that the unit values refer
+	 *   to distances in the world. So, the size of the element displayed <b>depends
+	 *   directly on the scale and CRS</b> used by the map. The size of the elements
+	 *   defined to use CartographicSupport.WORLD will match exactly to their
+	 *   actual size in the real world.</li>
+	 *   <li><b>CartographySupport.PAPER</b>: Defines that the unit values refer
+	 *   to the length that the element will have regardless where it appears. If
+	 *   ReferenceSystem is <b>CartographySupport.PAPER</b>, and the length is (e.g.)
+	 *   millimeters the element will be displayed with the <b>same</b> amount of
+	 *   millimeters of length whether in the <b>screen</b> or the <b>printer</b>
+	 *   (screen DPI and printer DPI must be correctly configured).</li>
+	 * </ol>
+	 */
+	public abstract void setReferenceSystem(int referenceSystem);
+
+	/**
+	 * Computes and sets the size (in pixels) of the cartographic element according
+	 * to the current rendering context (output dpi, map scale, map units) and the
+	 * symbol cartgraphic settings (unit, size, and unit reference system).
+	 *
+	 * @param viewPort, the ViewPort containing the symbol.
+	 * @param dpi, current output dpi (screen or printer)
+	 * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
+	 * @return a double containing the previous defined size
+	 */
+	public abstract double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	/**
+	 * Sets the size of the cartographic element in pixels.
+	 *
+	 * @param cartographicSize, the size in pixels of the element
+	 * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
+	 */
+	public abstract void setCartographicSize(double cartographicSize, Geometry geom);
+
+	/**
+	 * Gets the size (in pixels) of the cartographic element according
+	 * to the current rendering context (output dpi, map scale, map units) and the
+	 * symbol cartgraphic settings (unit, size, and unit reference system).
+	 * @param viewPort
+	 * @param dpi
+	 * @param shp
+	 * @return double containing the size in [screen/printer] pixels for the current symbol
+	 */
+	public abstract double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java	(revision 35988)
@@ -0,0 +1,82 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ *
+ * ITextSymbol.java<br>
+ * Represents an ISymbol that draws a text.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 11, 2007
+ *
+ */
+public interface ITextSymbol extends ISymbol {
+	
+	public static final String SYMBOL_NAME = "text";
+	
+	public final static int SYMBOL_STYLE_ALIGNMENT_LEFT = 94;
+	public final static int SYMBOL_STYLE_ALIGNMENT_RIGHT = 95;
+	public final static int SYMBOL_STYLE_ALIGNMENT_CENTERED = 96;
+	public final static int SYMBOL_STYLE_ALIGNMENT_JUSTIFY = 97;
+	/**
+	 * Establishes the font that will be used to render this ITextSymbol.
+	 * @param font
+	 */
+	public abstract void setFont(Font font);
+
+	/**
+	 * Returns the currently set font.
+	 * @return Font
+	 */
+	public abstract Font getFont();
+
+	/**
+	 * Returns the currently color set to be applied to the text
+	 * @return Color
+	 */
+	public abstract Color getTextColor();
+
+	/**
+	 * Sets the color of the text
+	 * @param color
+	 */
+	public abstract void setTextColor(Color color);
+
+	/**
+	 * Returns the text contained by this symbol
+	 * @return
+	 * @deprecated ?do i need it?
+	 */
+	public abstract String getText();
+
+	/**
+	 * Sets the text to be rendered by this symbol
+	 * @param text, a String
+	 */
+	public abstract void setText(String text);
+
+	/**
+	 * Sets the font size currently set to this symbol
+	 * @param d
+	 */
+	public abstract void setFontSize(double d);
+
+	/**
+	 * Computes a Geometry wrapping the text to be applied
+	 * @param p target location
+	 * @return
+	 */
+	public abstract Geometry getTextWrappingShape(Point p);
+
+	public abstract Rectangle getBounds();
+
+	public abstract void setAutoresizeEnabled(boolean autoresizeFlag);
+
+	public abstract boolean isAutoresizeEnabled();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java	(revision 35988)
@@ -0,0 +1,162 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelStyle.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.10  2007-08-16 06:55:30  jvidal
+* javadoc updated
+*
+* Revision 1.9  2007/08/13 11:36:30  jvidal
+* javadoc
+*
+* Revision 1.8  2007/05/08 08:47:39  jaume
+* *** empty log message ***
+*
+* Revision 1.7  2007/04/05 16:07:14  jaume
+* Styled labeling stuff
+*
+* Revision 1.6  2007/04/04 15:42:03  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2007/04/04 15:41:05  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2007/04/02 16:34:56  jaume
+* Styled labeling (start commiting)
+*
+* Revision 1.3  2007/03/29 16:02:01  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2007/03/09 11:20:56  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.1  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.styles;
+
+import java.awt.Dimension;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+
+/**
+ * Defines the style that a Label symbol can contain which typically define
+ * a background of the label as an Image, the texts that the label holds
+ * and their position within the label in rendering time.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public interface ILabelStyle extends IStyle {
+	/**
+	 * @return int, the amount of fields this style allows
+	 */
+	public int getFieldCount();
+
+	/**
+	 * Sets the texts that will appear in the label.
+	 * @param texts
+	 */
+	public void setTextFields(String[] texts);
+
+
+	/**
+	 * Returns an array of rectangles defining the text boxes where text is
+	 * placed.
+	 * @return
+	 */
+	public Rectangle2D[] getTextBounds();
+
+	public Dimension getSize();
+
+	/**
+	 * Returns the position of the point labeled by this label in percent units relative
+	 * to the label bounds. It determines the offset to be applied to the label to be
+	 * placed and allows the user to use custom styles.
+	 */
+	public Point2D getMarkerPoint();
+
+	/**
+	 * Sets the position of the point labeled by this in percent units relative to the
+	 * label bounds
+	 * @param p
+	 * @throws IllegalArgumentException if the point coordinates are >0.0 or <1.0
+	 */
+	public void setMarkerPoint(Point2D p) throws IllegalArgumentException;
+
+	/**
+	 * Sets a TextFieldArea using its index. With this method the user can
+	 * modify the size of the rectangle for the TextFieldArea
+	 * @param index
+	 * @param rect
+	 */
+	public void setTextFieldArea(int index, Rectangle2D rect);
+	
+	/**
+	 * Adds a new TextFieldArea with an specific size which is defined as a rectangle.
+	 * @param index,int
+	 * @param rect,Rectangle2D
+	 */
+	public void addTextFieldArea(Rectangle2D rect);
+	
+	/**
+	 * Delete the TextFieldArea specified by its index.
+	 * @param index,int
+	 */
+	public void deleteTextFieldArea(int index);
+	
+	/**
+	 * Sets the size for a laber and stablishes an unit scale factor to not change
+	 * too much its content
+	 * @param width
+	 * @param height
+	 */
+	public void setSize(double width, double height);
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java	(revision 35988)
@@ -0,0 +1,127 @@
+ /* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: IStyle.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.7  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.6  2007/09/19 16:19:27  jaume
+* removed unnecessary imports
+*
+* Revision 1.5  2007/08/22 09:49:00  jvidal
+* javadoc updated
+*
+* Revision 1.4  2007/08/16 06:55:30  jvidal
+* javadoc updated
+*
+* Revision 1.3  2007/08/13 11:36:41  jvidal
+* javadoc
+*
+* Revision 1.2  2007/04/04 15:41:05  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2007/03/09 11:20:56  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.styles;
+
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Used by Objects that have to define an style for them.This interface has
+ * methods to stablish a description and get it,to specify if an object
+ * that implements this interface is suitable for a kind of symbol and other
+ * methods to draw symbols.
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IStyle extends Persistent, Cloneable {
+	/**
+	 * Defines the description of a symbol.It will be specified with an
+	 * string.
+	 * @param desc,String
+	 */
+	public abstract void setDescription(String desc);
+	/**
+	 * Returns the description of a symbol
+	 * @return Description of a symbol
+	 */
+	public abstract String getDescription();
+	/**
+	 * Useful to render the symbol inside the TOC, or inside little
+	 * rectangles. For example, think about rendering a Label with size
+	 * in meters => You will need to specify a size in pixels.
+	 * Of course. You may also preffer to render a prepared image, etc.
+	 * @param g Graphics2D
+	 * @param r Rectangle
+	 */
+	public abstract void drawInsideRectangle(Graphics2D g, Rectangle r) throws SymbolDrawingException;
+
+	/**
+	 * True if this symbol is ok for the style or class.
+	 * @param symbol ISymbol
+	 */
+
+	public abstract boolean isSuitableFor(ISymbol symbol);
+
+	/**
+	 * Used to show an outline of the style to graphically show its properties.
+	 * @param g, the Graphics2D where to draw
+	 * @param r, the bounds of the style inside such Graphics2D
+	 */
+	public abstract void drawOutline(Graphics2D g, Rectangle r) throws SymbolDrawingException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java	(revision 35988)
@@ -0,0 +1,13 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+public interface IWarningSymbol extends ISymbol {
+	
+	public static final String SYMBOL_NAME = "warning";
+
+	void setDrawExceptionType(int symbolDrawExceptionType);
+
+	void setMessage(String message);
+	
+	void setDescription(String description);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {gvSIG}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Parent exception of symbol related exceptions.
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class SymbolException extends MapContextException {
+
+	private static final long serialVersionUID = -5432842435290441524L;
+
+	/**
+	 * @see BaseException#BaseException(String, String, long)
+	 */
+	public SymbolException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	/**
+	 * @see BaseException#BaseException(String, Throwable, String, long)
+	 */
+	public SymbolException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java	(revision 35988)
@@ -0,0 +1,124 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IMultiLayerSymbol.java 20989 2008-05-28 11:05:57Z jmvivo $
+ * $Log$
+ * Revision 1.5  2007-08-16 06:55:19  jvidal
+ * javadoc updated
+ *
+ * Revision 1.4  2007/08/09 08:04:36  jvidal
+ * javadoc
+ *
+ * Revision 1.3  2007/08/09 07:57:42  jvidal
+ * javadoc
+ *
+ * Revision 1.2  2007/03/09 11:20:56  jaume
+ * Advanced symbology (start committing)
+ *
+ * Revision 1.1.2.1  2007/02/16 10:54:12  jaume
+ * multilayer splitted to multilayerline, multilayermarker,and  multilayerfill
+ *
+ *
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+
+/**
+ * Allows to create multi layer symbols using the composition of
+ * several symbols of the same type.Depending on the type of the symbols that are
+ * used to compose the final symbol, the user will have MultiLayerMarkerSymbol,
+ * MultiLayerLineSymbol,...
+ *
+ */
+
+public interface IMultiLayerSymbol extends ISymbol {
+
+	/**
+	 * Establishes a concret symbol for a layer
+	 *
+	 * @param index, index of the layer
+	 * @param layer, symbol to be "applied" to the layer
+	 * @throws IndexOutOfBoundsException
+	 */
+	public abstract void setLayer(int index, ISymbol layer)
+	throws IndexOutOfBoundsException;
+	/**
+	 * Changes the position of two layers in a multilayersymbol
+	 * @param index1, index of the layer
+	 * @param index2, index of the layer
+	 */
+	public abstract void swapLayers(int index1, int index2);
+	/**
+	 * Obtains  the symbol that "contains" a layer whose index is the argument of the method.
+	 * @param layerIndex
+	 * @return
+	 */
+	public abstract ISymbol getLayer(int layerIndex);
+	/**
+	 * Returns the number of layers
+	 * @return int
+	 */
+	public abstract int getLayerCount();
+
+	/**
+	 * Stacks a new symbol to the symbol list. The symbol is appended to the
+	 * list and, in terms of use, it will be the last symbol to be processed.
+	 * @param ISymbol newLayer
+	 */
+	public abstract void addLayer(ISymbol newLayer);
+	/**
+	 * Stacks a new symbol to the symbol list. The symbol is appended to the
+	 * list in the specified position.
+	 * @param ISymbol newLayer
+	 */
+	public abstract void addLayer(ISymbol newLayer, int layerIndex)
+	throws IndexOutOfBoundsException;
+
+	/**
+	 * TODO maybe push it up to ISymbol
+	 * @param layer
+	 * @return true if this symbol contains the removed one
+	 */
+	public abstract boolean removeLayer(ISymbol layer);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java	(revision 35988)
@@ -0,0 +1,201 @@
+
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Font;
+
+/**
+ * Preferences for symbol configuration and default values.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface SymbolPreferences {
+
+	/**
+	 * Returns the file extension to use for persisted symbols.
+	 * 
+	 * @return the symbol file extension
+	 */
+	String getSymbolFileExtension();
+
+	/**
+	 * Sets the file extension to use for persisted symbols.
+	 * 
+	 * @param extension
+	 *            the file extension to use for persisted symbols
+	 */
+	void setSymbolFileExtension(String extension);
+
+	/**
+	 * Returns the default color to use for symbols.
+	 * 
+	 * @return the symbol default color
+	 */
+	Color getDefaultSymbolColor();
+
+	/**
+	 * Sets the default color to use for symbols.
+	 * 
+	 * @param defaultSymbolColor
+	 *            the symbol default color
+	 */
+	void setDefaultSymbolColor(Color defaultSymbolColor);
+
+	/**
+	 * Sets the default color for symbols to the original value.
+	 */
+	void resetDefaultSymbolColor();
+
+	/**
+	 * Returns the default fill color to use for symbols.
+	 * 
+	 * @return the default fill color
+	 */
+	Color getDefaultSymbolFillColor();
+
+	/**
+	 * Sets the default fill color to use for symbols.
+	 * 
+	 * @param defaultSymbolFillColor
+	 *            the default fill color
+	 */
+	void setDefaultSymbolFillColor(Color defaultSymbolFillColor);
+
+	/**
+	 * Sets the default fill color for symbols to the original value.
+	 */
+	void resetDefaultSymbolFillColor();
+
+	/**
+	 * Returns if the default symbol fill color has been generated in a aleatory
+	 * way.
+	 * 
+	 * @return if the default symbol fill color is aleatory
+	 */
+	boolean isDefaultSymbolFillColorAleatory();
+
+	/**
+	 * Sets if the default symbol fill color has been generated in a aleatory
+	 * way.
+	 * 
+	 * @param defaultSymbolFillColorAleatory
+	 *            if the default symbol fill color is aleatory
+	 */
+	void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory);
+
+	/**
+	 * Sets if the default symbol fill color is aleatory to the default value.
+	 */
+	void resetDefaultSymbolFillColorAleatory();
+
+	/**
+	 * Returns the default font to use for symbols.
+	 * 
+	 * @return the default symbol font
+	 */
+	Font getDefaultSymbolFont();
+
+	/**
+	 * Sets the default font to use for symbols.
+	 * 
+	 * @param defaultSymbolFont
+	 *            the default symbol font
+	 */
+	void setDefaultSymbolFont(Font defaultSymbolFont);
+
+	/**
+	 * Sets the default font to use for symbols to the original value.
+	 */
+	void resetDefaultSymbolFont();
+
+	/**
+	 * Returns the path to the symbol library, where the persisted symbols can
+	 * be found.
+	 * 
+	 * @return the path to the symbol library
+	 */
+	String getSymbolLibraryPath();
+
+	/**
+	 * Sets the path to the symbol library, where the persisted symbols can be
+	 * found.
+	 * 
+	 * @param symbolLibraryPath
+	 *            the path to the symbol library
+	 */
+	void setSymbolLibraryPath(String symbolLibraryPath);
+
+	/**
+	 * Sets the path to the symbol library to the original value.
+	 */
+	void resetSymbolLibraryPath();
+
+	/**
+	 * Returns the unit that will be used when creating new symbols with
+	 * Cartographic support.
+	 * 
+	 * @return the default cartographic support measure unit
+	 * @see CartographicSupport#getUnit()
+	 */
+	int getDefaultCartographicSupportMeasureUnit();
+
+	/**
+	 * Sets the unit that will be used when creating new symbols with
+	 * Cartographic support.
+	 * 
+	 * @param defaultCartographicSupportMeasureUnit
+	 *            the default cartographic support measure unit
+	 * @see CartographicSupport#setUnit()
+	 */
+	void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit);
+
+	/**
+	 * Returns the reference system that will be used when creating new symbols
+	 * with Cartographic support.
+	 * 
+	 * @return the cartographic reference system
+	 * @see CartographicSupport#PAPER
+	 * @see CartographicSupport#WORLD
+	 */
+	int getDefaultCartographicSupportReferenceSystem();
+
+	/**
+	 * Sets the reference system that will be used when creating new symbols
+	 * with Cartographic support.
+	 * 
+	 * @param defaultCartographicSupportReferenceSystem
+	 *            the cartographic reference system
+	 * @see CartographicSupport#PAPER
+	 * @see CartographicSupport#WORLD
+	 */
+	void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java	(revision 35988)
@@ -0,0 +1,14 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.geom.Geometry;
+
+public interface IPrintable {
+	public void print(Graphics2D g,
+					  AffineTransform at,
+					  Geometry shape,
+					  PrintAttributes properties);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java	(revision 35988)
@@ -0,0 +1,126 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+
+
+
+/**
+ * Estructura de datos con la informaci�n relativa a las geometr�as de una
+ * fuente de datos necesaria para acelerar el procesado de la capa en memoria.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class MemoryShapeInfo implements ShapeInfo {
+	ArrayList infos = new ArrayList();
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#addShapeInfo(java.awt.geom.Rectangle2D,
+	 * 		int)
+	 */
+	public void addShapeInfo(Rectangle2D boundingBox, int type) {
+		infos.add(new Info(boundingBox, type));
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#addShapeInfo(int,
+	 * 		java.awt.geom.Rectangle2D, int)
+	 */
+	public void setShapeInfo(int index, Rectangle2D boundingBox, int type)
+		throws ArrayIndexOutOfBoundsException {
+		infos.set(index, new Info(boundingBox, type));
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#getBoundingBox(int)
+	 */
+	public Rectangle2D getBoundingBox(int index) {
+		return ((Info) infos.get(index)).getRect();
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#getType(int)
+	 */
+	public int getType(int index) {
+		return ((Info) infos.get(index)).getType();
+	}
+
+	/**
+	 * Clase con el rect�ngulo y el tipo de shape.
+	 *
+	 * @author Vicente Caballero Navarro
+	 */
+	class Info {
+		private Rectangle2D rect;
+		private int type;
+
+		/**
+		 * Crea un nuevo Info.
+		 *
+		 * @param rect Extent del shape.
+		 * @param type Tipo de shape.
+		 */
+		public Info(Rectangle2D rect, int type) {
+			this.rect = rect;
+			this.type = type;
+		}
+
+		/**
+		 * Devuelve el extent del shape.
+		 *
+		 * @return Extent del shape.
+		 */
+		public Rectangle2D getRect() {
+			return rect;
+		}
+
+		/**
+		 * Devuelve el tipo de shape.
+		 *
+		 * @return Tipo de shape.
+		 */
+		public int getType() {
+			return type;
+		}
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java	(revision 35988)
@@ -0,0 +1,90 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import java.awt.geom.Rectangle2D;
+
+
+/**
+ * Estructura de datos con la informaci�n relativa a las geometr�as de una
+ * fuente de datos necesaria para acelerar el procesado de la capa
+ */
+public interface ShapeInfo {
+	/**
+	 * A�ade al final de la estructura de datos la informaci�n de una geometr�a
+	 *
+	 * @param boundingBox Extent del shape.
+	 * @param type Tipo de shape.
+	 */
+	void addShapeInfo(Rectangle2D boundingBox, int type);
+
+	/**
+	 * Establece en la posici�n index-�sima de la estructura de datos la
+	 * informaci�n de una geometr�a
+	 *
+	 * @param index �ndice.
+	 * @param boundingBox Extent del shape.
+	 * @param type Tipo de shape.
+	 *
+	 * @throws ArrayIndexOutOfBoundsException Si se intenta establecer la
+	 * 		   informaci�n para una geometr�a que no existe
+	 */
+	void setShapeInfo(int index, Rectangle2D boundingBox, int type)
+		throws ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Obtiene el bounding box de la geometr�a index-�sima
+	 *
+	 * @param index �ndice de la geometr�a.
+	 *
+	 * @return Extent de la geometr�a.
+	 */
+	Rectangle2D getBoundingBox(int index);
+
+	/**
+	 * Obtiene el tipo de la geometr�a index-�sima
+	 *
+	 * @param index �ndice.
+	 *
+	 * @return Tipo de geometr�a.
+	 */
+	int getType(int index);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java	(revision 35988)
@@ -0,0 +1,123 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * Visitor de zoom a lo seleccionado.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SelectedZoomVisitor implements LayersVisitor, Visitor {
+	private Envelope rectangle = null;
+
+	/**
+	 * Devuelve el Extent de los shapes seleccionados, y si no hay ning�n shape
+	 * seleccionado devuelve null.
+	 *
+	 * @return Extent de los shapes seleccionados.
+	 */
+	public Envelope getSelectBound() {
+		return rectangle;
+	}
+
+	public String getProcessDescription() {
+		return "Defining rectangle to zoom from selected geometries";
+	}
+
+	public void visit(Feature feature) throws BaseException {
+		if (rectangle == null) {
+			rectangle = (feature.getDefaultGeometry()).getEnvelope();
+		} else {
+			rectangle.add((feature.getDefaultGeometry())
+					.getEnvelope());
+		}
+	}
+
+	public void visit(FeatureReference featureRefence) throws BaseException {
+		this.visit(featureRefence.getFeature());
+	}
+
+	public void visit(Object obj) throws BaseException {
+		if (obj instanceof FeatureReference) {
+			this.visit((FeatureReference) obj);
+			return;
+		}
+		if (obj instanceof Feature) {
+			this.visit((Feature) obj);
+			return;
+		}
+		if (obj instanceof FLayer) {
+			this.visit((FLayer) obj);
+			return;
+		}
+
+		throw new NotSupportedOperationException(this, obj);
+	}
+
+	public void visit(FLayer layer) throws BaseException {
+		if (!(layer instanceof SingleLayer)) {
+			return;
+		} else if (!layer.isActive()) {
+			return;
+		}
+		DataSet selection = ((SingleLayer) layer).getDataStore()
+				.getSelection();
+
+		if (selection instanceof Visitable) {
+			((Visitable) selection).accept(this);
+		}
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java	(revision 35988)
@@ -0,0 +1,63 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Parent class for MapContext exceptions.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class MapContextException extends BaseException {
+
+    private static final long serialVersionUID = 8122532768532097211L;
+
+    /**
+     * @see BaseException#BaseException(String, String, long)
+     */
+    protected MapContextException(String message, String key, long code) {
+        super(message, key, code);
+    }
+
+    /**
+     * @see BaseException#BaseException(String, Throwable, String, long)
+     */
+    protected MapContextException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+
+    public MapContextException(Throwable cause) {
+        this(
+        		"MapContext related error",
+        		cause,
+        		"_MapContext_related_error", 
+        		serialVersionUID
+        );
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java	(revision 35988)
@@ -0,0 +1,31 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class CancelEditingLayerException extends BaseException {
+
+	private String layer = null;
+
+	public CancelEditingLayerException(String layer,Throwable exception) {
+		this.layer = layer;
+		init();
+		initCause(exception);
+	}
+
+	private void init() {
+		messageKey = "error_cancel_editing_layer";
+		formatString = "Can�t cancel editing the layer: %(layer) ";
+	}
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class DriverLayerException extends LoadLayerException {
+
+	public DriverLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_driver_layer";
+		formatString = "Can�t load driver of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ReprojectLayerException extends LoadLayerException {
+
+	public ReprojectLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_projection_layer";
+		formatString = "Can�t reproject the layer: %(layer) ";
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java	(revision 35988)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class LegendLayerException extends LoadLayerException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -4033030636689365030L;
+
+    protected LegendLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+	public LegendLayerException(String layer,Throwable cause) {
+		super(
+				"Can�t load the legend for layer %(layer).",
+				cause,
+				"Cant_load_the_legend_for_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+	
+	public LegendLayerException(String layer) {
+		this(layer,null);
+	}
+	
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java	(revision 35988)
@@ -0,0 +1,62 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * Excepci�n provocada por el WMS.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class UnsupportedVersionLayerException extends LoadLayerException {
+	public UnsupportedVersionLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_version_layer";
+		formatString = "Can�t use this version of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java	(revision 35988)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class StopEditionLayerException extends BaseException{
+
+	private String layer;
+	public StopEditionLayerException(String l,Throwable exception) {
+		this.layer=l;
+		init();
+		initCause(exception);
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_stop_editing_layer";
+		formatString = "Can�t stop editing the layer: %(tag) ";
+	}
+
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class URLLayerException extends LoadLayerException {
+
+	public URLLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_url_layer";
+		formatString = "Can�t create the url of the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java	(revision 35988)
@@ -0,0 +1,41 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class CreateLayerException extends MapContextException {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 7923597739786110983L;
+
+
+    protected CreateLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+
+    public CreateLayerException(String layer,Throwable cause) {
+        super(
+                "Can�t create the layer %(layer).",
+                cause,
+                "Cant_create_the_layer_XlayerX",
+                serialVersionUID
+        );
+        setValue("layer", layer);
+    }
+
+
+    public CreateLayerException(String layer) {
+        super(
+                "Can�t create the layer %(layer).",
+                "Cant_create_the_layer_XlayerX",
+                serialVersionUID
+        );
+        setValue("layer", layer);
+    }
+    
+    
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ReloadLayerException extends LoadLayerException {
+
+	public ReloadLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_reload_layer";
+		formatString = "Can�t reload the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java	(revision 35988)
@@ -0,0 +1,61 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ConnectionErrorLayerException extends LoadLayerException {
+
+	public ConnectionErrorLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_connection_layer";
+		formatString = "Can�t connet the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java	(revision 35988)
@@ -0,0 +1,32 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class StartEditionLayerException extends BaseException {
+	private String layer;
+	public StartEditionLayerException(String l,Throwable exception) {
+		this.layer=l;
+		init();
+		initCause(exception);
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_start_editing_layer";
+		formatString = "Can�t start editing the layer: %(tag) ";
+	}
+
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ProjectionLayerException extends LoadLayerException {
+
+	public ProjectionLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_projection_layer";
+		formatString = "Can�t project the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class FileLayerException extends LoadLayerException {
+
+	public FileLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_file_layer";
+		formatString = "Can�t found the file of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java	(revision 35988)
@@ -0,0 +1,40 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class LoadLayerException extends MapContextException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7500729722899605739L;
+
+    protected LoadLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+
+	public LoadLayerException(String layer,Throwable cause) {
+		super(
+				"Can�t load the layer %(layer).",
+				cause,
+				"Cant_load_the_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+
+
+	public LoadLayerException(String layer) {
+		super(
+				"Can�t load the layer %(layer).",
+				"Cant_load_the_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+	
+	
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class NameLayerException extends LoadLayerException {
+
+	public NameLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_name_layer";
+		formatString = "Can�t named the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class TypeLayerException extends LoadLayerException {
+
+	public TypeLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_type_layer";
+		formatString = "Can�t use type of the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java	(revision 35988)
@@ -0,0 +1,64 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+/**
+ * Parent class for MapContext runtime exceptions.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextRuntimeException extends BaseRuntimeException {
+
+	private static final long serialVersionUID = 3993964182701795153L;
+
+	/**
+     * @see BaseException#BaseException(String, String, long)
+     */
+    protected MapContextRuntimeException(String message, String key, long code) {
+        super(message, null, key, code);
+    }
+
+    /**
+     * @see BaseException#BaseException(String, Throwable, String, long)
+     */
+    protected MapContextRuntimeException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+    public MapContextRuntimeException(Throwable cause) {
+        this(
+        		"MapContext related error",
+        		cause,
+        		"_MapContext_related_error", 
+        		serialVersionUID
+        );
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java	(revision 35988)
@@ -0,0 +1,111 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+/**
+ * Locator for the MapContext library.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextLocator extends BaseLocator {
+
+	public static final String MAPCONTEXT_MANAGER_NAME = "mapcontextlocator.manager";
+
+	private static final String MAPCONTEXT_MANAGER_DESCRIPTION = "MapContext Library manager";
+
+	public static final String SYMBOL_MANAGER_NAME = "symbol.manager";
+
+	private static final String SYMBOL_MANAGER_DESCRIPTION = "Symbols manager";
+
+	private static final MapContextLocator instance = new MapContextLocator();
+
+	/**
+	 * Private constructor, we don't want it to be able to be instantiated
+	 * outside this class.
+	 */
+	private MapContextLocator() {
+		// Nothing to do
+	}
+
+	public static MapContextLocator getInstance() {
+		return instance;
+	}
+
+	/**
+	 * Return a reference to MapContextManager.
+	 * 
+	 * @return a reference to MapContextManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static MapContextManager getMapContextManager()
+			throws LocatorException {
+		return (MapContextManager) getInstance().get(MAPCONTEXT_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the MapContextManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the MapContextManager interface
+	 */
+	public static void registerMapContextManager(Class clazz) {
+		getInstance().register(MAPCONTEXT_MANAGER_NAME,
+				MAPCONTEXT_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to the {@link SymbolManager}.
+	 * 
+	 * @return a reference to the SymbolManager.
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static SymbolManager getSymbolManager() throws LocatorException {
+		return (SymbolManager) getInstance().get(SYMBOL_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the SymbolManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the SymbolManager interface
+	 */
+	public static void registerSymbolManager(Class clazz) {
+		getInstance().register(SYMBOL_MANAGER_NAME, SYMBOL_MANAGER_DESCRIPTION,
+				clazz);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java	(revision 35988)
@@ -0,0 +1,134 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.CompatLibrary;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.impl.DefaultMapContextDrawer;
+import org.gvsig.fmap.mapcontext.layers.FLayerStatus;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
+import org.gvsig.fmap.mapcontext.layers.LayerFactory;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.layers.vectorial.ReprojectDefaultGeometry;
+import org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.util.Caller;
+import org.gvsig.tools.util.impl.DefaultCaller;
+
+/**
+ * Library for the MapContext library API.
+ * @author jmvivo
+ */
+public class MapContextLibrary extends AbstractLibrary {
+	final static private Logger LOG = LoggerFactory.getLogger(FLyrDefault.class);
+
+    public void doRegistration() {
+        registerAsAPI(MapContextLibrary.class);
+        require(DALLibrary.class);
+        require(CompatLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		LayerFactory.getInstance().registerLayerToUseForStore(
+				FeatureStore.class, FLyrVect.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+        Caller caller = new DefaultCaller();
+
+        FLyrDefault.registerMetadata();	
+
+		MapContextManager manager = MapContextLocator.getMapContextManager();
+
+		if (manager == null) {
+			throw new ReferenceNotRegisteredException(
+					MapContextLocator.MAPCONTEXT_MANAGER_NAME,
+					MapContextLocator.getInstance());
+		}
+
+		try {
+			manager.setDefaultMapContextDrawer(DefaultMapContextDrawer.class);
+		} catch (MapContextException ex) {
+			throw new LibraryException(getClass().getName(), ex);
+		}
+		
+        caller.add( new ViewPort.RegisterPersistence() );
+
+        /*
+         * Do register of all
+         */
+        if( !caller.call() ) {
+        	throw new LibraryException(MapContextLibrary.class, caller.getExceptions());
+        }
+
+        // persistent classes
+		MapContext.registerPersistent();
+		
+		ExtentHistory.registerPersistent();
+		
+//		MappingAnnotation.registerPersistent();
+		ReprojectDefaultGeometry.registerPersistent();
+
+//		FLayerVectorialDB.registerPersistent();
+//		FLayerFileVectorial.registerPersistent();
+		
+		FLayerStatus.registerPersistent();
+		FLyrDefault.registerPersistent();
+		FLyrVect.registerPersistent();
+		FLayers.registerPersistent();
+				
+		////////////////////////////////////////
+		// Register the persistence factories //
+		////////////////////////////////////////
+		PersistenceManager persistenceManager =
+				ToolsLocator.getPersistenceManager();
+		// Color
+		persistenceManager.registerFactory(new ColorPersistenceFactory());
+		// Point2D
+		persistenceManager.registerFactory(new Point2DPersistenceFactory());
+		// Font
+		persistenceManager.registerFactory(new FontPersistenceFactory());
+		// Rectangle2D
+		persistenceManager.registerFactory(new Rectangle2DPersistenceFactory());
+		// awt Dimension
+		persistenceManager.registerFactory(new DimensionPersistenceFactory());
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java	(revision 35988)
@@ -0,0 +1,88 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+/**
+ * Clase que accede a los recursos para la i18n
+ */
+public class Messages {
+    /** DOCUMENT ME! */
+    private static final String BUNDLE_NAME = "com.iver.cit.gvsig.fmap.FMap";
+
+    /** DOCUMENT ME! */
+    private static ResourceBundle RESOURCE_BUNDLE = null;
+
+    /**
+     * Inicializa la clase con el locale adecuado
+     *
+     * @param loc Locale de la aplicaci�n
+     */
+    private static void init() {
+        Locale loc = Locale.getDefault();
+        RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, loc);
+    }
+
+    
+    /**
+     * Obtiene el valor del recurso con clave 'key'
+     *
+     * @param key clave del recurso que se quiere obtener
+     *
+     * @return recurso que se quiere obtener o !key! en caso de no encontrarlo.
+     *         En dicho caso no se notifica al framework ya que  estos son los
+     *         mensajes propios de la aplicaci�n y deben de estar todos
+     */
+    public static String getString(String key) {
+        try {
+            // La primera vez, cargamos las cadenas.
+            if (RESOURCE_BUNDLE == null)
+                init();
+            return RESOURCE_BUNDLE.getString(key);
+        } catch (MissingResourceException e) {
+            return '!' + key + '!';
+        }
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java	(revision 35988)
@@ -0,0 +1,359 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {Create Manager to register MapContextDrawer implementation}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+
+/**
+ * Manager of the MapContext library.
+ * 
+ * Holds the default implementation of the {@link MapContextDrawer}.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a>
+ */
+public interface MapContextManager {
+
+	/**
+	 * Create a new layer from the data parameters passed as parameter.
+	 * 
+	 * @param layerName name used in for the new layer. 
+	 * @param parameters used for create the {@link DataStore} of the new layer
+	 * 
+	 * @return the new FLayer
+	 * 
+	 * @throws LoadLayerException
+	 */
+	public FLayer createLayer(String layerName,
+			DataStoreParameters parameters) throws LoadLayerException;
+
+	/**
+	 * Create a layer from a {@link DataStore}.
+	 * 
+	 * @param layerName name used in for the new layer. 
+	 * @param store used for the new layer
+	 * 
+	 * @return the new FLayer
+	 * 
+	 * @throws LoadLayerException
+	 */
+	public FLayer createLayer(String layerName, DataStore store)
+			throws LoadLayerException;
+
+	/**
+	 * Create a layer to be used as the {@link GraphicLayer}.
+	 * 
+	 * @param projection used in the layer.
+	 * 
+	 * @return the new {@link GraphicLayer}.
+	 */
+	public GraphicLayer createGraphicsLayer(IProjection projection);
+
+	/**
+	 * Returns the current {@link SymbolManager}.
+	 * 
+	 * @return the {@link SymbolManager}
+	 */
+	SymbolManager getSymbolManager();
+
+	/**
+	 * Sets the class to use as the default implementation for the
+	 * {@link MapContextDrawer}.
+	 * 
+	 * @param drawerClazz
+	 *            the {@link MapContextDrawer} class to use
+	 * @throws MapContextException
+	 *             if there is any error setting the class
+	 */
+	public void setDefaultMapContextDrawer(Class drawerClazz)
+			throws MapContextException;
+
+	public void validateMapContextDrawer(Class drawerClazz) throws MapContextException;
+
+	/**
+	 * Creates a new instance of the default {@link MapContextDrawer}
+	 * implementation.
+	 * 
+	 * @return the new {@link MapContextDrawer} instance
+	 * @throws MapContextException
+	 *             if there is an error creating the new object instance
+	 */
+	public MapContextDrawer createDefaultMapContextDrawerInstance()
+			throws MapContextException;
+
+	/**
+	 * Creates a new instance of the provided {@link MapContextDrawer}
+	 * implementation.
+	 * 
+	 * @param drawerClazz
+	 *            the {@link MapContextDrawer} implementation class
+	 * @return the new {@link MapContextDrawer} instance
+	 * @throws MapContextException
+	 *             if there is an error creating the new object instance
+	 */
+	public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz)
+			throws MapContextException;
+
+	
+	
+	void registerLegend(String legendName, Class legendClass)
+			throws MapContextRuntimeException;
+
+	ILegend createLegend(String legendName) throws MapContextRuntimeException;
+
+	void setDefaultVectorLegend(String legendName);
+
+	IVectorLegend createDefaultVectorLegend(int shapeType)
+			throws MapContextRuntimeException;
+
+	void registerLegendWriter(String legendName, String format,
+			Class writerClass) throws MapContextRuntimeException;
+
+	void registerLegendReader(String format, Class readerClass)
+			throws MapContextRuntimeException;
+
+	ILegendWriter createLegendWriter(String legendName, String format)
+			throws MapContextException;
+
+	ILegendReader createLegendReader(String format)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	int getDefaultCartographicSupportMeasureUnit();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	int getDefaultCartographicSupportReferenceSystem();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Color getDefaultSymbolColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolColor(Color defaultSymbolColor);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Color getDefaultSymbolFillColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFillColor(Color defaultSymbolFillColor);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFillColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	boolean isDefaultSymbolFillColorAleatory();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFillColorAleatory();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Font getDefaultSymbolFont();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFont(Font defaultSymbolFont);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFont();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	String getSymbolLibraryPath();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setSymbolLibraryPath(String symbolLibraryPath);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetSymbolLibraryPath();
+	
+	
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(String symbolName) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(int shapeType) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(int shapeType, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass)
+			throws MapContextException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException;
+	
+	/**
+	 * It returns the legend associated with a {@link DataStore}.
+	 * If the legend doesn't exist it returns <code>null</code>.
+	 * @param dataStore
+	 * the store that could have a legend.
+	 * @return
+	 * the legend or <code>null</code>.
+	 */
+	ILegend getLegend(DataStore dataStore);	
+
+
+    // TODO:
+    // DynObjectModel getFeatureTypeUIModel(DataStore store,
+    // FeatureType featureType);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java	(revision 35988)
@@ -0,0 +1,123 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * Visitor de zoom a lo seleccionado.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SelectedZoomVisitor implements LayersVisitor, Visitor {
+	private Envelope rectangle = null;
+
+	/**
+	 * Devuelve el Extent de los shapes seleccionados, y si no hay ning�n shape
+	 * seleccionado devuelve null.
+	 *
+	 * @return Extent de los shapes seleccionados.
+	 */
+	public Envelope getSelectBound() {
+		return rectangle;
+	}
+
+	public String getProcessDescription() {
+		return "Defining rectangle to zoom from selected geometries";
+	}
+
+	public void visit(Feature feature) throws BaseException {
+		if (rectangle == null) {
+			rectangle = (feature.getDefaultGeometry()).getEnvelope();
+		} else {
+			rectangle.add((feature.getDefaultGeometry())
+					.getEnvelope());
+		}
+	}
+
+	public void visit(FeatureReference featureRefence) throws BaseException {
+		this.visit(featureRefence.getFeature());
+	}
+
+	public void visit(Object obj) throws BaseException {
+		if (obj instanceof FeatureReference) {
+			this.visit((FeatureReference) obj);
+			return;
+		}
+		if (obj instanceof Feature) {
+			this.visit((Feature) obj);
+			return;
+		}
+		if (obj instanceof FLayer) {
+			this.visit((FLayer) obj);
+			return;
+		}
+
+		throw new NotSupportedOperationException(this, obj);
+	}
+
+	public void visit(FLayer layer) throws BaseException {
+		if (!(layer instanceof SingleLayer)) {
+			return;
+		} else if (!layer.isActive()) {
+			return;
+		}
+		DataSet selection = ((SingleLayer) layer).getDataStore()
+				.getSelection();
+
+		if (selection instanceof Visitable) {
+			((Visitable) selection).accept(this);
+		}
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java	(revision 35988)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+public interface Record {
+    int getFieldCount() ;
+
+    String getFieldName(int index) ;
+
+    String getFieldValue(int index) ;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 35988)
@@ -0,0 +1,1921 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+
+import org.cresques.cts.GeoCalc;
+import org.cresques.cts.IProjection;
+import org.cresques.cts.UTM;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.util.Callable;
+
+/**
+ * <p>
+ * <code>ViewPort</code> class represents the logic needed to transform a
+ * rectangular area of a map to the available area in screen to display it.
+ * </p>
+ * 
+ * <p>
+ * Includes an affine transformation, between the rectangular area selected of
+ * the external map, in its own <i>map coordinates</i>, to the rectangular area
+ * available of a view in <i>screen coordinates</i>.
+ * </p>
+ * 
+ * <p>
+ * Elements:
+ * <ul>
+ * <li><i>extent</i>: the area selected of the map, in <i>map coordinates</i>.
+ * <li><i>imageSize</i>: width and height in pixels (<i>screen coordinates</i>)
+ * of the area available in screen to display the area selected of the map.
+ * <li><i>adjustedExtent</i>: the area selected must be an scale of
+ * <i>imageSize</i>.<br>
+ * This implies adapt the extent, preserving and centering it, and adding around
+ * the needed area to fill all the image size. That added area will be extracted
+ * from the original map, wherever exists, and filled with the background color
+ * wherever not.
+ * <li><i>scale</i>: the scale between the adjusted extent and the image size.
+ * <li><i>backColor</i>: the default background color in the view, if there is
+ * no map.
+ * <li><i>trans</i>: the affine transformation.
+ * <li><i>proj</i>: map projection used in this view.
+ * <li><i>distanceUnits</i>: distance measurement units, of data in screen.
+ * <li><i>mapUnits</i>: measurement units, of data in map.
+ * <li><i>extents</i>: an {@link ExtentHistory ExtentHistory} with the last
+ * previous extents.
+ * <li><i>offset</i>: position in pixels of the available rectangular area,
+ * where start drawing the map.
+ * <li><i>dist1pixel</i>: the distance in <i>world coordinates</i> equivalent to
+ * 1 pixel in the view with the current extent.
+ * <li><i>dist3pixel</i>: the distance in <i>world coordinates</i> equivalent to
+ * 3 pixels in the view with the current extent.
+ * <li><i>listeners</i>: list with the {@link ViewPortListener ViewPortListener}
+ * registered.
+ * </ul>
+ * </p>
+ * 
+ * @author Vicente Caballero Navarro
+ */
+public class ViewPort implements Persistent, Cloneable {
+
+    private static final String FIELD_DISTANCE_AREA = "distanceArea";
+    private static final String FIELD_IMAGE_SIZE = "imageSize";
+    private static final String FIELD_PROJ = "proj";
+    private static final String FIELD_OFFSET = "offset";
+    private static final String FIELD_MAP_UNITS = "mapUnits";
+    private static final String FIELD_EXTENT = "extent";
+    private static final String FIELD_EXTENTS = "extents";
+    private static final String FIELD_DISTANCE_UNITS = "distanceUnits";
+    private static final String FIELD_DIST3PIXEL = "dist3pixel";
+    private static final String FIELD_DIST1PIXEL = "dist1pixel";
+    private static final String FIELD_CLIP = "clip";
+    private static final String FIELD_BACK_COLOR = "backColor";
+    private static final String FIELD_ADJUSTED_EXTENT = "adjustedExtent";
+
+    private static final GeometryManager geomManager =
+        GeometryLocator.getGeometryManager();
+    private static final Logger logger =
+        LoggerFactory.getLogger(ViewPort.class);
+
+    /**
+     * <p>
+     * Screen resolution in <i>dots-per-inch</i>. Useful to calculate the
+     * geographic scale of the view.
+     * </p>
+     * 
+     * @see Toolkit#getScreenResolution()
+     * @see #getScale()
+     */
+    private static int dpi = java.awt.Toolkit.getDefaultToolkit()
+        .getScreenResolution();
+
+    /**
+     * <p>
+     * Area selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance when using the zoom in or zoom out
+     * tools, but also zooming to a selected feature or shape) the extent that
+     * covers that area is the value returned by this method. It is not the
+     * actual area shown in the view because it does not care about the aspect
+     * ratio of the available area. However, any part of the real world
+     * contained in this extent is shown in the view.
+     * </p>
+     * <p>
+     * Probably this is not what you are looking for. If you are looking for the
+     * complete extent currently shown, you must use
+     * {@linkplain #getAdjustedExtent()} method which returns the extent that
+     * contains this one but regarding the current view's aspect ratio.
+     * </p>
+     * 
+     * @see #getExtent()
+     * @see #setEnvelope(Envelope)
+     */
+    protected Rectangle2D extent;
+    
+    protected Time time;
+
+    /**
+     * <p>
+     * Location and dimensions of the extent adjusted to the image size.
+     * </p>
+     * 
+     * @see #getAdjustedExtent()
+     */
+    protected Rectangle2D adjustedExtent;
+
+    /**
+     * Draw version of the context. It's used for know when de componend has
+     * changed any visualization property
+     * 
+     * @see getDrawVersion
+     * @see updateDrawVersion
+     */
+    private long drawVersion = 0L;
+
+    /**
+     * <p>
+     * History with the last extents of the view.
+     * </p>
+     * 
+     * @see #setPreviousExtent()
+     * @see #getExtents()
+     */
+    protected ExtentHistory extents = new ExtentHistory();
+
+    /**
+     * <p>
+     * Size in <i>screen coordinates</i> of the rectangle where the image is
+     * displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageSize()
+     * @see #getImageHeight()
+     * @see #getImageWidth()
+     * @see #setImageSize(Dimension)
+     */
+    private Dimension imageSize;
+
+    /**
+     * <p>
+     * the affine transformation between the {@link #extent extent} in <i>map 2D
+     * coordinates</i> to the image area in the screen, in <i>screen 2D
+     * coordinates</i> (pixels).
+     * </p>
+     * 
+     * @see AffineTransform
+     * 
+     * @see #getAffineTransform()
+     * @see #setAffineTransform(AffineTransform)
+     * @see #calculateAffineTransform()
+     */
+    private AffineTransform trans = new AffineTransform();
+
+    /**
+     * <p>
+     * Measurement unit used for measuring distances and displaying information.
+     * </p>
+     * 
+     * @see #getDistanceUnits()
+     * @see #setDistanceUnits(int)
+     */
+    private int distanceUnits = 1;
+    /**
+     * <p>
+     * Measurement unit used for measuring areas and displaying information.
+     * </p>
+     * 
+     * @see #getDistanceArea()
+     * @see #setDistanceArea(int)
+     */
+    private int distanceArea = 1;
+    /**
+     * <p>
+     * Measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @see #getMapUnits()
+     * @see #setMapUnits(int)
+     */
+    private int mapUnits = 1;
+
+    /**
+     * <p>
+     * Array with the {@link ViewPortListener ViewPortListener}s registered to
+     * this view port.
+     * </p>
+     * 
+     * @see #addViewPortListener(ViewPortListener)
+     * @see #removeViewPortListener(ViewPortListener)
+     */
+    private ArrayList listeners = new ArrayList();
+
+    /**
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * <p>
+     * The offset of a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s
+     * <i>View</i> is always (0, 0) because the drawing area fits with the full
+     * window area. But in a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s
+     * <i>Layout</i> it's up to the place where the <code>FFrameView</code> is
+     * located.
+     * </p>
+     * 
+     * @see #getOffset()
+     * @see #setOffset(Point2D)
+     */
+    private Point2D offset = new Point2D.Double(0, 0);
+
+    /**
+     * <p>
+     * Clipping area.
+     * </p>
+     */
+    // private Rectangle2D clip;
+
+    /**
+     * <p>
+     * Background color of this view.
+     * </p>
+     * 
+     * @see #getBackColor()
+     * @see #setBackColor(Color)
+     */
+    private Color backColor = null; // Color.WHITE;
+
+    /**
+     * <p>
+     * Information about the map projection used in this view.
+     * </p>
+     * 
+     * @see #getProjection()
+     * @see #setProjection(IProjection)
+     */
+    private IProjection proj;
+
+    /**
+     * <p>
+     * Represents the distance in <i>world coordinates</i> equivalent to 1 pixel
+     * in the view with the current extent.
+     * </p>
+     * 
+     * @see #getDist1pixel()
+     * @see #setDist1pixel(double)
+     */
+    private double dist1pixel;
+
+    /**
+     * <p>
+     * Represents the distance in <i>world coordinates</i> equivalent to 3
+     * pixels in the view with the current extent.
+     * </p>
+     * 
+     * @see #getDist3pixel()
+     * @see #setDist3pixel(double)
+     */
+    private double dist3pixel;
+
+    /**
+     * <p>
+     * Ratio between the size of <code>imageSize</code> and <code>extent</code>:
+     * <br>
+     * <i>
+     * 
+     * <pre>
+     * min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())}
+     * </pre>
+     * 
+     * </i>
+     * </p>
+     */
+    private double scale;
+
+    /**
+     * <p>
+     * Clipping area.
+     * </p>
+     * 
+     * @see #setClipRect(Rectangle2D)
+     */
+    private Rectangle2D cliprect;
+
+    /**
+     * <p>
+     * Enables or disables the <i>"adjustable extent"</i> mode.
+     * </p>
+     * 
+     * <p>
+     * When calculates the affine transform, if
+     * <ul>
+     * <li><i>enabled</i>: the new <code>adjustedExtent</code> will have the (X,
+     * Y) coordinates of the <code>extent</code> and an area that will be an
+     * scale of the image size. That area will have different height or width
+     * (not both) of the extent according the least ratio (height or width) in
+     * 
+     * <pre>
+     * image.size/extent.size&quot;
+     * </pre>.
+     * <li><i>disabled</i>: the new <code>adjustedExtent</code> will be like
+     * <code>extent</code>.
+     * </ul>
+     * </p>
+     * 
+     * @see #setAdjustable(boolean)
+     */
+    private boolean adjustableExtent = true;
+
+    public ViewPort() {
+
+    }
+
+    /**
+     * <p>
+     * Creates a new view port with the information of the projection in
+     * <code>proj</code> argument, and default configuration:
+     * </p>
+     * <p>
+     * <ul>
+     * <li><i><code>distanceUnits</code></i> = meters
+     * <li><i><code>mapUnits</code></i> = meters
+     * <li><i><code>backColor</code></i> = <i>undefined</i>
+     * <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code>
+     * </ul>
+     * </p>
+     * 
+     * @param proj
+     *            information of the projection for this view port
+     */
+    public ViewPort(IProjection proj) {
+        // Por defecto
+        this.proj = proj;
+    }
+
+    /**
+     * <p>
+     * Changes the status of the <i>"adjustable extent"</i> option to enabled or
+     * disabled.
+     * </p>
+     * 
+     * <p>
+     * If view port isn't adjustable, won't bear in mind the aspect ratio of the
+     * available rectangular area to calculate the affine transform from the
+     * original map in real coordinates. (Won't scale the image to adapt it to
+     * the available rectangular area).
+     * </p>
+     * 
+     * @param boolean the boolean to be set
+     */
+    public void setAdjustable(boolean adjustable) {
+        if (adjustable == adjustableExtent) {
+            return;
+        }
+        adjustableExtent = adjustable;
+        this.updateDrawVersion();
+    }
+
+    /**
+     * <p>
+     * Appends the specified {@link ViewPortListener ViewPortListener} listener
+     * if weren't.
+     * </p>
+     * 
+     * @param arg0
+     *            the listener to add
+     * 
+     * @return <code>true</code> if has been added successfully
+     * 
+     * @see #removeViewPortListener(ViewPortListener)
+     */
+    public boolean addViewPortListener(ViewPortListener arg0) {
+        if (!listeners.contains(arg0)) {
+            return listeners.add(arg0);
+        }
+        return false;
+    }
+
+    /**
+     * <p>
+     * Removes the specified {@link ViewPortListener ViewPortListener} listener,
+     * if existed.
+     * </p>
+     * 
+     * @param arg0
+     *            the listener to remove
+     * 
+     * @return <code>true</code> if the contained the specified listener.
+     * 
+     * @see #addViewPortListener(ViewPortListener)
+     */
+    public boolean removeViewPortListener(ViewPortListener arg0) {
+        return listeners.remove(arg0);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the distance <code>d</code>, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> using a <i>delta
+     * transform</i> with the transformation affine information in the
+     * {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param d
+     *            distance in <i>map coordinates</i>
+     * 
+     * @return distance equivalent in <i>screen coordinates</i>
+     * 
+     * @see #toMapDistance(int)
+     * @see AffineTransform#deltaTransform(Point2D, Point2D)S
+     */
+    public int fromMapDistance(double d) {
+        Point2D.Double pWorld = new Point2D.Double(1, 1);
+        Point2D.Double pScreen = new Point2D.Double();
+
+        try {
+            trans.deltaTransform(pWorld, pScreen);
+        } catch (Exception e) {
+            System.err.print(e.getMessage());
+        }
+
+        return (int) (d * pScreen.x);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point <code>(x,y)</code>, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
+     * transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param x
+     *            the <code>x</code> <i>map coordinate</i> of a 2D point
+     * @param y
+     *            the <code>y</code> <i>map coordinate</i> of a 2D point
+     * 
+     * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #fromMapPoint(Point2D)
+     * @see AffineTransform#transform(Point2D, Point2D)
+     */
+    public Point2D fromMapPoint(double x, double y) {
+        Point2D.Double pWorld = new Point2D.Double(x, y);
+        Point2D.Double pScreen = new Point2D.Double();
+
+        try {
+            trans.transform(pWorld, pScreen);
+        } catch (Exception e) {
+            System.err.print(e.getMessage());
+        }
+
+        return pScreen;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point argument, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
+     * transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param point
+     *            the 2D point in <i>map coordinates</i>
+     * 
+     * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #toMapPoint(Point2D)
+     * @see #fromMapPoint(double, double)
+     */
+    public Point2D fromMapPoint(Point2D point) {
+        return fromMapPoint(point.getX(), point.getY());
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point <code>(x,y)</code>, that is in
+     * <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using the
+     * affine transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param x
+     *            the <code>x</code> <i>screen coordinate</i> of a 2D point
+     * @param y
+     *            the <code>y</code> <i>screen coordinate</i> of a 2D point
+     * 
+     * @return 2D point equivalent in <i>map coordinates</i>
+     * 
+     * @see #toMapPoint(Point2D)
+     * @see #fromMapPoint(double, double)
+     * @deprecated use {@link #convertToMapPoint(int, int)}
+     */
+    public Point2D toMapPoint(int x, int y) {
+        Point2D pScreen = new Point2D.Double(x, y);
+
+        return toMapPoint(pScreen);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the {@link Rectangle2D Rectangle2D}, that is in
+     * <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using
+     * {@linkplain #toMapDistance(int)}, and {@linkplain #toMapPoint(int, int)}.
+     * </p>
+     * 
+     * @param r
+     *            the 2D rectangle in <i>screen coordinates</i> (pixels)
+     * @return 2D rectangle equivalent in <i>map coordinates</i>
+     * 
+     * @see #fromMapRectangle(Rectangle2D)
+     * @see #toMapDistance(int)
+     * @see #toMapPoint(int, int)
+     */
+    public Rectangle2D toMapRectangle(Rectangle2D r) {
+        Rectangle2D rect = new Rectangle2D.Double();
+        Point2D p1 = toMapPoint((int) r.getX(), (int) r.getY());
+        Point2D p2 = toMapPoint((int) r.getMaxX(), (int) r.getMaxY());
+        rect.setFrameFromDiagonal(p1, p2);
+        return rect;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the distance <code>d</code>, that is in <i>screen
+     * coordinates</i> to <i>map coordinates</i> using the transformation affine
+     * information in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param d
+     *            distance in pixels
+     * 
+     * @return distance equivalent in <i>map coordinates</i>
+     * 
+     * @see #fromMapDistance(double)
+     * @see AffineTransform
+     */
+    public double toMapDistance(int d) {
+        double dist = d / trans.getScaleX();
+
+        return dist;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point argument, that is in <i>screen
+     * coordinates</i> (pixels) to <i>map coordinates</i> using the inverse
+     * affine transformation of the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param pScreen
+     *            the 2D point in <i>screen coordinates</i> (pixels)
+     * 
+     * @return 2D point equivalent in <i>map coordinates</i>
+     * 
+     * @see #toMapPoint(int, int)
+     * @see AffineTransform#createInverse()
+     * @see AffineTransform#transform(Point2D, Point2D)
+     * @deprecated use {@link #convertToMapPoint(Point2D)}
+     */
+    public Point2D toMapPoint(Point2D pScreen) {
+        Point2D.Double pWorld = new Point2D.Double();
+        AffineTransform at;
+
+        try {
+            at = trans.createInverse();
+            at.transform(pScreen, pWorld);
+        } catch (NoninvertibleTransformException e) {
+            throw new RuntimeException("Non invertible transform Exception", e);
+        }
+
+        return pWorld;
+    }
+
+    public Point convertToMapPoint(Point2D pScreen) {
+    	Point2D p = toMapPoint(pScreen);
+		try {
+			return geomManager.createPoint(
+				p.getX(), 
+				p.getY(), 
+				Geometry.SUBTYPES.GEOM2D
+			);
+		} catch (CreateGeometryException e) {
+			// FIXME: Use a most especific exception.
+			throw new RuntimeException(e);
+		}
+    }
+    
+    public Point convertToMapPoint(int x, int y) {
+        Point2D pScreen = new Point2D.Double(x, y);
+
+        return convertToMapPoint(pScreen);
+    }
+
+    
+    /**
+     * <p>
+     * Returns the real distance (in <i>world coordinates</i>) at the graphic
+     * layers of two 2D points (in <i>map coordinates</i>) of the plane where is
+     * selected the <i>extent</i>.
+     * </p>
+     * <p>
+     * If the projection of this view is UTM, considers the Earth curvature.
+     * </p>
+     * 
+     * @param pt1
+     *            a 2D point in <i>map coordinates</i>
+     * @param pt2
+     *            another 2D point in <i>map coordinates</i>
+     * 
+     * @return the distance in meters between the two points 2D
+     * 
+     * @see GeoCalcImpl#distanceVincenty(Point2D, Point2D)
+     */
+    public double distanceWorld(Point2D pt1, Point2D pt2) {
+        double dist = -1;
+        dist = pt1.distance(pt2);
+
+        if ((proj != null) && !(proj instanceof UTM)) {
+            dist =
+                new GeoCalc(proj).distanceVincenty(proj.toGeo(pt1),
+                    proj.toGeo(pt2));
+            return dist;
+        }
+        return (dist * MapContext.getDistanceTrans2Meter()[getMapUnits()]);
+    }
+
+    /**
+     * <p>
+     * Sets as extent and adjusted extent of this view port, the previous.
+     * Recalculating its parameters.
+     * </p>
+     * 
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     * @deprecated use {@link ViewPort#setPreviousEnvelope()}
+     */
+    public void setPreviousExtent() {
+        setPreviousEnvelope();
+    }
+
+    /**
+     * <p>
+     * Sets as envelope and adjusted envelope of this view port, the previous.
+     * Recalculating its parameters.
+     * </p>
+     * 
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     */
+    public void setPreviousEnvelope() {
+        this.updateDrawVersion();
+        extent = extents.removePrev();
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Gets the area selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom
+     * out</i> tools, but also zooming to a selected feature or shape) the
+     * extent that covers that area is the value returned by this method. It is
+     * not the actual area shown because it doesn't care about the aspect ratio
+     * of the image size of the view. However, any part of the real world
+     * contained in this extent is shown in the view.
+     * </p>
+     * 
+     * <p>
+     * If you are looking for the complete extent currently shown, you must use
+     * the {@linkplain #getAdjustedExtent()} method.
+     * </p>
+     * 
+     * @return the current extent
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #getAdjustedExtent()
+     * @see #setPreviousExtent()
+     * @see #getExtents()
+     * 
+     * @deprecated use {@link ViewPort#getEnvelope()}
+     */
+    public Rectangle2D getExtent() {
+        return extent;
+    }
+
+    /**
+     * <p>
+     * Gets the envelope selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom
+     * out</i> tools, but also zooming to a selected feature or shape) the
+     * envelope that covers that area is the value returned by this method. It
+     * is not the actual envelope shown because it doesn't care about the aspect
+     * ratio of the image size of the view. However, any part of the real world
+     * contained in this envelope is shown in the view.
+     * </p>
+     * 
+     * <p>
+     * If you are looking for the complete extent currently shown, you must use
+     * the {@linkplain #getAdjustedEnvelope()} method.
+     * </p>
+     * 
+     * @return the current envelope
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #getAdjustedEnvelope()
+     * @see #setPreviousEnvelope()
+     * @see #getEnvelopes()
+     */
+    public Envelope getEnvelope() {
+        if (this.extent == null) {
+            return null;
+        }
+        try {
+            return geomManager.createEnvelope(extent.getMinX(),
+                extent.getMinY(),
+                extent.getMaxX(),
+                extent.getMaxY(),
+                SUBTYPES.GEOM2D);
+            // This class has to use Envelope instead of Rectangle2D. This catch
+            // will disappear
+        } catch (CreateEnvelopeException e) {
+            logger.error("Error creating the envelope");
+        }
+        return null;
+    }
+
+    /**
+     * <p>
+     * Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br>
+     * <ul>
+     * <li>Stores the previous extent.
+     * <li>Calculates the new extent using <code>r</code>:
+     * 
+     * <pre>
+     * extent =
+     *     new Rectangle2D.Double(r.getMinX() - 0.1,
+     *         r.getMinY() - 0.1,
+     *         r.getWidth() + 0.2,
+     *         r.getHeight() + 0.2);
+     * </pre>
+     * 
+     * <li>Executes {@linkplain #calculateAffineTransform()}: getting the new
+     * scale, adjusted extent, affine transformation between map and screen
+     * coordinates, the real world coordinates equivalent to 1 pixel, and the
+     * real world coordinates equivalent to 3 pixels.
+     * <li>Notifies all {@link ViewPortListener ViewPortListener} registered
+     * that the extent has changed.
+     * </ul>
+     * </p>
+     * 
+     * @param r
+     *            the new extent
+     * 
+     * @see #getExtent()
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     * @see #setPreviousExtent()
+     */
+    public void setEnvelope(Envelope r) {
+        Rectangle2D newExtent = null;
+        // Esto comprueba que el extent no es de anchura o altura = "0"
+        // y si es as� lo redimensiona.
+        if (r != null) {
+            if ((r.getMaximum(0) - r.getMinimum(0) == 0)
+                || (r.getMaximum(1) - r.getMinimum(1) == 0)) {
+                newExtent =
+                    new Rectangle2D.Double(r.getMinimum(0) - 0.1,
+                        r.getMinimum(1) - 0.1,
+                        r.getMaximum(0) - r.getMinimum(0) + 0.2,
+                        r.getMaximum(1) - r.getMinimum(1) + 0.2);
+            } else {
+                newExtent =
+                    new Rectangle2D.Double(r.getMinimum(0),
+                        r.getMinimum(1),
+                        Math.abs(r.getMaximum(0) - r.getMinimum(0)),
+                        Math.abs(r.getMaximum(1) - r.getMinimum(1)));
+            }
+        }
+
+        if (this.extent != null && this.extent.equals(newExtent)) {
+            return;
+        }
+        if (extent != null) {
+            extents.put(extent);
+        }
+        this.updateDrawVersion();
+        this.extent = newExtent;
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br>
+     * <ul>
+     * <li>Executes {@linkplain #calculateAffineTransform()}: getting the new
+     * scale, adjusted extent, affine transformation between map and screen
+     * coordinates, the real world coordinates equivalent to 1 pixel, and the
+     * real world coordinates equivalent to 3 pixels.
+     * <li>Notifies to all {@link ViewPortListener ViewPortListener} registered
+     * that the extent has changed.
+     * </ul>
+     * </p>
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #calculateAffineTransform()
+     */
+    public void refreshExtent() {
+        // this.scale = scale;
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Calculates and returns using the current projection of this view port,
+     * the scale that is the extent in <i>screen coordinates</i> from the image
+     * in <i>map coordinates</i>.
+     * </p>
+     * 
+     * @return the scale <i>extent / image size</i> projected by this view port
+     * 
+     * @deprecated since 07/09/07, use {@linkplain MapContext#getScaleView()}
+     */
+    public double getScale() {
+        return proj.getScale(extent.getMinX(),
+            extent.getMaxX(),
+            imageSize.width,
+            dpi);
+    }
+
+    /**
+     * <p>
+     * Affine transformation between <i>map 2D coordinates</i> to <i>screen 2D
+     * coordinates</i> (pixels), preserving the "straightness" and "parallelism"
+     * of the lines.
+     * </p>
+     * 
+     * @return the affine transformation
+     * 
+     * @see #setAffineTransform(AffineTransform)
+     * @see #calculateAffineTransform()
+     */
+    public AffineTransform getAffineTransform() {
+        return trans;
+    }
+
+    /**
+     * <p>
+     * Returns the size of the image projected.
+     * </p>
+     * 
+     * @return the image size
+     * 
+     * @see #setImageSize(Dimension)
+     * @see #getImageHeight()
+     * @see #getImageWidth()
+     */
+    public Dimension getImageSize() {
+        return imageSize;
+    }
+
+    /**
+     * <p>
+     * Sets the size of the image projected, recalculating the parameters of
+     * this view port.
+     * </p>
+     * 
+     * @param imageSize
+     *            the image size
+     * 
+     * @see #getImageSize()
+     * @see #calculateAffineTransform()
+     */
+    public void setImageSize(Dimension imageSize) {
+
+        if (this.imageSize == null || (!this.imageSize.equals(imageSize))) {
+            this.updateDrawVersion();
+            this.imageSize = imageSize;
+            calculateAffineTransform();
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the adjusted extent
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param newRect
+     *            the new adjusted extend
+     * 
+     * @see #refreshExtent()
+     * @see #setEnvelope(Envelope)
+     * @see #setPreviousExtent()
+     * @see ExtentEvent
+     * @see ViewPortListener
+     */
+    protected void callExtentChanged(Envelope newRect) {
+        ExtentEvent ev = ExtentEvent.createExtentEvent(newRect);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.extentChanged(ev);
+        }
+    }
+    
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the time
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param newTime
+     *            the new time
+     * 
+     * @see #refreshExtent()
+     * @see #setTime(Time)   
+     * @see ExtentEvent
+     * @see ViewPortListener
+     */
+    protected void callTimeChanged(Time newTime) {
+        ExtentEvent viewPortEvent = new ExtentEvent(newTime);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.extentChanged(viewPortEvent);
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the background color
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param c
+     *            the new background color
+     * 
+     * @see #setBackColor(Color)
+     * @see ColorEvent
+     * @see ViewPortListener
+     */
+    private void callColorChanged(Color c) {
+        ColorEvent ce = ColorEvent.createColorEvent(c);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.backColorChanged(ce);
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the projection of
+     * this view port has changed.
+     * </p>
+     * 
+     * @param projection
+     *            the new projection
+     * 
+     * @see #setProjection(IProjection)
+     * @see ProjectionEvent
+     * @see ViewPortListener
+     */
+    private void callProjectionChanged(IProjection projection) {
+        ProjectionEvent ev = ProjectionEvent.createProjectionEvent(projection);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.projectionChanged(ev);
+        }
+    }
+
+    /**
+     * <p>
+     * Calculates the affine transformation between the {@link #extent extent}
+     * in <i>map 2D coordinates</i> to the image area in the screen, in
+     * <i>screen 2D coordinates</i> (pixels).
+     * </p>
+     * 
+     * <p>
+     * This process recalculates some parameters of this view port:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustedExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getAffineTransform()
+     * @see #setAffineTransform(AffineTransform)
+     * @see #refreshExtent()
+     * @see #setEnvelope(Envelope)
+     * @see #setImageSize(Dimension)
+     * @see #setPreviousExtent()
+     * @see #createFromXML(XMLEntity)
+     * @see AffineTransform
+     */
+    private void calculateAffineTransform() {
+        if ((imageSize == null) || (extent == null) || (imageSize.width <= 0)
+            || (imageSize.height <= 0)) {
+            return;
+        }
+
+        AffineTransform escalado = new AffineTransform();
+        AffineTransform translacion = new AffineTransform();
+
+        double escalaX;
+        double escalaY;
+
+        escalaX = imageSize.width / extent.getWidth();
+        escalaY = imageSize.height / extent.getHeight();
+
+        double xCenter = extent.getCenterX();
+        double yCenter = extent.getCenterY();
+        double newHeight;
+        double newWidth;
+
+        adjustedExtent = new Rectangle2D.Double();
+
+        if (adjustableExtent) {
+            if (escalaX < escalaY) {
+                scale = escalaX;
+                newHeight = imageSize.height / scale;
+                adjustedExtent.setRect(xCenter - (extent.getWidth() / 2.0),
+                    yCenter - (newHeight / 2.0),
+                    extent.getWidth(),
+                    newHeight);
+            } else {
+                scale = escalaY;
+                newWidth = imageSize.width / scale;
+                adjustedExtent.setRect(xCenter - (newWidth / 2.0), yCenter
+                    - (extent.getHeight() / 2.0), newWidth, extent.getHeight());
+            }
+            escalado.setToScale(scale, -scale);
+        } else { // adjusted is same as extent
+            scale = escalaX;
+            adjustedExtent.setFrame(extent);
+            escalado.setToScale(escalaX, -escalaY);
+        }
+        Envelope env = getAdjustedExtent();
+        if (env == null) {
+            return;
+        }
+        translacion.setToTranslation(-env.getMinimum(0), -env.getMinimum(1)
+            - getAdjustedExtent().getLength(1));
+
+        AffineTransform offsetTrans = new AffineTransform();
+        offsetTrans.setToTranslation(offset.getX(), offset.getY());
+
+        trans.setToIdentity();
+        trans.concatenate(offsetTrans);
+        trans.concatenate(escalado);
+
+        trans.concatenate(translacion);
+
+        // Calculamos las distancias de 1 pixel y 3 pixel con esa
+        // transformaci�n
+        // de coordenadas, de forma que est�n precalculadas para cuando las
+        // necesitemos
+        AffineTransform at;
+
+        try {
+            at = trans.createInverse();
+
+            Point2D pPixel = new Point2D.Float(1, 1);
+
+            Point2D.Float pProv = new Point2D.Float();
+            at.deltaTransform(pPixel, pProv);
+
+            dist1pixel = pProv.x;
+            dist3pixel = 3 * pProv.x;
+        } catch (NoninvertibleTransformException e) {
+            System.err.println("transformada afin = " + trans.toString());
+            System.err.println("extent = " + extent.toString() + " imageSize= "
+                + imageSize.toString());
+            throw new RuntimeException("Non invertible transform Exception", e);
+        }
+    }
+
+    /**
+     * <p>
+     * Sets the offset.
+     * </p>
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * 
+     * @param p
+     *            2D point that represents the offset in pixels
+     * 
+     * @see #getOffset()
+     */
+    public void setOffset(Point2D p) {
+        if (!offset.equals(p)) {
+            this.updateDrawVersion();
+            offset = p;
+        }
+    }
+
+    /**
+     * <p>
+     * Gets the offset.
+     * </p>
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * 
+     * @return 2D point that represents the offset in pixels
+     * 
+     * @see #setOffset(Point2D)
+     */
+    public Point2D getOffset() {
+        return offset;
+    }
+
+    /**
+     * <p>
+     * Sets the background color.
+     * </p>
+     * 
+     * @param c
+     *            the new background color
+     * 
+     * @see #getBackColor()
+     */
+    public void setBackColor(Color c) {
+        if (!c.equals(this.backColor)) {
+            this.updateDrawVersion();
+            backColor = c;
+            callColorChanged(backColor);
+        }
+    }
+
+    /**
+     * <p>
+     * Gets the background color.
+     * </p>
+     * 
+     * @return the background color of the view
+     * 
+     * @see #setBackColor(Color)
+     */
+    public Color getBackColor() {
+        return backColor;
+    }
+
+    /**
+     * <p>
+     * Returns the extent currently covered by the view adjusted (scaled) to the
+     * image size aspect.
+     * </p>
+     * 
+     * @return extent of the view adjusted to the image size aspect
+     * 
+     * @see #setAdjustable(boolean)
+     * @deprecated use {@link ViewPort#getAdjustedEnvelope()} instead
+     */
+    public Envelope getAdjustedExtent() {
+        return getAdjustedEnvelope();
+    }
+
+    /**
+     * <p>
+     * Returns the envelope currently covered by the view adjusted (scaled) to
+     * the image size aspect.
+     * </p>
+     * 
+     * @return envelope of the view adjusted to the image size aspect
+     * 
+     * @see #setAdjustable(boolean)
+     */
+    public Envelope getAdjustedEnvelope() {
+        if (cliprect != null) {
+            Rectangle2D r = adjustedExtent.createIntersection(cliprect);
+            try {
+                return geomManager.createEnvelope(r.getX(),
+                    r.getY(),
+                    r.getMaxX(),
+                    r.getMaxY(),
+                    SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        if (adjustedExtent != null) {
+            try {
+                return geomManager.createEnvelope(adjustedExtent.getX(),
+                    adjustedExtent.getY(),
+                    adjustedExtent.getMaxX(),
+                    adjustedExtent.getMaxY(),
+                    SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * <p>
+     * Returns the measurement unit of this view port used for measuring
+     * distances and displaying information.
+     * </p>
+     * 
+     * @return the measurement unit of this view used for measuring distances
+     *         and displaying information
+     * 
+     * @see #setDistanceUnits(int)
+     */
+    public int getDistanceUnits() {
+        return distanceUnits;
+    }
+
+    /**
+     * <p>
+     * Returns the measurement unit of this view port used for measuring areas
+     * and displaying information.
+     * </p>
+     * 
+     * @return the measurement unit of this view used for measuring areas and
+     *         displaying information
+     * 
+     * @see #setDistanceUnits(int)
+     */
+    public int getDistanceArea() {
+        return distanceArea;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit of this view port used for measuring distances
+     * and displaying information.
+     * </p>
+     * 
+     * @param distanceUnits
+     *            the measurement unit of this view used for measuring distances
+     *            and displaying information
+     * 
+     * @see #getDistanceUnits()
+     */
+    public void setDistanceUnits(int distanceUnits) {
+        this.distanceUnits = distanceUnits;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit of this view port used for measuring areas and
+     * displaying information.
+     * </p>
+     * 
+     * @param distanceUnits
+     *            the measurement unit of this view used for measuring areas and
+     *            displaying information
+     * 
+     * @see #getDistanceUnits()
+     */
+    public void setDistanceArea(int distanceArea) {
+        this.distanceArea = distanceArea;
+    }
+
+    /**
+     * <p>
+     * Gets the measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @return Returns the current map measure unit
+     * 
+     * @see #setMapUnits(int)
+     */
+    public int getMapUnits() {
+        return mapUnits;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @param mapUnits
+     *            the new map measure unit
+     * 
+     * @see #getMapUnits()
+     */
+    public void setMapUnits(int mapUnits) {
+        this.mapUnits = mapUnits;
+    }
+
+    /**
+     * <p>
+     * Gets the width in <i>screen coordinates</i> of the rectangle where the
+     * image is displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageHeight()
+     * @see #getImageSize()
+     * @see #setImageSize(Dimension)
+     */
+    public int getImageWidth() {
+        return imageSize.width;
+    }
+
+    /**
+     * <p>
+     * Gets the height in <i>screen coordinates</i> of the rectangle where the
+     * image is displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageWidth()
+     * @see #getImageSize()
+     * @see #setImageSize(Dimension)
+     */
+    public int getImageHeight() {
+        return imageSize.height;
+    }
+
+    /**
+     * <p>
+     * Gets the distance in <i>world coordinates</i> equivalent to 1 pixel in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @return the distance
+     * 
+     * @see #setDist1pixel(double)
+     */
+    public double getDist1pixel() {
+        return dist1pixel;
+    }
+
+    /**
+     * <p>
+     * Sets the distance in <i>world coordinates</i> equivalent to 1 pixel in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @param dist1pixel
+     *            the distance
+     * 
+     * @see #getDist1pixel()
+     */
+    public void setDist1pixel(double dist1pixel) {
+        if (dist1pixel == this.dist1pixel) {
+            return;
+        }
+        this.updateDrawVersion();
+        this.dist1pixel = dist1pixel;
+    }
+
+    /**
+     * <p>
+     * Gets the distance in <i>world coordinates</i> equivalent to 3 pixels in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @return the distance
+     * 
+     * @see #setDist3pixel(double)
+     */
+    public double getDist3pixel() {
+        return dist3pixel;
+    }
+
+    /**
+     * <p>
+     * Sets the distance in <i>world coordinates</i> equivalent to 3 pixels in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @param dist3pixel
+     *            the distance
+     * 
+     * @see #getDist3pixel()
+     */
+    public void setDist3pixel(double dist3pixel) {
+        if (this.dist3pixel == dist3pixel) {
+            return;
+        }
+        this.updateDrawVersion();
+        this.dist3pixel = dist3pixel;
+    }
+
+    /**
+     * <p>
+     * Returns the last previous extents of this view port.
+     * </p>
+     * 
+     * @return the last previous extents of this view port
+     * 
+     * @see #setPreviousExtent()
+     * @deprecated use {@link ViewPort#getEnvelopes()}
+     */
+    public ExtentHistory getExtents() {
+        return getEnvelopes();
+    }
+
+    /**
+     * <p>
+     * Returns the last previous extents of this view port.
+     * </p>
+     * 
+     * @return the last previous extents of this view port
+     * 
+     * @see #setPreviousExtent()
+     */
+    public ExtentHistory getEnvelopes() {
+        return extents;
+    }
+
+    /**
+     * <p>
+     * Gets the projection used in this view port.
+     * </p>
+     * 
+     * @return projection used in this view port
+     * 
+     * @see #setProjection(IProjection)
+     */
+    public IProjection getProjection() {
+        return proj;
+    }
+
+    /**
+     * <p>
+     * Sets the projection to this view port.
+     * </p>
+     * 
+     * @param proj
+     *            the new projection
+     * 
+     * @see #getProjection()
+     */
+    public void setProjection(IProjection proj) {
+        if (this.proj == null || !this.proj.getAbrev().equals(proj.getAbrev())) {
+            this.updateDrawVersion();
+            this.proj = proj;
+            callProjectionChanged(proj);
+        }
+    }
+
+    // -----------------------------------------------------------------------------------------------------------
+    // NOTA PARA DESARROLLADORES SOBRE EL M�TODO
+    // "public void setAffineTransform(AffineTransform at)"
+    // ==============================================================================================
+    // Only used for print, should be removed, redefining the {@link
+    // RasterAdapter RasterAdapter} interface,
+    // allowing it to receive a {@link ViewPortData ViewPortData} .
+    // -----------------------------------------------------------------------------------------------------------
+
+    /**
+     * <p>
+     * Sets only the affine transform to this view port, without updating
+     * dependent attributes.
+     * </p>
+     * <p>
+     * <b><i>This method could be problematic!</i></b>
+     * </p>
+     * 
+     * @param at
+     *            the affine transform to set
+     * 
+     * @see #getAffineTransform()
+     * @see #calculateAffineTransform()
+     */
+    public void setAffineTransform(AffineTransform at) {
+        this.trans = at;
+    }
+
+    /**
+     * <p>
+     * Returns an XML entity that represents this view port instance:<br>
+     * <ul>
+     * <li>Properties:
+     * <ul>
+     * <li><i>className</i>: name of this class.
+     * <li>If defined, the adjusted extent:
+     * <ul>
+     * <li><i>adjustedExtentX</i>: X coordinate of the adjusted extent.
+     * <li><i>adjustedExtentY</i>: Y coordinate of the adjusted extent.
+     * <li><i>adjustedExtentW</i>: width of the adjusted extent.
+     * <li><i>adjustedExtentH</i>: height of the adjusted extent.
+     * </ul>
+     * <li>If defined, the background color:
+     * <ul>
+     * <li><i>backColor</i>: background color.
+     * </ul>
+     * <li>If defined, the clip:
+     * <ul>
+     * <li><i>clipX</i>: X coordinate of the clip.
+     * <li><i>clipY</i>: Y coordinate of clip.
+     * <li><i>clipW</i>: width of the clip.
+     * <li><i>clipH</i>: height of the clip.
+     * </ul>
+     * <li><i>dist1pixel</i>: the distance in world coordinates equivalent to 1
+     * pixel in the view.
+     * <li><i>dist3pixel</i>: the distance in world coordinates equivalent to 3
+     * pixels in the view.
+     * <li><i>distanceUnits</i>: the distance measurement unit.
+     * <li>If defined, the extent:
+     * <ul>
+     * <li><i>extentX</i>: X coordinate of the extent.
+     * <li><i>extentY</i>: Y coordinate of the extent.
+     * <li><i>extentW</i>: width of the extent.
+     * <li><i>extentH</i>: height of the extent.
+     * </ul>
+     * <li><i>mapUnits</i>: the map measurement unit.
+     * <li><i>offsetX</i>: X coordinate of the offset.
+     * <li><i>offsetY</i>: Y coordinate of the offset.
+     * <li>If defined, the projection:
+     * <ul>
+     * <li>If its defined, the projection:
+     * <ul>
+     * <li><i>proj</i>: the projection.</li>
+     * </ul>
+     * </ul>
+     * <li><i>scale</i>: ratio between the size of <code>imageSize</code> and
+     * <code>extent</code>.
+     * </ul>
+     * <li>Child branches:
+     * <ul>
+     * <li>XML entity of the internal {@link ExtentHistory ExtentHistory} .
+     * </ul>
+     * </ul>
+     * 
+     * @return the XML entity
+     * 
+     * @see #createFromXML(XMLEntity)
+     */
+    public void saveToState(PersistentState state) throws PersistenceException {
+
+        state.set(FIELD_ADJUSTED_EXTENT, adjustedExtent);
+        state.set(FIELD_BACK_COLOR, backColor);
+        state.set(FIELD_CLIP, cliprect);
+        state.set(FIELD_DIST1PIXEL, dist1pixel);
+        state.set(FIELD_DIST3PIXEL, dist3pixel);
+        state.set(FIELD_DISTANCE_UNITS, distanceUnits);
+        state.set(FIELD_DISTANCE_AREA, distanceArea);
+
+        state.set(FIELD_EXTENT, extent);
+        state.set(FIELD_EXTENTS, extents);
+
+        state.set(FIELD_MAP_UNITS, mapUnits);
+        state.set(FIELD_OFFSET, offset);
+
+        state.set(FIELD_PROJ, proj);
+
+        state.set(FIELD_IMAGE_SIZE, imageSize);
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+
+        adjustedExtent = (Rectangle2D) state.get(FIELD_ADJUSTED_EXTENT);
+        backColor = (Color) state.get(FIELD_BACK_COLOR);
+        cliprect = (Rectangle2D) state.get(FIELD_CLIP);
+        dist1pixel = state.getDouble(FIELD_DIST1PIXEL);
+        dist3pixel = state.getDouble(FIELD_DIST3PIXEL);
+        distanceUnits = state.getInt(FIELD_DISTANCE_UNITS);
+        extents = (ExtentHistory) state.get(FIELD_EXTENTS);
+        extent = (Rectangle2D) state.get(FIELD_EXTENT);
+        mapUnits = state.getInt(FIELD_MAP_UNITS);
+        offset = (Point2D) state.get(FIELD_OFFSET);
+        proj = (IProjection) state.get(FIELD_PROJ);
+        imageSize = (Dimension) state.get(FIELD_IMAGE_SIZE);
+        distanceArea = state.getInt(FIELD_DISTANCE_AREA);
+
+        refreshExtent();
+    }
+
+	public static class RegisterPersistence implements Callable {
+
+		public Object call() throws Exception {
+			PersistenceManager manager = ToolsLocator.getPersistenceManager();
+			if( manager.getDefinition("ViewPort")==null ) {
+		        DynStruct definition =
+		            manager.addDefinition(ViewPort.class,
+		                "ViewPort",
+		                "ViewPort Persistence definition",
+		                null,
+		                null);
+
+		        definition.addDynFieldObject(FIELD_ADJUSTED_EXTENT)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_BACK_COLOR)
+		            .setClassOfValue(Color.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_CLIP)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldDouble(FIELD_DIST1PIXEL).setMandatory(true);
+
+		        definition.addDynFieldDouble(FIELD_DIST3PIXEL).setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_DISTANCE_UNITS).setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_DISTANCE_AREA).setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_EXTENT)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_EXTENTS)
+		            .setClassOfValue(ExtentHistory.class)
+		            .setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_MAP_UNITS).setMandatory(true);
+
+		        definition.addDynFieldObject(FIELD_OFFSET)
+		            .setClassOfValue(Point2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_PROJ)
+		            .setClassOfValue(IProjection.class)
+		            .setMandatory(true);
+
+		        definition.addDynFieldObject(FIELD_IMAGE_SIZE)
+		            .setClassOfValue(Dimension.class)
+		            .setMandatory(false);
+			}
+			return Boolean.TRUE;
+		}
+		
+	}
+
+	/**
+     * Clone the view port without clone the listeners nor the extent history.
+     * 
+     * @return the cloned view port
+     */
+    public Object clone() throws CloneNotSupportedException {
+
+        ViewPort clonedViewPort = (ViewPort) super.clone();
+        clonedViewPort.listeners = new ArrayList();
+        clonedViewPort.extents = new ExtentHistory();
+
+        if (this.adjustedExtent!=null){
+            clonedViewPort.adjustedExtent =
+                (Rectangle2D) this.adjustedExtent.clone();
+        }
+
+        if (this.cliprect!=null){
+            clonedViewPort.cliprect = (Rectangle2D) this.cliprect.clone();
+        }
+        
+        if (this.extent!=null) {
+            clonedViewPort.extent = (Rectangle2D) this.extent.clone();
+        }
+        if (this.imageSize!=null){
+            clonedViewPort.imageSize = (Dimension) this.imageSize.clone();
+        }
+        
+        if (this.offset!=null){
+            clonedViewPort.offset = (Point2D) this.offset.clone();
+        }
+        if (proj!=null){
+            clonedViewPort.proj = (IProjection) this.proj.clone();
+        }
+        
+        clonedViewPort.trans = (AffineTransform) this.trans.clone();
+
+        return clonedViewPort;
+    }
+
+    /**
+     * <p>
+     * Returns a <code>String</code> representation of the main values of this
+     * view port: <code>{@linkplain #extent}</code>,
+     * <code>{@linkplain #adjustedExtent}</code>,
+     * <code>{@linkplain #imageSize}</code>, <code>{@linkplain #scale}</code>,
+     * and <code>{@linkplain #trans}</code>.
+     * </p>
+     * 
+     * @return a <code>string</code> representation of the main values of this
+     *         view port
+     */
+    public String toString() {
+
+        String str;
+        str =
+            "Datos del viewPort:\nExtent=" + extent + "\nadjustedExtent="
+                + adjustedExtent + "\nimageSize=" + imageSize + "\nescale="
+                + scale + "\ntrans=" + trans;
+
+        return str;
+    }
+
+    /**
+     * <p>
+     * Sets the position and size of the clipping rectangle.
+     * </p>
+     * 
+     * @param rectView
+     *            the clipping rectangle to set
+     */
+    public void setClipRect(Rectangle2D rectView) {
+        this.updateDrawVersion();
+        cliprect = rectView;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the {@link Rectangle2D Rectangle2D}, that is in
+     * <i>map coordinates</i> to <i>screen coordinates</i> (pixels) using an
+     * <i>inverse transform</i> with the transformation affine information in
+     * the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param r
+     *            the 2D rectangle in <i>map coordinates</i>
+     * @return 2D rectangle equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #toMapRectangle(Rectangle2D)
+     * @see #fromMapDistance(double)
+     * @see #fromMapPoint(Point2D)
+     */
+    public Rectangle2D fromMapRectangle(Rectangle2D r) {
+        Rectangle2D rect = new Rectangle2D.Double();
+        Point2D p1 = fromMapPoint((int) r.getX(), (int) r.getY());
+        Point2D p2 = fromMapPoint((int) r.getMaxX(), (int) r.getMaxY());
+        rect.setFrameFromDiagonal(p1, p2);
+        return rect;
+    }
+
+    /**
+     * <p>
+     * Recalculates the current <code>{@linkplain #extent}</code> using an
+     * scale. It's necessary execute {@linkplain #refreshExtent()} after.
+     * </p>
+     * 
+     * @param s
+     *            the scale to set
+     * 
+     * @deprecated since 07/09/07, use
+     *             {@linkplain MapContext#setScaleView(long)}
+     */
+    public void setScale(long s) {
+        double x = extent.getX();
+        double y = extent.getY();
+        double escalaX = imageSize.width / extent.getWidth();
+        // double w = imageSize.width / s;
+        // double h = imageSize.height / s;
+        double difw = escalaX / s;
+
+        double x1 = (-x * difw) - x + extent.getWidth() / 2;
+        double y1 = (-y * difw) - y + extent.getHeight() / 2;
+        double w1 = extent.getWidth() * difw;
+        double h1 = extent.getHeight() * difw;
+        extent.setRect(-x1, -y1, w1, h1);
+    }
+
+    public long getDrawVersion() {
+        return this.drawVersion;
+    }
+
+    protected void updateDrawVersion() {
+        this.drawVersion++;
+    }
+
+    public Time getTime() {
+        return time;
+    }
+    
+    public void setTime(Time time) {
+        this.time = time;
+        this.updateDrawVersion();
+        callTimeChanged(time);
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 35988)
@@ -0,0 +1,1395 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.Messages;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerNotFoundInCollectionException;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitable;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.impl.MultiDynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * <p>Represents a generic collection of layers, that can be represented as a node in a tree of nodes of layers.</p>
+ *
+ * <p>Adapts the basic functionality implemented for a layer in the abstract class <code>FLyrDefault</code>, to
+ *  a collection of layers, implementing, as well, specific methods for this kind of object, defined in the
+ *  interfaces <code>VectorialData</code>, <code>LayerCollection</code>, and <code>InfoByPoint</code>.</p>
+ *
+ * @see FLyrDefault
+ */
+public class FLayers extends FLyrDefault implements LayerCollection,
+InfoByPoint {
+
+	
+	/**
+	 * List with all listeners registered for this kind of node.
+	 *
+	 * @see #addLayerCollectionListener(LayerCollectionListener)
+	 * @see #removeLayerCollectionListener(LayerCollectionListener)
+	 * @see #callLayerAdded(LayerCollectionEvent)
+	 * @see #callLayerAdding(LayerCollectionEvent)
+	 * @see #callLayerMoved(LayerPositionEvent)
+	 * @see #callLayerMoving(LayerPositionEvent)
+	 * @see #callLayerRemoved(LayerCollectionEvent)
+	 * @see #callLayerRemoving(LayerCollectionEvent)
+	 */
+	protected ArrayList layerCollectionListeners = null;
+
+	/**
+	 * A synchronized list with the layers.
+	 *
+	 * @see #setAllVisibles(boolean)
+	 * @see #addLayer(FLayer)
+	 * @see #addLayer(int, FLayer)
+	 * @see #moveTo(int, int)
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(int)
+	 * @see #removeLayer(String)
+	 * @see #replaceLayer(String, FLayer)
+	 * @see #getVisibles()
+	 * @see #getLayer(int)
+	 * @see #getLayer(String)
+	 * @see #getLayersCount()
+	 * @see #getFullEnvelope()
+	 */
+	protected List layers = null;
+
+	/**
+	 * The model of the layer.
+	 *
+	 * @see #getMapContext()
+	 */
+	protected MapContext fmap;
+
+	/**
+	 * Useful for debug the problems during the implementation.
+	 */
+	private static Logger logger = LoggerFactory.getLogger(FLayers.class);
+
+	public FLayers() {
+		super();
+		layerCollectionListeners = new ArrayList();
+		layers = Collections.synchronizedList(new ArrayList());
+		
+		logger = LoggerFactory.getLogger(FLayers.class);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
+	 */
+	public void addLayerCollectionListener(LayerCollectionListener listener) {
+		if (!layerCollectionListeners.contains(listener)) {
+			layerCollectionListeners.add(listener);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
+	 */
+	public void setAllVisibles(boolean visible) {
+		FLayer lyr;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+			lyr.setVisible(visible);
+
+			if (lyr instanceof LayerCollection) {
+				((LayerCollection) lyr).setAllVisibles(visible);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
+	 */
+	public void removeLayerCollectionListener(LayerCollectionListener listener) {
+		layerCollectionListeners.remove(listener);
+	}
+
+	/**
+	 * Adds a layer on an specified position in this node.
+	 *
+	 * @param pos position in the inner list where the layer will be added
+	 * @param layer a layer
+	 */
+	private void doAddLayer(int pos,FLayer layer) {
+		layers.add(pos,layer);
+		ToolsLocator.getDisposableManager().bind(layer);
+		layer.setParentLayer(this);
+		IProjection layerProj = layer.getProjection();
+		if(layerProj != null && fmap != null) {
+			IProjection mapContextProj = fmap.getProjection();
+			// TODO REVISAR ESTO !!!!
+			// Esta condici�n puede que no fuese exacta para todos los casos
+			if (!layerProj.getAbrev().equals(mapContextProj.getAbrev())) {
+				ICoordTrans ct = layerProj.getCT(mapContextProj);
+				layer.setCoordTrans(ct);
+			} else {
+				layer.setCoordTrans(null);
+			}
+		}
+		this.updateDrawVersion();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
+	 */
+	public void addLayer(FLayer layer) {
+		addLayer(layers.size(),layer);
+	}
+
+	/**
+	 * Adds a layer in an specified position in this node.
+	 *
+	 * @param layer a layer
+	 */
+	public void addLayer(int pos,FLayer layer) {
+		try {
+			//Notificamos a la capa que va a ser a�adida
+			if (layer instanceof FLyrDefault) {
+				((FLyrDefault)layer).wakeUp();
+			}
+
+			if (layer instanceof FLayers){
+				FLayers layers=(FLayers)layer;
+				fmap.addAsCollectionListener(layers);
+			}
+			callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
+
+			doAddLayer(pos,layer);
+
+			callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer));
+		} catch (CancelationException e) {
+			logger.warn(e.getMessage());
+		} catch (LoadLayerException e) {
+			layer.setAvailable(false);
+			layer.addError(e);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#moveTo(int, int)
+	 */
+	public void moveTo(int from, int to) throws CancelationException {
+		int newfrom=layers.size()-from-1;
+		int newto=layers.size()-to-1;
+		if ( newfrom < 0 || newfrom >=layers.size() || newto < 0 || newto >= layers.size()) {
+			return;
+		}
+		FLayer aux = (FLayer) layers.get(newfrom);
+		callLayerMoving(LayerPositionEvent.createLayerMovingEvent(aux, newfrom, newto));
+		layers.remove(newfrom);
+		layers.add(newto, aux);
+		this.updateDrawVersion();
+		callLayerMoved(LayerPositionEvent.createLayerMovedEvent(aux, newfrom, newto));
+	}
+
+	/**
+	 * Removes an inner layer.
+	 *
+	 * @param lyr a layer
+	 */
+	private void doRemoveLayer(FLayer lyr) {
+		layers.remove(lyr);
+		lyr.dispose();
+		this.updateDrawVersion();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
+	 */
+	public void removeLayer(FLayer lyr) throws CancelationException {
+		callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
+		doRemoveLayer(lyr);
+		callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(int)
+	 */
+	public void removeLayer(int idLayer) {
+		FLayer lyr = (FLayer) layers.get(idLayer);
+		callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
+		this.doRemoveLayer(lyr);
+//		layers.remove(idLayer);
+//		this.updateDrawVersion();
+		callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(java.lang.String)
+	 */
+	public void removeLayer(String layerName) {
+		FLayer lyr;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+
+			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+				removeLayer(i);
+
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Replace a layer identified by its name, by another.
+	 *
+	 * @param layerName the name of the layer to be replaced
+	 * @param layer the new layer
+	 */
+	public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException
+	{
+		FLayer lyr;
+		FLayer parent;
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+
+			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+				parent = lyr.getParentLayer();
+				removeLayer(i);
+				if (parent != null) {
+					//Notificamos a la capa que va a ser a�adida
+					if (layer instanceof FLyrDefault) {
+						((FLyrDefault)layer).wakeUp();
+					}
+				}
+
+				if (layer instanceof FLayers){
+					FLayers layers=(FLayers)layer;
+					fmap.addAsCollectionListener(layers);
+				}
+				callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
+
+//				layers.add(i,layer);
+//				layer.setParentLayer(this);
+				this.doAddLayer(i, layer);
+				
+				callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer));
+				break;
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getVisibles()
+	 */
+	public FLayer[] getVisibles() {
+		ArrayList array = new ArrayList();
+		LayersIterator iter = new LayersIterator(this) {
+			public boolean evaluate(FLayer layer) {
+				return layer.isVisible();
+			}
+
+		};
+
+		while (iter.hasNext()) {
+			array.add(iter.nextLayer());
+		}
+
+		return (FLayer[]) array.toArray(new FLayer[0]);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(int)
+	 */
+	public FLayer getLayer(int index) {
+		return (FLayer) layers.get(index);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(java.lang.String)
+	 */
+	public FLayer getLayer(String layerName) {
+		FLayer lyr;
+		FLayer lyr2;
+		ArrayList layerList;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+
+			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+				return lyr;
+			}
+
+			layerList = new ArrayList();
+			splitLayerGroup(lyr,layerList);
+			for(int j = 0; j<layerList.size(); j++ )
+			{
+				lyr2 = ((FLayer)layerList.get(j));
+				if (lyr2.getName().compareToIgnoreCase(layerName) == 0) {
+					return lyr2;
+				}
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * <p> Splits up a layer group in order to get a layer by name when there are layer groups</p>
+	 *
+	 * <p>In <code>result</code> always will be at least one layer.</p>
+	 *
+	 * @param layer the layer we are looking for
+	 * @param result an array list that will have the results of the search
+	 */
+	private void splitLayerGroup(FLayer layer, ArrayList result)
+	{
+		int i;
+		FLayers layerGroup;
+		if (layer instanceof FLayers)
+		{
+			layerGroup = (FLayers)layer;
+			for (i=0; i < layerGroup.getLayersCount(); i++ )
+			{
+				splitLayerGroup(layerGroup.getLayer(i),result);
+			}
+		}
+		else
+		{
+			result.add(layer);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayersCount()
+	 */
+	public int getLayersCount() {
+		return layers.size();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.utiles.swing.threads.Cancellable, double)
+	 */
+	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel, double scale) throws ReadException {
+		// FIXME Arreglar este error
+		throw new RuntimeException("Esto no deberia de llamarse");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
+	 * com.iver.cit.gvsig.fmap.ViewPort,
+	 * com.iver.utiles.swing.threads.Cancellable, double,
+	 * javax.print.attribute.PrintAttributes)
+	 */
+	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+			double scale, PrintAttributes properties)
+	throws ReadException {
+		throw new RuntimeException("No deberia pasar por aqui");
+	}
+
+	public void print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+			double scale, PrintAttributes properties)
+	throws ReadException {
+		this.print_old(g, viewPort, cancel, scale, properties, null);
+	}
+
+	/**
+	 * <p>Checks all layers (each one as a sub-node of this node <i>collection of layers</i>) of this collection and draws their requested properties. If a node is
+	 *  a group of layers (<code>ComposedLayer</code>), executes it's drawn.</p>
+	 *
+	 * <p>All nodes which could group with the composed layer <code>group</code>, will be drawn together. And once the <code>
+	 * group</code> is drawn, will be set to <code>null</code> if hasn't a parent layer.</p>
+	 *
+	 * <p>The particular implementation depends on the kind of each layer and composed layer. And this process can be cancelled at any
+	 *  time by the shared object <code>cancel</code>.</p>
+	 *
+	 * <p>According the print quality, labels will be printed in different resolution:
+	 *  <ul>
+	 *   <li><b>PrintQuality.DRAFT</b>: 72 dpi (dots per inch).</li>
+	 *   <li><b>PrintQuality.NORMAL</b>: 300 dpi (dots per inch).</li>
+	 *   <li><b>PrintQuality.HIGH</b>: 600 dpi (dots per inch).</li>
+	 *  </ul>
+	 * </p>
+	 *
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param viewPort the information for drawing the layers
+	 * @param cancel shared object that determines if this layer can continue being drawn
+	 * @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
+	 * @param properties properties that will be print
+	 * @param group a composed layer pending to paint; if this parameter is <code>null</code>, the composed layer
+	 *
+	 * @return <code>null</code> if the layers in <code>group</code> had been drawn or were <code>null</code>; otherwise, the <code>group</code>
+	 *
+	 * @see FLayer#print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
+	 *
+	 * @throws ReadDriverException if fails the driver reading the data.
+	 */
+	public ComposedLayer print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties, ComposedLayer group)
+	throws ReadException {
+		double dpi = 72;
+
+		int resolution = properties.getPrintQuality();
+		if (resolution == PrintAttributes.PRINT_QUALITY_NORMAL) {
+			dpi = 300;
+		} else if (resolution == PrintAttributes.PRINT_QUALITY_HIGH){
+			dpi = 600;
+		} else if (resolution == PrintAttributes.PRINT_QUALITY_DRAFT){
+			dpi = 72;
+		}
+
+		// TODO: A la hora de imprimir, isWithinScale falla, porque est�
+		// calculando la escala en pantalla, no para el layout.
+		// Revisar esto.
+
+		// TODO: We have to check when we have to call the drawLabels method when exists a ComposedLayer group.
+		for (int i=0; i < layers.size(); i++) {
+			FLayer lyr = (FLayer) layers.get(i);
+			if (!lyr.isVisible() || !lyr.isWithinScale(scale)) {
+				continue;
+			}
+
+			try{
+
+				///// CHEMA ComposedLayer
+				// Checks for draw group (ComposedLayer)
+				if (group != null) {
+					if (lyr instanceof FLayers){
+						group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
+					} else {
+						// If layer can be added to the group, does it
+						if (lyr instanceof ILabelable
+								&& ((ILabelable) lyr).isLabeled()
+								&& ((ILabelable) lyr).getLabelingStrategy() != null
+								&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+							group.add(lyr);
+						} else {
+							// draw the 'pending to draw' layer group
+							group.print(g,viewPort,cancel,scale,properties);
+
+							// gets a new group instance
+							if (lyr instanceof ILabelable
+									&& ((ILabelable) lyr).isLabeled()
+									&& ((ILabelable) lyr).getLabelingStrategy() != null
+									&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+								group = lyr.newComposedLayer();
+							} else {
+								group = null;
+							}
+							// if layer hasn't group, draws it inmediately
+							if (group == null) {
+								if (lyr instanceof FLayers){
+									group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
+								} else {
+									lyr.print(g, viewPort, cancel,scale,properties);
+									if (lyr instanceof ILabelable
+											&& ((ILabelable) lyr).isLabeled()
+											&& ((ILabelable) lyr).getLabelingStrategy() != null
+											&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+										ILabelable lLayer = (ILabelable) lyr;
+										lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
+									}
+								}
+							} else {
+								// add the layer to the group
+								group.setMapContext(fmap);
+								group.add(lyr);
+
+							}
+
+						}
+					}
+				} else {
+					// gets a new group instance
+					group = lyr.newComposedLayer();
+					// if layer hasn't group, draws it inmediately
+					if (group == null) {
+						if (lyr instanceof FLayers){
+							group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
+						} else {
+							lyr.print(g, viewPort, cancel,scale,properties);
+							if (lyr instanceof ILabelable && ((ILabelable) lyr).isLabeled()) {
+								ILabelable lLayer = (ILabelable) lyr;
+
+								lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
+							}
+						}
+					} else {
+						// add the layer to the group
+						group.setMapContext(fmap);
+						group.add(lyr);
+
+					}
+				}
+				///// CHEMA ComposedLayer
+
+			} catch (Exception e){
+				String mesg = Messages.getString("error_printing_layer")+" "+ lyr.getName() + ": " + e.getMessage();
+				fmap.addLayerError(mesg);
+				logger.error(mesg, e);
+			}
+
+		}
+
+		///// CHEMA ComposedLayer
+		if (group != null && this.getParentLayer() == null) {
+			//si tenemos un grupo pendiente de pintar, pintamos
+			group.print(g, viewPort, cancel,scale,properties);
+			group = null;
+
+		}
+		///// CHEMA ComposedLayer
+
+		//		if (getVirtualLayers() != null) {
+		//			getVirtualLayers().print( g, viewPort, cancel, scale, properties);
+		//		}
+
+		///// CHEMA ComposedLayer
+		return group;
+		///// CHEMA ComposedLayer
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
+	 */
+	public Envelope getFullEnvelope() {
+		Envelope rAux = null;
+		boolean first = true;
+
+
+		for (Iterator iter = layers.iterator(); iter.hasNext();) {
+			FLayer capa = (FLayer) iter.next();
+			try{
+				if (first) {
+					rAux = capa.getFullEnvelope();
+					first=false;
+				} else {
+					rAux.add(capa.getFullEnvelope());
+				}
+			}catch (Exception e) {
+				e.printStackTrace();//TODO hay que revisar para determinar el comportamiento que espera el usuario.
+			}
+		}
+
+		return rAux;
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that another layer is going to be added or replaced in the internal
+	 *  list of layers.
+	 *
+	 * @param e a layer collection event with the new layer
+	 */
+	protected void callLayerAdding(LayerCollectionEvent event)
+	throws CancelationException {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerAdding(event);
+		}
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that a layer is going to be removed from the internal list of layers.
+	 *
+	 * @param event a layer collection event with the layer being removed
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 */
+	protected void callLayerRemoving(LayerCollectionEvent event)
+	throws CancelationException {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerRemoving(event);
+		}
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that a layer is going to be moved in the internal list of layers.
+	 *
+	 * @param event a layer collection event with the layer being moved, and the initial and final positions
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 */
+	protected void callLayerMoving(LayerPositionEvent event)
+	throws CancelationException {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerMoving(event);
+		}
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that another layer has been added or replaced in the internal
+	 *  list of layers.
+	 *
+	 * @param e a layer collection event with the new layer
+	 */
+	protected void callLayerAdded(LayerCollectionEvent event) {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerAdded(event);
+		}
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that another layer has been removed from the internal list of layers.
+	 *
+	 * @param e a layer collection event with the layer removed
+	 */
+	protected void callLayerRemoved(LayerCollectionEvent event) {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerRemoved(event);
+		}
+	}
+
+	/**
+	 * Notifies all listeners associated to this collection of layers,
+	 *  that another layer has been moved in the internal list of layers.
+	 *
+	 * @param e a layer collection event with the layer moved, and the initial and final positions
+	 */
+	protected void callLayerMoved(LayerPositionEvent event) {
+		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+		for (Iterator iter = aux.iterator(); iter.hasNext();) {
+			((LayerCollectionListener) iter.next()).layerMoved(event);
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		super.saveToState(state);
+		
+		state.set("mapContext", fmap);
+		state.set("layers", layers);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+
+		super.loadFromState(state);
+
+		setMapContext((MapContext) state.get("mapContext"));
+		Iterator iter = state.getIterator("layers");
+		while (iter.hasNext()) {
+			FLayer item = (FLayer) iter.next();
+			layers.add(item); 
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMapContext()
+	 */
+	public MapContext getMapContext() {
+		return fmap;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setCoordTrans(org.cresques.cts.ICoordTrans)
+	 */
+	public void setCoordTrans(ICoordTrans ct) {
+		super.setCoordTrans(ct);
+
+		for (Iterator iter = layers.iterator(); iter.hasNext();) {
+			FLayer layer = (FLayer) iter.next();
+			layer.setCoordTrans(ct);
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllActives(boolean)
+	 */
+	public void setAllActives(boolean active) {
+		FLayer lyr;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+			lyr.setActive(active);
+
+			if (lyr instanceof LayerCollection) {
+				((LayerCollection) lyr).setAllActives(active);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getActives()
+	 */
+	public FLayer[] getActives() {
+		ArrayList ret = new ArrayList();
+		LayersIterator it = new LayersIterator(this) {
+
+			public boolean evaluate(FLayer layer) {
+				return layer.isActive();
+			}
+
+		};
+
+		while (it.hasNext())
+		{
+			ret.add(it.next());
+		}
+		return (FLayer[]) ret.toArray(new FLayer[0]);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMinScale()
+	 */
+	public double getMinScale() {
+		return -1; // La visibilidad o no la controla cada capa
+		// dentro de una colecci�n
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMaxScale()
+	 */
+	public double getMaxScale() {
+		return -1;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMinScale(double)
+	 */
+	public void setMinScale(double minScale)
+	{
+		for (Iterator iter = layers.iterator(); iter.hasNext();) {
+			FLayer lyr = (FLayer) iter.next();
+			lyr.setMinScale(minScale);
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMaxScale(double)
+	 */
+	public void setMaxScale(double maxScale)
+	{
+		for (Iterator iter = layers.iterator(); iter.hasNext();) {
+			FLayer lyr = (FLayer) iter.next();
+			lyr.setMinScale(maxScale);
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setActive(boolean)
+	 */
+	public void setActive(boolean b){
+		super.setActive(b);
+		for (int i=0;i<layers.size();i++){
+			((FLayer)layers.get(i)).setActive(b);
+		}
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+	 */
+	public boolean addLayerListener(LayerListener o) {
+		for (int i = 0; i < layers.size(); i++) {
+			((FLayer) layers.get(i)).addLayerListener(o);
+		}
+		return true;
+	}
+
+    public DynObjectSet getInfo(Point p, double tolerance,
+			Cancellable cancel) throws LoadLayerException, DataException {
+    	return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
+    }
+
+    public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel,
+        boolean fast) throws LoadLayerException, DataException {
+    	return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
+    }
+    
+    public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p,
+    		double tolerance) throws LoadLayerException, DataException {
+        int i;
+        FLayer layer;
+        List res = new ArrayList();
+        for (i = 0; i < this.layers.size(); i++) {
+            layer = (FLayer) layers.get(i);
+            if (layer instanceof InfoByPoint) {
+                InfoByPoint queryable_layer = (InfoByPoint) layer;
+                res.add(queryable_layer.getInfo(p, tolerance));
+            }
+        }
+        DynObjectSet[] innerSets =
+            (DynObjectSet[]) res.toArray(new DynObjectSet[res.size()]);
+        return new MultiDynObjectSet(innerSets);
+    }
+    
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getTocImageIcon()
+	 */
+	public String getTocImageIcon() {
+		return "toc-layer-group";
+	}
+
+	/**
+	 * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers. And
+	 *  returns <code>true</code> if there hasn't been errors.</p>
+	 *
+	 * @see CopyOfFLayers#addLayerFromXML(XMLEntity, String)
+	 *
+	 * @param xml tree-node structure with information about layers
+	 * @param name name of the layer to add
+	 * @return <code>true</code> if there were no errors adding the layer, <code>false</code> otherwise
+	 *
+	 * @throws LoadLayerException if fails loading this layer.
+	 */
+	//	public boolean addLayerFromXMLEntity(XMLEntity xml, String name) throws LoadLayerException {
+	//		fmap.clearErrors();
+	//		this.addLayerFromXML(xml,name);
+	//
+	//		return (fmap.getLayersError().size() == 0);
+	//
+	//	}
+
+//	/**
+//	 * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers.</p>
+//	 *
+//	 * <p>This method really executes the addition, considering the kind of layer (<code>FLyrVect</code>,
+//	 *  <code>FLyrAnnotation</code>, <code>FLyrRaster</code>, a collection of layers (<code>FLayers</code>),
+//	 *  or another kind of layer (<code>FLayer</code>)), and the driver in the layer.</p>
+//	 *
+//	 * @param xml tree-node structure with information about layers
+//	 * @param name name of the layer to add
+//	 *
+//	 * @throws LoadLayerException if fails loading this layer.
+//	 */
+//	private void addLayerFromXML(XMLEntity xml, String name) throws LoadLayerException {
+//		FLayer layer = null;
+//
+//		try {
+//			if (name == null) {
+//				name = xml.getName();
+//			}
+//
+//
+//			String className = xml.getStringProperty("className");
+//			Class clase = Class.forName(className);
+//			layer = (FLayer) clase.newInstance();
+//			if (FLayers.class.isAssignableFrom(clase)) {
+//				((FLayers)layer).setMapContext(getMapContext());
+//				((FLayers)layer).setParentLayer(this);
+//				//			layer = new FLayers(getMapContext(),this);
+//				layer.setXMLEntity(xml);
+//			} else {
+//				// Capas Nuevas (externas)
+//				layer.setName(name);
+//				layer.setXMLEntity(xml);
+//				layer.load();
+//			}
+//
+//			//		//TODO VCN FLyrAnnotation es un parche para no tener que duplicar todo el c�digo de aq� y de los diferentes m�todos de LayerFactory,
+//			//		//ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
+//			//		if (className.equals(FLyrVect.class.getName())){// || className.equals(FLyrAnnotation.class.getName())) {
+//			//			String type = xml.getStringProperty("type");
+//			//			if ("vectorial".equals(type)){
+//			//				//String recordsetName = xml.getChild(i).getStringProperty("recordset-name");
+//			//				IProjection proj = null;
+//			//				if (xml.contains("proj")) {
+//			//					proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
+//			//				}
+//			//				else
+//			//				{
+//			//					proj = this.getMapContext().getViewPort().getProjection();
+//			//				}
+//			//				if (xml.contains("file")) {
+//			//					Driver d;
+//			//					try {
+//			//						d = LayerFactory.getDM().getDriver(xml.getStringProperty("driverName"));
+//			//					} catch (DriverLoadException e1) {
+//			//						throw new DriverLayerException(name,e1);
+//			//					}
+//			//					layer = LayerFactory.createLayer(name, (VectorialFileDriver) d,
+//			//							new File(xml.getStringProperty("file")),
+//			//							proj);
+//			//
+//			//
+//			//				}
+//			//				if (xml.contains("db")) {
+//			//
+//			//					String driverName = xml.getStringProperty("db");
+//			//					IVectorialDatabaseDriver driver;
+//			//					try {
+//			//						driver = (IVectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName);
+//			//						//Hay que separar la carga de los datos del XMLEntity del load.
+//			//						driver.setXMLEntity(xml.getChild(2));
+//			//
+//			//						boolean loadOk = false;
+//			//						((DefaultJDBCDriver)driver).load();
+//			//						if (((DefaultJDBCDriver)driver).getConnection() != null) {
+//			//							loadOk = true;
+//			//						}
+//			//						layer = LayerFactory.createDBLayer(driver, name, proj);
+//			//						if (!loadOk) {
+//			//							layer.setAvailable(false);
+//			//						}
+//			//
+//			//					} catch (DriverLoadException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					} catch (XMLException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					} catch (ReadException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					}
+//			//
+//			//				}
+//			//				// Clases con algun driver gen�rico creado por otro
+//			//				// programador
+//			//				if (xml.contains("other")) {
+//			//
+//			//					String driverName = xml.getStringProperty("other");
+//			//					VectorialDriver driver = null;
+//			//					try {
+//			//						driver = (VectorialDriver) LayerFactory.getDM().getDriver(driverName);
+//			//					} catch (DriverLoadException e) {
+//			//						// Si no existe ese driver, no pasa nada.
+//			//						// Puede que el desarrollador no quiera que
+//			//						// aparezca en el cuadro de di�logo y ha metido
+//			//						// el jar con sus clases en nuestro directorio lib.
+//			//						// Intentamos cargar esa clase "a pelo".
+//			//						if (xml.getChild(2).contains("className"))
+//			//						{
+//			//							String className2 = xml.getChild(2).getStringProperty("className");
+//			//							try {
+//			//								driver = (VectorialDriver) Class.forName(className2).newInstance();
+//			//							} catch (Exception e1) {
+//			//								throw new DriverLayerException(name,e);
+//			//							}
+//			//						}
+//			//					} catch (NullPointerException npe) {
+//			//						// Si no existe ese driver, no pasa nada.
+//			//						// Puede que el desarrollador no quiera que
+//			//						// aparezca en el cuadro de di�logo y ha metido
+//			//						// el jar con sus clases en nuestro directorio lib.
+//			//						// Intentamos cargar esa clase "a pelo".
+//			//						if (xml.getChild(2).contains("className"))
+//			//						{
+//			//							String className2 = xml.getChild(2).getStringProperty("className");
+//			//							try {
+//			//								driver = (VectorialDriver) Class.forName(className2).newInstance();
+//			//							} catch (Exception e1) {
+//			//								throw new DriverLayerException(name,e1);
+//			//							}
+//			//						}
+//			//					}
+//			//					if (driver instanceof IPersistence)
+//			//					{
+//			//						IPersistence persist = (IPersistence) driver;
+//			//						persist.setXMLEntity(xml.getChild(2));
+//			//					}
+//			//					layer = LayerFactory.createLayer(name, driver, proj);
+//			//				}
+//			//
+//			//			}
+//			//
+//			//			//TODO VCN FLyrAnnotation es un parche para no tener que duplicar todo el c�digo de aq� y de los diferentes m�todos de LayerFactory,
+//			//			//ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
+//			//			if (className.equals(FLyrAnnotation.class.getName())){
+//			//				layer=FLyrAnnotation.createLayerFromVect((FLyrVect)layer);
+//			//			}
+//			//
+//			//
+//			//			layer.setXMLEntity(xml);
+//			//
+//			//		} else {
+//			//			Class clase = LayerFactory.getLayerClassForLayerClassName(className);
+//			//			layer = (FLayer) clase.newInstance();
+//			//			if (clase.isAssignableFrom(FLayers.class)) {
+//			//				((FLayers)layer).setMapContext(getMapContext());
+//			//				((FLayers)layer).setParentLayer(this);
+//			////				layer = new FLayers(getMapContext(),this);
+//			//				layer.setXMLEntity(xml);
+//			//			} else {
+//			//				// Capas Nuevas (externas)
+//			//				layer.setName(name);
+//			//				layer.setXMLEntity(xml);
+//			//				layer.load();
+//			//			}
+//			//		}
+//			this.addLayer(layer);
+//			logger.debug("layer: "+ layer.getName() +" loaded");
+//			// Comprobar que la proyecci�n es la misma que la de FMap
+//			// Si no lo es, es una capa que est� reproyectada al vuelo
+//			IProjection proj = layer.getProjection();
+//			if ((proj != null)) {
+//				if (!proj.getFullCode().equals(getMapContext().getProjection().getFullCode()))
+//				{
+//					ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+//					// TODO: REVISAR CON LUIS
+//					// Se lo fijamos a todas, luego cada una que se reproyecte
+//					// si puede, o que no haga nada
+//
+//					layer.setCoordTrans(ct);
+//				}
+//			}
+//		} catch (XMLException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (ClassNotFoundException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (InstantiationException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (IllegalAccessException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (LoadLayerException e){
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw e;
+//		}
+//	}
+
+	/**
+	 * <p>Sets the <code>MapContext</code> that contains this layer node.</p>
+	 *
+	 * @param mapContext the <code>MapContext</code> that contains this layer node
+	 */
+	public void setMapContext(MapContext mapContext) {
+		this.fmap = mapContext;
+	}
+
+//	/**
+//	 * <p>Creates a new layer of the same class as the property <i>className</i> of the XML, after, adds the XML entity to that layer
+//	 *  and loads the layer. Then, adds the layer to this collection of layers, and if there is a projection defined,
+//	 *  inserts the transformation coordinates to the layer.</p>
+//	 *
+//	 * <p>If the new layer is an instance of <code>FLyrVect</code>, and has a label field, creates a label layer on the layer.</p>
+//	 *
+//	 * @param xml tree-node structure with information about layers
+//	 * @param name name of the layer to add
+//	 */
+//	private void addLayerFromXMLNew(XMLEntity xml, String name) {
+//		//		FLayer layer = null;
+//		//
+//		//
+//		//		try {
+//		//			String className = xml.getStringProperty("className");
+//		//			Class clazz = Class.forName(className);
+//		//			if (clazz.isAssignableFrom(FLayers.class)) {
+//		//				layer = (FLayer) clazz.newInstance();
+//		//				((FLayers)layer).setMapContext(getMapContext());
+//		//				((FLayers)layer).setParentLayer(this);
+//		//	//		if (className.equals((FLayers.class.getName()))){
+//		//	//			layer = new FLayers(getMapContext(),this);
+//		//			} else {
+//		//	//			Por compatibilidad
+//		//				if (className.equals(FLyrVect.class.getName())) {
+//		//					if (xml.contains("file")) {
+//		//						layer = new FLayerFileVectorial();
+//		//					} else if (xml.contains("db")) {
+//		//						try {
+//		//							layer = (FLayer)((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create("com.iver.cit.gvsig.fmap.layers.FLayerJDBCVectorial");
+//		//						} catch (Exception e) {
+//		//							throw new XMLException(new Exception("No se tiene registrada la capa de tipo JDBC"));
+//		//						}
+//		//						//className = FLayerJDBCVectorial.class.getName();
+//		//					} else if (xml.contains("other")){
+//		//						layer = new FLayerGenericVectorial();
+//		//					} else {
+//		//						throw new XMLException(new Exception("Capa vectorial de tipo no reconocido"));
+//		//					}
+//		//	//				Fin por compatibilidad
+//		//				} else {
+//		//					try {
+//		//						layer = (FLayer)(((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create(className));
+//		//					} catch (Exception e) {
+//		//						//puende que no este registrada como punto de extension
+//		//						Class clase = Class.forName(className);
+//		//						layer = (FLayer) clase.newInstance();
+//		//						// FIXME: Hacemos algo aqui o dejamos que suba el error?
+//		//					}
+//		//				}
+//		//
+//		//			}
+//		//			layer.setXMLEntity(xml);
+//		//			if (name != null) layer.setName(name);
+//		//			layer.load();
+//		//
+//		//			this.addLayer(layer);
+//		//			logger.debug("layer: "+ layer.getName() +" loaded");
+//		//			// Comprobar que la proyecci�n es la misma que la de FMap
+//		//			// Si no lo es, es una capa que est� reproyectada al vuelo
+//		//			IProjection proj = layer.getProjection();
+//		//			if ((proj != null))
+//		//				if (proj != getMapContext().getProjection())
+//		//				{
+//		//					ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+//		//					// TODO: REVISAR CON LUIS
+//		//					// Se lo fijamos a todas, luego cada una que se reproyecte
+//		//					// si puede, o que no haga nada
+//		//					layer.setCoordTrans(ct);
+//		//
+//		//				}
+//		//		}catch (Exception e) {
+//		//			fmap.addLayerError(xml.getStringProperty("name"));
+//		//			logger.debug(Messages.getString("could_not_load_layer")+": "+xml.getStringProperty("name") + ".\n"
+//		//					+Messages.getString("reason")+":", e);
+//		//		}
+//	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		throw new NotSupportedOperationException(visitor, this);
+	}
+
+	public void accept(LayersVisitor visitor) throws BaseException {
+		for (int i = 0; i < this.getLayersCount(); i++) {
+			FLayer layer = this.getLayer(i);
+			if (layer instanceof LayersVisitable) {
+				((LayersVisitable) layer).accept(visitor);
+			} else {
+				visitor.visit(layer);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.metadata.Metadata#getMetadataID()
+	 */
+	public Object getMetadataID() throws MetadataException {
+		StringBuffer strb = new StringBuffer();
+		strb.append("Layers(");
+		strb.append(this.getName());
+		strb.append("):{");
+		Iterator iter = this.layers.iterator();
+		while (iter.hasNext()) {
+			strb.append(((FLayer) iter.next()).getMetadataID());
+			strb.append(",");
+		}
+		strb.append("}");
+		return strb.toString();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+	 */
+	public Set getMetadataChildren() {
+		Set ret = new TreeSet();
+		Iterator iter = this.layers.iterator();
+		while (iter.hasNext()) {
+			ret.add(iter.next());
+		}
+		return ret;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.metadata.Metadata#getMetadataName()
+	 */
+	public String getMetadataName() throws MetadataException {
+		StringBuffer strb = new StringBuffer();
+		strb.append("Layer Group '");
+		strb.append(this.getName());
+		strb.append("': {");
+		Iterator iter = this.layers.iterator();
+		while (iter.hasNext()) {
+			strb.append(((FLayer) iter.next()).getMetadataName());
+			strb.append(",");
+		}
+		strb.append("}");
+		return strb.toString();
+	}
+
+
+	public void beginDraw(Graphics2D g, ViewPort viewPort) {
+		LayerDrawEvent beforeEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_BEFORE_DRAW);
+		fmap.fireLayerDrawingEvent(beforeEvent);
+	}
+
+	public void endDraw(Graphics2D g, ViewPort viewPort) {
+		LayerDrawEvent afterEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
+		fmap.fireLayerDrawingEvent(afterEvent);
+	}
+
+	public static void registerPersistent() {
+		
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		if( manager.getDefinition(FLyrDefault.class) == null ) {
+			FLyrDefault.registerPersistent();
+		}
+		DynStruct definition = manager.addDefinition(
+				FLayers.class,
+				"FLayers",
+				"FLayers Persistence definition",
+				null, 
+				null
+		);
+		definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, "FLyrDefault");
+		
+		definition.addDynFieldObject("mapContext").setClassOfValue(MapContext.class).setMandatory(true);
+		definition.addDynFieldList("layers").setClassOfItems(FLayer.class).setMandatory(true);
+	}
+
+	protected void doDispose() throws BaseException {
+		if (layers != null) {
+			for (int i = 0; i < layers.size(); i++) {
+				dispose((Disposable) layers.get(i));
+			}
+		}
+	}
+	
+	public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException{
+
+			callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(layer));
+			group.addLayer(layer, where, adjoiningLayer);
+			removeLayer(layer);
+			this.updateDrawVersion();
+			callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(layer));
+
+	}
+
+	public void move(FLayer layer, LayerCollection group){
+		try {
+			move(layer, group, END, null);
+		} catch (LayerNotFoundInCollectionException e){
+			throw new MapContextRuntimeException(e);
+		}
+	}
+	
+	public void addLayer(FLayer layer, int where, FLayer adjoiningLayer)
+	throws LayerNotFoundInCollectionException {
+
+		switch (where) {
+		case BEGIN:
+			addLayer(0,layer);
+			break;
+		case BEFORE:
+			if (adjoiningLayer!=null){
+				if (this.layers.contains(adjoiningLayer)){
+					for(int i=0; i<this.getLayersCount(); i++){
+						if(adjoiningLayer==this.getLayer(i)){
+							addLayer(i, layer);
+							break;
+						}
+					}
+				} else {
+					throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
+				}
+			} else {
+				addLayer(0,layer);
+			}
+			break;
+		case AFTER:
+			if (adjoiningLayer!=null){
+				if (this.layers.contains(adjoiningLayer)){
+					for(int i=0; i<this.getLayersCount(); i++){
+						if(adjoiningLayer==this.getLayer(i)){
+							addLayer(i+1, layer);
+							break;
+						}
+					}
+				} else {
+					throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
+				}
+			} else {
+				this.addLayer(layer);
+			}
+			break;
+		default: // By default add layer an the end of the collection
+			this.addLayer(layer);
+			break;
+		}
+
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java	(revision 35988)
@@ -0,0 +1,89 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * Lanzada cuando se intenta realizar una operaci�n generalmente sobre una
+ * clase abstracta o interfaz y la implementaci�n de dicha clase abstracta o
+ * interfaz no soporta dicha  operaci�n. Ver la descripci�n del m�todo que la
+ * origin�
+ */
+public class OperationNotSupportedException extends Exception {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1057162354181561395L;
+
+	/**
+	 * Crea una nueva OperationNotSupportedException.
+	 */
+	public OperationNotSupportedException() {
+		super();
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param message
+	 */
+	public OperationNotSupportedException(String message) {
+		super(message);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param message
+	 * @param cause
+	 */
+	public OperationNotSupportedException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param cause
+	 */
+	public OperationNotSupportedException(Throwable cause) {
+		super(cause);
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.Contains;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class ContainsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public ContainsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Contains.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "contains with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " contains(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java	(revision 35988)
@@ -0,0 +1,221 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class ReprojectDefaultGeometry extends AbstractFeatureStoreTransform {
+
+	private IProjection targetSRS;
+	private ICoordTrans ct;
+	private IProjection sourceSRS;
+	private FeatureType orgDefFeatureType;
+	private List orgFeatureTypes;
+
+	public ReprojectDefaultGeometry() {
+		
+	}
+	
+	public IProjection getTargetSRS() {
+		return targetSRS;
+	}
+
+	public void setTargetSRS(IProjection targetSRS) {
+		this.targetSRS = targetSRS;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#applyTransform(org.gvsig.fmap.dal.feature.Feature, org.gvsig.fmap.dal.feature.EditableFeature)
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = target.getType().iterator();
+		int defGeomIndex = target.getType().getDefaultGeometryAttributeIndex();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor)iter.next();
+			if (attr.getIndex() == defGeomIndex) {
+				Geometry geom =source.getDefaultGeometry();
+				geom.reProject(ct);
+				target.setDefaultGeometry(geom);
+			} else {
+				target.set(attr.getIndex(), source.get(attr.getName()));
+			}
+
+		}
+
+	}
+
+	public void setFeatureStore(FeatureStore store) {
+		try {
+			orgDefFeatureType = store.getDefaultFeatureType();
+			orgFeatureTypes = store.getFeatureTypes();
+			EditableFeatureType defFType = orgDefFeatureType
+					.getEditable();
+			EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) defFType
+					.getAttributeDescriptor(defFType
+							.getDefaultGeometryAttributeName());
+			sourceSRS = attr.getSRS();
+			ct = sourceSRS.getCT(targetSRS);
+			attr.setSRS(this.targetSRS);
+			FeatureType defaultType = defFType.getNotEditableCopy();
+			List types = new ArrayList();
+			Iterator iter = orgFeatureTypes.iterator();
+			FeatureType tmp;
+			while (iter.hasNext()) {
+				tmp = (FeatureType) iter.next();
+				if (tmp.getId().equals(defaultType.getId())) {
+					types.add(defaultType);
+				} else {
+					types.add(tmp);
+				}
+			}
+
+			this.setFeatureTypes(types, defaultType);
+		} catch (DataException e) {
+			// FIXME
+			throw new RuntimeException(e);
+		}
+
+		super.setFeatureStore(store);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#getSourceFeatureTypeFrom(org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		EditableFeatureType result = null;
+		FeatureType tmp;
+		EditableFeatureAttributeDescriptor attr;
+		Iterator iter = orgFeatureTypes.iterator();
+		Iterator iterAttr;
+		while (iter.hasNext()) {
+			tmp = (FeatureType) iter.next();
+			if (tmp.getId().equals(targetFeatureType.getId())) {
+				result = tmp.getEditable();
+				iterAttr = result.iterator();
+				while (iterAttr.hasNext()) {
+					attr = (EditableFeatureAttributeDescriptor) iterAttr.next();
+					if (targetFeatureType.getIndex(attr.getName()) < 0) {
+						iterAttr.remove();
+					}
+				}
+				break;
+			}
+		}
+		return result.getNotEditableCopy();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#isTransformsOriginalValues()
+	 */
+	public boolean isTransformsOriginalValues() {
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#loadState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		
+		state.set("source_crs", this.sourceSRS);
+		state.set("source_defaultFeatureType", this.orgDefFeatureType);
+		state.set("source_featureTypes", this.orgFeatureTypes);
+		state.set("target_crs", this.targetSRS);
+		state.set("coordtrans", this.ct);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#loadFromState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		super.loadFromState(state);
+		this.sourceSRS = (IProjection) state.get("source_crs");
+		this.orgDefFeatureType = (FeatureType) state.get("source_defaultFeatureType");
+		this.orgFeatureTypes = new ArrayList( (List) state.get("source_featureTypes"));
+		this.targetSRS = (IProjection) state.get("target_crs");
+		this.ct = (ICoordTrans) state.get("coordtrans");
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ReprojectDefaultGeometry.class,
+				"ReprojectDefaultGeometry",
+				"ReprojectDefaultGeometry Persistence definition",
+				null, 
+				null
+		);
+		definition.extend( manager.getDefinition(AbstractFeatureStoreTransform.class));
+		
+		definition.addDynFieldObject("source_crs")
+			.setClassOfValue(IProjection.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("source_defaultFeatureType")
+			.setClassOfValue(FeatureType.class)
+			.setMandatory(true);
+		definition.addDynFieldList("source_featureTypes")
+			.setClassOfItems(FeatureType.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("target_crs")
+			.setClassOfValue(IProjection.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("coordtrans")
+			.setClassOfValue(ICoordTrans.class)
+			.setMandatory(true);
+
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.Crosses;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class CrossesGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public CrossesGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Crosses.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "crosses with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " crosses(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java	(revision 35988)
@@ -0,0 +1,243 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+package org.gvsig.fmap.mapcontext.layers.vectorial.impl;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.exception.BaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Default {@link GraphicLayer} implementation. 
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class DefaultGraphicLayer extends FLyrVect implements GraphicLayer{
+	private static final String DEFAULT = "default";
+	protected static final Logger logger = LoggerFactory.getLogger(DefaultGraphicLayer.class);
+	private static DataManager dataManager = DALLocator.getDataManager();
+	private IVectorialUniqueValueLegend legend = null;
+	
+	private FeatureStore store = null;
+	private long ids = 0;
+
+	private int symbolId = -1;
+
+	public DefaultGraphicLayer() {
+		super();	
+	}
+
+	public void initialize(IProjection projection) throws ValidateDataParametersException, DataException, LoadLayerException { 
+		store = dataManager.createMemoryStore(FEATURE_ATTR_PRIORITY);
+		store.edit();
+
+		EditableFeatureType editableFeatureType = store.getDefaultFeatureType().getEditable();
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_GROUPID, DataTypes.STRING);
+
+		EditableFeatureAttributeDescriptor geometryDescriptor = editableFeatureType.add(GraphicLayer.FEATURE_ATTR_GEOMETRY, DataTypes.GEOMETRY);
+		geometryDescriptor.setGeometryType(TYPES.GEOMETRY);
+		geometryDescriptor.setGeometrySubType(SUBTYPES.GEOM2D);
+		geometryDescriptor.setSRS(projection);
+		editableFeatureType.setDefaultGeometryAttributeName(GraphicLayer.FEATURE_ATTR_GEOMETRY);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_IDSYMBOL, DataTypes.INT);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_LABEL, DataTypes.STRING);
+
+		EditableFeatureAttributeDescriptor featureIdDescriptor = 
+			editableFeatureType.add(GraphicLayer.FEATURE_ATTR_FEATUREID, DataTypes.LONG);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_TAG, DataTypes.OBJECT);
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_PRIORITY, DataTypes.INT);
+		
+		featureIdDescriptor.setIsPrimaryKey(true);
+		editableFeatureType.setHasOID(true);
+
+		store.update(editableFeatureType);	
+
+		store.finishEditing();		
+
+		this.setDataStore(store);
+	}
+
+	public void addGraphic(String groupId, Geometry geom, int idsym) {
+		addGraphic(groupId, geom, idsym, null, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(Geometry geom, int idsym) {
+		addGraphic(DEFAULT, geom, idsym, null, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(Geometry geom, int idsym, String label) {
+		addGraphic(DEFAULT, geom, idsym, label, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(String groupId, Geometry geom, int idsym, String label) {
+		addGraphic(groupId, geom, idsym, label, null, DEFAULT_PRIORITY);
+	}
+	
+	public void addGraphic(String groupId, Geometry geom, int idsym, String label,
+			Object tag, int priority) {
+
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			EditableFeature feature = store.createNewFeature().getEditable();
+			feature.setString(GraphicLayer.FEATURE_ATTR_GROUPID, groupId);
+			feature.setGeometry(GraphicLayer.FEATURE_ATTR_GEOMETRY, geom);
+			feature.setInt(GraphicLayer.FEATURE_ATTR_IDSYMBOL, idsym);	
+			feature.setString(GraphicLayer.FEATURE_ATTR_LABEL, label);	
+			feature.setLong(GraphicLayer.FEATURE_ATTR_FEATUREID, ids);
+			feature.set(GraphicLayer.FEATURE_ATTR_TAG, tag);
+			feature.setInt(GraphicLayer.FEATURE_ATTR_PRIORITY, priority);
+
+			ids++;
+
+			store.insert(feature);
+			store.finishEditing();
+		} catch (DataException e) {
+			logger.error("Error adding a geometry to the graphic layer", e);
+		}
+	}	
+
+	public int addSymbol(ISymbol newSymbol) {
+		symbolId++;
+		legend.addSymbol(new Integer(symbolId), newSymbol);
+		return symbolId;
+	}
+
+	public ISymbol getSymbol(int symbolPos) {
+		return legend.getSymbolByValue(new Integer(symbolPos));		
+	}
+
+	public int getSymbolId(ISymbol symbol) {
+		Object key = legend.getSymbolKey(symbol);
+		return key == null ? -1 : ((Number) key).intValue();
+	}
+
+	public void clearAllGraphics() {
+		DisposableIterator iterator = null;
+		FeatureSet featureSet = null;
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			featureSet = store.getFeatureSet();
+			for (iterator = featureSet.fastIterator(); iterator.hasNext();) {
+				Feature feature = (Feature) iterator.next();
+				featureSet.delete(feature);
+			}
+			store.finishEditing();			
+		} catch (DataException e) {
+			logger.error("Error clearing all the geometry of the graphic layer", e);
+		} finally {
+			if (featureSet != null) {
+				featureSet.dispose();
+			}
+			if (iterator != null) {
+				iterator.dispose();
+			}
+		}
+	}
+
+	public int clearAllSymbols() {
+		legend.clear();
+		symbolId = -1;
+		return symbolId;
+	}
+
+	public void removeGraphics(String groupId) {
+		DisposableIterator iterator = null;
+		FeatureSet featureSet = null;
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			featureSet = store.getFeatureSet();
+			for (iterator = featureSet.fastIterator(); iterator.hasNext();) {
+				Feature feature = (Feature) iterator.next();
+				if (feature.get(FEATURE_ATTR_GROUPID).equals(groupId)) {
+					featureSet.delete(feature);
+				}
+			}
+			store.finishEditing();
+		} catch (DataException e) {
+			logger.error("Error clearing all the geometry of the graphic layer", e);
+		} finally {
+			if (featureSet != null) {
+				featureSet.dispose();
+			}
+			if (iterator != null) {
+				iterator.dispose();
+			}
+		}
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		if (store != null) {
+			store.dispose();
+			store = null;
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect#setLegend(org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend)
+	 */
+	public void setLegend(IVectorLegend legend) throws LegendLayerException {
+		if (legend instanceof IVectorialUniqueValueLegend){		
+			super.setLegend(legend);
+			this.legend = (IVectorialUniqueValueLegend)legend;
+			this.legend.setClassifyingFieldNames(new String[]{FEATURE_ATTR_IDSYMBOL});
+		}else{
+			logger.warn("The legend for the graphics layer must be a instance of IVectorialUniqueValueLegend");
+		}
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Disjoint;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class DisjointGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public DisjointGeometryEvaluator(Geometry geometry,
+			IProjection projection,
+			FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Disjoint.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "disjoint with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " disjoint(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Intersects;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class IntersectsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private String geometryWKT = null;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public IntersectsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Intersects.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "intersects with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " intersects(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java	(revision 35988)
@@ -0,0 +1,60 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class IntersectsTimeEvaluator extends AbstractEvaluator {
+    private Time time;
+    private String timeAttributeName;
+   
+    public IntersectsTimeEvaluator(Time time, String timeAttributeName) {
+        super();  
+        this.time = time;
+        this.timeAttributeName = timeAttributeName;
+        this.getFieldsInfo().addMatchFieldValue(timeAttributeName, time);
+    }
+
+    public Object evaluate(EvaluatorData data) throws EvaluatorException {
+        Feature feature = ((Feature) data.getContextValue("feature"));
+        return new Boolean(time.intersects((Time)feature.get(timeAttributeName)));       
+    }
+
+    public String getName() {       
+        return "intersets with time";
+    }
+
+    public String getSQL() {
+        // TODO add the time filter!!!
+        return super.getSQL();
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,91 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Equals;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class EqualsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private String geometryWKT = null;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public EqualsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Equals.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "equals with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " equals(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java	(revision 35988)
@@ -0,0 +1,165 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.layers.AbstractLinkProperties;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+
+/**
+ * This class extends AbstractLinkProperties and implements the method to get an array of URI
+ * using a point2D and a tolerance. This class extends AstractLinkProperties to add HyperLink
+ * to Vectorial Layer(FLyrVect)
+ * 
+ * @deprecated this functionality has extracted of the core form gvSIG 2.0 
+ */
+
+public class FLyrVectLinkProperties extends AbstractLinkProperties {
+
+    /**
+     * Default Constructor. Costructs a LinkProperties with the necessary information
+     *
+     */
+    public FLyrVectLinkProperties(){
+        setType(0);
+        setField(null);
+        setExt(null);
+    }
+
+    /**
+     * Constructor. Constructs a LinkProperties with the information that receives
+     * @param tipo
+     * @param fieldName
+     * @param extension
+     */
+    public FLyrVectLinkProperties(int tipo, String fieldName, String extension){
+        setType(tipo);
+        setField(fieldName);
+        setExt(extension);
+    }
+
+    /**
+     * Creates an array of URI. With the point and the tolerance makes a query to the layer
+     * and gets the geometries that contains the point with a certain error (tolerance).
+     * For each one of this geometries creates one URI and adds it to the array
+     * @param layer
+     * @param point
+     * @param tolerance
+     * @return Array of URI
+     * @throws ReadException
+     */
+    public URI[] getLink(FLayer layer, Point2D point, double tolerance) throws ReadException{
+    	//Sacado de la clase LinkListener
+		FLyrVect lyrVect = (FLyrVect) layer;
+		FeatureStore fStore = null;
+		FeatureSet fSet=null;
+		DisposableIterator iter = null;
+
+    	try {
+    		fStore = lyrVect.getFeatureStore();
+    		//URI uri[]=null;
+
+    		//Construimos el BitSet (V�ctor con componentes BOOLEAN) con la consulta que
+    		try {
+    			fSet = lyrVect.queryByPoint(point, tolerance, fStore.getDefaultFeatureType());//fStore.getFeatureSet(featureQuery);
+    		} catch (ReadException e) {
+    			return null;
+    		} catch (DataException e) {
+    			return null;
+			}
+
+    		//Si el bitset creado no est� vac�o creamos el vector de URLS correspondientes
+    		//a la consulta que hemos hecho.
+
+    		ArrayList tmpUris=new ArrayList();
+    		String auxext="";
+    		int idField = fStore.getDefaultFeatureType().getIndex(this.getField());
+
+
+
+
+    		//Consigo el identificador del campo pasandole como par�metro el
+    		//nombre del campo del �nlace
+    		if (idField == -1){
+        		throw new ReadException(lyrVect.getName()+": '"+this.getField()+"' not found",new Exception());
+    		}
+    		//Recorremos el BitSet siguiendo el ejmplo de la clase que se
+    		//proporciona en la API
+    		iter = fSet.iterator();
+    		while (iter.hasNext()){
+    			//TODO
+    			//Sacado de la clase LinkPanel, decidir como pintar la URL le
+    			//corresponde a LinkPanel, aqu� solo creamos el vector de URL�s
+    			if (!super.getExt().equals("")){
+    				auxext="."+this.getExt();
+    			}
+    			//Creamos el fichero con el nombre del campo y la extensi�n.
+    			Feature feature = (Feature) iter.next();
+    			String auxField=feature.getString(idField);
+    			URI tmpUri = null;
+    			if(auxField.startsWith("http:/")){
+    				tmpUri= new URI(auxField);
+    			}else{
+    				File file =new File(feature.getString(idField)+auxext);
+    				tmpUri = file.toURI();
+    			}
+    			tmpUris.add(tmpUri);
+    			System.out.println(tmpUri.toString());
+
+
+    		}
+
+    		if (tmpUris.size()==0){
+    			return null;
+    		}
+
+    		// Creo el vector de URL�s con la misma longitud que el bitset
+
+    		return (URI[]) tmpUris.toArray(new URI[0]);
+
+    	} catch (ReadException e) {
+    		throw new ReadException(lyrVect.getName(),e);
+    	} catch (URISyntaxException e) {
+    		throw new ReadException(lyrVect.getName(),e);
+		} catch (DataException e) {
+			throw new ReadException(lyrVect.getName(),e);
+		}finally{
+			if (iter != null) {
+				iter.dispose();
+			}
+			if (fSet != null) {
+				fSet.dispose();
+			}
+		}
+
+    }
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLyrVectLinkProperties.class,
+				"FLyrVectLinkProperties",
+				"FLyrVectLinkProperties Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("typeLink").setMandatory(true);
+		definition.addDynFieldString("fieldName").setMandatory(true);
+		definition.addDynFieldString("extName").setMandatory(true);
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Overlaps;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class OverlapsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public OverlapsGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Overlaps.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "overlaps with geometry";
+	}
+
+	public String getSQL() {
+		return " overlaps(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java	(revision 35988)
@@ -0,0 +1,1492 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.cresques.cts.ICoordTrans;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Circle;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException;
+import org.gvsig.fmap.geom.type.GeometryTypeNotValidException;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReprojectLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StopEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.SpatialCache;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.FeatureDrawnNotification;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.locator.LocatorException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Capa b�sica Vectorial.
+ * 
+ * @author Fernando Gonz�lez Cort�s
+ */
+
+public class FLyrVect extends FLyrDefault implements VectorLayer,
+LegendContentsChangedListener, Observer {
+
+    final static private org.slf4j.Logger logger =
+        LoggerFactory.getLogger(FLyrVect.class);
+    private final GeometryManager geomManager =
+        GeometryLocator.getGeometryManager();
+
+    /** Leyenda de la capa vectorial */
+    private IVectorLegend legend;
+    private int typeShape = -1;
+    private FeatureStore featureStore = null;
+    private SpatialCache spatialCache = new SpatialCache();
+
+    /**
+     * An implementation of gvSIG spatial index
+     */
+    // protected ISpatialIndex spatialIndex = null;
+    private IVectorLegend loadLegend = null;
+
+    private boolean isLabeled;
+    protected ILabelingStrategy strategy;
+
+    public FLyrVect() {
+        super();
+    }
+
+    /**
+     * Devuelve el VectorialAdapater de la capa.
+     * 
+     * @return VectorialAdapter.
+     */
+    public DataStore getDataStore() {
+        if (!this.isAvailable()) {
+            return null;
+        }
+        return featureStore;
+    }
+
+    /**
+     * If we use a persistent spatial index associated with this layer, and the
+     * index is not intrisic to the layer (for example spatial databases) this
+     * method looks for existent spatial index, and loads it.
+     * 
+     */
+    // private void loadSpatialIndex() {
+    // //FIXME: Al abrir el indice en fichero...
+    // //�C�mo lo liberamos? un metodo Layer.shutdown()
+    //
+    //
+    // ReadableVectorial source = getSource();
+    // //REVISAR QUE PASA CON LOS DRIVERS DXF, DGN, etc.
+    // //PUES SON VECTORIALFILEADAPTER
+    // if (!(source instanceof VectorialFileAdapter)) {
+    // // we are not interested in db adapters
+    // return;
+    // }
+    // VectorialDriver driver = source.getDriver();
+    // if (!(driver instanceof BoundedShapes)) {
+    // // we dont spatially index layers that are not bounded
+    // return;
+    // }
+    // File file = ((VectorialFileAdapter) source).getFile();
+    // String fileName = file.getAbsolutePath();
+    // File sptFile = new File(fileName + ".qix");
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // // before to exit, look for it in temp path
+    // String tempPath = System.getProperty("java.io.tmpdir");
+    // fileName = tempPath + File.separator + sptFile.getName();
+    // sptFile = new File(fileName);
+    // // it doesnt exists, must to create
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // return;
+    // }// if
+    // }// if
+    //
+    // try {
+    // source.start();
+    // spatialIndex = new
+    // QuadtreeGt2(FileUtils.getFileWithoutExtension(sptFile),
+    // "NM", source.getFullExtent(), source.getShapeCount(), false);
+    // source.setSpatialIndex(spatialIndex);
+    // } catch (SpatialIndexException e) {
+    // spatialIndex = null;
+    // e.printStackTrace();
+    // return;
+    // } catch (ReadDriverException e) {
+    // spatialIndex = null;
+    // e.printStackTrace();
+    // return;
+    // }
+    //
+    // }
+
+    /**
+     * Checks if it has associated an external spatial index
+     * (an spatial index file).
+     * 
+     * It looks for it in main file path, or in temp system path.
+     * If main file is rivers.shp, it looks for a file called
+     * rivers.shp.qix.
+     * 
+     * @return
+     */
+    // public boolean isExternallySpatiallyIndexed() {
+    // /*
+    // * FIXME (AZABALA): Independizar del tipo de fichero de �ndice
+    // * con el que se trabaje (ahora mismo considera la extension .qix,
+    // * pero esto depender� del tipo de �ndice)
+    // * */
+    // ReadableVectorial source = getSource();
+    // if (!(source instanceof VectorialFileAdapter)) {
+    // // we are not interested in db adapters.
+    // // think in non spatial dbs, like HSQLDB
+    // return false;
+    // }
+    // File file = ((VectorialFileAdapter) source).getFile();
+    // String fileName = file.getAbsolutePath();
+    // File sptFile = new File(fileName + ".qix");
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // // before to exit, look for it in temp path
+    // // it doesnt exists, must to create
+    // String tempPath = System.getProperty("java.io.tmpdir");
+    // fileName = tempPath + File.separator + sptFile.getName();
+    // sptFile = new File(fileName);
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // return false;
+    // }// if
+    // }// if
+    // return true;
+    // }
+    /**
+     * Inserta el VectorialAdapter a la capa.
+     * 
+     * @param va
+     *            VectorialAdapter.
+     * 
+     * @deprecated esto deber�a se ser protected
+     */
+    public void setDataStore(DataStore dataStore) throws LoadLayerException {
+        if (this.featureStore != null && this.featureStore != dataStore) {
+            this.featureStore.deleteObserver(this);
+        }
+
+        featureStore = (FeatureStore) dataStore;
+
+        IVectorLegend legend =
+            (IVectorLegend) MapContextLocator.getMapContextManager().getLegend(dataStore);
+
+        if (legend == null) {
+            throw new LegendLayerException(this.getName());
+        }
+
+        this.setLegend(legend);
+
+        ILabelingStrategy labeler = null;
+        try {
+            labeler =
+                (ILabelingStrategy) dataStore.invokeDynMethod("getLabeling",
+                    null);
+        } catch (DynMethodNotSupportedException e1) {
+            labeler = null;
+        } catch (DynMethodException e1) {
+            logger.error("Can't load the specific lebeling strategy provided for the layer {}.",
+                this.getName(),
+                e1);
+        }
+
+        if (labeler != null) {
+            labeler.setLayer(this);
+            this.setLabelingStrategy(labeler);
+            this.setIsLabeled(true); // TODO: ac� no s'hauria de detectar si t�
+            // etiquetes?????
+        }
+
+        this.delegate(dataStore);
+
+        dataStore.addObserver(this);
+
+        ToolsLocator.getDisposableManager().bind(dataStore);
+    }
+
+    public Envelope getFullEnvelope() throws ReadException {
+        Envelope rAux;
+        try {
+            rAux = getFeatureStore().getEnvelope();
+        } catch (BaseException e) {
+            throw new ReadException(getName(), e);
+        }
+
+        // Esto es para cuando se crea una capa nueva con el fullExtent de ancho
+        // y alto 0.
+        if (rAux == null || rAux.getMaximum(0) - rAux.getMinimum(0) == 0
+            && rAux.getMaximum(1) - rAux.getMinimum(1) == 0) {
+            try {
+                rAux =
+                    geomManager.createEnvelope(0, 0, 100, 100, SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                logger.error("Error creating the envelope", e);
+                e.printStackTrace();
+            }
+        }
+        // Si existe reproyecci�n, reproyectar el extent
+        ICoordTrans ct = getCoordTrans();
+        try {
+            if (ct != null) {
+                Point2D pt1 =
+                    new Point2D.Double(rAux.getMinimum(0), rAux.getMinimum(1));
+                Point2D pt2 =
+                    new Point2D.Double(rAux.getMaximum(0), rAux.getMaximum(1));
+                pt1 = ct.convert(pt1, null);
+                pt2 = ct.convert(pt2, null);
+                try {
+                    rAux =
+                        geomManager.createEnvelope(pt1.getX(),
+                            pt1.getY(),
+                            pt2.getX(),
+                            pt2.getY(),
+                            SUBTYPES.GEOM2D);
+                } catch (CreateEnvelopeException e) {
+                    logger.error("Error creating the envelope", e);
+                    e.printStackTrace();
+                }// new Rectangle2D.Double();
+            }
+        } catch (IllegalStateException e) {
+            this.setAvailable(false);
+            this.addError(new ReprojectLayerException(getName(), e));
+        }
+        return rAux;
+
+    }
+
+    /**
+     * Draws using IFeatureIterator. This method will replace the old draw(...)
+     * one.
+     * 
+     * @autor jaume dominguez faus - jaume.dominguez@iver.es
+     * @param image
+     * @param g
+     * @param viewPort
+     * @param cancel
+     * @param scale
+     * @throws ReadDriverException
+     */
+    public void draw(BufferedImage image,
+        Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale) throws ReadException {
+
+        if (legend == null) {
+            return;
+        }
+
+        if (!this.isWithinScale(scale)) {
+            return;
+        }
+        if (cancel.isCanceled()) {
+            return;
+        }
+
+        if (spatialCache.isEnabled()) {
+            spatialCache.clearAll();
+            legend.addDrawingObserver(this);
+        }
+
+        FeatureQuery featureQuery = null;
+        try {
+            FeatureAttributeDescriptor featureAttributeDescriptor =
+                getFeatureStore().getDefaultFeatureType().getDefaultTimeAttribute();
+
+            if ((viewPort.getTime() != null) && (featureAttributeDescriptor != null)){
+                featureQuery = getFeatureStore().createFeatureQuery();
+                IntersectsTimeEvaluator intersectsTimeEvaluator =
+                    new IntersectsTimeEvaluator(viewPort.getTime(), featureAttributeDescriptor.getName());
+                featureQuery.addFilter(intersectsTimeEvaluator);
+            }
+        } catch (DataException e1) {
+            logger.error("Impossible to get the temporal filter", e1);
+        }
+
+        try {
+            legend.draw(image,
+                g,
+                viewPort,
+                cancel,
+                scale,
+                null,
+                getCoordTrans(),
+                getFeatureStore(),
+                featureQuery);
+
+        } catch (LegendException e) {
+            this.setVisible(false);
+            this.setActive(false);
+            throw new ReadException(getName(), e);
+        } finally {
+            if (spatialCache.isEnabled()) {
+                legend.deleteDrawingObserver(this);
+            }
+        }
+    }
+
+    public void print(Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        PrintAttributes properties) throws ReadException {
+        if (!this.isWithinScale(scale)) {
+            return;
+        }
+        if (cancel.isCanceled()) {
+            return;
+        }
+
+        try {
+            legend.print(g,
+                viewPort,
+                cancel,
+                scale,
+                null,
+                getCoordTrans(),
+                getFeatureStore(),
+                null,
+                properties);
+
+        } catch (LegendException e) {
+            this.setVisible(false);
+            this.setActive(false);
+            throw new ReadException(getName(), e);
+        }
+    }
+
+    /**
+     * <p>
+     * Creates an spatial index associated to this layer. The spatial index will
+     * used the native projection of the layer, so if the layer is reprojected,
+     * it will be ignored.
+     * </p>
+     * 
+     * @param cancelMonitor
+     *            instance of CancellableMonitorable that allows
+     *            to monitor progress of spatial index creation, and cancel the
+     *            process
+     */
+    // public void createSpatialIndex(CancellableMonitorable cancelMonitor){
+    // // FJP: ESTO HABR� QUE CAMBIARLO. PARA LAS CAPAS SECUENCIALES, TENDREMOS
+    // // QUE ACCEDER CON UN WHILE NEXT. (O mejorar lo de los FeatureVisitor
+    // // para que acepten recorrer sin geometria, solo con rectangulos.
+    //
+    // //If this vectorial layer is based in a spatial database, the spatial
+    // //index is already implicit. We only will index file drivers
+    // ReadableVectorial va = getSource();
+    // //We must think in non spatial databases, like HSQLDB
+    // if(!(va instanceof VectorialFileAdapter)){
+    // return;
+    // }
+    // if (!(va.getDriver() instanceof BoundedShapes)) {
+    // return;
+    // }
+    // File file = ((VectorialFileAdapter) va).getFile();
+    // String fileName = file.getAbsolutePath();
+    // ISpatialIndex localCopy = null;
+    // try {
+    // va.start();
+    // localCopy = new QuadtreeGt2(fileName, "NM", va.getFullExtent(),
+    // va.getShapeCount(), true);
+    //
+    // } catch (SpatialIndexException e1) {
+    // // Probably we dont have writing permissions
+    // String directoryName = System.getProperty("java.io.tmpdir");
+    // File newFile = new File(directoryName +
+    // File.separator +
+    // file.getName());
+    // String newFileName = newFile.getName();
+    // try {
+    // localCopy = new QuadtreeGt2(newFileName, "NM", va.getFullExtent(),
+    // va.getShapeCount(), true);
+    // } catch (SpatialIndexException e) {
+    // // if we cant build a file based spatial index, we'll build
+    // // a pure memory spatial index
+    // localCopy = new QuadtreeJts();
+    // } catch (ReadException e) {
+    // localCopy = new QuadtreeJts();
+    // }
+    //
+    // } catch(Exception e){
+    // e.printStackTrace();
+    // }//try
+    // BoundedShapes shapeBounds = (BoundedShapes) va.getDriver();
+    // try {
+    // for (int i=0; i < va.getShapeCount(); i++)
+    // {
+    // if(cancelMonitor != null){
+    // if(cancelMonitor.isCanceled())
+    // return;
+    // cancelMonitor.reportStep();
+    // }
+    // Rectangle2D r = shapeBounds.getShapeBounds(i);
+    // if(r != null)
+    // localCopy.insert(r, i);
+    // } // for
+    // va.stop();
+    // if(localCopy instanceof IPersistentSpatialIndex)
+    // ((IPersistentSpatialIndex) localCopy).flush();
+    // spatialIndex = localCopy;
+    // //vectorial adapter needs a reference to the spatial index, to solve
+    // //request for feature iteration based in spatial queries
+    // source.setSpatialIndex(spatialIndex);
+    // } catch (ReadException e) {
+    // // TODO Auto-generated catch block
+    // e.printStackTrace();
+    // }
+    // }
+
+    // public void createSpatialIndex() {
+    // createSpatialIndex(null);
+    // }
+
+    public void setLegend(IVectorLegend legend) throws LegendLayerException {
+        if (this.legend == legend) {
+            return;
+        }
+        if (this.legend != null && this.legend.equals(legend)) {
+            return;
+        }
+        IVectorLegend oldLegend = this.legend;
+        this.legend = legend;
+        if (oldLegend != null) {
+            oldLegend.removeLegendListener(this);
+            oldLegend.deleteDrawingObserver(this);
+        }
+        if (legend != null) {
+            this.legend.addDrawingObserver(this);
+            this.legend.addLegendListener(this);
+        }
+        LegendChangedEvent e =
+            LegendChangedEvent.createLegendChangedEvent(oldLegend, this.legend);
+        e.setLayer(this);
+        callLegendChanged(e);
+    }
+
+    /**
+     * Devuelve la Leyenda de la capa.
+     * 
+     * @return Leyenda.
+     */
+    public ILegend getLegend() {
+        return legend;
+    }
+
+    /**
+     * Devuelve el tipo de shape que contiene la capa.
+     * 
+     * @return tipo de shape.
+     * 
+     * @throws ReadException
+     */
+    public int getShapeType() throws ReadException {
+    	if (typeShape == -1) {
+    		FeatureType featureType = null;
+    		try {
+    			if( getDataStore()!=null ){
+    				featureType =
+    					(((FeatureStore) getDataStore()).getDefaultFeatureType());
+    			}
+    		} catch (DataException e) {
+    			throw new ReadException(getName(), e);
+    		}
+    		if( featureType!=null ){
+    			int indexGeom = featureType.getDefaultGeometryAttributeIndex();
+    			typeShape =
+    				featureType.getAttributeDescriptor(indexGeom).getGeometryType();
+    		}
+    	}
+    	return typeShape;
+    }
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+
+        if (!this.isAvailable()) {
+            return;
+        }
+
+        super.saveToState(state);
+
+        if (getLegend() != null) {
+            state.set("legend", getLegend());
+        }
+
+        FeatureStore fst = null;
+        fst = getFeatureStore();
+
+        if (fst != null) {
+            state.set("featureStore", fst);
+        }
+
+        state.set("isLabeled", isLabeled);
+
+        if (strategy != null) {
+            state.set("labelingStrategy", strategy);
+        }
+
+        if (getLinkProperties() != null) {
+            state.set("linkProperties", getLinkProperties());
+        }
+
+        // state.set("bHasJoin", bHasJoin);
+        state.set("typeShape", typeShape);
+    }
+
+    // public XMLEntity getXMLEntity() throws XMLException {
+    //
+    // if (!this.isAvailable() && this.orgXMLEntity != null) {
+    // return this.orgXMLEntity;
+    // }
+    // XMLEntity xml = super.getXMLEntity();
+    // if (getLegend()!=null){
+    // XMLEntity xmlLegend=getLegend().getXMLEntity();
+    // xmlLegend.putProperty("tagName","legend");
+    // xml.addChild(xmlLegend);
+    // }
+    // try {
+    // PersistenceManager manager = ToolsLocator.getPersistenceManager();
+    // PersistentState stateFeatureStore=manager.getState(getFeatureStore());
+    // stateFeatureStore.set("tagName","featureStore");
+    // xml.addChild(((XMLEntityState)stateFeatureStore).getXMLEntity());
+    // } catch (ReadException e) {
+    // throw new XMLLayerException(getName(),e);
+    // } catch (PersistenceException e) {
+    // throw new XMLLayerException(getName(),e);
+    // }
+    // // properties from ILabelable
+    // xml.putProperty("isLabeled", isLabeled);
+    // if (strategy != null) {
+    // XMLEntity strategyXML = strategy.getXMLEntity();
+    // strategyXML.putProperty("tagName", "labelingStrategy");
+    // xml.addChild(strategy.getXMLEntity());
+    // }
+    // xml.addChild(getLinkProperties().getXMLEntity());
+    // return xml;
+    // }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+
+        super.loadFromState(state);
+        DataStore store = null;
+        try {
+        	store = (DataStore) state.get("featureStore");
+        } catch (PersistenceRuntimeException e) {
+			this.setAvailable(false);
+			return;
+		}
+        try {
+            this.setDataStore(store);
+        } catch (LoadLayerException e) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                e);
+        }
+
+        IVectorLegend lgnd = (IVectorLegend) state.get("legend");
+        try {
+            this.setLegend(lgnd);
+        } catch (LegendLayerException e) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                e);
+        }
+
+        Boolean isLbl = new Boolean(false);
+        ILabelingStrategy lblst = null;
+
+        try {
+            isLbl = (Boolean) state.get("isLabeled");
+            if (isLbl.booleanValue()) {
+                lblst = (ILabelingStrategy) state.get("labelingStrategy");
+            }
+        } catch (Exception ex) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                ex);
+        }
+
+        /*
+         * String _labelFieldName = null;
+         * String _labelfield = null;
+         */
+
+        if (isLbl.booleanValue()) {
+            this.setIsLabeled(true);
+            this.setLabelingStrategy(lblst);
+        } else {
+            this.setIsLabeled(false);
+            this.setLabelingStrategy(null);
+        }
+
+        // try {
+        // linkProperties = (FLyrVectLinkProperties)
+        // state.get("linkProperties");
+        // } catch (PersistenceException pex) {
+        // // not mandatory
+        // linkProperties = null;
+        // }
+
+        // bHasJoin = state.getBoolean("bHasJoin");
+        typeShape = state.getInt("typeShape");
+
+        // try { _labelFieldName = state.getString("labelFieldName"); } catch
+        // (PersistenceException ex) {
+        // _labelFieldName = null;
+        // }
+        // try { _labelfield = state.getString("labelfield"); } catch
+        // (PersistenceException ex) {
+        // _labelfield = null;
+        // }
+
+        // ILabelingStrategy not implemented
+        // if (_labelFieldName != null) {
+        //
+        // AttrInTableLabelingStrategy labeling = new
+        // AttrInTableLabelingStrategy();
+        // try {
+        // labeling.setLayer(this);
+        // } catch (ReadException e) {
+        // logger.error("While setting layer to AttrInTableLabelingStrategy: " +
+        // e.getMessage());
+        // }
+        // labeling.setUsesFixedSize(true);
+        // labeling.setFixedSize(10);
+        // labeling.setTextField(_labelFieldName);
+        // labeling.setHeightField(state.getString("labelHeightFieldName"));
+        // labeling.setRotationField(state.getString("labelRotationFieldName"));
+        // setLabelingStrategy(labeling);
+        // setIsLabeled(true);
+        //
+        // } else {
+        // if (_labelfield != null) {
+        //
+        // AttrInTableLabelingStrategy labeling = new
+        // AttrInTableLabelingStrategy();
+        // try {
+        // labeling.setLayer(this);
+        // } catch (ReadException e) {
+        // logger.error("While setting layer to AttrInTableLabelingStrategy: " +
+        // e.getMessage());
+        // }
+        // labeling.setUsesFixedSize(true);
+        // labeling.setFixedSize(10);
+        // labeling.setTextField(_labelfield);
+        // labeling.setHeightField(state.getString("labelFieldHeight"));
+        // labeling.setRotationField(state.getString("labelFieldRotation"));
+        // setLabelingStrategy(labeling);
+        // setIsLabeled(true);
+        // }
+        // }
+
+    }
+
+    // public void setXMLEntity(XMLEntity xml) throws XMLException {
+    // try {
+    // super.setXMLEntity(xml);
+    // XMLEntity legendXML = xml.firstChild("tagName","legend");
+    // IVectorLegend leg = LegendFactory.createFromXML(legendXML);
+    //
+    // // PersistentState persistentState=new XMLEntityState(new
+    // XMLEntityManager());
+    // XMLEntity xmlStore=xml.firstChild("tagName","featureStore");
+    // XMLEntityManager xmlManger = new XMLEntityManager();
+    // PersistentState state = xmlManger.createState(xmlStore);
+    // DataStore store = (DataStore)
+    // ToolsLocator.getPersistenceManager().create(state);
+    // // persistentState.createState(xmlStore);
+    //
+    // // DataManager dm=DALLocator.getDataManager();
+    //
+    // this.setDataStore(store);
+    // /* end patch */
+    // try {
+    // setLegend(leg);
+    // } catch (LegendLayerException e) {
+    // throw new XMLLegendException(e);
+    // }
+    // // set properties for ILabelable
+    //
+    // if (xml.contains("isLabeled")
+    // && xml.getBooleanProperty(("isLabeled"))) {
+    // XMLEntity labelingXML = xml.firstChild("tagName", "labelingStrategy");
+    // if (labelingXML != null){
+    //
+    // isLabeled = true;
+    // try {
+    // this.strategy = LabelingFactory.createStrategyFromXML(labelingXML, this);
+    // } catch (NotExistInXMLEntity neXMLEX) {
+    // // no strategy was set, just continue;
+    // logger.warn("Reached what should be unreachable code");
+    // }
+    // } else {
+    // isLabeled = false;
+    // }
+    // } else if (legendXML.contains("labelFieldName")||
+    // legendXML.contains("labelfield")) {
+    // /* (jaume) begin patch;
+    // * for backward compatibility purposes. Since gvSIG v1.1 labeling is
+    // * no longer managed by the Legend but by the ILabelingStrategy. The
+    // * following allows restoring older projects' labelings.
+    // */
+    // String labelTextField = null;
+    // if (legendXML.contains("labelFieldName")){
+    // labelTextField = legendXML.getStringProperty("labelFieldName");
+    // if (labelTextField != null) {
+    // AttrInTableLabelingStrategy labeling = new AttrInTableLabelingStrategy();
+    // labeling.setLayer(this);
+    // labeling.setUsesFixedSize(true);
+    // labeling.setFixedSize(10);
+    // labeling.setTextField(labelTextField);
+    // labeling.setHeightField(legendXML.getStringProperty("labelHeightFieldName"));
+    // labeling.setRotationField(legendXML.getStringProperty("labelRotationFieldName"));
+    // this.setLabelingStrategy(labeling);
+    // this.setIsLabeled(true);
+    // }
+    // }else{
+    // labelTextField = legendXML.getStringProperty("labelfield");
+    // if (labelTextField != null) {
+    // AttrInTableLabelingStrategy labeling = new AttrInTableLabelingStrategy();
+    // labeling.setLayer(this);
+    // labeling.setUsesFixedSize(true);
+    // labeling.setFixedSize(10);
+    // labeling.setTextField(labelTextField);
+    // labeling.setHeightField(legendXML.getStringProperty("labelFieldHeight"));
+    // labeling.setRotationField(legendXML.getStringProperty("labelFieldRotation"));
+    // this.setLabelingStrategy(labeling);
+    // this.setIsLabeled(true);
+    // }
+    // }
+    // }else{
+    // isLabeled = false;
+    // }
+    // XMLEntity xmlLinkProperties=xml.firstChild("typeChild","linkProperties");
+    // if (xmlLinkProperties != null){
+    // getLinkProperties().setXMLEntity(xmlLinkProperties);
+    // }
+    // } catch (Exception e) {
+    // e.printStackTrace();
+    // this.setAvailable(false);
+    // this.orgXMLEntity = xml;
+    //
+    // }
+    // //
+    //
+    // }
+
+    /**
+     * Sobreimplementaci�n del m�todo toString para que las bases de datos
+     * identifiquen la capa.
+     * 
+     * @return DOCUMENT ME!
+     */
+    public String toString() {
+        /*
+         * Se usa internamente para que la parte de datos identifique de forma
+         * un�voca las tablas
+         */
+        String ret = super.toString();
+
+        return "layer" + ret.substring(ret.indexOf('@') + 1);
+    }
+
+    // public boolean isJoined() {
+    // return bHasJoin;
+    // }
+
+    /**
+     * Returns if a layer is spatially indexed
+     * 
+     * @return if this layer has the ability to proces spatial queries without
+     *         secuential scans.
+     * @throws StopEditionLayerException 
+     */
+    // public boolean isSpatiallyIndexed() {
+    // ReadableVectorial source = getSource();
+    // if (source instanceof ISpatialDB)
+    // return true;
+    //
+    // //FIXME azabala
+    // /*
+    // * Esto es muy dudoso, y puede cambiar.
+    // * Estoy diciendo que las que no son fichero o no son
+    // * BoundedShapes estan indexadas. Esto es mentira, pero
+    // * as� quien pregunte no querr� generar el indice.
+    // * Esta por ver si interesa generar el indice para capas
+    // * HSQLDB, WFS, etc.
+    // */
+    // if(!(source instanceof VectorialFileAdapter)){
+    // return true;
+    // }
+    // if (!(source.getDriver() instanceof BoundedShapes)) {
+    // return true;
+    // }
+    //
+    // if (getISpatialIndex() != null)
+    // return true;
+    // return false;
+    // }
+    //
+    // public void setIsJoined(boolean hasJoin) {
+    // bHasJoin = hasJoin;
+    // }
+
+    // /**
+    // * @return Returns the spatialIndex.
+    // */
+    // public ISpatialIndex getISpatialIndex() {
+    // return spatialIndex;
+    // }
+    // /**
+    // * Sets the spatial index. This could be useful if, for some
+    // * reasons, you want to work with a distinct spatial index
+    // * (for example, a spatial index which could makes nearest
+    // * neighbour querys)
+    // * @param spatialIndex
+    // */
+    // public void setISpatialIndex(ISpatialIndex spatialIndex){
+    // this.spatialIndex = spatialIndex;
+    // }
+
+    public void setEditing(boolean b) throws StartEditionLayerException {
+        super.setEditing(b);
+        FeatureStore fs = getFeatureStore();
+        if (b) {
+            try {
+                fs.edit();
+            } catch (ReadException e) {
+                throw new StartEditionLayerException(getName(), e);
+            } catch (DataException e) {
+                throw new StartEditionLayerException(getName(), e);
+            }
+        }
+        setSpatialCacheEnabled(b);
+        callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition"));
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public void clearSpatialCache() {
+        spatialCache.clearAll();
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public boolean isSpatialCacheEnabled() {
+        return spatialCache.isEnabled();
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public void setSpatialCacheEnabled(boolean spatialCacheEnabled) {
+        spatialCache.setEnabled(spatialCacheEnabled);
+    }
+
+    public SpatialCache getSpatialCache() {
+        return spatialCache;
+    }
+
+    /**
+     * Siempre es un numero mayor de 1000
+     * 
+     * @param maxFeatures
+     */
+    public void setMaxFeaturesInEditionCache(int maxFeatures) {
+        if (maxFeatures > spatialCache.getMaxFeatures()) {
+            spatialCache.setMaxFeatures(maxFeatures);
+        }
+
+    }
+
+    /**
+     * This method returns a boolean that is used by the FPopMenu
+     * to make visible the properties menu or not. It is visible by
+     * default, and if a later don't have to show this menu only
+     * has to override this method.
+     * 
+     * @return
+     *         If the properties menu is visible (or not)
+     */
+    public boolean isPropertiesMenuVisible() {
+        return true;
+    }
+
+    public void reload() throws ReloadLayerException {
+        super.reload();
+        try {
+            getFeatureStore().refresh();
+        } catch (Exception e) {
+            throw new ReloadLayerException(getName(), e);
+        }
+    }
+
+    protected void setLoadSelection(Object xml) {
+        // this.loadSelection = xml;
+    }
+
+    protected void setLoadLegend(IVectorLegend legend) {
+        this.loadLegend = legend;
+    }
+
+    protected void putLoadSelection() {
+        // if (this.loadSelection == null) return;
+        // try {
+        // this.getRecordset().getSelectionSupport().setXMLEntity(this.loadSelection);
+        // } catch (ReadDriverException e) {
+        // throw new XMLException(e);
+        // }
+        // this.loadSelection = null;
+
+    }
+
+    protected void putLoadLegend() throws LegendLayerException {
+        if (this.loadLegend == null) {
+            return;
+        }
+        this.setLegend(this.loadLegend);
+        this.loadLegend = null;
+    }
+
+    protected void cleanLoadOptions() {
+        this.loadLegend = null;
+    }
+
+    public boolean isWritable() {
+        return getFeatureStore().allowWrite();
+    }
+
+    public FLayer cloneLayer() throws Exception {
+        FLyrVect clonedLayer = new FLyrVect();
+        clonedLayer.setDataStore(getDataStore());
+        // if (isJoined()) {
+        // clonedLayer.setIsJoined(true);
+        // }
+        clonedLayer.setVisible(isVisible());
+        // clonedLayer.setISpatialIndex(getISpatialIndex());
+        clonedLayer.setName(getName());
+        clonedLayer.setCoordTrans(getCoordTrans());
+
+        clonedLayer.setLegend((IVectorLegend) getLegend().cloneLegend());
+
+        clonedLayer.setIsLabeled(isLabeled());
+        ILabelingStrategy labelingStrategy = getLabelingStrategy();
+        if (labelingStrategy != null) {
+            clonedLayer.setLabelingStrategy(labelingStrategy);
+        }
+
+        return clonedLayer;
+    }
+
+    protected boolean isOnePoint(AffineTransform graphicsTransform,
+        ViewPort viewPort,
+        double dpi,
+        CartographicSupport csSym,
+        Geometry geom,
+        int[] xyCoords) {
+        return isOnePoint(graphicsTransform, viewPort, geom, xyCoords)
+        && csSym.getCartographicSize(viewPort, dpi, geom) <= 1;
+    }
+
+    private boolean isOnePoint(AffineTransform graphicsTransform,
+        ViewPort viewPort,
+        Geometry geom,
+        int[] xyCoords) {
+        boolean onePoint = false;
+        int type = geom.getType();
+        if (type == Geometry.TYPES.NULL) {
+            return false;
+        }
+        if (type != Geometry.TYPES.POINT && type != Geometry.TYPES.MULTIPOINT) {
+
+            Envelope geomBounds = geom.getEnvelope();
+
+            // ICoordTrans ct = getCoordTrans();
+
+            // Se supone que la geometria ya esta reproyectada
+            // if (ct!=null) {
+            // // geomBounds = ct.getInverted().convert(geomBounds);
+            // geomBounds = geomBounds.convert(ct);
+            // }
+
+            double dist1Pixel = viewPort.getDist1pixel();
+
+            onePoint =
+                (geomBounds.getLength(0) <= dist1Pixel && geomBounds.getLength(1) <= dist1Pixel);
+
+            if (onePoint) {
+                // avoid out of range exceptions
+                org.gvsig.fmap.geom.primitive.Point p;
+                try {
+                    p =
+                        geomManager.createPoint(geomBounds.getMinimum(0),
+                            geomBounds.getMinimum(1),
+                            SUBTYPES.GEOM2D);
+                    p.transform(viewPort.getAffineTransform());
+                    p.transform(graphicsTransform);
+                    xyCoords[0] = (int) p.getX();
+                    xyCoords[1] = (int) p.getY();
+                } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+                    logger.error("Error creating a point", e);
+                }
+
+            }
+
+        }
+        return onePoint;
+    }
+
+    /*
+     * jaume. Stuff from ILabeled.
+     */
+
+    public boolean isLabeled() {
+        return isLabeled;
+    }
+
+    public void setIsLabeled(boolean isLabeled) {
+        this.isLabeled = isLabeled;
+    }
+
+    public ILabelingStrategy getLabelingStrategy() {
+        return strategy;
+    }
+
+    public void setLabelingStrategy(ILabelingStrategy strategy) {
+        this.strategy = strategy;
+        if (strategy == null) {
+            return;
+        }
+        strategy.setLayer(this);
+    }
+
+    public void drawLabels(BufferedImage image,
+        Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        double dpi) throws ReadException {
+        if (strategy != null && isWithinScale(scale)) {
+            strategy.draw(image, g, viewPort, cancel, dpi);
+        }
+    }
+
+    public void printLabels(Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        PrintAttributes properties) throws ReadException {
+        if (strategy != null) {
+            strategy.print(g, viewPort, cancel, properties);
+        }
+    }
+
+    // M�todos para el uso de HyperLinks en capas FLyerVect
+
+    /**
+     * Return true, because a Vectorial Layer supports HyperLink
+     */
+    public boolean allowLinks() {
+        return true;
+    }
+
+    /**
+     * Returns an instance of AbstractLinkProperties that contains the
+     * information
+     * of the HyperLink
+     * 
+     * @return Abstra
+     */
+    // public AbstractLinkProperties getLinkProperties()
+    // {
+    // return linkProperties;
+    // }
+
+    /**
+     * Provides an array with URIs. Returns one URI by geometry that includes
+     * the point
+     * in its own geometry limits with a allowed tolerance.
+     * 
+     * @param layer
+     *            , the layer
+     * @param point
+     *            , the point to check that is contained or not in the
+     *            geometries in the layer
+     * @param tolerance
+     *            , the tolerance allowed. Allowed margin of error to detect if
+     *            the point
+     *            is contained in some geometries of the layer
+     * @return
+     * @throws ReadException
+     * @throws BehaviorException
+     */
+    // public URI[] getLink(Point2D point, double tolerance) throws
+    // ReadException
+    // {
+    // //return linkProperties.getLink(this)
+    // return linkProperties.getLink(this,point,tolerance);
+    // }
+
+    public void load() throws LoadLayerException {
+        super.load();
+    }
+
+    public FeatureStore getFeatureStore() {
+        return (FeatureStore) getDataStore();
+    }
+
+    /**
+     * @deprecated use instead {@link #queryByPoint(org.gvsig.fmap.geom.primitive.Point, double, FeatureType)}
+     */
+    public FeatureSet queryByPoint(Point2D mapPoint,
+        double tol,
+        FeatureType featureType) throws DataException {
+        logger.warn("Deprecated use of queryByPoint.");
+        GeometryManager manager = GeometryLocator.getGeometryManager();
+        org.gvsig.fmap.geom.primitive.Point center;
+        try {
+            center =
+                (org.gvsig.fmap.geom.primitive.Point) manager.create(TYPES.POINT,
+                    SUBTYPES.GEOM2D);
+            center.setX(mapPoint.getX());
+            center.setY(mapPoint.getY());
+            Circle circle =
+                (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
+            circle.setPoints(center, tol);
+            return queryByGeometry(circle, featureType);
+        } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+            throw new CreateGeometryException(TYPES.CIRCLE, SUBTYPES.GEOM2D, e);
+        }
+    }
+
+    public FeatureSet queryByPoint(org.gvsig.fmap.geom.primitive.Point point,
+        double tol,
+        FeatureType featureType) throws DataException {
+        GeometryManager manager = GeometryLocator.getGeometryManager();
+        try {
+            Circle circle =
+                (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
+            circle.setPoints(point, tol);
+            return queryByGeometry(circle, featureType);
+        } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+            throw new CreateGeometryException(TYPES.CIRCLE, SUBTYPES.GEOM2D, e);
+        }
+    }
+
+    public FeatureSet queryByGeometry(Geometry geom, FeatureType featureType) throws DataException {
+        FeatureQuery featureQuery = featureStore.createFeatureQuery();
+        String geomName =
+            featureStore.getDefaultFeatureType()
+            .getDefaultGeometryAttributeName();
+        featureQuery.setFeatureType(featureType);
+        IntersectsGeometryEvaluator iee =
+            new IntersectsGeometryEvaluator(geom,
+                getMapContext().getViewPort().getProjection(),
+                featureStore.getDefaultFeatureType(),
+                geomName);
+        featureQuery.setFilter(iee);
+        return getFeatureStore().getFeatureSet(featureQuery);
+
+    }
+
+    /**
+     * It return the {@link FeatureSet} that intersects with the envelope.
+     * @param envelope
+     *          envelope that defines the area for the query.
+     * @param featureType
+     *          only the features with this feature type are used in
+     *          the query.    
+     * @return
+     *          the set of features that intersect with the envelope.
+     * @throws DataException
+     */
+    public FeatureSet queryByEnvelope(Envelope envelope, FeatureType featureType) throws DataException {
+        return queryByEnvelope(envelope, featureType, null);
+    }
+
+    /**
+     * It return the {@link FeatureSet} that intersects with the envelope.
+     * @param envelope
+     *          envelope that defines the area for the query.
+     * @param featureType
+     *          only the features with this feature type are used in
+     *          the query.
+     * @param names
+     *          the feature attributes that have to be checked.
+     * @return
+     *          the set of features that intersect with the envelope.
+     * @throws DataException
+     */
+    public FeatureSet queryByEnvelope(Envelope envelope,
+        FeatureType featureType,
+        String[] names) throws DataException {
+        FeatureQuery featureQuery = featureStore.createFeatureQuery();
+        if (names == null) {
+            featureQuery.setFeatureType(featureType);
+        } else {
+            featureQuery.setAttributeNames(names);
+            featureQuery.setFeatureTypeId(featureType.getId());
+        }
+        String geomName =
+            featureStore.getDefaultFeatureType()
+            .getDefaultGeometryAttributeName();
+        IntersectsGeometryEvaluator iee =
+            new IntersectsGeometryEvaluator(envelope.getGeometry(),
+                getMapContext().getViewPort().getProjection(),
+                featureStore.getDefaultFeatureType(),
+                geomName);
+        featureQuery.setFilter(iee);
+        return getFeatureStore().getFeatureSet(featureQuery);
+
+    }
+
+    public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) throws LoadLayerException,
+    DataException {
+
+        return getInfo(p, tolerance, cancel, true);
+    }
+
+    public DynObjectSet getInfo(Point p,
+        double tolerance,
+        Cancellable cancel,
+        boolean fast) throws LoadLayerException, DataException {
+        Point2D infop = new Point2D.Double(p.x, p.y);
+        Point2D pReal = this.getMapContext().getViewPort().toMapPoint(infop);
+        return queryByPoint(pReal,
+            tolerance,
+            getFeatureStore().getDefaultFeatureType()).getDynObjectSet(fast);
+    }
+
+    public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p,
+        double tolerance) throws LoadLayerException, DataException {
+        return queryByPoint(p,tolerance, getFeatureStore().getDefaultFeatureType()).getDynObjectSet(false);
+    }
+    
+    public void legendCleared(LegendClearEvent event) {
+        // this.updateDrawVersion(); TODO
+        LegendChangedEvent e =
+            LegendChangedEvent.createLegendChangedEvent(legend, legend);
+        this.callLegendChanged(e);
+    }
+
+    public boolean symbolChanged(SymbolLegendEvent e) {
+        LegendChangedEvent ev =
+            LegendChangedEvent.createLegendChangedEvent(legend, legend);
+        this.callLegendChanged(ev);
+        return true;
+    }
+
+    public void update(Observable observable, Object notification) {
+        if (observable.equals(this.featureStore)) {
+            if (notification instanceof FeatureStoreNotification) {
+                FeatureStoreNotification event =
+                    (FeatureStoreNotification) notification;
+                if (event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING
+                    || event.getType() == FeatureStoreNotification.AFTER_DELETE
+                    || event.getType() == FeatureStoreNotification.AFTER_UNDO
+                    || event.getType() == FeatureStoreNotification.AFTER_REDO
+                    || event.getType() == FeatureStoreNotification.AFTER_REFRESH
+                    || event.getType() == FeatureStoreNotification.AFTER_UPDATE
+                    || event.getType() == FeatureStoreNotification.AFTER_UPDATE_TYPE
+                    || event.getType() == FeatureStoreNotification.SELECTION_CHANGE
+                    || event.getType() == FeatureStoreNotification.AFTER_INSERT) {
+                    this.updateDrawVersion();
+
+                } else if (event.getType() == FeatureStoreNotification.TRANSFORM_CHANGE){
+                    //If a transform has to be applied, try to reload the layer.
+                    try {
+                        reload();
+                    } catch (ReloadLayerException e) {
+                        this.setAvailable(false);
+                    }
+                } else if (event.getType() == FeatureStoreNotification.RESOURCE_CHANGED) {
+                    this.setAvailable(false);
+                } else 	if (event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) {
+                    this.setAvailable(true);
+                }
+            }
+        }
+        // Only if its an event from our own legend
+        else
+            // I comment this line because a legend doesn't implements the
+            // Observable interface.
+            // This code is necessary on edition.
+            // if (observable == getLegend()) {
+            if (notification instanceof FeatureDrawnNotification) {
+                Geometry geometry =
+                    ((FeatureDrawnNotification) notification).getDrawnGeometry();
+                spatialCache.insert(geometry.getEnvelope(), geometry);
+                // }
+            }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+     */
+    public Set getMetadataChildren() {
+        Set ret = new TreeSet();
+        ret.add(this.featureStore);
+        return ret;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataID()
+     */
+    public Object getMetadataID() throws MetadataException {
+        return "Layer(" + this.getName() + "):"
+        + this.featureStore.getMetadataID();
+    }
+
+
+
+    public GeometryType getTypeVectorLayer() throws DataException,
+    LocatorException,
+    GeometryTypeNotSupportedException,
+    GeometryTypeNotValidException {
+        // FIXME Esto deberia de pedirse a FType!!!!
+        FeatureStore fs = this.getFeatureStore();
+        FeatureType fType = fs.getDefaultFeatureType();
+        FeatureAttributeDescriptor attr =
+            fType.getAttributeDescriptor(fType.getDefaultGeometryAttributeIndex());
+        GeometryType geomType =
+            GeometryLocator.getGeometryManager()
+            .getGeometryType(attr.getGeometryType(),
+                attr.getGeometrySubType());
+        return geomType;
+    }
+
+    public static void registerPersistent() {
+        PersistenceManager manager = ToolsLocator.getPersistenceManager();
+        if (manager.getDefinition(FLyrDefault.class) == null) {
+            FLyrDefault.registerPersistent();
+        }
+        DynStruct definition =
+            manager.addDefinition(FLyrVect.class,
+                "FLyrVect",
+                "FLyrVect Persistence definition",
+                null,
+                null);
+        definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE,
+        "FLyrDefault");
+
+        definition.addDynFieldObject("legend")
+        .setClassOfValue(IVectorLegend.class)
+        .setMandatory(true);
+        definition.addDynFieldObject("featureStore")
+        .setClassOfValue(FeatureStore.class)
+        .setMandatory(true);
+        definition.addDynFieldBoolean("isLabeled").setMandatory(true);
+        definition.addDynFieldInt("typeShape").setMandatory(true);
+        definition.addDynFieldObject("labelingStrategy")
+        .setClassOfValue(ILabelingStrategy.class)
+        .setMandatory(false);
+
+    }
+
+    protected void doDispose() throws BaseException {
+        dispose(featureStore);
+        spatialCache.clearAll();
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java	(revision 35988)
@@ -0,0 +1,13 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+
+public interface VectorLayer  extends SingleLayer, ILabelable, InfoByPoint,
+ClassifiableVectorial  {
+
+	FeatureStore getFeatureStore();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java	(revision 35988)
@@ -0,0 +1,86 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class ContainsEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+	private String envelopeWKT;
+
+	public ContainsEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+		this.srs = envelopeProjection.getAbrev();
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		Envelope featureEnvelope;
+		if (isDefault) {
+			featureEnvelope = ((Feature) data.getContextValue("feature"))
+					.getDefaultEnvelope();
+
+		} else {
+			featureEnvelope = ((Geometry) data.getDataValue(geomName))
+					.getEnvelope();
+		}
+		return new Boolean(envelopeTrans.contains(featureEnvelope));
+	}
+
+	public String getName() {
+		return "contains in envelope";
+	}
+
+	public String getSQL() {
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE, null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " contains(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Within;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class WithinGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public WithinGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Within.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "within with geometry";
+	}
+
+	public String getSQL() {
+		return " within(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 35988)
@@ -0,0 +1,90 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class IntersectsEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private String envelopeWKT = null;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+
+	public IntersectsEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+
+		this.srs = envelopeProjection.getAbrev();
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		Envelope featureEnvelope;
+		if (isDefault) {
+			featureEnvelope = ((Feature) data.getContextValue("feature"))
+					.getDefaultEnvelope();
+		} else {
+			featureEnvelope = ((Geometry) data.getDataValue(geomName)).getEnvelope();
+		}
+		return new Boolean(envelopeTrans.intersects(featureEnvelope));
+
+	}
+
+	public String getName() {
+		return "intersets in envelope";
+	}
+
+	public String getSQL() {
+
+
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE, null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " intersects(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Out;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class OutGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public OutGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addFieldValue(geomName);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Out.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "out of geometry";
+	}
+
+	public String getSQL() {
+		return " not contains(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java	(revision 35988)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Touches;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class TouchesGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public TouchesGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Touches.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "touches with geometry";
+	}
+
+	public String getSQL() {
+		return " touches(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java	(revision 35988)
@@ -0,0 +1,169 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
+
+/**
+ * Utility layer to be able to draw graphics in a {@link MapContext}. Those
+ * graphics won't be stored and will be rendered on top of all the other
+ * MapContext's layers.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public interface GraphicLayer extends VectorLayer {
+
+	public static final int DEFAULT_PRIORITY = 100;
+
+	public static final String FEATURE_ATTR_FEATUREID = "featureId";
+	public static final String FEATURE_ATTR_GROUPID = "groupId";
+	public static final String FEATURE_ATTR_GEOMETRY = "geom";
+	public static final String FEATURE_ATTR_IDSYMBOL = "idsym";
+	public static final String FEATURE_ATTR_LABEL = "label";
+	public static final String FEATURE_ATTR_TAG = "tag";
+	public static final String FEATURE_ATTR_PRIORITY = "priority";
+
+	/**
+	 * Adds a new {@link ISymbol} to the layer to be used to render the
+	 * {@link Geometry} objects. The symbol will be added to the legend of the
+	 * layer.
+	 * 
+	 * @param newSymbol
+	 *            the {@link ISymbol} to add
+	 * @return an identifier of the symbol to be used when adding geometries
+	 */
+	public int addSymbol(ISymbol newSymbol);
+
+	/**
+	 * Returns the {@link ISymbol} of the layer with the given identifier.
+	 * 
+	 * @param symbolId
+	 *            the symbol identifier
+	 * @return the symbol with the given id or null if there is not any symbol
+	 *         registered with that id
+	 */
+	public ISymbol getSymbol(int symbolId);
+
+	/**
+	 * Returns the identifier of the symbol into the layer.
+	 * 
+	 * @param symbol
+	 *            the symbol to look for
+	 * @return the symbol identifier or -1 if it is not registered into the
+	 *         layer
+	 */
+	public int getSymbolId(ISymbol symbol);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym);
+
+	/**
+	 * @deprecated @see
+	 *             {@link #addGraphic(String, Geometry, int, String, Object, int)
+
+	 */
+	public void addGraphic(Geometry geom, int idsym);
+
+	/**
+	 * @deprecated @see
+	 *             {@link #addGraphic(String, Geometry, int, String, Object, int)
+
+	 */
+	public void addGraphic(Geometry geom, int idsym, String label);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 * @param label
+	 *            the text to show if the {@link ISymbol} is a
+	 *            {@link ITextSymbol}. Set null otherwise.
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym,
+			String label);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 * @param label
+	 *            the text to show if the {@link ISymbol} is a
+	 *            {@link ITextSymbol}. Set null otherwise.
+	 * @param tag
+	 *            an object to classify, identify or add related information to
+	 *            the {@link Geometry}
+	 * @param priority
+	 *            to apply while rendering the {@link Geometry}. Values with
+	 *            lower priority will be rendered first.
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym,
+			String label, Object tag, int priority);
+
+	/**
+	 * Removes all previously registered {@link Geometry} objects from the layer
+	 * with the given groupId.
+	 * 
+	 * @param groupId
+	 *            of the geometries to remove
+	 */
+	public void removeGraphics(String groupId);
+
+	/**
+	 * Removes all registered {@link Geometry} objects.
+	 */
+	public void clearAllGraphics();
+
+	/**
+	 * Removes all registered {@link ISymbol} objects.
+	 */
+	public int clearAllSymbols();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java	(revision 35988)
@@ -0,0 +1,107 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class CrossEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+	private String envelopeWKT;
+
+	public CrossEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+		this.srs = envelopeProjection.getAbrev();
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		if (isDefault) {
+			Feature feature = (Feature) data.getContextValue("feature");
+			//			return new Boolean(envelopeTrans.contains(feature
+			//					.getDefaultEnvelope())
+			//					|| envelopeTrans.intersects(feature.getDefaultEnvelope()));
+//			System.out.println("== Filter[" + envelopeTrans.getLowerCorner()[0]
+//					+ "," + envelopeTrans.getLowerCorner()[1] + "] ["
+//					+ envelopeTrans.getUpperCorner()[0] + ","
+//					+ envelopeTrans.getUpperCorner()[1] + "]");
+
+			Envelope featureEnvelope = feature.getDefaultEnvelope();
+//			System.out.println("== Geom ["
+//					+ featureEnvelope.getLowerCorner()[0]
+//					+ "," + featureEnvelope.getLowerCorner()[1] + "] ["
+//					+ featureEnvelope.getUpperCorner()[0] + ","
+//					+ featureEnvelope.getUpperCorner()[1] + "]");
+			Boolean r = new Boolean(envelopeTrans.intersects(featureEnvelope));
+//			System.out.println("==3 "+r);
+			return r;
+
+		} else {
+			Geometry geom = (Geometry) data.getDataValue(geomName);
+			//			return new Boolean(envelopeTrans.contains(geom.getEnvelope())
+			//					|| envelopeTrans.intersects(geom.getEnvelope()));
+
+			return new Boolean(envelopeTrans.intersects(geom.getEnvelope()));
+
+		}
+	}
+
+	public String getName() {
+		return "contains in envelope";
+	}
+
+	public String getSQL() {
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " intersects(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java	(revision 35988)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+
+
+/**
+ * Interator for iterate in a Layers tree
+ * <P>
+ * Extend this class to create an expecific layer iterator
+ * and override the method <code>evaluate</code> for check
+ * if a layer will be in the iteration list.
+ * <P> 
+ * @author jmvivo
+ *
+ */
+public class LayersIterator implements Iterator {
+	ArrayList layersList  =new ArrayList();
+	int index = 0;
+	
+	public LayersIterator() {
+		
+	}
+	
+	public LayersIterator(FLayer layer) {
+		this.appendLayer(layer);
+	}
+	
+	protected void appendLayer(FLayer layer) {
+		if (this.evaluate(layer)) {
+			layersList.add(layer);
+		}
+		if (layer instanceof LayerCollection) {
+			appendLayers((LayerCollection)layer);			
+		}
+	}
+	
+	private void appendLayers(LayerCollection layers) {
+		int i;
+		for (i=0;i< layers.getLayersCount();i++) {
+			appendLayer(layers.getLayer(i));
+		}
+	}
+
+	public void remove() {
+		throw new UnsupportedOperationException();		
+	}
+
+	public boolean hasNext() {
+		return  index < layersList.size();
+	}
+
+	public Object next() {		
+		return nextLayer();
+	}
+	
+    /**
+     * Returns the next layer in the iteration.
+     *
+     * @return the next layer in the iteration.
+     * @exception NoSuchElementException iteration has no more elements.
+     * 
+     * @see next()
+     */
+	public FLayer nextLayer() {
+		if (!this.hasNext()) {
+			throw new NoSuchElementException();
+		}
+		FLayer aux = (FLayer)layersList.get(index);
+		index++;
+		return aux;
+	}
+	
+	/**
+	 * Called before add a layer to the iteration
+	 * list.	 
+	 * @param layer the layer to check
+	 * @return true if the layer will be in the iteration list
+	 */
+	public boolean evaluate(FLayer layer) {
+		return true;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java	(revision 35988)
@@ -0,0 +1,130 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+
+/**
+ * Listener que est� pendiente de la selecci�n que se haga sobre la tabla para
+ * poder seleccionar de la tabla linkada los registros oportunos.
+ *
+ * @author Vicente Caballero Navarro
+ * @deprecated TODO Esto tendr�a que estar en appgvSIG en las tablas
+ */
+public class LinkSelectionListener implements SelectionListener {
+//	private SelectableDataSource modelo1;
+//	private SelectableDataSource modelo2;
+	private int index1;
+	private int index2;
+
+	/**
+	 * Crea un nuevo LinkSelectionListener. Donde se pasan como par�metros dos
+	 * SelectableDataSource, el primero de ellos(model1), representa la tabla
+	 * sobre la que al seleccionar alg�n registro buscaremos en el modelo2
+	 * para ver el valor del campo s1 y compararlo con el valor del campo s2 y
+	 * de esta forma seleccionar instantanemente los registros oportunos en la
+	 * tabla al que se representa con el modelo2.
+	 *
+	 * @param model1 SelectableDataSource de la tabla sobre la que se efectua
+	 * 		  el link.
+	 * @param model2 SelectableDataSource de la tabla linkada.
+	 * @param s1 nombre del campo de la tabla donde se efectua el link.
+	 * @param s2 nombre del campo de la tabla linkada.
+	 */
+//	public LinkSelectionListener(SelectableDataSource model1,
+//		SelectableDataSource model2, String s1, String s2) {
+//		modelo1 = model1;
+//		modelo2 = model2;
+//
+//		try {
+//			index1 = modelo1.getFieldIndexByName(s1);
+//			index2 = modelo2.getFieldIndexByName(s2);
+//		} catch (ReadDriverException e) {
+//			e.printStackTrace();
+//		}
+//
+//		//field1 = s1;
+//		//field2 = s2;
+//	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.layers.LegendListener#selectionChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void selectionChanged(SelectionEvent e) {
+//		FBitSet bs1 = modelo1.getSelection();
+//		FBitSet bs2 = new FBitSet(); //(FBitSet)modelo2.getSelection().clone();
+//		HashMap idx = new HashMap(bs1.cardinality());
+//		//int index1 = -1;
+//		//int index2 = -1;
+//
+//		try {
+//			//		Construimos el �ndice
+//			for (int i = bs1.nextSetBit(0); i >= 0;
+//					i = bs1.nextSetBit(i + 1)) {
+//				Value v = modelo1.getFieldValue((long) i, index1);
+//
+//				if (idx.get(v) == null) {
+//					idx.put(v, new Integer(i));
+//				}
+//			}
+//		} catch (ReadDriverException e2) {
+//			e2.printStackTrace();
+//		}
+//
+//		try {
+//			for (int i = 0; i < modelo2.getRowCount(); i++) {
+//				Value v = modelo2.getFieldValue(i, index2);
+//				Integer pi = (Integer) idx.get(v);
+//
+//				if (pi != null) {
+//					bs2.set(i);
+//				}
+//			}
+//		} catch (ReadDriverException e1) {
+//			e1.printStackTrace();
+//		}
+//
+//		// this applies the selection to the linked table
+//		if (modelo1!=modelo2)
+//			modelo2.setSelection(bs2);
+//		//modelo2.fireSelectionEvents();
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java	(revision 35988)
@@ -0,0 +1,189 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event produced when changes the visibility, activation, edition status, or the name of a layer.</p>
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class LayerEvent extends FMapEvent {
+	/**
+	 * <p>String that identifies the property that has changed.</p>
+	 */
+	private String property;
+
+	/**
+	 * <p>Layer affected by the action.</p>
+	 */
+	private FLayer source;
+
+	/**
+	 * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
+	 */
+	public static final int VISIBILITY_CHANGED = 0;
+
+	/**
+	 * <p>Identifies this event as a action of change of the activation status of a layer.</p>
+	 */
+	public static final int ACTIVATION_CHANGED = 1;
+	
+	/**
+	 * <p>Identifies this event as a action of a change of the name of a layer.</p>
+	 */
+	public static final int NAME_CHANGED = 2;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the edition status of a layer.</p>
+	 */
+	public static final int EDITION_CHANGED = 3;
+
+	/**
+	 * <p>Identifies this event as a action of change of any property that affects to draw of the layer.</p>
+	 */
+	public static final int DRAW_VALUES_CHANGED = 4;
+
+	/**
+	 * <p>Creates a new layer event notifying a "visibility changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, VISIBILITY_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer event notifying an "activation changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, ACTIVATION_CHANGED);
+	}
+	
+	public static LayerEvent createDrawValuesChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, DRAW_VALUES_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */	
+	public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, NAME_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer event notifying an "edition changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, EDITION_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer event of the specified type.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer collection event
+	 */
+	private LayerEvent(FLayer default1, String property, int eventType) {
+		source = default1;
+		this.property = property;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the layer affected.</p>
+	 *
+	 * @return the layer affected
+	 */
+	public FLayer getSource() {
+		return source;
+	}
+
+	/**
+	 * <p>Sets the layer affected.</p>
+	 *
+	 * @param the layer affected
+	 */
+	public void setSource(FLayer source) {
+		this.source = source;
+	}
+
+	/**
+	 * <p>Gets the property that has changed.</p>
+	 *
+	 * @return the property that has changed
+	 */
+	public String getProperty() {
+		return property;
+	}
+
+	/**
+	 * <p>Sets the property that has changed.</p>
+	 *
+	 * @param the property that has changed
+	 */
+	public void setProperty(String property) {
+		this.property = property;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java	(revision 35988)
@@ -0,0 +1,92 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+
+
+/**
+ * <p>Manages all legend listeners of a layer, notifying them any legend change event produced.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerChangeSupport {
+	/**
+	 * <p>The legend listeners of a layer.</p>
+	 */
+	private ArrayList listeners = new ArrayList();
+
+	/**
+	 * <p>Registers a <code>LegendListener</code>.</p>
+	 * 
+	 * @param listener the legend listener
+	 */
+	public void addLayerListener(LegendListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes a registered <code>LegendListener</code>.</p>
+	 *
+	 * @param listener the legend listener
+	 */
+	public void removeLayerListener(LegendListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * <p>Notifies a legend change to all legend listeners registered.</p>
+	 *
+	 * @param e a legend event with the new legend and events that compound this one
+	 */
+	public void callLegendChanged(LegendChangedEvent e) {
+		for (Iterator iter = listeners.iterator(); iter.hasNext();) {
+			LegendListener listener = (LegendListener) iter.next();
+
+			listener.legendChanged(e);
+		}
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java	(revision 35988)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.List;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.util.Converter;
+
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.index.ItemVisitor;
+import com.vividsolutions.jts.index.quadtree.Quadtree;
+
+public class SpatialCache  {
+	int maxFeatures = 1000; // Por defecto, pero se puede cambiar
+	int fastNumTotalRegs=0;
+	Quadtree quadTree = new Quadtree();
+	
+	private boolean enabled = false;
+
+	public int getMaxFeatures() {
+		return maxFeatures;
+	}
+
+	public void setMaxFeatures(int maxFeatures) {
+		this.maxFeatures = maxFeatures;
+	}
+
+	/**
+	 * M�todo de conveniencia
+	 *
+	 * @param r
+	 * @param igeometry
+	 */
+	public synchronized void insert(org.gvsig.fmap.geom.primitive.Envelope bounds, Geometry geom) {
+		if (isEnabled() && getMaxFeatures() >= size()) {
+			Envelope env = Converter.convertEnvelopeToJTS(bounds);
+			this.insert(env, geom);
+			//fastNumTotalRegs++;
+		}
+	}
+
+	public synchronized void query(Envelope searchEnv, ItemVisitor visitor)
+	{
+		quadTree.query(searchEnv, visitor);
+	}
+	public synchronized List query(Envelope searchEnv)
+	{
+		return quadTree.query(searchEnv);
+	}
+
+	public void insert(Envelope itemEnv, Object item) {
+		if (isEnabled() && getMaxFeatures() >= size()) {
+			quadTree.insert(itemEnv, item);
+			fastNumTotalRegs++;
+		}
+	}
+
+	public boolean remove(Envelope itemEnv, Object item) {
+		boolean resul = quadTree.remove(itemEnv, item);
+		if (resul)
+			fastNumTotalRegs--;
+		return resul;
+	}
+
+	public int size() {
+		return fastNumTotalRegs;
+	}
+
+	public void clearAll() {
+		quadTree = new Quadtree();
+		fastNumTotalRegs = 0;
+	}
+
+	public void remove(org.gvsig.fmap.geom.primitive.Envelope bounds, Geometry geom) {
+		Envelope env = Converter.convertEnvelopeToJTS(bounds);
+		this.remove(env,geom);
+	}
+
+	public boolean isEnabled() {
+		return enabled;
+	}
+
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java	(revision 35988)
@@ -0,0 +1,1037 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Image;
+import java.awt.geom.Point2D;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.metadata.MetadataContainer;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * <p>Implementation of the common characteristics of all layers: visibility, activation, name, ...</p>
+ *
+ * <p>Represents the definition of a basic layer, implementing {@link FLayer FLayer}, and new functionality:
+ * <ul>
+ *  <li>Supports transparency.
+ *  <li>Notification of evens produced using this layer.
+ *  <li>Can have internal virtual layers.
+ *  <li>Can have a text layer.
+ *  <li>Supports an strategy for visit its geometries.
+ *  <li>Can have an image in the <i>TOC (table of contents)</i> associated to the state of this layer.
+ * </ul>
+ * </p>
+ *
+ * <p>Each graphical layer will inherit from this class and adapt to its particular logic and model according
+ *  its nature.</p>
+ *
+ * @see FLayer
+ * @see FLayerStatus
+ */
+public abstract class FLyrDefault extends AbstractDisposable implements FLayer,
+		LayerListener {
+	/**
+	 * Useful for debug the problems during the implementation.
+	 */
+	final static private org.slf4j.Logger logger = LoggerFactory.getLogger(FLyrDefault.class);
+
+	private LayerChangeSupport layerChangeSupport = new LayerChangeSupport();
+
+	/**
+	 * Path to the upper layer which this layer belongs.
+	 *
+	 * @see #getParentLayer()
+	 * @see #setParentLayer(FLayers)
+	 */
+	private FLayers parentLayer = null;
+
+	/**
+	 * Transparency level of this layer in the range 0-255. By default 255.
+	 * 0   --> Transparent
+	 * 255 --> Opaque
+	 *
+	 * @see #getTransparency()
+	 * @see #setTransparency(int)
+	 */
+	private int transparency = 255;
+
+	/**
+	 * Coordinate transformation.
+	 *
+	 * @see #getCoordTrans()
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	private ICoordTrans ct;
+
+	/**
+	 * Minimum scale, >= 0 or -1 if not defined. By default -1.
+	 *
+	 * @see #getMinScale()
+	 * @see #setMinScale(double)
+	 */
+	private double minScale = -1; // -1 indica que no se usa
+
+	/**
+	 * Maximum scale, >= 0 or -1 if not defined. By default -1.
+	 *
+	 * @see #getMaxScale()
+	 * @see #setMaxScale(double)
+	 */
+	private double maxScale = -1;
+	//	private boolean isInTOC = true;
+
+	/**
+	 * Array list with all listeners registered to this layer.
+	 *
+	 * @see #getLayerListeners()
+	 * @see #removeLayerListener(LayerListener)
+	 * @see #callEditionChanged(LayerEvent)
+	 */
+	protected ArrayList layerListeners = new ArrayList();
+
+
+	/**
+	 * Hash table with the extended properties of this layer.
+	 *
+	 * @see #getProperty(Object)
+	 * @see #setProperty(Object, Object)
+	 * @see #getExtendedProperties()
+	 */
+	private Map properties = new Hashtable();
+
+	//by default, all is active, visible and avalaible
+	/**
+	 * Status of this layer.
+	 *
+	 * @see #getFLayerStatus()
+	 * @see #setFLayerStatus(FLayerStatus)
+	 * @see #isActive()
+	 * @see #setActive(boolean)
+	 * @see #isVisible()
+	 * @see #setVisible(boolean)
+	 * @see #visibleRequired()
+	 * @see #isEditing()
+	 * @see #setEditing(boolean)
+	 * @see #isInTOC()
+	 * @see #isCachingDrawnLayers()
+	 * @see #setCachingDrawnLayers(boolean)
+	 * @see #isDirty()
+	 * @see #setDirty(boolean)
+	 * @see #isAvailable()
+	 * @see #setAvailable(boolean)
+	 * @see #isOk()
+	 * @see #isWritable()
+	 * @see #getNumErrors()
+	 * @see #getError(int)
+	 * @see #getErrors()
+	 * @see #addError(BaseException)
+	 */
+	private FLayerStatus status = new FLayerStatus();
+	/**
+	 * Image drawn shown in the TOC according the status of this layer.
+	 *
+	 * @see #getTocStatusImage()
+	 * @see #setTocStatusImage(Image)
+	 */
+	private Image tocStatusImage;
+
+	protected MetadataContainer metadataContainer;
+
+	/**
+	 * Draw version of the context. It's used for know when de componend has
+	 * changed any visualization property
+	 *
+	 *  @see getDrawVersion
+	 *  @see updateDrawVersion
+	 */
+	private long drawVersion= 0L;
+
+	public FLyrDefault(MetadataContainer metadataContainer) {
+		this.metadataContainer = metadataContainer;
+	}
+
+	public FLyrDefault() {
+		this(MetadataLocator
+			.getMetadataManager()
+				.createMetadataContainer(FLayer.METADATA_DEFINITION_NAME)
+		);
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getProperty(java.lang.Object)
+	 */
+	public Object getProperty(Object key) {
+		return properties.get(key);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setProperty(java.lang.Object, java.lang.Object)
+	 */
+	public void setProperty(Object key, Object val) {
+		properties.put(key, val);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getExtendedProperties()
+	 */
+	public Map getExtendedProperties() {
+		return properties;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean)
+	 */
+	public void setActive(boolean selected) {
+		status.active = selected;
+		callActivationChanged(LayerEvent.createActivationChangedEvent(this,
+		"active"));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isActive()
+	 */
+	public boolean isActive() {
+		return status.active;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String)
+	 */
+	public void setName(String name) {
+		this.metadataContainer.setDynValue(METADATA_NAME, name);
+		callNameChanged(LayerEvent.createNameChangedEvent(this, "name"));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getName()
+	 */
+	public String getName() {
+		return (String) this.metadataContainer.getDynValue(METADATA_NAME);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#load()
+	 */
+	public void load() throws LoadLayerException {
+	    MetadataManager manager = MetadataLocator.getMetadataManager();
+	    try {
+            manager.loadMetadata(this);
+        } catch (MetadataException e) {
+            throw new LoadLayerException("Can't load metadata." , e );
+        }
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean)
+	 */
+	public void setVisible(boolean visibility) {
+		if (status.visible != visibility){
+			status.visible = visibility;
+			this.updateDrawVersion();
+
+			//			if (this.getMapContext() != null){
+			//				this.getMapContext().clearAllCachingImageDrawnLayers();
+			//			}
+			callVisibilityChanged(LayerEvent.createVisibilityChangedEvent(this,
+			"visible"));
+		}
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isVisible()
+	 */
+	public boolean isVisible() {
+		return status.visible && status.available;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getParentLayer()
+	 */
+	public FLayers getParentLayer() {
+		return parentLayer;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setParentLayer(com.iver.cit.gvsig.fmap.layers.FLayers)
+	 */
+	public void setParentLayer(FLayers root) {
+		if (this.parentLayer != root){
+			this.parentLayer = root;
+			this.updateDrawVersion();
+		}
+	}
+
+	/**
+	 * <p>Inserts the projection to this layer.</p>
+	 *
+	 * @param proj information about the new projection
+	 *
+	 * @see #isReprojectable()
+	 * @see #reProject(MapControl)
+	 */
+	public void setProjection(IProjection proj) {
+		IProjection curProj = this.getProjection();
+		if (curProj == proj) {
+			return;
+		}
+		if (curProj != null && curProj.equals(proj)){
+			return;
+		}
+		this.updateDrawVersion();
+		this.metadataContainer.setDynValue(METADATA_CRS, proj);
+		// Comprobar que la proyecci�n es la misma que la de FMap
+		// Si no lo es, es una capa que est� reproyectada al vuelo
+		if ((proj != null) && (getMapContext() != null)) {
+			if (proj != getMapContext().getProjection()) {
+				ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+				setCoordTrans(ct);
+				logger.debug("Cambio proyecci�n: FMap con "
+						+ getMapContext().getProjection().getAbrev() + " y capa "
+						+ getName() + " con " + proj.getAbrev());
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.cresques.geo.Projected#getProjection()
+	 */
+	public IProjection getProjection() {
+		return (IProjection) this.metadataContainer.getDynValue(METADATA_CRS);
+	}
+
+	/**
+	 * <p>Changes the projection of this layer.</p>
+	 * <p>This method will be overloaded in each kind of layer, according its specific nature.</p>
+	 *
+	 * @param mapC <code>MapControl</code> instance that will reproject this layer
+	 *
+	 * @return <code>true<code> if the layer has been created calling {@link FLayers#addLayer(FLayer) FLayers#addLayer}. But returns <code>false</code>
+	 *  if the load control logic of this layer is in the reprojection method
+	 *
+	 * @see #isReprojectable()
+	 * @see #setProjection(IProjection)
+	 */
+	public void reProject(ICoordTrans arg0) {
+	}
+
+	/**
+	 * Returns the transparency level of this layer, in the range 0-255 .
+	 *
+	 * @return the transparency level
+	 *
+	 * @see #setTransparency(int)
+	 */
+	public int getTransparency() {
+		return transparency;
+	}
+
+	/**
+	 * Inserts the transparency level for this layer, the range allowed is 0-255 .
+	 *
+	 * @param trans the transparency level
+	 *
+	 * @see #getTransparency()
+	 */
+	public void setTransparency(int trans) {
+		if (this.transparency != trans){
+			transparency = trans;
+			this.updateDrawVersion();
+		}
+	}
+	
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMapContext()
+	 */
+	public MapContext getMapContext() {
+		if (getParentLayer() != null) {
+			return getParentLayer().getMapContext();
+		} else {
+			return null;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+	 */
+	public boolean addLayerListener(LayerListener o) {
+		if (layerListeners.contains(o)) {
+			return false;
+		}
+		return layerListeners.add(o);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLayerListeners()
+	 */
+	public LayerListener[] getLayerListeners() {
+		return (LayerListener[])layerListeners.toArray(new LayerListener[0]);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#removeLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+	 */
+	public boolean removeLayerListener(LayerListener o) {
+		return layerListeners.remove(o);
+	}
+	/**
+	 *
+	 */
+	private void callDrawValueChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.drawValueChanged(e);
+		}
+	}
+	/**
+	 * Called by the method {@linkplain #setName(String)}. Notifies all listeners associated to this layer,
+	 *  that its name has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setName(String)
+	 */
+	private void callNameChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.nameChanged(e);
+		}
+	}
+
+	/**
+	 * Called by the method {@linkplain #setVisible(boolean)}. Notifies all listeners associated to this layer,
+	 *  that its visibility has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setVisible(boolean)
+	 */
+	private void callVisibilityChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.visibilityChanged(e);
+		}
+	}
+
+	/**
+	 * Called by the method {@linkplain #setActive(boolean)}. Notifies all listeners associated to this layer,
+	 *  that its active state has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setActive(boolean)
+	 */
+	private void callActivationChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.activationChanged(e);
+		}
+	}
+
+	/**
+	 * Returns the virtual layers associated to this layer.
+	 *
+	 * @return a node with the layers
+	 *
+	 * @see #setVirtualLayers(FLayers)
+	 */
+	//	public FLayers getVirtualLayers() {
+	//		return virtualLayers;
+	//	}
+
+	/**
+	 * Inserts virtual layers to this layer.
+	 *
+	 * @param virtualLayers a node with the layers
+	 *
+	 * @see #getVirtualLayers()
+	 */
+	//	public void setVirtualLayers(FLayers virtualLayers) {
+	//		this.virtualLayers = virtualLayers;
+	//	}
+
+	/**
+	 * Sets transformation coordinates for this layer.
+	 *
+	 * @param ct an object that implements the <code>ICoordTrans</code> interface, and with the transformation coordinates
+	 *
+	 * @see #getCoordTrans()
+	 */
+	public void setCoordTrans(ICoordTrans ct) {
+		if (this.ct == ct){
+			return;
+		}
+		if (this.ct != null && this.ct.equals(ct)){
+			return;
+		}
+		this.ct = ct;
+		this.updateDrawVersion();
+	}
+
+	/**
+	 * Returns the transformation coordinates of this layer.
+	 *
+	 * @return an object that implements the <code>ICoordTrans</code> interface, and with the transformation coordinates
+	 *
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	public ICoordTrans getCoordTrans() {
+		return ct;
+	}
+
+	/**
+	 * <p>Method called by {@link FLayers FLayers} to notify this layer that is going to be added.
+	 *  This previous notification is useful for the layers that need do something before being added. For
+	 *  example, the raster needs reopen a file that could have been closed recently.</p>
+	 */
+	public void wakeUp() throws LoadLayerException {
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMinScale()
+	 */
+	public double getMinScale() {
+		return minScale;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMaxScale()
+	 */
+	public double getMaxScale() {
+		return maxScale;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setMinScale(double)
+	 */
+	public void setMinScale(double minScale) {
+		if (this.minScale != minScale){
+			this.minScale = minScale;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setMaxScale(double)
+	 */
+	public void setMaxScale(double maxScale) {
+		if (this.maxScale != maxScale){
+			this.maxScale = maxScale;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isWithinScale(double)
+	 */
+	public boolean isWithinScale(double scale) {
+
+		boolean bVisible = true;
+		if (getMinScale() != -1) {
+			if (scale < getMinScale()){
+				bVisible = false;
+			}
+		}
+		if (getMaxScale() != -1) {
+			if (scale > getMaxScale()) {
+				bVisible = false;
+			}
+		}
+
+		return bVisible;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setEditing(boolean)
+	 */
+	public void setEditing(boolean b) throws StartEditionLayerException {
+		status.editing = b;
+	}
+	/**
+	 * Called by some version of the method {@linkplain #setEditing(boolean)} overwritten. Notifies
+	 *  all listeners associated to this layer, that its edition state has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setEditing(boolean)
+	 */
+	protected void callEditionChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.editionChanged(e);
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isEditing()
+	 */
+	public boolean isEditing() {
+		return status.editing;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getTocImageIcon()
+	 */
+	public String getTocImageIcon() {
+		return "toc-layer-group";
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isInTOC()
+	 */
+	public boolean isInTOC() {
+		return status.inTOC;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setInTOC(boolean)
+	 */
+	public void setInTOC(boolean b) {
+		status.inTOC=b;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isAvailable()
+	 */
+	public boolean isAvailable() {
+		return status.available;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setAvailable(boolean)
+	 */
+	public void setAvailable(boolean available) {
+		if (status.available != available){
+			status.available = available;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#reload()
+	 */
+	public void reload() throws ReloadLayerException {
+		this.setAvailable(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFLayerStatus()
+	 */
+	public FLayerStatus getFLayerStatus(){
+		return status.cloneStatus();
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setFLayerStatus(com.iver.cit.gvsig.fmap.layers.FLayerStatus)
+	 */
+	public void setFLayerStatus(FLayerStatus status){
+		if (!this.status.equals(status)){
+			this.status = status;
+			this.updateDrawVersion();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isOk()
+	 */
+
+	public boolean isOk(){
+		return status.isOk();
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getNumErrors()
+	 */
+	public int getNumErrors(){
+		return status.getNumErrors();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getError(int)
+	 */
+	public BaseException getError(int i){
+		return status.getError(i);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getErrors()
+	 */
+	public List getErrors(){
+		return status.getErrors();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#addError(BaseException)
+	 */
+	public void addError(BaseException exception){
+		status.addLayerError(exception);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#visibleRequired()
+	 */
+	public boolean visibleRequired() {
+		return status.visible;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getInfoString()
+	 */
+	public String getInfoString() {
+		return null;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isWritable()
+	 */
+	public boolean isWritable() {
+		return status.writable;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#cloneLayer()
+	 */
+	public FLayer cloneLayer() throws Exception {
+		return this;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getTocStatusImage()
+	 */
+	public Image getTocStatusImage() {
+		return tocStatusImage;
+	}
+
+	/**
+	 * Inserts the image icon that will be shown in the TOC next to this layer, according its status.
+	 *
+	 * @param tocStatusImage the image
+	 *
+	 * @see #getTocStatusImage()
+	 */
+	public void setTocStatusImage(Image tocStatusImage) {
+		this.tocStatusImage = tocStatusImage;
+		logger.debug("setTocStatusImage " + tocStatusImage + " sobre capa " + this.getName());
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#newComposedLayer()
+	 */
+	public ComposedLayer newComposedLayer() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#allowLinks()
+	 */
+	public boolean allowLinks()
+	{
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLinkProperties()
+	 */
+	public AbstractLinkProperties getLinkProperties()
+	{
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLink(java.awt.geom.Point2D, double)
+	 */
+	public URI[] getLink(Point2D point, double tolerance) throws ReadException{
+		return null;
+	}
+
+	/**
+	 * @see LayerChangeSupport#addLayerListener(LegendListener)
+	 */
+	public void addLegendListener(LegendListener listener) {
+		layerChangeSupport.addLayerListener(listener);
+	}
+
+	/**
+	 * @see LayerChangeSupport#callLegendChanged(LegendChangedEvent)
+	 */
+	protected void callLegendChanged(LegendChangedEvent e) {
+		layerChangeSupport.callLegendChanged(e);
+		if(parentLayer != null) {
+			parentLayer.callLegendChanged(e);
+		}
+	}
+
+	/**
+	 * @see LayerChangeSupport#removeLayerListener(LegendListener)
+	 */
+	public void removeLegendListener(LegendListener listener) {
+		layerChangeSupport.removeLayerListener(listener);
+	}
+	public String getClassName() {
+		return this.getClass().getName();
+	}
+
+	public void delegate(DynObject dynObject) {
+		this.metadataContainer.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		return this.metadataContainer.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		return this.metadataContainer.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		return this.metadataContainer.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		this.metadataContainer.implement(dynClass);
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+	throws DynMethodException {
+		return this.metadataContainer.invokeDynMethod(this, code, context);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+	throws DynMethodException {
+		return this.metadataContainer.invokeDynMethod(this, name, context);
+	}
+
+	public void setDynValue(String name, Object value)
+	throws DynFieldNotFoundException {
+		this.metadataContainer.setDynValue(name, value);
+	}
+
+	public long getDrawVersion() {
+		return this.drawVersion;
+	}
+
+	protected void updateDrawVersion(){
+		this.drawVersion++;
+		this.callDrawValueChanged(LayerEvent.createDrawValuesChangedEvent(this, ""));
+		if (this.parentLayer != null){
+			this.parentLayer.updateDrawVersion();
+		}
+	}
+
+	public boolean hasChangedForDrawing(long value){
+		return this.drawVersion > value;
+	}
+
+	public void activationChanged(LayerEvent e) {
+	}
+
+	public void drawValueChanged(LayerEvent e) {
+		this.updateDrawVersion();
+	}
+
+	public void editionChanged(LayerEvent e) {
+
+	}
+
+	public void nameChanged(LayerEvent e) {
+
+	}
+
+	public void visibilityChanged(LayerEvent e) {
+
+	}
+	
+	// ========================================================
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("parentLayer", parentLayer);
+		state.set("status",status);
+		state.set("minScale", minScale);
+		state.set("maxScale", maxScale);
+		state.set("transparency",transparency);
+		state.set("coordTrans",ct);
+		state.set("name", getName());
+		state.set("crs", getProjection());
+		state.set("properties",properties);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		this.parentLayer = (FLayers) state.get("parentLayer");
+		this.status = (FLayerStatus) state.get("status");
+		this.minScale = state.getDouble("minScale");
+		this.minScale = state.getDouble("maxScale");
+		this.transparency = state.getInt("transparency");
+		this.ct = (ICoordTrans) state.get("coordTrans");
+
+		this.setDynValue(METADATA_NAME, state.getString("name"));
+		this.setDynValue(METADATA_CRS, state.get("crs"));
+		
+		this.properties = new Hashtable((Map)state.get("properties"));
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLyrDefault.class,
+				"FLyrDefault",
+				"FLyrDefault Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name").setMandatory(false);
+		definition.addDynFieldInt("transparency").setMandatory(true);
+		definition.addDynFieldDouble("minScale").setMandatory(true);
+		definition.addDynFieldDouble("maxScale").setMandatory(true);
+		definition.addDynFieldObject("crs").setClassOfValue(IProjection.class).setMandatory(false);
+		definition.addDynFieldObject("parentLayer").setClassOfValue(FLayers.class).setMandatory(false);
+		definition.addDynFieldObject("coordTrans").setClassOfValue(ICoordTrans.class).setMandatory(false);
+		definition.addDynFieldObject("status").setClassOfValue(FLayerStatus.class).setMandatory(true);
+		definition.addDynFieldMap("properties").setClassOfItems(Object.class)
+				.setMandatory(true);
+	}
+
+	
+//	/**
+//	 * Splits string into an array of strings
+//	 * @param input input string
+//	 * @param sep separator string
+//	 * @return an array of strings
+//	 */
+//	public static String[] splitString(String input, String sep) {
+//		return Pattern.compile(sep).split(input, 0);
+//	}
+	
+	public void clear() {
+		if (metadataContainer != null) {
+			metadataContainer.clear();
+		}
+	}
+	
+    public String getMetadataName() throws MetadataException {
+        return FLayer.METADATA_DEFINITION_NAME;
+    }
+    
+	public static void registerMetadata() {
+		MetadataManager metadataManager = MetadataLocator.getMetadataManager();
+
+		
+		DynStruct metadataDefinition = metadataManager.getDefinition(FLayer.METADATA_DEFINITION_NAME);
+		if (metadataDefinition == null) {
+			try {
+				metadataDefinition = metadataManager.addDefinition(
+						FLayer.METADATA_DEFINITION_NAME,
+						FLayer.METADATA_DEFINITION_DESCRIPTION);
+				metadataDefinition.addDynField(FLayer.METADATA_NAME)
+						.setMandatory(true);
+
+				metadataDefinition.addDynFieldObject(FLayer.METADATA_CRS)
+						.setType(DataTypes.CRS).setMandatory(true);
+			} catch (MetadataException e) {
+				logger.warn("Can't create metadata definition for 'Layer'", e);
+			}
+		}
+	}
+	
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java	(revision 35988)
@@ -0,0 +1,503 @@
+/*
+ * Created on 28-dic-2004
+ *
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Capa de texto.
+ *
+ * @author FJP
+ * @deprecated
+ */
+public class FLyrText extends FLyrDefault implements ClassifiableVectorial {
+    /**
+     * <code>m_labels</code> es una arrayList de FLabel (string + punto de
+     * inserci�n + rotaci�n + altura de texto
+     */
+    private ArrayList m_labels = new ArrayList();
+
+    private IVectorLegend legend;
+
+    // private Rectangle2D fullExtent;
+    private FLyrVect assocLyrVect = null;
+
+    /**
+     * Crea un nuevo FLyrText.
+     *
+     * @param arrayLabels
+     *            DOCUMENT ME!
+     */
+    public FLyrText() {
+    	super();
+    }
+
+//    /**
+//     * Esto tiene el fallo de que obligas a una etiqueta por
+//     * entidad, para poder evitar esto, una posible soluci�n
+//     * ser�a que un FLabel pudiera ser una colecci�n de FLabel
+//     * (Patr�n Composite)
+//     * @param lyrVect
+    // * @throws ReadDriverException
+//     */
+//    public void createLabels(FLyrVect lyrVect) throws ReadDriverException {
+//
+//        assocLyrVect = lyrVect;
+//        SelectableDataSource ds=null;
+//			ds = lyrVect.getRecordset();
+//
+//        try {
+//           	ReadableVectorial adapter = lyrVect.getSource();
+//            adapter.start();
+//            ds.start();
+//            int sc;
+//            int fieldId = ds.getFieldIndexByName(legend.getLabelField());
+//            IVectorialLegend l = (IVectorialLegend) getLegend();
+//            int idFieldHeightText = -1;
+//            int idFieldRotationText = -1;
+//
+////            FSymbol defaultSym = (FSymbol) l.getDefaultSymbol();
+////
+////            if (l.getLabelHeightField() != null) {
+////                idFieldHeightText = ds.getFieldIndexByName(l
+////                        .getLabelHeightField());
+////                defaultSym.setFontSizeInPixels(false);
+////            }
+////
+////            if (l.getLabelRotationField() != null) {
+////                idFieldRotationText = ds.getFieldIndexByName(l
+////                        .getLabelRotationField());
+////            }
+//
+//            sc = (int) ds.getRowCount();
+//            m_labels = new ArrayList(sc);
+//
+//
+//            DriverAttributes attr = adapter.getDriverAttributes();
+//            boolean bMustClone = false;
+//            if (attr != null) {
+//                if (attr.isLoadedInMemory()) {
+//                    bMustClone = attr.isLoadedInMemory();
+//                }
+//            }
+//            ICoordTrans ct = getCoordTrans();
+//
+//
+//            for (int i = 0; i < sc; i++) {
+//                IGeometry geom = adapter.getShape(i);
+//
+//                if (geom == null) {
+//                    m_labels.add(null);
+//                    continue;
+//                }
+//                if (ct != null) {
+//                    if (bMustClone)
+//                        geom = geom.cloneGeometry();
+//                    geom.reProject(ct);
+//                }
+//
+//                // TODO: El m�todo contenedor (createLabelLayer) debe recoger
+//                // los par�metros de posicionamiento y de allowDuplicates
+//                // if (i >= 328)
+//                // System.out.println("i= " + i + " " + val.toString());
+//                Value val = ds.getFieldValue(i, fieldId);
+//
+//                if ((val instanceof NullValue) || (val == null)) {
+//                    continue;
+//                }
+//
+//                FLabel[] lbls = geom.createLabels(0, true);
+//				for (int j = 0; j < lbls.length; j++) {
+//					if (lbls[j] != null) {
+//						lbls[j].setString(val.toString());
+//
+//						if (idFieldHeightText != -1) {
+//							NumericValue height = (NumericValue) ds.getFieldValue(i,
+//									idFieldHeightText);
+//							lbls[j].setHeight(height.floatValue());
+//						} else {
+//                            // El tama�o del texto va siempre en el simbolo por defecto
+//                            // cuando no hay un campo de altura de texto
+//                            // TODO: Todo esto cambiar� con el nuevo sistema de leyendas...
+//// jaume							if (l.getDefaultSymbol()!=null)
+//// jaume					lbls[j].setHeight(defaultSym.getFontSize());
+//						}
+//
+//						if (idFieldRotationText != -1) {
+//							DoubleValue rotation = (DoubleValue) ds.getFieldValue(i,
+//									idFieldRotationText);
+//							lbls[j].setRotation(rotation.getValue());
+//						}
+//						m_labels.add(lbls[j]);
+//					}
+//
+//
+//				}
+//
+//                /* if (lbls[0] == null)
+//                    m_labels.add(null);
+//                else
+//                    m_labels.add(lbls[0].getOrig()); */
+//            }
+//
+//            ds.stop();
+//            adapter.stop();
+//        } catch (ExpansionFileReadException e) {
+//        	 throw new ReadDriverException(getName(),e);
+//		} catch (InitializeDriverException e) {
+//			 throw new ReadDriverException(getName(),e);
+//		}
+//
+//    }
+
+    /**
+     * Dibuja sobre el graphics los textos.
+     *
+     * @param image
+     * @param g
+     *            Graphics.
+     * @param viewPort
+     *            ViewPort.
+     * @param cancel
+     */
+//    private void drawLabels(BufferedImage image, Graphics2D g,
+//            ViewPort viewPort, Cancellable cancel) {
+//        int numReg;
+//        /*
+//         * refactored... labels will be managed by the LabelingStrategy
+//        Rectangle2D elExtent = viewPort.getAdjustedExtent();
+//
+//        // int anchoMapa;
+//        // int altoMapa;
+//        // double anchoReal;
+//        // double altoReal;
+//        // double escala;
+//        ISymbol theSymbol = null;
+//        System.out.println("Dibujando etiquetas...");
+//
+//        for (numReg = 0; numReg < m_labels.size(); numReg++) {
+//            if (cancel.isCanceled()) {
+//                break;
+//            }
+//
+//            FLabel theLabel = (FLabel) m_labels.get(numReg);
+//            if ((theLabel == null) || (theLabel.getOrig() == null))
+//                continue;
+//
+//            if (elExtent.contains(theLabel.getOrig())) // TODO: Aqui hay que
+//            // ponerle al FLabel un
+//            // getExtent()
+//            {
+//                theSymbol = getLegend().getDefaultSymbol();
+//
+//                FShape shp = new FPoint2D(theLabel.getOrig().getX(), theLabel
+//                        .getOrig().getY());
+//
+//                theLabel.draw(g, viewPort.getAffineTransform(), shp, theSymbol);
+//                // FGraphicUtilities.DrawLabel(g, viewPort.getAffineTransform(),
+//                //         shp, theSymbol, theLabel);
+//            }
+//        }
+//        */
+//    }
+
+//    /**
+//     * @deprecated use drawlabels (compatibility with postgis)
+//     * @param image
+//     * @param g
+//     * @param viewPort
+//     * @param cancel
+    // * @throws ReadDriverException
+//     */
+//    private void drawLabels2(BufferedImage image, Graphics2D g,
+//            ViewPort viewPort, Cancellable cancel) throws ReadDriverException {
+//        int numReg;
+//        Rectangle2D elExtent = viewPort.getAdjustedExtent();
+//
+//        // int anchoMapa;
+//        // int altoMapa;
+//        // double anchoReal;
+//        // double altoReal;
+//        // double escala;
+//        FSymbol theSymbol = null;
+//        System.out.println("Dibujando etiquetas...");
+//        FLabel theLabel = new FLabel();
+//
+//        SelectableDataSource ds=null;
+//			ds = assocLyrVect.getRecordset();
+//	        int fieldId = ds.getFieldIndexByName(legend.getLabelField());
+//            IVectorialLegend l = (IVectorialLegend) getLegend();
+//            int idFieldHeightText = -1;
+//            int idFieldRotationText = -1;
+//            FSymbol defaultSym = (FSymbol) l.getDefaultSymbol();
+//
+//            if (l.getLabelHeightField() != null) {
+//                // l.setBWithHeightText(true);
+//                idFieldHeightText = ds.getFieldIndexByName(l
+//                        .getLabelHeightField());
+//                defaultSym.setFontSizeInPixels(false);
+//            }
+//            /*
+//             * }else{ l.setBWithHeightText(false); }
+//             */
+//
+//            // boolean bWithRotationText = false;
+//            if (l.getLabelRotationField() != null) {
+//                // bWithRotationText = true;
+//                idFieldRotationText = ds.getFieldIndexByName(l
+//                        .getLabelRotationField());
+//            }
+//
+//            for (numReg = 0; numReg < m_labels.size(); numReg++) {
+//                if (cancel.isCanceled()) {
+//                    break;
+//                }
+//
+//                Point2D thePoint = (Point2D) m_labels.get(numReg);
+//
+//
+//
+//                if (thePoint == null)
+//                    continue;
+//                FPoint2D theShape = new FPoint2D(thePoint);
+//                if (getCoordTrans() != null)
+//                    theShape.reProject(this.getCoordTrans());
+//
+//                if (elExtent.contains(theShape.getX(), theShape.getY())) // TODO: Aqui hay que
+//                // ponerle al FLabel un
+//                // getExtent()
+//                {
+//                    Value val = ds.getFieldValue(numReg, fieldId);
+//
+//                    if ((val instanceof NullValue) || (val == null)) {
+//                        continue;
+//                    }
+//
+//                    theSymbol = defaultSym;
+//                    theLabel.setString(val.toString());
+//                    theLabel.setOrig(thePoint);
+//
+//                    if (idFieldHeightText != -1) {
+//                        NumericValue height = (NumericValue) ds
+//                                .getFieldValue(numReg, idFieldHeightText);
+//                        theLabel.setHeight(height.floatValue());
+//                    } else {
+//                        // El tama�o del texto va siempre en el simbolo por
+//                        // defecto
+//                        // cuando no hay un campo de altura de texto
+//                        // TODO: Todo esto cambiar� con el nuevo sistema de
+//                        // leyendas...
+//                        if (defaultSym != null)
+//                            theLabel.setHeight(defaultSym.getFontSize());
+//                    }
+//
+//                    if (idFieldRotationText != -1) {
+//                        DoubleValue rotation = (DoubleValue) ds
+//                                .getFieldValue(numReg, idFieldRotationText);
+//                        theLabel.setRotation(rotation.getValue());
+//                    }
+//                    theLabel.draw(g, viewPort.getAffineTransform(), theShape, theSymbol);
+//                }
+//            }
+//
+//
+//    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
+     */
+    public Envelope getFullEnvelope() throws ReadException {
+        return assocLyrVect.getFullEnvelope();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage,
+     *      java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort,
+     *      com.iver.cit.gvsig.fmap.operations.Cancellable)
+     */
+    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+            Cancellable cancel, double scale) throws ReadException {
+//        if (isVisible() && isWithinScale(scale)) {
+//            drawLabels(image, g, viewPort, cancel);
+//        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
+     *      com.iver.cit.gvsig.fmap.ViewPort,
+     *      com.iver.cit.gvsig.fmap.operations.Cancellable)
+     */
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, PrintAttributes properties) throws ReadException {
+//        if (isVisible() && isWithinScale(scale)) {
+//            drawLabels(null, g, viewPort, cancel);
+//        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial#setLegend(com.iver.cit.gvsig.fmap.rendering.VectorialLegend)
+     */
+    public void setLegend(IVectorLegend r) {
+        legend = r;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#addLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener)
+     */
+    public void addLegendListener(LegendListener listener) {
+        // TODO Auto-generated method stub
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#removeLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener)
+     */
+    public void removeLegendListener(LegendListener listener) {
+        // TODO Auto-generated method stub
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getLegend()
+     */
+    public ILegend getLegend() {
+        return legend;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getShapeType()
+     */
+    public int getShapeType() {
+        return legend.getShapeType();
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+	 */
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataID()
+	 */
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataName()
+	 */
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    /**
+     * Devuelve un ArrayList con los textos de la capa.
+     *
+     * @return Texto de la capa.
+     */
+    /* public ArrayList getLabels() {
+        return m_labels;
+    } */
+
+    /**
+     * Inserta los textos de la capa
+     *
+     * @param m_labels
+     *            ArrayList con los textos de la capa.
+     */
+    /* public void setLabels(ArrayList m_labels) {
+        this.m_labels = m_labels;
+    } */
+	
+	public static void registerPersistent() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	protected void doDispose() throws BaseException {
+		// Nothing to do
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java	(revision 35988)
@@ -0,0 +1,88 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.mapcontext.layers;
+
+
+
+/**
+ * <p><code>LayerListener</code> defines the interface for an object that listens
+ *  to changes in a layer.</p>
+ */
+public interface LayerListener {
+	/**
+	 * <p>Called when the visibility of a layer has changed.</p>
+	 * 
+	 * @param e a visibility changed layer event object
+	 */
+	public void visibilityChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the activation of a layer has changed.</p>
+	 * 
+	 * @param e an activation changed layer event object
+	 */
+	public void activationChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the name of a layer has changed.</p>
+	 * 
+	 * @param e a name changed layer event object
+	 */
+	public void nameChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the edition of a layer has changed.</p>
+	 * 
+	 * @param e an edition changed layer event object
+	 */
+	public void editionChanged(LayerEvent e);
+
+	/**
+	 * <p>
+	 * Called when a draw value of a layer has changed.
+	 * </p>
+	 * 
+	 * @param e
+	 *            an edition changed layer event object
+	 */
+	public void drawValueChanged(LayerEvent e);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java	(revision 35988)
@@ -0,0 +1,643 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.cresques.geo.Projected;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.metadata.Metadata;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * <p>Definition of the basic functionality that all kind of <i>FMap</i> layers should implement.</p>
+ *
+ * <p>This kind of layers store their data, are drawable, projectable (with a projection), can be a node of a tree of layers, and
+ *  could be editable and have a cache with previous draws. They also can be visible or not, and active or not.</p>
+ *
+ * <p>A layer can also store information about errors produced working with it, and have a name (kind of layer) and
+ *  a brief summary explaining what's for.</p>
+ *
+ * <p>Each particular implementation can add new properties, and limit or expand the functionality.</p>
+ *
+ * @see Projected
+ */
+public interface FLayer extends Projected, Persistent, Metadata, Disposable
+{
+	public final String METADATA_DEFINITION_NAME = "Layer";
+	public final String METADATA_DEFINITION_DESCRIPTION = "Basic layer metadata definition";
+
+	public static final String METADATA_CRS = DataStore.METADATA_CRS;
+	public static final String METADATA_NAME = "name";
+
+
+//	/**
+//	 * <p>Returns an entity that represents this layer.</p>
+//	 *
+//	 * <p>This XML entity has elements that represent and store information about this layer.</p>
+//	 *
+//	 * @return an XML entity with information of this layer
+//	 * @throws XMLException if there is an error obtaining the object.
+//	 *
+//	 * @see #setXMLEntity(XMLEntity)
+//	 * @see #setXMLEntity03(XMLEntity)
+//	 */
+//	XMLEntity getXMLEntity() throws XMLException;
+//
+//	/**
+//	 * <p>Inserts information to this layer from an XML entity.</p>
+//	 *
+//	 * <p>This XML entity has elements that represent and store information about this layer.</p>
+//	 *
+//	 * @param xml an <code>XMLEntity</code> with the information
+//	 *
+//	 * @throws XMLException if there is an error setting the object.
+//	 *
+//	 * @see #getXMLEntity()
+//	 * @see #setXMLEntity03(XMLEntity)
+//	 */
+//	void setXMLEntity(XMLEntity xml) throws XMLException;
+
+	/**
+	 * <p>Changes the status of this layer to active or inactive.</p>
+	 * <p>One layer is active if is selected in TOC.</p>
+	 *
+	 * @param selected the boolean to be set
+	 *
+	 * @see #isActive()
+	 */
+	void setActive(boolean selected);
+
+	/**
+	 * <p>Returns if this layer is active or not in TOC.</p>
+	 * <p>One layer is active if is selected in TOC.</p>
+	 *
+	 * @return <code>true</code> if this layer is active; <code>false</code> otherwise
+	 *
+	 * @see #setActive(boolean)
+	 */
+	boolean isActive();
+
+	/**
+	 * Sets a name to this layer.
+	 *
+	 * @param name the string that is to be this layer's name
+	 *
+	 * @see #getName()
+	 */
+	void setName(String name);
+
+	/**
+	 * Returns the name of this layer.
+	 *
+	 * @return an string with this layer's name
+	 *
+	 * @see #setName(String)
+	 */
+	String getName();
+
+	/**
+	 * <p>Executes the initialization operations of this layer. This method is invoked
+	 * only one time during the life of this layer and just before visualize it.</p>
+	 *
+	 * @throws org.gvsig.fmap.drivers.reading.DriverIOException if fails loading the layer.
+	 *
+	 * @see #reload()
+	 */
+	void load() throws LoadLayerException;
+	/**
+	 * <p>Changes the status of this layer to visible or not.</p>
+	 * <p>One layer is visible if it's check box associated is selected. This means
+	 *  that layer will tried to be painted. If the data associated isn't available,
+	 *  then this property will change to <code>false</code>.</p>
+	 *
+	 * @param visibility the boolean to be set
+	 *
+	 * @see #isVisible()
+	 * @see #visibleRequired()
+	 * @see #isAvailable()
+	 */
+	void setVisible(boolean visibility);
+
+	/**
+	 * <p>Returns if this layer is visible and available.</p>
+	 * <p>One layer is visible if it's check box associated is selected. This means
+	 *  that layer will tried to be painted.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 * <p>It's probably that one layer selected hadn't available it's data, for example
+	 *  in a remote service.</p>
+	 *
+	 * @return <code>true</code> if this layer is visible and available; <code>false</code> otherwise
+	 *
+	 * @see #isAvailable()
+	 * @see #setAvailable(boolean)
+	 * @see #visibleRequired()
+	 */
+	boolean isVisible();
+
+	/**
+	 * Returns the parent {@link FLayers FLayers} node of this layer.
+	 *
+	 * @return the parent of this layer, or <code>null</code> if hasn't parent
+	 *
+	 * @see #setParentLayer(FLayers)
+	 */
+	public FLayers getParentLayer();
+
+	/**
+	 * <p>Returns a reference to the model of this layer, or null if this layer has no model.</p>
+	 *
+	 * @return the model of this layer
+	 */
+	public MapContext getMapContext();
+
+	/**
+	 * Inserts the parent {@link FLayers FLayers} node of the layer.
+	 *
+	 * @param root a <code>FLayers</code> object
+	 *
+	 * @see #getParentLayer()
+	 */
+	public void setParentLayer(FLayers root);
+	/**
+	 * Returns the full extension of the layer node.
+	 *
+	 * @return location and dimension of this layer node
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 */
+	Envelope getFullEnvelope() throws ReadException;
+
+	/**
+	 * Draws the layer using a buffer.
+	 *
+	 * @param image an image used to accelerate the screen draw
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param viewPort information for drawing this layer
+	 * @param cancel an object thread that implements the <code>Cancellable</code> interface, and will allow to cancel the draw
+	 * @param scale value that represents the scale
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 *
+	 * @see #print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
+	 */
+	void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException;
+
+	/**
+	 * Prints this layer according to some properties requested.
+	 *
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param viewPort the information for drawing the layers
+	 * @param cancel an object thread that implements the {@link Cancellable Cancellable} interface, and will allow to cancel the draw
+	 * @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
+	 * @param properties a set with the settings to be applied to a whole print job and to all the docs in the print job
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 *
+	 * @see #draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties)
+	throws ReadException;
+
+	/**
+	 * Inserts the transformation coordinates.
+	 *
+	 * @param ct transformation coordinates
+	 *
+	 * @see #getCoordTrans()
+	 */
+	void setCoordTrans(ICoordTrans ct);
+
+	/**
+	 * Returns the transformation coordinates.
+	 *
+	 * @return transformation coordinates
+	 *
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	ICoordTrans getCoordTrans();
+
+	/**
+	 * Adds a <code>LayerListener</code> to the listener list.
+	 *
+	 * @param o a layer listener
+	 *
+	 * @return <code>true</code> if hasn't been any problem during the insertion of the listener
+	 *
+	 * @see #getLayerListeners()
+	 * @see #removeLayerListener(LayerListener)
+	 */
+	public boolean addLayerListener(LayerListener o);
+	/**
+	 * Returns all <code>LayerListener</code>s of this layer as an array.
+	 *
+	 * @return an array with all layer listeners associated to this layer
+	 *
+	 * @see #addLayerListener(LayerListener)
+	 * @see #removeLayerListener(LayerListener)
+	 */
+	public LayerListener[] getLayerListeners();
+	/**
+	 * Removes the <code>LayerListener</code> argument from this layer.
+	 *
+	 * @param o a layer listener
+	 *
+	 * @return <code>true</code> if hasn't been any problem doing this process
+	 *
+	 * @see #addLayerListener(LayerListener)
+	 * @see #getLayerListeners()
+	 */
+	public boolean removeLayerListener(LayerListener o);
+	/**
+	 * <p>Returns if the value of <code>scale</code> argument
+	 *  is within the maximum and minimum scale of this layer.</p>
+	 *
+	 * @param scale the scale > 0
+	 *
+	 * @return <code>true</code> if the <code>scale</code> argument is within the range of scales of this layer; <code>false</code> otherwise
+	 *
+	 * @see #setMinScale(double)
+	 * @see #setMaxScale(double)
+	 */
+	public boolean isWithinScale(double scale);
+
+
+	/**
+	 * Returns the minimum scale visible. Lower scales won't be drawn.
+	 *
+	 * @return the minimum scale > 0, -1 if not defined
+	 *
+	 * @see #setMinScale(double)
+	 */
+	public double getMinScale();
+
+	/**
+	 * Returns the maximum scale visible. Higher scales won't be drawn.
+	 *
+	 * @return the maximum scale > 0, -1 if not defined
+	 *
+	 * @see #setMaxScale(double)
+	 */
+	public double getMaxScale();
+	/**
+	 * Sets the minimum scale visible. Lower scales won't be drawn.
+	 *
+	 * @param minScale the scale > 0, -1 if not defined
+	 *
+	 * @see #getMinScale()
+	 */
+	public void setMinScale(double minScale);
+	/**
+	 * Sets the maximum scale visible. Higher scales won't be drawn.
+	 *
+	 * @param maxScale the scale > 0, -1 if not defined
+	 *
+	 * @see #getMaxScale()
+	 */
+	public void setMaxScale(double maxScale);
+	/**
+	 * <p>Changes the status of this layer to editable or not.</p>
+	 * <p>One layer is editable if user can modify its information with graphical tools.</p>
+	 *
+	 * @param b the boolean to be set
+	 *
+	 * @throws com.iver.cit.gvsig.fmap.edition.EditionException if fails enabling for edition this kind of layer.
+	 *
+	 * @see #isEditing()
+	 */
+	public void setEditing(boolean b) throws StartEditionLayerException;
+	/**
+	 * <p>Returns if this layer is editable.</p>
+	 * <p>One layer is editable if user can modify its information with graphical tools.</p>
+	 *
+	 * @return <code>true</code> if this layer is editable; <code>false</code> otherwise
+	 *
+	 * @see #setEditing(boolean)
+	 */
+	public boolean isEditing();
+
+	/**
+	 * Returns the image icon that will be shown in the TOC next to this layer.
+	 *
+	 * @return a String reference to the image icon, or <code>null</code> if there isn't any
+	 */
+	public String getTocImageIcon();
+
+	/**
+	 * <p>Returns if this layer appears in the TOC.</p>
+	 * <p>If doesn't appears, remains in the view and in the project.</p>
+	 *
+	 * @return <code>true</code> if this layer appears in the TOC; <code>false</code> otherwise
+	 */
+	boolean isInTOC();
+	/**
+	 * <p>Sets that this layer appears or not in the TOC.</p>
+	 *
+	 * @param b <code>true</code> if appears in the TOC; <code>false</code> otherwise
+	 */
+	void setInTOC(boolean b);
+	/**
+	 * Returns the status of this layer.
+	 *
+	 * @return the status stored in a <code>FLayerStatus</code> object
+	 *
+	 * @see #setFLayerStatus(FLayerStatus)
+	 */
+	public FLayerStatus getFLayerStatus();
+	/**
+	 * Sets the status of this layer.
+	 *
+	 * @param status information of the status for this layer
+	 *
+	 * @see #getFLayerStatus()
+	 */
+	public void setFLayerStatus(FLayerStatus status);
+	/*
+	 * This stuff is to save error's info that causes
+	 * unavailable status.
+	 * */
+	/**
+	 * <p>Returns if this layer hasn't got errors.</p>
+	 *
+	 * @return <code>true</code> if this layer hasn't got errors; <code>false</code> otherwise
+	 */
+	public boolean isOk();
+	/**
+	 * Returns the number of errors which causes this layer to be in unavailable status.
+	 *
+	 * @return number of errors >= 0
+	 *
+	 * @see #getError(int)
+	 * @see #getErrors()
+	 */
+	public int getNumErrors();
+
+	/**
+	 * Returns the specified error.
+	 *
+	 * @param i index of the error >= 0 && < <code>getNumErrors</code>
+	 *
+	 * @return a singular error
+	 *
+	 * @see #getNumErrors()
+	 * @see #getErrors()
+	 */
+	public BaseException getError(int i);
+
+    /**
+     * Adds an error reason that describes this layer's wrong status.
+     * 
+     * @param error
+     *            a <code>BaseException</code> with the information of the error
+     * 
+     * @see #getNumErrors()
+     * @see #getError(int)
+     * @see #getErrors()
+     */
+	public void addError(BaseException exception);
+
+	/**
+	 * Returns a list with all layer errors.
+	 *
+	 * @return an <code>ArrayList</code> with the errors
+	 *
+	 * @see #getError(int)
+	 * @see #getNumErrors()
+	 */
+	public List getErrors();
+	/**
+	 * <p>Changes the status of availability of this layer.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 *
+	 * @param the boolean to be set
+	 *
+	 * @see #isAvailable()
+	 */
+	public void setAvailable(boolean available);
+	/**
+	 * <p>Returns the status of availability of this layer.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 *
+	 * @return <code>true</code> if the source of data is on-line; <code>false</code> otherwise
+	 *
+	 * @see #setAvailable(boolean)
+	 * @see #isVisible()
+	 */
+	public boolean isAvailable();
+
+    /**
+     * <p>
+     * Tries recover a layer of a possible error.
+     * </p>
+     * <p>
+     * If it has any problem during the load, marks the availability to false
+     * and throws an exception.
+     * </p>
+     * 
+     * @throws ReloadLayerException
+     *             if it's thrown a <code>ReadException</code> or an
+     *             <code>IOException</code> during the load of this layer.
+     * 
+     * @see #load()
+     */
+	public void reload() throws ReloadLayerException;
+
+	/**
+	 * Returns <code>true</code> if this layer has the visible status enabled.
+	 *
+	 * @return <code>true</code> if visible this layer has the visible status enabled, otherwise <code>false</code>
+	 *
+	 * @see #isVisible()
+	 * @see #setVisible(boolean)
+	 */
+	boolean visibleRequired();
+	/**
+	 * Returns an string with the information of this layer.
+	 *
+	 * @return the string that is to be this component's information
+	 */
+	public String getInfoString();
+	/**
+	 * <p>Returns the writing status of this layer.</p>
+	 * <p>One layer is writable if there is a writing driver for this layer.</p>
+	 *
+	 * @return <code>true</code> if there is a writing driver for this layer; <code>false</code> otherwise
+	 */
+	public boolean isWritable();
+
+	/**
+	 * <p>This method can be used to have a fast cloned layer.</p>
+	 * <p>The implementations should take care of not recreate this layer. Instead of this,
+	 *  is better to use the same source (driver) and <i>deepclone</i> the legend. Exception:
+	 *   the labels aren't <i>deepcloned</i> to avoid memory consumption.</p>
+	 * <p><i>Note</i>: Labels are memory consuming to speed up layers like PostGIS and so on.</p>
+	 *
+	 * @return a layer that is a clonation of this layer
+	 *
+	 * @throws java.lang.Exception any exception produced during the cloning of this layer.
+	 */
+	public FLayer cloneLayer() throws Exception;
+
+
+
+	/**
+	 * <p>Returns a reference to an object (property) associated to this layer.</p>
+	 *
+	 * <p>For example, you can attach a network definition to key "network" and check
+	 *  if a layer has a network loaded using <i>getAssociatedObject("network")</i> and
+	 *  that it's not null.</p>
+	 *
+	 * @param key the key associated to the property
+	 *
+	 * @return <code>null</code> if key is not found
+	 *
+	 * @see #getExtendedProperties()
+	 * @see #setProperty(Object, Object)
+	 */
+	public Object getProperty(Object key);
+
+	/**
+	 * Insets an object as a property to this layer.
+	 *
+	 * @param key the key associated to the property
+	 * @param obj the property
+	 *
+	 * @see #getProperty(Object)
+	 * @see #getExtendedProperties()
+	 */
+	public void setProperty(Object key, Object obj);
+	/**
+	 * Returns a hash map with all new properties associated to this layer.
+	 *
+	 * @return hash table with the added properties
+	 *
+	 * @see #getProperty(Object)
+	 * @see #setProperty(Object, Object)
+	 */
+	public Map getExtendedProperties();
+
+	/**
+	 * <p>Returns a new instance of {@link ComposedLayer ComposedLayer}.</p>
+	 *
+	 * <p>This allows make a single draw for a group
+	 * of layers with the same source.</p>
+	 *
+	 * <p>If this operation isn't applicable for this
+	 * kind of layer, this method returns null.</p>
+	 *
+	 * <p>By default this operation is not supported.</p>
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer
+	 *
+	 * @return a new composed layer or <code>null</code> if not supported
+	 */
+	public ComposedLayer  newComposedLayer();
+
+	/**
+	 * Returns the image icon that will be shown in the TOC next to this layer, according its status.
+	 *
+	 * @return the image
+	 */
+	Image getTocStatusImage();
+
+//	M�todos para la utilizaci�n de HyperLinks
+
+	/**
+	 * Returns information about if the layer allows HyperLink or not
+	 * @return boolean true if allows Link, false if not
+	 */
+	public boolean allowLinks();
+
+	/**
+	 * Returns an instance of AbstractLinkProperties that contains the information
+	 * of the HyperLink
+	 * @return Abstra
+	 */
+	public AbstractLinkProperties getLinkProperties();
+
+	/**
+	 * Provides an array with URIs. Returns one URI by geometry that includes the point
+	 * in its own geometry limits with a allowed tolerance.
+	 * @param layer, the layer
+	 * @param point, the point to check that is contained or not in the geometries in the layer
+	 * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the  point
+	 * 		is contained in some geometries of the layer
+	 * @return
+	 * @throws ReadException
+	 * @throws BehaviorException
+	 */
+	public URI[] getLink(Point2D point, double tolerance) throws ReadException;
+
+
+	/**
+	 * <p>Inserts the projection to this layer.</p>
+	 *
+	 * @param proj information about the new projection
+	 *
+	 */
+	public void setProjection(IProjection proj);
+	
+	public long getDrawVersion();
+	
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java	(revision 35988)
@@ -0,0 +1,55 @@
+/*
+ * Created on 13-may-2005
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.fmap.dal.feature.FeatureSet;
+
+public interface VectorialSecuencial {
+
+    // public int getRowIndexByFID(IFeature FID);
+    public FeatureSet getFeatureIterator(Rectangle2D r, String strEPSG);
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java	(revision 35988)
@@ -0,0 +1,350 @@
+/*
+ * Created on 16-feb-2005
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Dimension;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * C�lculo de Partes (Tiles) en las que se divide un raster grande.
+ * Se usa para imprimir rasters y capas raste remotas (WMS).
+ *
+ * Para no pedir imagenes demasiado grandes, vamos
+ * a hacer lo mismo que hace EcwFile: chunkear.
+ * Llamamos a drawView con cuadraditos m�s peque�os
+ * del BufferedImage ni caso, cuando se imprime viene con null
+ * c�digo original de Fran Pe�arrubia
+ * @author Luis W. Sevilla (sevilla_lui@gva.es)
+ */
+
+public class Tiling {	
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(Tiling.class);
+	private static final int		MIN_SIZE = 50; //Tama�o m�nimo en pixeles del tile
+	private boolean 				debug = true;
+	private int 					tileMaxWidth, tileMaxHeight;
+	private int 					numRows, numCols;
+	private double[][] 				srcPts;
+	private Rectangle2D[] 			tile;
+	private double 					width = 500, height = 500;
+	private AffineTransform 		mat;
+	private ViewPort 				vp;
+
+	public Tiling(){}
+
+	public Tiling(int tileW, int tileH, Rectangle2D r) {
+		int[] size = this.calcMaxTileSize(tileW, tileH, r);
+		tileMaxWidth = size[0];
+		tileMaxHeight = size[1];
+
+        int stepX, stepY;
+        int xProv, yProv;
+        int altoAux, anchoAux;
+
+        //Vamos a hacerlo en trozos de AxH
+        numCols = 1+(int) (r.getWidth()) / tileMaxWidth;
+        numRows = 1+(int) (r.getHeight()) / tileMaxHeight;
+
+        srcPts = new double[numCols*numRows][8];
+        tile = new Rectangle2D[numCols*numRows];
+
+    	yProv = (int) r.getY();
+        for (stepY=0; stepY < numRows; stepY++) {
+    		if ((yProv + tileMaxHeight) > r.getMaxY())
+    			altoAux = (int) r.getMaxY() - yProv;
+    		else
+    			altoAux = tileMaxHeight;
+
+    		xProv = (int) r.getX();
+        	for (stepX=0; stepX < numCols; stepX++) {
+	    		if ((xProv + tileMaxWidth) > r.getMaxX())
+	    			anchoAux = (int) r.getMaxX() - xProv;
+	    		else
+	    			anchoAux = tileMaxWidth;
+
+        		//Rectangle newRect = new Rectangle(xProv, yProv, anchoAux, altoAux);
+        		int tileCnt = stepY*numCols+stepX;
+        		// Parte que dibuja
+        		srcPts[tileCnt][0] = xProv;
+        		srcPts[tileCnt][1] = yProv;
+        		srcPts[tileCnt][2] = xProv + anchoAux+1;
+        		srcPts[tileCnt][3] = yProv;
+        		srcPts[tileCnt][4] = xProv + anchoAux+1;
+        		srcPts[tileCnt][5] = yProv + altoAux+1;
+        		srcPts[tileCnt][6] = xProv;
+        		srcPts[tileCnt][7] = yProv + altoAux+1;
+
+        		tile[tileCnt] = new Rectangle2D.Float(xProv, yProv, anchoAux+1, altoAux+1);
+
+				xProv += tileMaxWidth;
+        	}
+        	yProv += tileMaxHeight;
+        }
+	}
+
+	/**
+	 * Calcula el tama�o m�ximo de tile controlando que ning�n tile tenga menos de MIN_SIZE
+	 * pixeles
+	 * @param tileW Ancho del tile
+	 * @param tileH	Alto del tile
+	 * @param r Rectangulo que define el area de la imagen
+	 */
+	public int[] calcMaxTileSize(int tileW, int tileH, Rectangle2D r){
+		
+		if(r.getWidth() < tileW || r.getHeight() < tileH){
+			int[] sizeTiles = {tileW, tileH};
+			return sizeTiles;
+		}
+
+        int wLastCol = 0;
+        tileW += MIN_SIZE;
+		do{
+			tileW -= MIN_SIZE;
+	        int numCols = (int) (r.getWidth() / tileW);
+	        int w = 0;
+	        for(int i = 0; i < numCols; i++)
+	        	w += tileW;
+	        wLastCol = ((int) r.getWidth()) - w;
+		}while(wLastCol < MIN_SIZE && tileW > (MIN_SIZE * 2));
+
+		int hLastRow = 0;
+        tileH += MIN_SIZE;
+		do{
+			tileH -= MIN_SIZE;
+	        int numRows = (int) (r.getHeight() / tileH);
+	        int h = 0;
+	        for(int i = 0; i < numRows; i++)
+	        	h += tileH;
+	        hLastRow = ((int) r.getHeight()) - h;
+		}while(hLastRow < MIN_SIZE && tileH > (MIN_SIZE * 2));
+
+		tileMaxWidth = tileW;
+		tileMaxHeight = tileH;
+		int[] sizeTiles = {tileMaxWidth, tileMaxHeight};
+		return sizeTiles;
+	}
+
+	public double [] getTilePts(int colNr, int rowNr) {
+		return srcPts[rowNr*numCols+colNr];
+	}
+
+	public double [] getTilePts(int num) {
+		return srcPts[num];
+	}
+
+	public Rectangle2D getTileSz(int colNr, int rowNr) {
+		return tile[rowNr*numCols+colNr];
+	}
+
+	public Rectangle2D getTile(int num) {
+		return tile[num];
+	}
+
+	/**
+	 * @return Returns the numCols.
+	 */
+	public int getNumCols() {
+		return numCols;
+	}
+	/**
+	 * @return Returns the numRows.
+	 */
+	public int getNumRows() {
+		return numRows;
+	}
+
+	public int getNumTiles() { return numRows*numCols; }
+	/**
+	 * @return Returns the tileHeight.
+	 */
+	public int getMaxTileHeight() {
+		return tileMaxHeight;
+	}
+	/**
+	 * @return Returns the tileWidth.
+	 */
+	public int getMaxTileWidth() {
+		return tileMaxWidth;
+	}
+
+	ViewPort[] viewPortList = null;
+	private void calcViewPort(ViewPort viewPort)throws NoninvertibleTransformException{
+		viewPortList = new ViewPort[numCols*numRows];
+
+		/*if(viewPort.getImageWidth() < width && viewPort.getImageHeight() < height){
+			viewPortList[0] = viewPort;
+			return;
+		}*/
+
+	    int vpCnt = 0;
+
+	    double imgPxX = viewPort.getImageWidth();
+	    double dWcX = viewPort.getAdjustedExtent().getLength(0);
+	    double tileWcW = (getTile(vpCnt).getWidth() * dWcX) / imgPxX;
+
+	    double imgPxY = viewPort.getImageHeight();
+	    double dWcY = viewPort.getAdjustedExtent().getLength(1);
+	    double tileWcH = (getTile(vpCnt).getHeight() * dWcY) / imgPxY;
+
+	    try {
+            viewPortList[0] = (ViewPort) viewPort.clone();
+        } catch (CloneNotSupportedException e) {
+            logger.error("Error clonning the viewport", e);
+            e.printStackTrace();
+        }
+	    
+	    int auxw = (int) getTile(vpCnt).getWidth();
+	    int auxh = (int) getTile(vpCnt).getHeight();
+	    Dimension auxdim = new Dimension(auxw, auxh);
+	    
+	    viewPortList[0].setImageSize(auxdim);
+	    Envelope r=viewPort.getAdjustedExtent();
+	    try {
+			viewPortList[0].setEnvelope(geomManager.createEnvelope(r.getMinimum(0), r.getMaximum(1) - tileWcH,r.getMinimum(0)+tileWcW, r.getMaximum(1), SUBTYPES.GEOM2D));
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error setting the envelope", e);
+			e.printStackTrace();
+		}
+	    viewPortList[0].setAffineTransform(mat);
+
+	    double wt = tileWcW;
+	    double ht = tileWcH;
+	    double xt = viewPort.getAdjustedExtent().getMinimum(0);
+	    double yt = viewPort.getAdjustedExtent().getMaximum(1) - tileWcH;
+
+	    for (int stepY=0; stepY < numRows; stepY++) {
+	    	wt = tileWcW;
+	    	xt = viewPort.getAdjustedExtent().getMinimum(0);
+	    	for (int stepX=0; stepX < numCols; stepX++) {
+	    		vpCnt = stepY*numCols+stepX;
+	    		if(vpCnt > 0){
+	    			if(stepX > 0)
+	    				xt += wt;
+	    			if((xt + wt) > viewPort.getAdjustedExtent().getMaximum(0))
+	    				wt = Math.abs(viewPort.getAdjustedExtent().getMaximum(0) - xt);
+
+	    			try {
+                        viewPortList[vpCnt] = (ViewPort) viewPort.clone();
+                    } catch (CloneNotSupportedException e) {
+                        logger.error("Error clonning the viewport", e);
+                        e.printStackTrace();
+                    }
+	    			
+	    		    auxw = (int) getTile(vpCnt).getWidth();
+	    		    auxh = (int) getTile(vpCnt).getHeight();
+	    		    auxdim = new Dimension(auxw, auxh);
+
+	    			viewPortList[vpCnt].setImageSize(auxdim);
+	    			
+	    			try {
+						viewPortList[vpCnt].setEnvelope(geomManager.createEnvelope(xt, yt,xt + wt, yt + ht, SUBTYPES.GEOM2D));
+					} catch (CreateEnvelopeException e) {
+						logger.error("Error setting the envelope", e);
+						e.printStackTrace();
+					}
+	    			viewPortList[vpCnt].setAffineTransform(mat);
+
+	    		}
+	    		//System.out.println("ViewPort: "+vpCnt+" "+viewPortList[vpCnt].getAdjustedExtent()+" "+getTile(vpCnt).getSize());
+	    	}
+	    	if((yt - ht) < viewPort.getAdjustedExtent().getMinimum(1)){
+	    		ht = Math.abs(yt - viewPort.getAdjustedExtent().getMinimum(1));
+	    		yt = viewPort.getAdjustedExtent().getMinimum(1);
+	    	}else
+	    		yt -= ht;
+	    }
+	}
+
+	public ViewPort getTileViewPort(ViewPort viewPort, int tileNr) throws NoninvertibleTransformException {
+		/*if(viewPortList == null)
+			this.calcViewPort(viewPort);
+		return viewPortList[tileNr];*/
+
+		if(tile.length == 1)
+			return viewPort;
+
+		double [] dstPts = new double[8];
+		double [] srcPts = getTilePts(tileNr);
+		Rectangle2D tile = getTile(tileNr);
+		//Rectangle newRect = new Rectangle((int)srcPts[0], (int)srcPts[1], tileSz[0], tileSz[1]);
+
+		mat.inverseTransform(srcPts, 0, dstPts, 0, 4);
+		double x = dstPts[0], w = dstPts[2] - dstPts[0];
+		double y = dstPts[1], h = dstPts[5] - dstPts[3];
+		if (w < 0) { x = dstPts[2]; w = dstPts[0] - dstPts[2]; }
+		if (h < 0) { y = dstPts[5]; h = dstPts[3] - dstPts[5]; }
+		Envelope rectCuadricula = null;
+		try {
+			rectCuadricula = geomManager.createEnvelope(x, y,x+ w,y+ h, SUBTYPES.GEOM2D);
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error setting the envelope", e);
+			e.printStackTrace();
+		}
+		//Extent extent = new Extent(rectCuadricula);
+
+		ViewPort vp = null;
+		try {
+		    vp = (ViewPort) viewPort.clone();
+
+
+		    int auxw = (int) tile.getWidth();
+		    int auxh = (int) tile.getHeight();
+		    Dimension auxdim = new Dimension(auxw, auxh);
+
+		    vp.setImageSize(auxdim);
+		    //vp.setOffset(tile.getLocation());
+		    vp.setEnvelope(rectCuadricula);
+		    vp.setAffineTransform(mat);
+
+		    if (debug)
+		        System.out.println("Tiling.print(): tile "+tileNr+" de "
+		            + getNumTiles() +
+		            "\n, Extent = "+vp.getAdjustedExtent() + " tile: "
+		            + tile);
+
+		} catch (CloneNotSupportedException e) {
+            logger.error("Error clonning the viewport", e);
+            e.printStackTrace();
+        }
+        return vp;
+	}
+	/**
+	 * @return Returns the mat.
+	 */
+	public AffineTransform getAffineTransform() {
+		return mat;
+	}
+	/**
+	 * @param mat The mat to set.
+	 */
+	public void setAffineTransform(AffineTransform mat) {
+		this.mat = mat;
+	}
+	/**
+	 * @return Returns the debug.
+	 */
+	public boolean isDebug() {
+		return debug;
+	}
+	/**
+	 * @param debug The debug to set.
+	 */
+	public void setDebug(boolean debug) {
+		this.debug = debug;
+	}
+}
+
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java	(revision 35988)
@@ -0,0 +1,116 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * 
+ * @deprecated
+ *
+ */
+public class MappingAnnotation implements Persistent {
+
+	private int columnText = -1;
+	private int columnRotate = -1;
+	private int columnColor = -1;
+	private int columnHeight = -1;
+	private int columnTypeFont = -1;
+	private int columnStyleFont = -1;
+
+	public MappingAnnotation() {
+		
+	}
+	
+	public int getColumnColor() {
+		return columnColor;
+	}
+
+	public void setColumnColor(int columnColor) {
+		this.columnColor = columnColor;
+	}
+
+	public int getColumnHeight() {
+		return columnHeight;
+	}
+
+	public void setColumnHeight(int columnHeight) {
+		this.columnHeight = columnHeight;
+	}
+
+	public int getColumnRotate() {
+		return columnRotate;
+	}
+
+	public void setColumnRotate(int columnRotate) {
+		this.columnRotate = columnRotate;
+	}
+
+	public int getColumnStyleFont() {
+		return columnStyleFont;
+	}
+
+	public void setColumnStyleFont(int columnStyleFont) {
+		this.columnStyleFont = columnStyleFont;
+	}
+
+	public int getColumnText() {
+		return columnText;
+	}
+
+	public void setColumnText(int columnText) {
+		this.columnText = columnText;
+	}
+
+	public int getColumnTypeFont() {
+		return columnTypeFont;
+	}
+
+	public void setColumnTypeFont(int columnTypeFont) {
+		this.columnTypeFont = columnTypeFont;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+
+		columnText = state.getInt("columnText");
+		columnRotate = state.getInt("columnRotate");
+		columnColor = state.getInt("columnColor");
+		columnHeight = state.getInt("columnHeight");
+		columnTypeFont = state.getInt("columnTypeFont");
+		columnStyleFont = state.getInt("columnStyleFont");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+
+		state.set("columnText", columnText);
+		state.set("columnRotate", columnRotate);
+		state.set("columnColor", columnColor);
+		state.set("columnHeight", columnHeight);
+		state.set("columnTypeFont", columnTypeFont);
+		state.set("columnStyleFont", columnStyleFont);
+
+	}
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MappingAnnotation.class,
+				"MappingAnnotation",
+				"MappingAnnotation Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("columnText").setMandatory(true);
+		definition.addDynFieldInt("columnRotate").setMandatory(true);
+		definition.addDynFieldInt("columnColor").setMandatory(true);
+		definition.addDynFieldInt("columnHeight").setMandatory(true);
+		definition.addDynFieldInt("columnTypeFont").setMandatory(true);
+		definition.addDynFieldInt("columnStyleFont").setMandatory(true);
+	}
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java	(revision 35988)
@@ -0,0 +1,340 @@
+/*
+ * Created on 01-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id: FLayerStatus.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.2  2007-03-06 17:08:55  caballero
+* Exceptions
+*
+* Revision 1.1  2006/09/21 17:23:39  azabala
+* First version in cvs
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+/**
+ * <p>All layers in <i>libFMap</i> can be in a set of <i>states</i>, that their combination represent the <i>status</i> of a layer.</p>
+ * 
+ * <p><code>FLayerStatus</code> class supports the common status for all kind of {@link FLyrDefault FLyrDefault} layers.</p>
+ * 
+ * <p>This means that not necessarily all layers can stay in all possible status, it depends on its particular
+ * nature.</p>
+ * 
+ * <p>Layer status states defined in <code>FLayerStatus</code> are:
+ *  <ul>
+ *  <li><i><b>Available</b></i>: the layer is available if the source of its data is on-line.</li>
+ *  <li><i><b>Visible</b></i>: one layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
+ *  layer will be called to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
+ *  remote services.</li>
+ *  <li><i><b>Active</b></i>: is active if it's selected at the TOC.</li>
+ *  <li><i><b>Dirty</b></i>: is dirty if needs to be refreshed.</li>
+ *  <li><i><b>In TOC</b></i>: if it's being listed in a TOC GUI.</li>
+ *  <li><i><b>Editing</b></i>: if the layer it's being edited now.</li>
+ *  <li><i><b>Writable</b></i>: if can be modified and saved the changes.</li>
+ *  <li><i><b>Cache drawn layers</b></i>: if stores previous draws. This is useful to accelerate the draw of the layer.</li>
+ *  <li><i><b>Driver loaded</b></i>: if driver for managing the layer has been loaded successfully.</li>
+ *  </ul>
+ * </p>
+ * 
+ * @see IFLayerStatus
+ * 
+ * @author azabala
+ */
+public class FLayerStatus implements IFLayerStatus {
+	/**
+	 * <p>Layer's availability: the layer is available if the source of its data is on-line.</p>
+	 */
+	public boolean available;
+	
+	/**
+	 * <p>Layer's visibility: the layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
+	 *  layer will tried to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
+	 *  remote services.</p>
+	 */
+	public boolean visible;
+	
+	/**
+	 * <p>The layer is active if it's selected at the TOC.</p>
+	 */
+	public boolean active;
+	
+	/**
+	 * <p>One layer is dirty if needs to be refreshed.</p>
+	 */
+	public boolean dirty;
+	
+	/**
+	 * <p>The layer is in TOC if it's being listed in a TOC GUI.</p>
+	 */
+	public boolean inTOC;
+	
+	/**
+	 * <p>This parameter reports if the layer it's being edited now.</p>
+	 */
+	public boolean editing;
+	
+	/**
+	 * <p>This parameter reports if the layer can be modified and saved the changes.</p>
+	 */
+	public boolean writable;
+	
+	/**
+	 * <p>This state reports if the layer stores previous draws. That's useful to accelerate the draw of the layer.</p>
+	 */
+	public boolean cacheDrawnLayers;
+
+	
+	/**
+	 * <p>List with the information of the driver errors produced working this layer.</p>
+	 */
+	private ArrayList layerErrors;
+		
+	/**
+	 * <p>This state reports if the driver for managing the layer has been loaded successfully.</p>
+	 */
+	private boolean driverLoaded=true;
+
+	/**
+	 * <p>Creates an instance with the default status of a <code>FLyrDefault</code> layer:
+	 * <br>
+	 *  <ul>
+	 *  <li><b><i>Visible</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Active</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>In TOC</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Editing</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Cache drawn layers</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Dirty</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Available</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Driver loaded</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Writable</i></b>: <code>false</code> .</li>
+	 *  <li>Without driver errors.</li>
+	 *  </ul>
+	 * </p>
+	 */
+	public FLayerStatus(){
+		this.layerErrors = new ArrayList();
+		visible = true;
+		active = false;
+		inTOC = true;
+		editing = false;
+		cacheDrawnLayers = false;
+		dirty = false;
+		available = true;
+
+		writable = false;
+
+	}
+
+	/**
+	 * <p>Stores information of an exception produced working with a driver of the layer.</p>
+	 * 
+	 * @param error the driver exception
+	 */
+	public void addLayerError(BaseException error){
+		layerErrors.add(error);
+	}
+
+	public FLayerStatus cloneStatus(){
+		FLayerStatus newStatus = new FLayerStatus();
+		newStatus.layerErrors.addAll(this.layerErrors);
+		newStatus.visible = this.visible;
+		newStatus.active = this.active;
+		newStatus.inTOC = this.inTOC;
+		newStatus.editing = this.editing;
+		newStatus.cacheDrawnLayers = this.cacheDrawnLayers;
+		newStatus.dirty = this.dirty;
+		newStatus.available = this.available;
+		newStatus.driverLoaded = this.driverLoaded;	
+		newStatus.writable = this.writable;
+	
+		return newStatus;
+	}
+	
+	
+
+	public boolean equals(Object obj) {
+		FLayerStatus other;
+		if (obj instanceof FLayerStatus) {
+			other = (FLayerStatus) obj;
+		} else{
+			return false;
+		}
+
+		if (other.visible != this.visible 
+				|| other.active != this.active
+				|| other.inTOC != this.inTOC || other.editing != this.editing
+				|| other.cacheDrawnLayers != this.cacheDrawnLayers
+				|| other.dirty != this.dirty
+				|| other.available != this.available
+				|| other.driverLoaded != this.driverLoaded
+				|| other.writable != this.writable) {
+			return false;
+		}
+		
+
+		
+		if ((!other.layerErrors.containsAll(this.layerErrors)) || other.layerErrors.size() != this.layerErrors.size()){
+			return false;
+		}
+		return super.equals(obj);
+	}
+
+	/**
+	 * <p>Gets the number of driver exceptions produced working with the layer.</p>
+	 * 
+	 * @return number of driver exceptions produced
+	 */
+	public int getNumErrors(){
+		return layerErrors.size();
+	}
+
+	/**
+	 * <p>Gets the information of the <i>nth</i> layer driver exception registered in the status.</p>
+	 * 
+	 * @param i ith layer exception registered
+	 * 
+	 * @return the <i>nth</i> layer driver exception registered
+	 */
+	public BaseException getError(int i){
+		return (BaseException) layerErrors.get(i);
+	}
+
+	/**
+	 * <p>Returns if there have been driver errors working with the layer.</p>
+	 * 
+	 * @return <code>true</code> if there have driver errors working with the layer; otherwise <code>false</code>
+	 */
+	public boolean isOk(){
+		return layerErrors.size() == 0;
+	}
+
+	/**
+	 * <p>Returns a list of errors produced in a layer working with its driver.</p>
+	 * 
+	 * @return list errors produced in a layer working with its driver
+	 */
+	public List getErrors() {
+		return layerErrors;
+	}
+
+	/**
+	 * <p>Returns if has been loaded successfully the driver for managing the layer.</p>
+	 * 
+	 * @return <code>true</code> if has been loaded successfully the driver for managing the layer; otherwise <code>false</code>
+	 */
+	public boolean isDriverLoaded() {
+		return driverLoaded;
+	}
+
+	/**
+	 * <p>Sets if has been loaded successfully the driver for managing the layer.</p>
+	 * 
+	 * @param driverLoaded <code>true</code> if has been loaded successfully the driver for managing the layer; otherwise <code>false</code>
+	 */
+	public void setDriverLoaded(boolean driverLoaded) {
+		this.driverLoaded = driverLoaded;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+
+		visible = state.getBoolean("visible");
+		active = state.getBoolean("active");
+		inTOC = state.getBoolean("inTOC");
+		editing = state.getBoolean("editing");
+		cacheDrawnLayers = state.getBoolean("cacheDrawnLayers");
+		dirty = state.getBoolean("dirty");
+		available = state.getBoolean("available");
+		writable = state.getBoolean("writable");
+		driverLoaded = state.getBoolean("driverLoaded");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		state.set("visible", visible);
+		state.set("active", active);
+		state.set("inTOC", inTOC);
+		state.set("editing", editing);
+		state.set("cacheDrawnLayers", cacheDrawnLayers);
+		state.set("dirty", dirty);
+		state.set("available", available);
+		state.set("writable", writable);
+		state.set("driverLoaded", driverLoaded);
+	}
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLayerStatus.class,
+				"FLayerStatus",
+				"FLayerStatus Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldBoolean("visible").setMandatory(true);
+		definition.addDynFieldBoolean("active").setMandatory(true);
+		definition.addDynFieldBoolean("inTOC").setMandatory(true);
+		definition.addDynFieldBoolean("editing").setMandatory(true);
+		definition.addDynFieldBoolean("cacheDrawnLayers").setMandatory(true);
+		definition.addDynFieldBoolean("dirty").setMandatory(true);
+		definition.addDynFieldBoolean("available").setMandatory(true);
+		definition.addDynFieldBoolean("writable").setMandatory(true);
+		definition.addDynFieldBoolean("driverLoaded").setMandatory(true);
+		//definition.addDynFieldBoolean("locked").setMandatory(true);
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java	(revision 35988)
@@ -0,0 +1,52 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event associated to a selection on a vector layer.</p>
+ * 
+ * @see FMapEvent
+ */
+public class SelectionEvent extends FMapEvent {
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java	(revision 35988)
@@ -0,0 +1,96 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+
+
+/**
+ * @author fjp
+ *
+ * Class to iterate for all layers in FLayers, but assuring not FLayers is returned.
+ * The layer you receive in next method is a "leaf" layer, not grouped. 
+ */
+public class SingleLayerIterator {
+
+	ArrayList singleLayers  =new ArrayList();
+	int i = 0;
+	int subIndex = 0;	
+	public SingleLayerIterator(FLayers layers)
+	{
+		addSubLayer(layers);
+		
+	}
+
+	public boolean hasNext() {
+		return (i < singleLayers.size());
+	}
+
+	public FLayer next() {
+		FLayer aux = (FLayer) singleLayers.get(i); 
+		i++;
+		return aux;
+	}
+	
+	private void addSubLayer(FLayer lyr) {
+		FLayers layers;
+		if (lyr instanceof FLayers)
+		{
+			layers = (FLayers)lyr;
+			for (int i=0; i < layers.getLayersCount(); i++)
+			{
+				addSubLayer(layers.getLayer(i));
+			}			
+		}
+		else
+		{
+			singleLayers.add(lyr);
+		}		
+	}
+	
+	public void rewind()
+	{
+		i=0;
+	}
+
+}
+
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java	(revision 35988)
@@ -0,0 +1,190 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event produced when a layer is been added or removed, or has been added or
+ *  removed, or its visibility or activation state has changed from a collection of layers.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerCollectionEvent extends FMapEvent {
+	/**
+	 * <p>Identifies this event as a action on a layer that has been added.</p>
+	 */
+	private final static int LAYER_ADDED = 0;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that has been removed.</p>
+	 */
+	private final static int LAYER_REMOVED = 2;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being added.</p>
+	 */
+	private final static int LAYER_ADDING = 3;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being removed.</p>
+	 */
+	private final static int LAYER_REMOVING = 5;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the activation status of a layer.</p>
+	 */
+	private final static int LAYER_ACTIVATION_CHANGED = 6;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
+	 */
+	private final static int LAYER_VISIBILITY_CHANGED = 7;
+
+	/**
+	 * <p>Reference to the collection of layers.</p>
+	 */
+	private FLayers layers;
+
+	/**
+	 * <p>Reference to the layer which this layer notifies.</p>
+	 */
+	private FLayer affected;
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer added" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerAddedEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ADDED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer removed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerRemovedEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_REMOVED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer adding" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerAddingEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ADDING);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer removing" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerRemovingEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_REMOVING);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer activation changed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerActivationEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ACTIVATION_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer visibility changed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerVisibilityEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_VISIBILITY_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer collection event of the specified type.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer collection event
+	 */
+	protected LayerCollectionEvent(FLayer lyr, int eventType) {
+		layers = lyr.getParentLayer();
+		affected = lyr;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the collection of layers which the layer affected belongs.</p>
+	 *
+	 * @return the collection of layers affected
+	 */
+	public FLayers getLayers() {
+		return layers;
+	}
+
+	/**
+	 * <p>Gets the layer that this event references.</p>
+	 *
+	 * @return the layer that this event references
+	 */
+	public FLayer getAffectedLayer() {
+		return affected;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java	(revision 35988)
@@ -0,0 +1,58 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p>The interface <code>SelectionListener</code> defines the interface for an object that listens
+ *  to changes in a vector layer.</p>
+ */
+public interface SelectionListener {
+	/**
+	 * <p>Called when the selection in a vector layer has changed.</p>
+	 * 
+	 * <p>The <code>SelectionEvent</code> event must be launched invoking
+	 *  the <code>fireSelectionEvents</code> method of the layer.</p>
+	 *
+	 * @param e a selection event on a vector layer
+	 */
+	void selectionChanged(SelectionEvent e);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java	(revision 35988)
@@ -0,0 +1,83 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * Excepci�n que se lanzara cunado exista un problema de versi�n.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DifferentVersionException extends Exception {
+	/**
+	 * Crea una nueva DifferentVersionException
+	 */
+	public DifferentVersionException() {
+		super();
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 */
+	public DifferentVersionException(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 * @param arg1
+	 */
+	public DifferentVersionException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 */
+	public DifferentVersionException(Throwable arg0) {
+		super(arg0);
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java	(revision 35988)
@@ -0,0 +1,97 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+
+
+/**
+ * <p>The <code>LayerDrawEvent</code> class represents an event produced on a layer about a drawing change.</p>
+ * <p>This event can be a notification before or after a {@link FLayer FLayer}, {@link FLayers FLayers}, or
+ *  {@link GraphicLayer GraphicLayer} is drawn.</p>
+ */
+public class LayerDrawEvent extends FMapEvent {
+	/**
+	 * <p>The view port the information for drawing the layer in which this event has been produced.</p>
+	 */
+	ViewPort vp;
+	
+	/**
+	 * <p>Reference to an object for rendering 2D on the Java(tm) platform.</p>
+	 */
+	Graphics2D g;
+	
+	/**
+	 * <p>Reference to the layer where this event has been produced.</p>
+	 */
+	FLayer lyr;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  before drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
+	 */
+	public static final int LAYER_BEFORE_DRAW = 101;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  after drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
+	 */
+	public static final int LAYER_AFTER_DRAW = 102;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  before drawing on a {@link GraphicLayer GraphicLayer}.
+	 */
+	public static final int GRAPHICLAYER_BEFORE_DRAW = 103;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  after drawing on a {@link GraphicLayer GraphicLayer}.
+	 */
+	public static final int GRAPHICLAYER_AFTER_DRAW = 104;
+
+	/**
+	 * <p>Creates a new layer draw event with all necessary information.</p>
+	 * 
+	 * @param lyr layer in which the event has been produced
+	 * @param g object for rendering 2D on the Java(tm) platform
+	 * @param vp object with information for drawing the layer in which this event has been produced
+	 * @param eventType identifies the kind of this event: {@linkplain #LAYER_BEFORE_DRAW}, {@linkplain #LAYER_AFTER_DRAW},
+	 *  {@linkplain #GRAPHICLAYER_BEFORE_DRAW} or {@linkplain #GRAPHICLAYER_AFTER_DRAW}.
+	 */
+	public LayerDrawEvent(FLayer lyr, Graphics2D g, ViewPort vp, int eventType) {
+		this.lyr = lyr;
+		this.g = g;
+		this.vp = vp;
+		setEventType(eventType);
+	}
+	
+	/**
+	 * <p>Returns an object for rendering 2-dimensional shapes, text and images on the Java(tm) platform.</p>
+	 * 
+	 * @return object for rendering 2D on the Java(tm) platform
+	 */
+	public Graphics2D getGraphics() {
+		return g;
+	}
+	
+	/**
+	 * <p>Returns the view port the information for drawing the layer in which this event has been produced.</p>
+	 * 
+	 * @return object with information for drawing the layer in which this event has been produced
+	 */
+	public ViewPort getViewPort() {
+		return vp;
+	}
+
+	/**
+	 * <p>Returns a reference to the layer where this event has been produced.</p> 
+	 * 
+	 * @return layer in which this event has been produced
+	 */
+	public FLayer getLayer() {
+		return lyr;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java	(revision 35988)
@@ -0,0 +1,58 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+
+
+/**
+ * <p><code>LayerDrawingListener</code> defines listeners
+ *  to catch and handle drawing events from layers.</p>
+ */
+public interface LayerDrawingListener {
+    /**
+ 	 * <p>Called before a layer of type {@link FLayer FLayer} or {@link FLayers FLayers} is drawn.</p>
+ 	 * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void beforeLayerDraw(LayerDrawEvent e) throws CancelationException;
+    
+    /**
+     * <p>Process to execute after a layer had been drawn.</p>
+     * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void afterLayerDraw(LayerDrawEvent e) throws CancelationException;
+    
+    /**
+     * <p>Process to execute before a {@link GraphicLayer GraphicLayer} had been drawn.</p>
+     *
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void beforeGraphicLayerDraw(LayerDrawEvent e) throws CancelationException;
+
+    /**
+     * <p>Process to execute after a {@link GraphicLayer GraphicLayer} had been drawn.</p>
+     * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void afterLayerGraphicDraw(LayerDrawEvent e) throws CancelationException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java	(revision 35988)
@@ -0,0 +1,122 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p><code>LayerCollectionListener</code> defines listeners for events that can be produced in a
+ *  collection of layers.</p>
+ */
+public interface LayerCollectionListener {
+    /**
+ 	 * <p>Called when a layer has been added or replaced in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerAdded(LayerCollectionEvent e);
+
+    /**
+ 	 * <p>Called when a layer has been moved in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerMoved(LayerPositionEvent e);
+
+    /**
+  	 * <p>Called when a layer has been removed from the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerRemoved(LayerCollectionEvent e);
+
+    /**
+ 	 * <p>Called when a layer is just going to be added or replaced in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the adding operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerAdding(LayerCollectionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when a layer is just going to be moved in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the moving operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerMoving(LayerPositionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when a layer is just going to be removed from the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the removing operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerRemoving(LayerCollectionEvent e) throws CancelationException;
+
+
+    ///**
+    // * <p>Called when the activation state of the collection of layers has changed.</p>
+    // *
+    // * @param e a layer collection event object
+    // *
+    // * @throws CancelationException Si se quiere cancelar la operaci�n. El
+    // *         mensaje de la excepci�n es el que se mostrar� al usuario en su
+    // *         caso
+    // */
+    //  useless. Please, use LayerListener interface instead
+    // void activationChanged(LayerCollectionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when the visibility of the collection of layers has changed.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the operation of change visibility, this exception will have the
+     *  message that user will see.
+     */
+    void visibilityChanged(LayerCollectionEvent e) throws CancelationException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java	(revision 35988)
@@ -0,0 +1,151 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.geom.Point2D;
+import java.net.URI;
+
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+
+/**
+ * This is an abstract class to keep the properties of the HyperLink. One layer may have
+ * one or zero LinkProperties. The properties of a Link are:
+ * - fieldName, the field�s name of the selected column of the table associated to the
+ * 	layer
+ * - extName, the name of the extension that the usser indicates
+ * - typeLink, the type of the Link
+ * The class implements  'IPersistance' interface to provide persistance to the properties
+ * of HyperLink
+ * 
+ * @deprecated this functionality has extracted of the core in gvSIG 2.0 
+ */
+public abstract class AbstractLinkProperties implements Persistent {
+	private String fieldName;
+	private String extName;
+	private int typeLink;
+
+
+	/**
+	 * Default constructor
+	 */
+	public AbstractLinkProperties(){
+		fieldName=null;
+		extName=null;
+		typeLink=-1;
+	}
+
+	/**
+	 * Provides an array with URIs. Returns one URI by geometry that includes the point
+	 * in its own geometry limits with a allowed tolerance.
+	 * @param layer, the layer
+	 * @param point, the point to check that is contained or not in the geometries in the layer
+	 * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the  point
+	 * 		is contained in some geometries of the layer
+	 * @return
+	 * @throws ReadException
+	 * @throws BehaviorException
+	 */
+	public abstract URI[] getLink(FLayer layer, Point2D point, double tolerance) throws ReadException;
+
+	/**
+	 * Gets the field�s name of the table that the user has selected
+	 * @return this name of the field
+	 */
+	public String getField(){
+		return this.fieldName;
+	}
+
+	/**
+	 * Sets the field�s name
+	 * @param campo, the field�s name
+	 */
+	public void setField(String campo){
+		this.fieldName=campo;
+	}
+
+	/**
+	 * Gets the type of the HyperLink
+	 * @return the type
+	 */
+	public int getType(){
+		return this.typeLink;
+	}
+
+	/**
+	 * Sets the type of the HyperLink
+	 * @param tipo
+	 */
+	public void setType(int tipo){
+		this.typeLink=tipo;
+	}
+
+	/**
+	 * Gets the extension of the files that the user has indicated like properties of the
+	 * HyperLink, this extension is added to the content of the field selected in the table
+	 *
+	 * @return the extension
+	 */
+	public String getExt(){
+		return this.extName;
+	}
+
+	/**
+	 * Sets the extension
+	 * @param extension, the extension of the files
+	 */
+	public void setExt(String extension){
+		this.extName=extension;
+	}
+
+//	/**
+//	 * Provides persistance to the properties of the HyperLink.
+//	 * @return XMLEntity with the information of the HyperLink
+//	 */
+//	public XMLEntity getXMLEntity() {
+//		XMLEntity xml=new XMLEntity();
+//		xml.putProperty("typeChild","linkProperties");
+//		xml.putProperty("extName",extName);
+//		xml.putProperty("fieldName",fieldName);
+//		xml.putProperty("typeLink",typeLink);
+//		return xml;
+//	}
+//
+//	/**
+//	 * Sets the properties of the HyperLink using a XMLEntity that contains the information
+//	 * @param XMLEntity
+//	 */
+//	public void setXMLEntity(XMLEntity xml) {
+//		extName=xml.getStringProperty("extName");
+//		fieldName=xml.getStringProperty("fieldName");
+//		typeLink=xml.getIntProperty("typeLink");
+//	}
+	
+	/**
+	 * Saves the internal state of the object on the provided
+	 * PersistentState object.
+	 * 
+	 * @param state
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("extName",extName);
+		state.set("fieldName",fieldName);
+		state.set("typeLink",typeLink);
+	}
+
+	/**
+	 * Set the state of the object from the state passed as parameter.
+	 *
+	 * @param state
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		
+		extName = state.getString("extName");
+		fieldName = state.getString("fieldName");
+		typeLink = state.getInt("typeLink");
+	}
+	
+	
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java	(revision 35988)
@@ -0,0 +1,68 @@
+/*
+ * Created on 01-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id: IFLayerStatus.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.1  2006-09-21 17:23:39  azabala
+* First version in cvs
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * <p>According to the particular constitution of a layer, it can be in a set of states,
+ *  some of them simultaneously, that altogether represent its <i>status</i>.</p>
+ *   
+ * <p><code>IFLayerStatus</code> is a "marked" interface (we don't define any methods), that represents
+ *  the common status of all kind of layers.</p>
+ * 
+ * @author azabala
+ */
+public interface IFLayerStatus extends Persistent {
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java	(revision 35988)
@@ -0,0 +1,91 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * <p>There are classes and event handlers that allow cancel some of their operations when they are running. 
+ * If fails that cancellation, a <code>CancelationException</code> exception is thrown.</p>
+ * 
+ * @see RuntimeException
+ */
+public class CancelationException extends RuntimeException {
+	/**
+	 * <p>Constructs a new cancelation exception with <code>null</code> as its detail message.
+	 *  The cause is not initialized, and may subsequently be initialized by a call to <code>initCause</code>.</p>
+	 */
+	public CancelationException() {
+		super();
+	}
+
+	/**
+	 * <p>Constructs a new cancelation exception with the specified detail message. The cause is not
+	 *  initialized, and may subsequently be initialized by a call to <code>initCause</code>.
+	 * 
+	 * @param message the detail message. The detail message is saved for later retrieval by the <code>getMessage()</code> method.
+	 */
+	public CancelationException(String message) {
+		super(message);
+	}
+
+	/**
+	 * <p>Constructs a new cancelation exception with the specified detail message and cause.</p>
+	 * <p>Note that the detail message associated with cause is not automatically incorporated in this
+	 *  exception's detail message.</p>
+	 *  
+	 * @param message the detail message (which is saved for later retrieval by the <code>getMessage()</code> method).
+	 * @param cause the cause (which is saved for later retrieval by the <code>getCause()</code> method). (A <code>null</code>
+	 *  value is permitted, and indicates that the cause is nonexistent or unknown).
+	 */
+	public CancelationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * <p>Constructs a cancelation exception with the specified <code>cause</code> and a detail message of <code>(cause==null ?
+	 *  null : cause.toString())</code> (which typically contains the class and detailed information about cause).
+	 *  
+	 * @param cause the cause (which is saved for later retrieval by the <code>getCause()</code> method). (A <code>null</code>
+	 *  value is permitted, and indicates that the cause is nonexistent or unknown).
+	 */
+	public CancelationException(Throwable cause) {
+		super(cause);
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java	(revision 35988)
@@ -0,0 +1,130 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p>Event produced when a layer has been or is being moved from a collection of layers.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerPositionEvent extends LayerCollectionEvent {
+	/**
+	 * <p>If this event is a <i>LAYER_MOVED</i> type, stores the previous index of the affected layer in the layer
+	 *  collection; otherwise its value will be the same as the <code>newPos</code> one.</p>
+	 */
+	private int oldPos;
+
+	/**
+	 * <p>The new index in the layer collection of the layer affected.</p>
+	 */
+	private int newPos;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being moved.</p>
+	 */
+	private final static int LAYER_MOVING = 4;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that has been moved.</p>
+	 */
+	private final static int LAYER_MOVED = 1;
+
+	/**
+	 * <p>Creates a new layer position event notifying a "layer moved" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * 
+	 * @return a new layer position event
+	 */
+	public static LayerPositionEvent createLayerMovedEvent(FLayer lyr, int oldp, int newp){
+		return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVED);
+	}
+
+	/**
+	 * <p>Creates a new layer position event notifying a "layer moving" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * 
+	 * @return a new layer position event
+	 */
+	public static LayerPositionEvent createLayerMovingEvent(FLayer lyr, int oldp, int newp){
+		return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVING);
+	}
+
+	/**
+	 * <p>Creates a new layer position event of the specified type.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer position event
+	 */
+	private LayerPositionEvent(FLayer lyr, int oldp, int newp, int eventType) {
+		super(lyr, eventType);
+		oldPos = oldp;
+		newPos = newp;
+	}
+
+	/**
+	 * <p>Gets the previous index of the affected layer in the layer collection.</p>
+	 *
+	 * @return the previous index
+	 */
+	public int getOldPos() {
+		return oldPos;
+	}
+
+	/**
+	 * <p>Gets the new index of the affected layer in the layer collection.</p>
+	 *
+	 * @return the new index
+	 */
+	public int getNewPos() {
+		return newPos;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java	(revision 35988)
@@ -0,0 +1,61 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+
+/**
+ * <p>All vector layers that can be classifiable and can have associated a legend, must implement
+ *  <code>ClassifiableVectorial</code>.</p>
+ *
+ * @see Classifiable
+ */
+public interface ClassifiableVectorial extends Classifiable{
+	/**
+	 * <p>Sets the layer's legend as a vector legend.</p>
+	 *
+	 * @param r the legend with vector data
+	 *
+	 * @throws LegendLayerException if fails setting the legend to this layer.
+	 */
+	void setLegend(IVectorLegend r) throws LegendLayerException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.exception.BaseException;
+
+public class LayerNotFoundInCollectionException extends BaseException {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1936414534310013616L;
+    private final static String MESSAGE_FORMAT = "Layer '%(layer)' not found in collection '%(collection)'.";
+    private final static String MESSAGE_KEY = "_LayerNotFoundInCollectionException";
+    
+    public LayerNotFoundInCollectionException(FLayer layer, LayerCollection collection){
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+        setValue("layer", layer.getName());
+        setValue("collection", collection.toString());
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java	(revision 35988)
@@ -0,0 +1,78 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+
+/**
+ * DOCUMENT ME!
+ *
+ */
+public interface SingleLayer extends FLayer {
+	/**
+	 * M�todo que devuelve el DataStore del que saca los datos la capa.
+	 *
+	 * @return DataStore de la capa.
+	 */
+	public DataStore getDataStore();
+
+	/**
+	 * M�todo que devuelve el DataStore del que saca los datos la capa.
+	 *
+	 * @param dataStore
+	 *            a insertar.
+	 *
+	 * @throws LoadLayerException
+	 * @throws {@link UnsupportedOperationException}
+	 *
+	 * @deprecated ???? creo que ya no deber�a estar en inteface
+	 */
+	public void setDataStore(DataStore dataStore) throws LoadLayerException;
+
+    /**
+     * By default null
+     * @return
+     */
+//    public Strategy getStrategy();
+//    public void setStrategy(Strategy s);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.visitor.Visitor;
+
+public interface LayersVisitor extends Visitor {
+	public void visit(FLayer layer) throws BaseException;
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java	(revision 35988)
@@ -0,0 +1,147 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.task.Cancellable;
+
+
+/**
+ * <p>Interface that must be implemented by layers which support the operation "<i>information by point</i>".</p>
+ *
+ * <p>That operation allows get meta-information from a point and an area around, of a layer.</p>
+ */
+public interface InfoByPoint {
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The coordinates also depend on the
+     *            implementation.
+     * @param cancel
+     *            shared object that determines if this layer can continue being
+     *            drawn
+     * 
+     * @return a DynObjectSet. If the InfoByPoint Object is a vector layer it
+     *         should return a FeatureSet.
+     * @throws DataException
+     *             TODO
+     * @throws LoadLayerException
+     *             any exception produced using the driver.
+     *             
+     * @deprecated use instead {@link #getInfo(Point, double)}
+     */
+    public DynObjectSet getInfo(java.awt.Point p, double tolerance, Cancellable cancel)
+        throws LoadLayerException, DataException;
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The coordinates also depend on the
+     *            implementation.
+     * @param cancel
+     *            shared object that determines if this layer can continue being
+     *            drawn
+     * 
+     * @param fast
+     *            if true try to reuse objects as much as possible to make the
+     *            object iteration faster. If true, DynObjects got through the
+     *            returned set must not be stored unless cloned.
+     * 
+     * @return a DynObjectSet. If the InfoByPoint Object is a vector layer it
+     *         should return a FeatureSet.
+     * @throws DataException
+     *             TODO
+     * @throws LoadLayerException
+     *             any exception produced using the driver.
+     *             
+     * @deprecated use instead {@link #getInfo(Point, double)}
+     */
+    public DynObjectSet getInfo(java.awt.Point p, double tolerance, Cancellable cancel,
+        boolean fast) throws LoadLayerException, DataException;
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point in map coordinates where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The unit are in map coordinates.
+     */            
+    public DynObjectSet getInfo(Point p, double tolerance) throws LoadLayerException, DataException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java	(revision 35988)
@@ -0,0 +1,97 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+/**
+ * <p>Interface that all layers that can be classifiable, must implement.</p>
+ * <p>The interface <code>Classifiable</code> allows classify a layer in <i>raster</i> or <i>vector</i>,
+ *  and then, generates a legend.</p>
+ */
+public interface Classifiable {
+	/**
+	 * Adds the specified legend listener to receive legend events from the inner legend.
+	 *  If the parameter is null, no exception is thrown and no action is performed.
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #removeLegendListener(LegendListener)
+	 */
+	void addLegendListener(LegendListener listener);
+
+	/**
+	 * Removes the specified legend listener so that it no longer receives legend events from the inner
+	 *  legend. This method performs no function, nor does it throw an exception, if the listener specified
+	 *  by the argument was not previously added to the legend. If the parameter is null, no exception is
+	 *  thrown and no action is performed.
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #addLegendListener(LegendListener)
+	 */
+	void removeLegendListener(LegendListener listener);
+
+	/**
+	 * Returns the inner legend.
+	 *
+	 * @return Legend.
+	 */
+	public ILegend getLegend();
+
+	/**
+	 * <p>Returns the type of the shape.</p>
+	 * <p>All geometry types are defined in <code>Geometry.TYPES</code>.
+	 *  For getting the equivalent shape of a geometry type, you must use a method like
+	 *  <code>{@linkplain SHPFileWrite#getShapeType()}</code>.</p>
+	 *
+	 * @return the type of this shape.
+	 * @throws ReadException
+	 *
+	 * @see Geometry
+	 * @see Constant
+	 *
+	 * @throws ReadDriverException if the driver fails reading the data.
+	 */
+	public int getShapeType() throws ReadException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java	(revision 35988)
@@ -0,0 +1,72 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend;
+
+
+/**
+ * <p>Interface that all raster layers that can be classifiable and can have associated a legend,
+ *  must implement.</p>
+ *
+ * @see Classifiable
+ */
+public interface ClassifiableRaster extends Classifiable {
+	/**
+	 * <p>Sets the layer's legend as a raster legend.</p>
+	 *
+	 * @param r the legend with raster data
+	 *
+	 * @throws DriverException if fails the driver used in this method.
+	 */
+	void setLegend(IRasterLegend r);
+
+	/**
+	 * <p>Returns the type of this shape.</p>
+	 * <p>All geometry types are defined in <code>Geometry.TYPES</code>, and their shape equivalent in <code>FConstant</code>.</p>
+	 *
+	 * @return the type of this shape
+	 *
+	 * @see Geometry
+	 * @see Constant
+	 */
+	int getShapeType();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java	(revision 35988)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitable;
+
+public interface LayersVisitable extends Visitable {
+	public void accept(LayersVisitor visitor) throws BaseException;
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java	(revision 35988)
@@ -0,0 +1,142 @@
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Abstract class for the classes that make able
+ * a single draw for a layers group
+ *
+ * @see  org.gvsig.fmap.mapcontext.layers.FLayer#newComposedLayer()
+ */
+public abstract class ComposedLayer {
+
+	ArrayList pendingLayersEvents= new ArrayList();
+	MapContext mapContext = null;
+
+	public ComposedLayer(){
+
+	}
+
+	public void setMapContext(MapContext mapContext) {
+		this.mapContext = mapContext;
+	}
+
+	/**
+	 * Checks if the layer can be added to this group
+	 *
+	 * @param layer
+	 * @return layer can be added or not
+	 */
+	public abstract boolean canAdd(FLayer layer);
+
+	/**
+	 * Adds the layer to the draw group.
+	 * You have to implements the doAdd(FLayer) method.
+	 *
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#canAdd(FLayer)
+	 *
+	 * @param layer
+	 * @throws Exception
+	 */
+	public final void add(FLayer layer) throws Exception {
+		if (this.mapContext == null){
+			this.mapContext =layer.getMapContext();
+		}
+        doAdd(layer);
+    	pendingLayersEvents.add(layer);
+	}
+
+	/**
+	 * Draws all the group in one pass
+	 * You have to implements the doDraw method.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+    public final void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException {
+    	doDraw(image, g, viewPort, cancel, scale);
+    	fireLayerDrawingEvents(g,viewPort);
+		pendingLayersEvents.clear();
+    }
+
+	/**
+	 * Prints all the group in one pass
+	 * You have to implements the doDraw method.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+    public final void print(Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale,PrintAttributes properties) throws ReadException {
+    	doPrint(g, viewPort, cancel, scale,properties);
+		pendingLayersEvents.clear();
+    }
+
+	/**
+	 * Fires the event LayerDrawEvent.LAYER_AFTER_DRAW for every
+	 * layers of the group.
+	 *
+	 *
+	 *  @see org.gvsig.fmap.mapcontext.layers.LayerDrawEvent
+	 *
+	 */
+	private void fireLayerDrawingEvents(Graphics2D g, ViewPort viewPort) {
+		Iterator iter = pendingLayersEvents.iterator();
+		LayerDrawEvent afterEvent;
+		FLayer layer = null ;
+		while (iter.hasNext()) {
+			layer =(FLayer)iter.next();
+			afterEvent = new LayerDrawEvent(layer, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
+			// System.out.println("+++ evento " + afterEvent.getLayer().getName());
+			mapContext.fireLayerDrawingEvent(afterEvent);
+		}
+	}
+
+
+	/**
+	 * Adds the layer to the draw group.
+	 * Specific implementation.
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#add(FLayer)
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#canAdd(FLayer)
+	 *
+	 * @param layer
+	 * @throws Exception
+	 */
+	protected abstract void doAdd(FLayer layer) throws Exception ;
+
+	/**
+	 * Draws all the group in one pass.
+	 * Specific implementation.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	protected abstract void doDraw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException ;
+
+	/**
+	 * Prints all the group in one pass.
+	 * Specific implementation.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#print(Graphics2D, ViewPort, Cancellable, double)
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#print(Graphics2D, ViewPort, Cancellable, double)
+	 */
+	protected abstract void doPrint(Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale,PrintAttributes properties) throws ReadException ;
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java	(revision 35988)
@@ -0,0 +1,52 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Image;
+
+public interface IHasImageLegend {
+
+	Image getImageLegend();
+	String getPathImage();
+
+}
+
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java	(revision 35988)
@@ -0,0 +1,278 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+
+
+
+/**
+ * <p>Interface with methods for a collection of layers.</p>
+ */
+public interface LayerCollection extends LayersVisitable {
+
+	/**
+	 * Value used to specify the insertion at the beginning.
+	 */
+	public final static int BEGIN = 0;
+	/**
+	 * Value used to specify the insertion at the end.
+	 */
+	public final static int END = 1;
+	/**
+	 * Value used to specify the insertion before an element.
+	 */
+	public final static int BEFORE = 2;
+	/**
+	 * Value used to specify the insertion after an element.
+	 */
+	public final static int AFTER = 3;
+
+	/**
+	 * <p>Adds a listener of events produced on a collection of layers.</p>
+	 *
+	 * @param listener a <code>LayerCollectionListener</code>
+	 *
+	 * @see #removeLayerCollectionListener(LayerCollectionListener)
+	 */
+	public void addLayerCollectionListener(LayerCollectionListener listener);
+
+	/**
+	 * <p>Removes a listener of events produced on a collection of layers.</p>
+	 *
+	 * @param listener a <code>LayerCollectionListener</code>
+	 *
+	 * @see #addLayerCollectionListener(LayerCollectionListener)
+	 */
+	public void removeLayerCollectionListener(LayerCollectionListener listener);
+
+	/**
+	 * <p>Adds a new layer to this collection.</p>
+	 *
+	 * @param layer the new layer
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 * @throws LoadLayerException any exception produced loading the layer.
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(int)
+	 * @see #removeLayer(String)
+	 */
+	public void addLayer(FLayer layer) throws CancelationException, LoadLayerException;
+
+	/**
+	 * <p>Adds a new layer to this collection before or after an element if supplied, 
+	 * and if not at the beginning or end of the collection.</p>.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @param where the position parameter. The valid values are:<br>
+	 * 	0 = BEGIN (first position)<br>
+	 * 	1 = END (last position)<br>
+	 * 	2 = BEFORE (before target layer)<br>
+	 * 	3 = AFTER (after target layer)<br>
+	 * 
+	 * @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 * @throws LoadLayerException any exception produced loading the layer.
+	 *
+	 * @see #moveTo(FLayer, LayerCollection, int, FLayer)
+	 */
+	public void addLayer(FLayer layer, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException ;
+
+	/**
+	 * <p>Moves a layer of the collection to another position in internal list. It doesn't consider sub-nodes of layers.</p>
+	 *
+	 * @param from origin position
+	 * @param to destination position
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 */
+	public void moveTo(int from, int to) throws CancelationException;
+
+	/**
+	 * <p>Removes a layer from this collection.</p>
+	 *
+	 * @param lyr a layer
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 *
+	 * @see #removeLayer(int)
+	 * @see #removeLayer(String)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(FLayer lyr) throws CancelationException;
+
+	/**
+	 * <p>Removes a layer using its identifier.</p>
+	 *
+	 * @param idLayer layer identifier
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(String)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(int idLayer);
+
+	/**
+	 * <p>Removes a layer using its name.</p>
+	 *
+	 * @param layerName the name of the layer
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(int)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(String layerName);
+
+	/**
+	 * <p>Returns an array with all visible layers in this collection.</p>
+	 *
+	 * @return array with first-level visible layer nodes, or <code>null</code> if no there is no layer visible
+	 *
+	 * @see #setAllVisibles(boolean)
+	 */
+	public FLayer[] getVisibles();
+
+	/**
+	 * <p>Returns an array with all active layers in this collection.</p>
+	 *
+	 * @return array with first-level active layer nodes, or <code>null</code> if no there is no layer actived
+	 *
+	 * @see #setAllActives(boolean)
+	 */
+	public FLayer[] getActives();
+
+	/**
+	 * <p>Returns the ith-output directed son (from bottom up) of this collection.</p>
+	 *
+	 * @param index index of the ith-output layer in this collection.
+	 *
+	 * @return a layer
+	 *
+	 * @see #getLayer(String)
+	 */
+	public FLayer getLayer(int index);
+
+	/**
+	 * <p>Returns a first-level layer of this collection, using its name.</p>
+	 *
+	 * @param layerName name of a layer of this collection
+	 *
+	 * @return a layer
+	 *
+	 * @see #getLayer(int)
+	 */
+	public FLayer getLayer(String layerName);
+
+	/**
+	 * <p>Returns the number of layers that are at the first level inside this one.</p>
+	 *
+	 * <p>Doesn't counts the sublayers (of <code>FLayers</code> subnodes).</p>
+	 *
+	 * @return number >= 0 with layers that are at the same first-level
+	 *
+	 * @see #getLayer(int)
+	 * @see #getLayer(String)
+	 */
+	public int getLayersCount();
+
+	/**
+	 * <p>Changes the status of all layers to active or inactive.</p>
+	 *
+	 * @param active a boolean value
+	 *
+	 * @see #getActives()
+	 */
+	public void setAllActives(boolean active);
+
+	/**
+	 * <p>Changes the status of all layers to visible or invisible.</p>
+	 *
+	 * @param visible a boolean value
+	 *
+	 * @see #getVisibles()
+	 */
+	public void setAllVisibles(boolean visible);
+
+
+	public void beginDraw(Graphics2D g, ViewPort viewPort);
+	public void endDraw(Graphics2D g, ViewPort viewPort);
+	
+	/**
+	 * <p>Moves a layer from this collection to another collection 
+	 * before or after an element if supplied, 
+	 * and if not at the beginning or end of the collection.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @param where the position parameter. The valid values are:<br>
+	 * 	0 = BEGIN (first position)<br>
+	 * 	1 = END (last position)<br>
+	 * 	2 = BEFORE (before target layer)<br>
+	 * 	3 = AFTER (after target layer)<br>
+	 * 
+	 * @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
+	 * @throws LayerNotFoundInCollectionException 
+	 * 
+	 * @see #addLayer(FLayer, int, FLayer)
+	 */
+	public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException;
+
+	/**
+	 * <p>Moves a layer from this collection to the end of another collection.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @throws LayerNotFoundInCollectionException 
+	 *
+	 */
+	public void move(FLayer layer, LayerCollection group);
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java	(revision 35988)
@@ -0,0 +1,190 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+
+/**
+ * Crea un adaptador del driver que se le pasa como par�metro en los m�todos
+ * createLayer. Si hay memoria suficiente se crea un FLyrMemory que pasa todas
+ * las features del driver a memoria
+ */
+public class LayerFactory {
+//	final static private Logger logger = LoggerFactory.getLogger(LayerFactory.class);
+
+	private static LayerFactory instance = null;
+
+
+
+	public static LayerFactory getInstance() {
+		if (instance == null) {
+			instance = new LayerFactory();
+		}
+		return instance;
+	}
+
+	/**
+	 * Guarda registro de que clase de capa debe usar para un determinado Store
+	 *
+	 * como clave usamos el nombre de registro del dataStore
+	 */
+	private Map layersToUseForStore = new HashMap();
+
+	/**
+	 * Registra que clase tiene que usar para un {@link DataStore} determinado. <br>
+	 * Por defecto, si el
+	 *
+	 *
+	 * @param dataStoreName
+	 *            Nombre de registro del {@link DataStore} dentro del
+	 *            {@link DataManager}
+	 * @param layerClassToUse
+	 *            clase que implementa {@link SingleLayer}
+	 * @return
+	 */
+
+	public boolean registerLayerToUseForStore(String dataStoreName,
+			Class layerClassToUse) {
+
+		DataManager dm = DALLocator.getDataManager();
+		DataStoreParameters dsparams;
+		try {
+			dsparams = dm.createStoreParameters(dataStoreName);
+		} catch (InitializeException e) {
+			e.printStackTrace();
+			return false;
+		} catch (ProviderNotRegisteredException e) {
+			e.printStackTrace();
+			return false;
+		}
+		if (!layerClassToUse.isAssignableFrom(SingleLayer.class)) {
+			return false;
+		}
+		this.layersToUseForStore.put(dsparams.getDataStoreName(),
+				layerClassToUse);
+
+		return true;
+	}
+
+	public boolean registerLayerToUseForStore(Class storeClass,
+			Class layerClassToUse) {
+
+//		DataManager dm = DALLocator.getDataManager();
+		if (!DataStore.class.isAssignableFrom(storeClass)) {
+			return false;
+		}
+
+		if (!SingleLayer.class.isAssignableFrom(layerClassToUse)
+				|| !FLayer.class.isAssignableFrom(layerClassToUse)) {
+			return false;
+		}
+		this.layersToUseForStore.put(storeClass,
+				layerClassToUse);
+
+		return true;
+	}
+
+	private Class getLayerClassFor(DataStore store) {
+		Class result = (Class) this.layersToUseForStore.get(store.getName());
+		if (result == null) {
+			Iterator iter = this.layersToUseForStore.entrySet().iterator();
+			Map.Entry entry;
+			Class key;
+			while (iter.hasNext()) {
+				entry = (Entry) iter.next();
+				if (entry.getKey() instanceof Class) {
+					key = (Class) entry.getKey();
+					if (key.isAssignableFrom(store.getClass())) {
+						result = (Class) entry.getValue();
+						break;
+					}
+				}
+			}
+		}
+		return result;
+
+	}
+
+
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1
+	 * @see {@link MapContextManager}.
+	 */
+	public FLayer createLayer(String layerName,
+			DataStoreParameters storeParameters) throws LoadLayerException {
+		// Se obtiene el driver que lee
+		try{
+			DataManager dataManager=DALLocator.getDataManager();
+			DataStore dataStore=dataManager.createStore(storeParameters);
+			return createLayer(layerName, dataStore);
+		}catch (Exception e) {
+			throw new LoadLayerException(layerName,e);
+		}
+	}
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1
+	 * @see {@link MapContextManager}.
+	 */
+	public FLayer createLayer(String layerName, DataStore dataStore) throws LoadLayerException{
+		try{	
+			Class layerClass = this.getLayerClassFor(dataStore);
+			if (layerClass == null) {
+				throw new CantRetrieveLayerByStoreException(layerName,dataStore.getName());
+			}
+			FLayer layer;
+			try {
+				layer = (FLayer) layerClass.newInstance();
+			} catch (InstantiationException e) {
+				throw new LoadLayerException(layerName, e);
+			} catch (IllegalAccessException e) {
+				throw new LoadLayerException(layerName, e);
+			}
+
+			layer.setName(layerName);
+			((SingleLayer) layer).setDataStore(dataStore);
+			IProjection proj = (IProjection)dataStore.getDynValue(FeatureStore.METADATA_CRS);
+			if (proj != null) {
+				layer.setProjection(proj);
+			}
+			layer.load();
+			return layer;
+		} catch (Exception e) {
+			throw new LoadLayerException(layerName,e);
+		}
+	}
+	
+	private class CantRetrieveLayerByStoreException extends LoadLayerException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 1442450896900126712L;
+
+		CantRetrieveLayerByStoreException(String layerName, String storeName) {
+			super(
+				"Can't retrieve the class leyer of %(layer) to use for store %(store).",
+				null,
+				"_Cant_retrieve_the_class_leyer_of_XlayerX_to_use_for_store_XstoreX",
+				serialVersionUID
+			);
+			setValue("layer", layerName);
+			setValue("store", storeName);
+		}
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java	(revision 35988)
@@ -0,0 +1,82 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Dimension;
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Rectangle2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class DimensionPersistenceFactory extends
+		AbstractSinglePersistenceFactory {
+
+	private static final String DYNCLASS_NAME = "AwtDimension";
+	private static final String DYNCLASS_DESCRIPTION = "Dimension in AWT";
+
+	public static final String FIELD_HEIGHT = "height";
+	public static final String FIELD_WIDTH = "width";
+
+	/**
+	 * Creates a new {@link DimensionPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Dimension} objects.
+	 */
+	public DimensionPersistenceFactory() {
+		super(Dimension.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null,
+				null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldInt(FIELD_WIDTH).setMandatory(true);
+		definition.addDynFieldInt(FIELD_HEIGHT).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		Dimension dimension = new Dimension();
+		dimension.width = state.getInt(FIELD_WIDTH);
+		dimension.height = state.getInt(FIELD_HEIGHT); 
+		return dimension;
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Dimension dim = (Dimension) obj;
+
+		state.set(FIELD_HEIGHT, dim.height);
+		state.set(FIELD_WIDTH, dim.width);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java	(revision 35988)
@@ -0,0 +1,82 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Font;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Font} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class FontPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_NAME = "name";
+	static final String FIELD_STYLE = "style";
+	static final String FIELD_SIZE = "size";
+
+	private static final String DYNCLASS_NAME = "AwtFont";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Font";
+
+	/**
+	 * Creates a new {@link FontPersistenceFactory} with the {@link DynStruct}
+	 * definition for the {@link Font} objects.
+	 */
+	public FontPersistenceFactory() {
+		super(Font.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldString(FIELD_NAME).setMandatory(true);
+		definition.addDynFieldInt(FIELD_STYLE).setMandatory(true);
+		definition.addDynFieldInt(FIELD_SIZE).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		String name = state.getString(FIELD_NAME);
+		int style = state.getInt(FIELD_STYLE);
+		int size = state.getInt(FIELD_SIZE);
+
+		return new Font(name, style, size);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Font font = (Font) obj;
+		state.set(FIELD_NAME, font.getName());
+		state.set(FIELD_STYLE, font.getStyle());
+		state.set(FIELD_SIZE, font.getSize());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java	(revision 35988)
@@ -0,0 +1,90 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Rectangle2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class Rectangle2DPersistenceFactory extends
+		AbstractSinglePersistenceFactory {
+
+	private static final String DYNCLASS_NAME = "AwtRectangle2D";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Rectangle2D";
+
+	public static final String FIELD_X = "x";
+	public static final String FIELD_Y = "y";
+	public static final String FIELD_WIDTH = "width";
+	public static final String FIELD_HEIGHT = "height";
+
+	/**
+	 * Creates a new {@link Rectangle2DPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Rectangle2D} objects.
+	 */
+	public Rectangle2DPersistenceFactory() {
+		super(Rectangle2D.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null,
+				null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldDouble(FIELD_X).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_Y).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_WIDTH).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_HEIGHT).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+
+		double x = state.getDouble(FIELD_X);
+		double y = state.getDouble(FIELD_Y);
+		double width = state.getDouble(FIELD_WIDTH);
+		double height = state.getDouble(FIELD_HEIGHT);
+
+		return new Rectangle2D.Double(x, y, width, height);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Rectangle2D rec = (Rectangle2D) obj;
+
+		state.set(FIELD_X, rec.getX());
+		state.set(FIELD_Y, rec.getY());
+		state.set(FIELD_WIDTH, rec.getWidth());
+		state.set(FIELD_HEIGHT, rec.getHeight());
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java	(revision 35988)
@@ -0,0 +1,87 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Color;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Color} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class ColorPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_RED = "red";
+	static final String FIELD_GREEN = "green";
+	static final String FIELD_BLUE = "blue";
+	static final String FIELD_ALPHA = "alpha";
+
+	private static final String DYNCLASS_NAME = "AwtColor";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Color";
+
+	/**
+	 * Creates a new {@link ColorPersistenceFactory} with the {@link DynStruct}
+	 * definition for the {@link Color} objects.
+	 */
+	public ColorPersistenceFactory() {
+		super(Color.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldInt(FIELD_RED).setMandatory(true);
+		definition.addDynFieldInt(FIELD_GREEN).setMandatory(true);
+		definition.addDynFieldInt(FIELD_BLUE).setMandatory(true);
+		definition.addDynFieldInt(FIELD_ALPHA).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		int red = state.getInt(FIELD_RED);
+		int green = state.getInt(FIELD_GREEN);
+		int blue = state.getInt(FIELD_BLUE);
+		int alpha = state.getInt(FIELD_ALPHA);
+
+		return new Color(red, green, blue, alpha);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Color color = (Color) obj;
+		state.set(FIELD_RED, color.getRed());
+		state.set(FIELD_GREEN, color.getGreen());
+		state.set(FIELD_BLUE, color.getBlue());
+		state.set(FIELD_ALPHA, color.getAlpha());
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java	(revision 35988)
@@ -0,0 +1,78 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Point2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Point2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class Point2DPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_X = "x";
+	static final String FIELD_Y = "y";
+
+	private static final String DYNCLASS_NAME = "AwtPoint2D";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Point2D";
+
+	/**
+	 * Creates a new {@link Point2DPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Point2D} objects.
+	 */
+	public Point2DPersistenceFactory() {
+		super(Point2D.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldDouble(FIELD_X).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_Y).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		double x = state.getDouble(FIELD_X);
+		double y = state.getDouble(FIELD_Y);
+
+		return new Point2D.Double(x, y);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Point2D point = (Point2D) obj;
+		state.set(FIELD_X, point.getX());
+		state.set(FIELD_Y, point.getY());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java	(revision 35988)
@@ -0,0 +1,609 @@
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.gvsig.compat.CompatLocator;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.LayersIterator;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+public class DefaultMapContextDrawer implements MapContextDrawer {
+	private MapContext mapContext=null;
+	private ViewPort viewPort=null;
+	private CachedImage cachedImage=null;
+	private DrawList previousDrawList = null;
+
+	public DefaultMapContextDrawer(){
+
+	}
+
+	protected void checkIntilalized(){
+		if (mapContext == null || viewPort == null){
+			throw new IllegalStateException("MapContext and ViewPort must be set");
+		}
+	}
+
+	protected boolean isLayerCacheable(FLayer layer){
+		return layer.isActive();
+	}
+
+	public void draw(FLayers root, BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException {
+
+		this.checkIntilalized();
+
+		boolean needToPaintAll = false;
+
+		DrawList drawList = this.createDrawList(root, cancel,scale);
+		if (cancel.isCanceled()){
+			return;
+		}
+
+		if (cachedImage == null){
+			needToPaintAll=true;
+		} else if (!cachedImage.isValid(mapContext, viewPort, drawList.getFirstLayerToDraw())){
+			needToPaintAll=true;
+		}
+
+
+		int firstLayer= 0;
+		if (!needToPaintAll){
+			firstLayer = cachedImage.getListPosition()+1;
+//			System.out.println("=======Pintando a partir de la pos "+ firstLayer+"============");
+			g.drawImage(cachedImage.getImage(), 0, 0, null);
+//			System.out.println("=======Pintando imagen ============");
+
+		} else{
+			this.cachedImage = null;
+//			System.out.println("=======Pintando todo============");
+		}
+
+
+		boolean cached=false;
+		ComposedLayer composed = null;
+		int pos;
+		int layerPos= -1;
+		FLayer layer;
+		Object obj;
+		LayersGroupEvent event;
+		for (pos=0; pos < drawList.size(); pos++){
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			obj = drawList.get(pos);
+
+			// *** Gestion de eventos de pintado de grupos ***
+			if (obj instanceof LayersGroupEvent){
+				event = (LayersGroupEvent) obj;
+				if (event.type == LayersGroupEvent.IN_Event){
+//					System.out.println("=======Empiza a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+					event.group.beginDraw(g, viewPort);
+				} else{
+					event.group.endDraw(g, viewPort);
+//					System.out.println("=======Fin a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+
+				}
+				continue;
+			}
+			layerPos++;
+			if (layerPos < firstLayer){
+				continue;
+			}
+
+			layer = (FLayer) obj;
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			// *** Gestion de cache ***
+			if ((!cached) && this.isLayerCacheable(layer)){
+				if (layerPos > 0){ //La primera capa es la activa, no cacheamos
+					if (cachedImage==null || cachedImage.getListPosition() < layerPos-1){
+
+						if (composed != null){
+							//si tenemos una composicion de capas, necesitamos pintarlas
+							//antes de guardarnos la imagen
+//							System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (antes de cache)============");
+							this.draw(composed, image, g, cancel, scale);
+//							composed.draw(image, g, viewPort, cancel, scale);
+							composed = null;
+
+						}
+						CachedImage  newCached = new CachedImage();
+						newCached.setImage(image, mapContext, viewPort, layerPos-1);
+						this.cachedImage = newCached;
+//						System.out.println("=======Guardando imagen de la pos "+ (layerPos-1)+" ("+ newCached.getListPosition() +")============");
+					}
+				}
+				cached = true;
+			}
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			if (composed == null){
+				composed = layer.newComposedLayer();
+				if (composed != null){
+					try {
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						composed.add(layer);
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefalutMapContexDrawer exception",e);
+					}
+				}
+			}else{
+				if (composed.canAdd(layer)){
+					try {
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						composed.add(layer);
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefalutMapContexDrawer exception",e);
+					}
+				} else {
+//					System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (cambio composicion)============");
+					this.draw(composed, image, g, cancel, scale);
+//					composed.draw(image, g, viewPort, cancel, scale);
+					composed = layer.newComposedLayer();
+					if (composed != null){
+						try {
+//							System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+							composed.add(layer);
+							continue;
+						} catch (Exception e) {
+							throw new ReadException("DefalutMapContexDrawer exception",e);
+						}					}
+				}
+			}
+//			System.out.println("=== pintando "+ layerPos+ " "+layer.getName());
+			this.draw(layer, image, g, cancel, scale);
+//			layer.draw(image, g, viewPort, cancel, scale);
+
+		}
+		if (composed != null){
+			// si la composicion no se ha pintado la pintamos
+//			System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (ultimo)============");
+			this.draw(composed, image, g, cancel, scale);
+//			composed.draw(image, g, viewPort, cancel, scale);
+		}
+		if (cancel.isCanceled()){
+			return;
+		}
+
+		this.previousDrawList = drawList;
+
+	}
+
+	private void draw(Object layerOrComposed,BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException{
+		ILabelable labelable= null;
+		ILabelable tmp= null;
+		if (layerOrComposed instanceof ILabelable){
+
+			tmp =(ILabelable) layerOrComposed;
+
+			if (tmp.isLabeled()
+				&& tmp.getLabelingStrategy() != null
+				&& tmp.getLabelingStrategy().shouldDrawLabels(scale)) {
+				labelable =tmp;
+			}
+		}
+		if (layerOrComposed instanceof FLayer){
+			FLayer layer = (FLayer) layerOrComposed;
+			layer.draw(image, g, viewPort, cancel, scale);
+		} else{
+			ComposedLayer composed = (ComposedLayer) layerOrComposed;
+			composed.draw(image, g, viewPort, cancel, scale);
+		}
+		if (labelable != null){
+			labelable.drawLabels(image, g, viewPort, cancel, scale, MapContext.getScreenDPI());
+		}
+
+	}
+
+	private void print(Object layerOrComposed,Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties) throws ReadException{
+		ILabelable labelable= null;
+		ILabelable tmp= null;
+		if (layerOrComposed instanceof ILabelable){
+
+			tmp =(ILabelable) layerOrComposed;
+
+			if (tmp.isLabeled()
+				&& tmp.getLabelingStrategy() != null
+				&& tmp.getLabelingStrategy().shouldDrawLabels(scale)) {
+				labelable =tmp;
+			}
+		}
+
+		if (layerOrComposed instanceof FLayer){
+			FLayer layer = (FLayer) layerOrComposed;
+			layer.print(g, viewPort, cancel, scale, properties);
+		} else{
+			ComposedLayer composed = (ComposedLayer) layerOrComposed;
+			composed.print(g, viewPort, cancel, scale, properties);
+		}
+		if (labelable != null){
+			labelable.printLabels(g, viewPort, cancel, scale, properties);
+		}
+
+	}
+
+	public void setMapContext(MapContext mapContext) {
+		if (this.mapContext == mapContext){
+			return;
+		}
+		this.clean();
+		this.mapContext = mapContext;
+
+	}
+
+	public void setViewPort(ViewPort viewPort) {
+		if (this.viewPort == viewPort){
+			return;
+		}
+		this.clean();
+		this.viewPort = viewPort;
+
+	}
+
+	protected void clean(){
+		this.cachedImage = null;
+	}
+
+	public class CachedImage{
+		private BufferedImage image;
+		private long mapContextVersion;
+		private long viewPortVersion;
+		private int listPosition;
+
+		public void setImage(BufferedImage img,MapContext mapContext, ViewPort viewPort,int pos) {
+
+			image = CompatLocator.getGraphicsUtils().copyBufferedImage(img);
+			this.mapContextVersion = mapContext.getDrawVersion();
+			this.viewPortVersion = viewPort.getDrawVersion();
+			this.listPosition = pos;
+		}
+
+		public BufferedImage getImage() {
+			return image;
+		}
+
+		public long getMapContextVersion() {
+			return mapContextVersion;
+		}
+
+		public long getViewPortVersion() {
+			return viewPortVersion;
+		}
+
+		public int getListPosition(){
+			return this.listPosition;
+		}
+
+		public boolean isValid(MapContext context,ViewPort viewPort,int firstLayerToDraw){
+			if (viewPort.getDrawVersion() > this.viewPortVersion){
+				return false;
+			}
+			if (firstLayerToDraw <= this.listPosition){
+				return false;
+			}
+			return true;
+		}
+	}
+
+	public class DrawList{
+		private List layers = new ArrayList();
+		private List all = new ArrayList();
+		private List versions = new ArrayList();
+		private DrawList previosList = null;
+		private int firstLayerToDraw =-1;
+
+		public DrawList(){
+		}
+
+		public DrawList(DrawList previousList){
+			if (previousList != null){
+				this.firstLayerToDraw =previousList.getLayerCount();
+				this.previosList=previousList;
+			}
+		}
+
+		public int getLayerCount(){
+			return this.layers.size();
+		}
+
+		private boolean hasChanged(FLayer layer, int pos){
+			FLayer previous =(FLayer) this.previosList.layers.get(pos);
+//			String previousName = previous.getName();
+//			String layerName = layer.getName();
+			if (previous != layer){
+				return true;
+			}
+			long previousVersion = ((Long) this.previosList.versions.get(pos)).longValue();
+			long layerVersion = layer.getDrawVersion();
+
+			return previousVersion != layerVersion;
+		}
+
+		public void add(Object obj){
+			if (obj instanceof FLayer){
+				FLayer layer = (FLayer) obj;
+				int curIndex = this.layers.size();
+				if (this.firstLayerToDraw >= curIndex){
+					if (this.previosList.getLayerCount() > curIndex){
+						if (this.hasChanged(layer, curIndex)){
+							this.firstLayerToDraw = curIndex;
+						}
+					} else if (this.previosList.getLayerCount() == curIndex){
+						this.firstLayerToDraw = curIndex;
+					}
+				}
+				this.layers.add(layer);
+				this.versions.add(new Long(layer.getDrawVersion()));
+			} else if (!(obj instanceof LayersGroupEvent)){
+				throw new UnsupportedOperationException();
+			}
+
+			this.all.add(obj);
+		}
+
+		public int size(){
+			return this.all.size();
+		}
+
+		public int getFirstLayerToDraw(){
+			if (this.firstLayerToDraw > this.layers.size()){
+				this.firstLayerToDraw = this.layers.size();
+			}
+			return this.firstLayerToDraw;
+		}
+
+		public FLayer getLayer(int pos){
+			return (FLayer) this.layers.get(pos);
+		}
+
+		public Object get(int pos){
+			return this.all.get(pos);
+		}
+
+	}
+
+	private class SimpleLayerIterator extends LayersIterator{
+
+		public SimpleLayerIterator(FLayer layer) {
+			this.appendLayer(layer);
+		}
+
+		public boolean evaluate(FLayer layer) {
+			if (layer instanceof FLayers) {
+				return false;
+			}
+			return layer.isAvailable() && layer.isVisible();
+		}
+
+	}
+
+	public void dispose() {
+		this.mapContext=null;
+		this.viewPort=null;
+		this.cachedImage=null;
+		this.previousDrawList = null;
+	}
+
+
+	public void print(FLayers root, Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties)
+			throws ReadException {
+		this.checkIntilalized();
+
+		List printList = this.createPrintList(root, cancel);
+		if (cancel.isCanceled()){
+			return;
+		}
+
+
+		ComposedLayer composed = null;
+		int pos;
+		FLayer layer;
+		int layerPos= -1;
+		Object obj;
+		LayersGroupEvent event;
+		for (pos=0; pos < printList.size(); pos++){
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			obj = printList.get(pos);
+			if (obj instanceof LayersGroupEvent){
+				event = (LayersGroupEvent) obj;
+				if (event.type == LayersGroupEvent.IN_Event){
+//					System.out.println("=======Empiza a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+					event.group.beginDraw(g, viewPort);
+				} else{
+					event.group.endDraw(g, viewPort);
+//					System.out.println("=======Fin a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+
+				}
+				continue;
+			}
+			layerPos++;
+
+			layer = (FLayer) obj;
+
+
+			// *** Pintado de capa/composicion de capa ***
+			if (composed == null){
+				composed = layer.newComposedLayer();
+				if (composed != null){
+					try {
+						composed.add(layer);
+//						System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" ============");
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefaultMapContexDrawer exception",e);
+					}
+				}
+			}else{
+				if (composed.canAdd(layer)){
+					try {
+						composed.add(layer);
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefaultMapContexDrawer exception",e);
+					}
+				} else {
+//					System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" ============");
+					this.print(composed, g, cancel, scale, properties);
+//					composed.print( g, viewPort, cancel, scale,properties);
+					composed = layer.newComposedLayer();
+					if (composed != null){
+						try {
+							composed.add(layer);
+//							System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+							continue;
+						} catch (Exception e) {
+							throw new ReadException("DefaultMapContexDrawer exception",e);
+						}
+					}
+				}
+			}
+//			System.out.println("=== imprimiendo "+ layerPos+ " "+layer.getName());
+			this.print(layer, g, cancel, scale, properties);
+//			layer.print(g, viewPort, cancel, scale,properties);
+			// *** Pintado de capa/composicion de capa ***
+			if (composed != null){
+				// si la composicion no se ha pintado la pintamos
+//				System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" (ultimo) ============");
+				this.print(composed, g, cancel, scale, properties);
+//				composed.print(g, viewPort, cancel, scale, properties);
+				composed = null;
+			}
+		}
+
+
+	}
+
+	private DrawList createDrawList(FLayers root,Cancellable cancel,double scale){
+		DrawList result = new DrawList(this.previousDrawList);
+		Iterator iter = new MyLayerIterator((FLayer)root,scale);
+		while (iter.hasNext()){
+			if (cancel.isCanceled()){
+				return null;
+			}
+			result.add(iter.next());
+
+		}
+
+		return result;
+	}
+
+	private List createPrintList(FLayers root,Cancellable cancel){
+		List result = new ArrayList();
+		Iterator iter = new SimpleLayerIterator((FLayer)root);
+		while (iter.hasNext()){
+			if (cancel.isCanceled()){
+				return null;
+			}
+			result.add(iter.next());
+		}
+		return result;
+	}
+
+	private class MyLayerIterator implements Iterator{
+		ArrayList layersList  =new ArrayList();
+		int index = 0;
+		double scale=0;
+
+
+		public MyLayerIterator(FLayer layer, double scale) {
+			this.scale=scale;
+			this.appendLayer(layer);
+		}
+
+		protected void appendLayer(FLayer layer) {
+			if (this.evaluate(layer)) {
+				layersList.add(layer);
+			}
+			if (layer instanceof LayerCollection) {
+				appendLayers((LayerCollection)layer);
+			}
+		}
+
+		private void appendLayers(LayerCollection layers) {
+			int i;
+			layersList.add(new LayersGroupEvent(layers,LayersGroupEvent.IN_Event));
+			for (i=0;i< layers.getLayersCount();i++) {
+				appendLayer(layers.getLayer(i));
+			}
+			layersList.add(new LayersGroupEvent(layers,LayersGroupEvent.OUT_Event));
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		public boolean hasNext() {
+			return  index < layersList.size();
+		}
+
+		public Object next() {
+			if (!this.hasNext()) {
+				throw new NoSuchElementException();
+			}
+			Object aux = layersList.get(index);
+			index++;
+			return aux;
+		}
+
+		public boolean evaluate(FLayer layer) {
+			if (layer instanceof FLayers) {
+				return false;
+			}
+			return layer.isAvailable() && layer.isVisible() && layer.isWithinScale(this.scale);
+		}
+
+	}
+
+	private class LayersGroupEvent {
+		public static final String IN_Event = "in";
+		public static final String OUT_Event = "Out";
+
+		private LayerCollection group=null;
+		private String type = IN_Event;
+
+		public LayersGroupEvent(LayerCollection group,String type){
+			this.group =group;
+			this.type =type;
+		}
+
+
+		public String getType() {
+			return type;
+		}
+
+		public LayerCollection getGroup() {
+			return group;
+		}
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java	(revision 35988)
@@ -0,0 +1,535 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {Create Manager to register MapContextDrawer implementation}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerFactory;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.impl.DefaultGraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Default implementation of the {@link MapContextManager}.
+ *
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultMapContextManager implements MapContextManager {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultMapContextManager.class);
+
+	private Class drawerClazz = DefaultMapContextDrawer.class;
+
+	private Map legends = Collections.synchronizedMap(new HashMap());
+
+	private Map legendReaders = Collections.synchronizedMap(new HashMap());
+
+	private Map legendWriters = Collections.synchronizedMap(new HashMap());
+
+	private String defaultVectorLegend;
+
+	public SymbolManager getSymbolManager() {
+		return MapContextLocator.getSymbolManager();
+	}
+
+	private SymbolPreferences getSymbolPreferences() {
+		return getSymbolManager().getSymbolPreferences();
+	}
+
+	public String getSymbolLibraryPath() {
+		return getSymbolPreferences().getSymbolLibraryPath();
+	}
+
+	public void setSymbolLibraryPath(String symbolLibraryPath) {
+		getSymbolPreferences().setSymbolLibraryPath(symbolLibraryPath);
+	}
+
+	public void resetSymbolLibraryPath() {
+		getSymbolPreferences().resetSymbolLibraryPath();
+	}
+
+	public Color getDefaultSymbolColor() {
+		return getSymbolPreferences().getDefaultSymbolColor();
+	}
+
+	public Color getDefaultSymbolFillColor() {
+		return getSymbolPreferences().getDefaultSymbolFillColor();
+	}
+
+	public Font getDefaultSymbolFont() {
+		return getSymbolPreferences().getDefaultSymbolFont();
+	}
+
+	public String getSymbolFileExtension() {
+		return getSymbolPreferences().getSymbolFileExtension();
+	}
+
+	public boolean isDefaultSymbolFillColorAleatory() {
+		return getSymbolPreferences().isDefaultSymbolFillColorAleatory();
+	}
+
+	public void resetDefaultSymbolColor() {
+		getSymbolPreferences().resetDefaultSymbolColor();
+	}
+
+	public void resetDefaultSymbolFillColor() {
+		getSymbolPreferences().resetDefaultSymbolFillColor();
+	}
+
+	public void resetDefaultSymbolFillColorAleatory() {
+		getSymbolPreferences().resetDefaultSymbolFillColorAleatory();
+	}
+
+	public void resetDefaultSymbolFont() {
+		getSymbolPreferences().resetDefaultSymbolFont();
+	}
+
+	public void setDefaultSymbolColor(Color defaultSymbolColor) {
+		getSymbolPreferences().setDefaultSymbolColor(defaultSymbolColor);
+	}
+
+	public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
+		getSymbolPreferences().setDefaultSymbolFillColor(defaultSymbolFillColor);
+	}
+
+	public void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory) {
+		getSymbolPreferences().setDefaultSymbolFillColorAleatory(
+				defaultSymbolFillColorAleatory);
+	}
+
+	public void setDefaultSymbolFont(Font defaultSymbolFont) {
+		getSymbolPreferences().setDefaultSymbolFont(defaultSymbolFont);
+	}
+
+	public void setSymbolFileExtension(String extension) {
+		getSymbolPreferences().setSymbolFileExtension(extension);
+	}
+
+	public int getDefaultCartographicSupportMeasureUnit() {
+		return getSymbolPreferences().getDefaultCartographicSupportMeasureUnit();
+	}
+
+	public void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit) {
+		getSymbolPreferences().setDefaultCartographicSupportMeasureUnit(
+				defaultCartographicSupportMeasureUnit);
+	}
+
+	public int getDefaultCartographicSupportReferenceSystem() {
+		return getSymbolPreferences().getDefaultCartographicSupportReferenceSystem();
+	}
+
+	public void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem) {
+		getSymbolPreferences().setDefaultCartographicSupportReferenceSystem(
+				defaultCartographicSupportReferenceSystem);
+	}
+
+	public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz)
+	throws MapContextException {
+		return createMapContextDrawerInstance(drawerClazz, "NONE");
+	}
+
+	public MapContextDrawer createDefaultMapContextDrawerInstance()
+	throws MapContextException {
+
+		return createMapContextDrawerInstance(drawerClazz, "default");
+	}
+
+	private MapContextDrawer createMapContextDrawerInstance(Class drawerClazz,
+			String name) throws RegisteredClassInstantiationException {
+		try {
+			return (MapContextDrawer) drawerClazz.newInstance();
+		} catch (Exception ex) {
+			throw new RegisteredClassInstantiationException(
+					MapContextDrawer.class, drawerClazz, name, ex);
+		}
+	}
+
+	public void setDefaultMapContextDrawer(Class drawerClazz)
+	throws MapContextException {
+
+		validateMapContextDrawer(drawerClazz);
+		this.drawerClazz = drawerClazz;
+	}
+
+	public void validateMapContextDrawer(Class drawerClazz)
+	throws MapContextException {
+		if (!MapContextDrawer.class.isAssignableFrom(drawerClazz)) {
+			throw new InvalidRegisteredClassException(MapContextDrawer.class,
+					drawerClazz, "UNKNOWN");
+		}
+	}
+
+	public GraphicLayer createGraphicsLayer(IProjection projection) {
+		DefaultGraphicLayer layer = new DefaultGraphicLayer();
+		try {
+			layer.initialize(projection);	
+			layer.setLegend((IVectorLegend)createLegend(IVectorialUniqueValueLegend.LEGEND_NAME));
+		} catch (Exception e) {
+			LOG.error("Error initializing the graphics layer", e);
+		}
+		return layer;
+	}
+
+	public String getDefaultVectorLegend() {
+		return defaultVectorLegend;
+	}
+
+	public void setDefaultVectorLegend(String defaultVectorLegend) {
+		this.defaultVectorLegend = defaultVectorLegend;
+	}
+
+	public void registerLegend(String legendName, Class legendClass)
+	throws MapContextRuntimeException {
+
+		if (legendClass == null || !ILegend.class.isAssignableFrom(legendClass)) {
+			throw new InvalidRegisteredClassException(ILegend.class,
+					legendClass, legendName);
+		}
+
+		legends.put(legendName, legendClass);
+	}
+
+	public ILegend createLegend(String legendName)
+	throws MapContextRuntimeException {
+		Class legendClass = (Class) legends.get(legendName);
+
+		if (legendClass != null) {
+			try {
+				return (ILegend) legendClass.newInstance();
+			} catch (InstantiationException e) {
+				throw new RegisteredClassInstantiationException(ILegend.class,
+						legendClass, legendName, e);
+			} catch (IllegalAccessException e) {
+				throw new RegisteredClassInstantiationException(ILegend.class,
+						legendClass, legendName, e);
+			}
+		}
+		return null;
+	}
+
+	public IVectorLegend createDefaultVectorLegend(int shapeType)
+	throws MapContextRuntimeException {
+		try {
+			Random rand = new Random();
+
+			int numreg = rand.nextInt(255 / 2);
+			double div = (1 - rand.nextDouble() * 0.66) * 0.9;
+			Color randomColor = new Color(((int) (255 * div + (numreg * rand
+					.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
+							.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
+									.nextDouble()))) % 255);
+			IVectorLegend legend = (IVectorLegend) createLegend(getDefaultVectorLegend());
+			if( legend == null ) {
+				return null;
+			}
+			ISymbol defaultSymbol =
+				getSymbolManager().createSymbol(shapeType, randomColor);
+			legend.setDefaultSymbol(defaultSymbol);
+			legend.setShapeType(shapeType);
+			return legend;
+		} catch(Exception e) {
+			throw new MapContextRuntimeException(e);
+		}
+	}
+
+	public void registerLegendReader(String format, Class readerClass)
+	throws MapContextRuntimeException {
+		if (readerClass == null
+				|| !ILegendReader.class.isAssignableFrom(readerClass)) {
+			throw new InvalidRegisteredClassException(ILegendReader.class,
+					readerClass, format);
+		}
+
+		legendReaders.put(format, readerClass);
+	}
+
+	public ILegendReader createLegendReader(String format)
+	throws MapContextRuntimeException {
+		Class legendReaderClazz = (Class) legendReaders.get(format);
+
+		if (legendReaderClazz != null) {
+			try {
+				return (ILegendReader) legendReaderClazz.newInstance();
+			} catch (InstantiationException e) {
+				throw new RegisteredClassInstantiationException(
+						ILegendReader.class, legendReaderClazz, format, e);
+			} catch (IllegalAccessException e) {
+				throw new RegisteredClassInstantiationException(
+						ILegendReader.class, legendReaderClazz, format, e);
+			}
+		}
+		return null;
+	}
+
+	public void registerLegendWriter(String legendName, String format,
+			Class writerClass) throws MapContextRuntimeException {
+		if (writerClass == null
+				|| !ILegendWriter.class.isAssignableFrom(writerClass)) {
+			throw new InvalidRegisteredClassException(ILegendWriter.class,
+					writerClass, format.concat("-").concat(legendName));
+		}
+
+		Map legendFormatWriters = (Map) legendWriters.get(format);
+
+		synchronized (legendWriters) {
+			if (legendFormatWriters == null) {
+				legendFormatWriters = Collections
+				.synchronizedMap(new HashMap());
+				legendWriters.put(format, legendFormatWriters);
+			}
+		}
+
+		legendFormatWriters.put(legendName, writerClass);
+	}
+
+	public ILegendWriter createLegendWriter(String legendName, String format)
+	throws MapContextRuntimeException {
+		Map legendFormatWriters = getLegendWritersForFormat(format);
+
+		if (legendFormatWriters != null) {
+			Class legendWriterClazz = (Class) legendFormatWriters
+			.get(legendName);
+
+			if (legendWriterClazz != null) {
+				try {
+					return (ILegendWriter) legendWriterClazz.newInstance();
+				} catch (InstantiationException e) {
+					throw new RegisteredClassInstantiationException(
+							ILegendWriter.class, legendWriterClazz, format
+							.concat("-").concat(legendName), e);
+				} catch (IllegalAccessException e) {
+					throw new RegisteredClassInstantiationException(
+							ILegendWriter.class, legendWriterClazz, format
+							.concat("-").concat(legendName), e);
+				}
+			}
+		}
+		return null;
+	}
+
+	private Map getLegendWritersForFormat(String format) {
+		return (Map) legendWriters.get(format);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createMultiLayerSymbol(shapeType);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createMultiLayerSymbol(symbolName);
+	}
+
+	public ISymbol createSymbol(int shapeType, Color color)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(shapeType, color);
+	}
+
+	public ISymbol createSymbol(int shapeType)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(shapeType);
+	}
+
+	public ISymbol createSymbol(String symbolName, Color color)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(symbolName, color);
+	}
+
+	public ISymbol createSymbol(String symbolName)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(symbolName);
+	}
+
+	public IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException {
+		return getSymbolManager().getWarningSymbol(message, symbolDesc,
+				symbolDrawExceptionType);
+	}
+
+	public ISymbol[] loadSymbols(File folder, FileFilter filter)
+	throws SymbolException {
+		return getSymbolManager().loadSymbols(folder, filter);
+	}
+
+	public ISymbol[] loadSymbols(File folder) throws SymbolException {
+		return getSymbolManager().loadSymbols(folder);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+	throws MapContextRuntimeException {
+		getSymbolManager().registerMultiLayerSymbol(symbolName, symbolClass);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		getSymbolManager().registerMultiLayerSymbol(symbolName, shapeTypes,
+				symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, Class symbolClass)
+	throws MapContextRuntimeException {
+		getSymbolManager().registerSymbol(symbolName, symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextException {
+		getSymbolManager().registerSymbol(symbolName, shapeTypes, symbolClass);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException {
+		getSymbolManager().saveSymbol(symbol, fileName, folder, overwrite);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder)
+	throws SymbolException {
+		getSymbolManager().saveSymbol(symbol, fileName, folder);
+	}
+
+	public FLayer createLayer(String layerName, DataStoreParameters parameters)
+	throws LoadLayerException {
+		return LayerFactory.getInstance().createLayer(layerName, parameters);
+	}
+
+	public FLayer createLayer(String layerName, DataStore store)
+	throws LoadLayerException {
+		return LayerFactory.getInstance().createLayer(layerName, store);
+	}
+
+	public ILegend getLegend(DataStore dataStore) {
+		ILegend legend = null;
+
+		//Loading the legend from a store based on file
+		try {
+//			This access by reflection is done because the libFMap_dalfile project
+//			has to be divided in several projects. The commented code is the fine
+//			code whereas the used code has to be deleted.		
+//			
+//			if (dataStore.getExplorer() instanceof FilesystemServerExplorer){
+//				File file = ((FilesystemServerExplorer)dataStore.getExplorer()).getResourcePath(dataStore, "gvl");
+//				if ((file != null) && (file.exists())){
+//					PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
+//					PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file));
+//					legend = (ILegend)persistenceManager.create(persistentState);
+//				}
+//			}
+			DataServerExplorer dataServerExplorer = dataStore.getExplorer();
+			Class[] args = new Class[2];
+			args[0] = DataStore.class;
+			args[1] = String.class;
+			Method method = dataStore.getExplorer().getClass().getMethod("getResourcePath", args);
+			if (method != null){
+				Object[] params = new Object[2];
+				params[0] = dataStore;
+				params[1] = "gvl";
+				File file = (File)method.invoke(dataServerExplorer, params);
+				if ((file != null) && (file.exists())){
+					PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
+					PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file));
+					legend = (ILegend)persistenceManager.create(persistentState);
+				}
+			}	
+
+		} catch (Exception e) {
+			LOG.info("Can't load the specific legend provided by the explorer.", e);
+		} 
+
+		//If the legend is null, next option is to check if the store has the getLegend method
+		if (legend == null){
+			try {
+				legend = (IVectorLegend) dataStore.invokeDynMethod(
+						"getLegend", null);
+			} catch (DynMethodNotSupportedException e) {
+	            LOG.info("This store {} can not provide a legend.", dataStore.getName(), e);
+			} catch (DynMethodException e) {
+				LOG.error("Can't load the specific legend provided for the store {}.", dataStore.getName(), e);
+			}
+		}
+
+		//If legend is null, last step is just try to create the legend by default
+		if( legend == null ) {
+			FeatureType featureType;
+			try {
+				featureType = (((FeatureStore)dataStore).getDefaultFeatureType());
+				int indexGeom = featureType.getDefaultGeometryAttributeIndex();
+				int typeShape = featureType.getAttributeDescriptor(indexGeom).getGeometryType();
+				legend = MapContextLocator.getMapContextManager().createDefaultVectorLegend(typeShape);
+			} catch (DataException e) {
+				LOG.error("Error getting the default feature type", e);
+			}			
+		}
+
+		return legend;
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+
+/**
+ * Exception thrown when a class instance could not be created.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class RegisteredClassInstantiationException extends
+		MapContextRuntimeException {
+
+	private static final long serialVersionUID = -2797661681885864660L;
+
+	private static final String KEY = "registered_class_instantiation_exception";
+
+	private static final String MESSAGE = "Unable to create an object instance"
+			+ "of the type %(typeToImplement) from the class %(registeredClass)"
+			+ ", registered with the name %(registeredName)";
+
+	public RegisteredClassInstantiationException(Class typeToImplement,
+			Class registeredClass, String registeredName, Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+		setValue("typeToImplement", typeToImplement);
+		setValue("registeredClass", registeredClass);
+		setValue("registeredName", registeredName);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+
+/**
+ * Exception thrown when a null class or an implementation class which does
+ * not implements the required type, is registered.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class InvalidRegisteredClassException extends MapContextRuntimeException {
+
+	private static final long serialVersionUID = -2797661681885864660L;
+
+	private static final String KEY = "invalid_registered_class_exception";
+
+	private static final String MESSAGE = "The provided class %(registeredClass), "
+			+ "registered with the name %(registeredName), is null or does not "
+			+ "implements the %(typeToImplement) type";
+
+	public InvalidRegisteredClassException(Class typeToImplement,
+			Class registeredClass, String registeredName) {
+		super(MESSAGE, KEY, serialVersionUID);
+		setValue("typeToImplement", typeToImplement);
+		setValue("registeredName", registeredName);
+		setValue("registeredClass", registeredClass);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java	(revision 35988)
@@ -0,0 +1,55 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextLibrary;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.rendering.symbols.impl.DefaultSymbolManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * Library for the default implementation of the MapContext library.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextImplLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsImplementationOf(MapContextLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		MapContextLocator
+				.registerMapContextManager(DefaultMapContextManager.class);
+		MapContextLocator.registerSymbolManager(DefaultSymbolManager.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java	(revision 35988)
@@ -0,0 +1,1650 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.cresques.geo.Projected;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.CompatLocator;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.events.ErrorEvent;
+import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener;
+import org.gvsig.fmap.mapcontext.events.listeners.ErrorListener;
+import org.gvsig.fmap.mapcontext.events.listeners.EventBuffer;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawingListener;
+import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent;
+import org.gvsig.fmap.mapcontext.layers.operations.Classifiable;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.fmap.mapcontext.rendering.strategies.SelectedZoomVisitor;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * <p>The <code>MapContext</code> class represents the model and a part of the control and view around graphical layers
+ * used by {@link MapControl MapControl}.</p>
+ *
+ * <p>An instance of <code>MapContext</code> is made up with:
+ * <ul>
+ * <li>a hierarchy of {@link FLayers FLayers} nodes
+ * <li>a {@link GraphicLayer GraphicLayer} layer
+ * <li>a {@link ViewPort ViewPort}
+ * <li>an {@link EventBuffer EventButter}
+ * <li>some {@link com.iver.cit.gvsig.fmap.layers.LegendListener LegendListener}s
+ * <li>some {@link LayerDrawingListener LayerDrawingListener}s
+ * <li>some {@link ErrorListener ErrorListener}s
+ * </ul>
+ * </p>
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class MapContext extends AbstractDisposable implements Projected,
+		Persistent, Observer {
+	/**
+	 * <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in meters</b>.</p>
+	 *
+	 * <p><b><i>Conversion values of distance measurements:</i></b>
+	 * <ul>
+	 *  <li><code>MapContext.CHANGEM[0]</code>: kilometer
+	 *  <li><code>MapContext.CHANGEM[1]</code>: meter
+	 *  <li><code>MapContext.CHANGEM[2]</code>: centimeter
+	 *  <li><code>MapContext.CHANGEM[3]</code>: millimeter
+	 *  <li><code>MapContext.CHANGEM[4]</code>: international statute mile
+	 *  <li><code>MapContext.CHANGEM[5]</code>: yard
+	 *  <li><code>MapContext.CHANGEM[6]</code>: foot
+	 *  <li><code>MapContext.CHANGEM[7]</code>: inch
+	 *  <li><code>MapContext.CHANGEM[8]</code>: grade
+	 * </ul>
+	 *
+	 * <p><h3>Examples:</h3>
+	 * <pre>1 international statute mile / MapContext.CHANGEM[4] = X meters</pre>
+	 * <pre>1 kilometer / MapContext.CHANGEM[0] = X meters</pre>
+	 * <pre>1 grade / MapContext.CHANGEM[8] = X meters</pre>
+	 * </p>
+	 *
+	 * <p><h3>Grade conversion value: <code>MapContext.CHANGEM[8]</code></h3>
+	 * The value of <code>MapContext.CHANGEM[8]</code> represents the meters of a straight line between two
+	 *  points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
+	 *  a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations:
+	 * <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre>
+	 * <pre>MapContext.CHANGEM[8] = 1 / D</pre>
+	 * <h4>Explanation:</h4>
+	 * We get an isosceles triangle with the center of the Earth and the 2 points on the surface. This triangle can be divided into
+	 * two rectangle triangles. We know two values, the angle of 1 grade, that will be 0.50 grades in each triangle, and the Earth radius that
+	 * is the hypotenuse. Then we apply trigonometry and get the distance <i>D</i> between both points on the Earth surface.</p>
+	 * <p>Now we only must invert that value to obtain <code>MapContext.CHANGEM[8]</code>.</p>
+	 *@deprecated use getDistanceTrans2Meter()
+	 */
+	public static final double[] CHANGEM = { 1000, 1, 0.01, 0.001, 1609.344,
+			0.9144, 0.3048, 0.0254, 1/8.983152841195214E-6 };
+
+
+	public static ArrayList AREANAMES=new ArrayList();
+	public static ArrayList AREAABBR=new ArrayList();
+	public static ArrayList AREATRANS2METER=new ArrayList();
+
+	public static ArrayList DISTANCENAMES=new ArrayList();
+	public static ArrayList DISTANCEABBR=new ArrayList();
+	public static ArrayList DISTANCETRANS2METER=new ArrayList();
+
+	static{
+		MapContext.addDistanceUnit("Kilometros","Km",1000);
+    	MapContext.addDistanceUnit("Metros","m",1);
+    	MapContext.addDistanceUnit("Centimetros","cm",0.01);
+    	MapContext.addDistanceUnit("Milimetros","mm",0.001);
+    	MapContext.addDistanceUnit("Millas","mi",1609.344);
+    	MapContext.addDistanceUnit("Yardas","Ya",0.9144);
+    	MapContext.addDistanceUnit("Pies","ft",0.3048);
+    	MapContext.addDistanceUnit("Pulgadas","inche",0.0254);
+    	MapContext.addDistanceUnit("Grados","�",1/8.983152841195214E-6);
+
+    	MapContext.addAreaUnit("Kilometros","Km",true,1000);
+    	MapContext.addAreaUnit("Metros","m",true,1);
+    	MapContext.addAreaUnit("Centimetros","cm",true,0.01);
+    	MapContext.addAreaUnit("Milimetros","mm",true,0.001);
+    	MapContext.addAreaUnit("Millas","mi",true,1609.344);
+    	MapContext.addAreaUnit("Yardas","Ya",true,0.9144);
+    	MapContext.addAreaUnit("Pies","ft",true,0.3048);
+    	MapContext.addAreaUnit("Pulgadas","inche",true,0.0254);
+    	MapContext.addAreaUnit("Grados","�",true,1/8.983152841195214E-6);
+
+
+    }
+	
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	
+	private static final MapContextManager mapContextManager = MapContextLocator
+            .getMapContextManager(); 
+	
+	private static final Logger logger = LoggerFactory.getLogger(MapContext.class);
+
+	/**
+	 * <p>Determines the number of frames.</p>
+	 *
+	 * <p>Number of updates per second that the timer will invoke repaint this component.</p>
+	 */
+    private static int drawFrameRate = 3;
+    /**
+	 * <p>Returns the draw frame rate.</p>
+	 *
+	 * <p>Draw frame rate is the number of repaints of this <code>MapControl</code> instance that timer invokes per second.</p>
+	 *
+	 * @return number of repaints of this <code>MapControl</code> instance that timer invokes per second
+	 *
+	 * @see #applyFrameRate()
+	 * @see #setDrawFrameRate(int)
+	 */
+	public static int getDrawFrameRate() {
+		return drawFrameRate;
+	}
+
+	/**
+	 * <p>Sets the draw frame rate.</p>
+	 *
+	 * <p>Draw frame rate is the number of repaints of this <code>MapControl</code> instance that timer invokes per second.</p>
+	 *
+	 * @param drawFrameRate number of repaints of this <code>MapControl</code> instance that timer invokes per second
+	 *
+	 * @see #applyFrameRate()
+	 * @see #getDrawFrameRate()
+	 */
+	public static void setDrawFrameRate(int dFR) {
+		drawFrameRate = dFR;
+	}
+	public static void addAreaUnit(String name, String abbr,boolean isLinear,double trans2meter){
+		if (!AREANAMES.contains(name)){
+			AREANAMES.add(name);
+			String pow="";
+			if (isLinear) {
+				pow=String.valueOf((char)178);
+			}
+			AREAABBR.add(abbr+pow);
+			AREATRANS2METER.add(new Double(trans2meter));
+		}
+	}
+	public static String[] getAreaNames(){
+		return (String[])AREANAMES.toArray(new String[0]);
+	}
+	public static String[] getAreaAbbr(){
+		return (String[])AREAABBR.toArray(new String[0]);
+	}
+	public static double[] getAreaTrans2Meter(){
+		int size=AREATRANS2METER.size();
+		double[] trans2meters=new double[size];
+		for (int i = 0; i < size; i++) {
+			trans2meters[i]=((Double)AREATRANS2METER.get(i)).doubleValue();
+		}
+		return trans2meters;
+	}
+	public static String getOfLinear(int i) {
+		if (((String)AREAABBR.get(i)).toLowerCase().endsWith(String.valueOf((char)178))){
+			return String.valueOf((char)178);
+		}
+		return "";
+	}
+	public static void addDistanceUnit(String name, String abbr,double trans2meter){
+		if (!DISTANCENAMES.contains(name)){
+			DISTANCENAMES.add(name);
+			DISTANCEABBR.add(abbr);
+			DISTANCETRANS2METER.add(new Double(trans2meter));
+		}
+	}
+	public static String[] getDistanceNames(){
+		return (String[])DISTANCENAMES.toArray(new String[0]);
+	}
+	
+	public String getDistanceName() {
+		return (String) DISTANCENAMES.get( this.getViewPort().getDistanceUnits() );
+	}
+	
+	public static String[] getDistanceAbbr(){
+		return (String[])DISTANCEABBR.toArray(new String[0]);
+	}
+	public static double[] getDistanceTrans2Meter(){
+		int size=DISTANCETRANS2METER.size();
+		double[] trans2meters=new double[size];
+		for (int i = 0; i < size; i++) {
+			trans2meters[i]=((Double)DISTANCETRANS2METER.get(i)).doubleValue();
+		}
+		return trans2meters;
+	}
+	public static int getDistancePosition(String s){
+		for (int i = 0; i < DISTANCENAMES.size(); i++) {
+			if (DISTANCENAMES.get(i).equals(s)){
+				return i;
+			}
+		}
+		return 0;
+	}
+
+	/**
+	 * <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in centimeters</b>.</p>
+	 *
+	 * <p><b><i>Conversion values of distance measurements:</i></b>
+	 * <ul>
+	 *  <li><code>MapContext.CHANGE[0]</code>: kilometer
+	 *  <li><code>MapContext.CHANGE[1]</code>: meter
+	 *  <li><code>MapContext.CHANGE[2]</code>: centimeter
+	 *  <li><code>MapContext.CHANGE[3]</code>: millimeter
+	 *  <li><code>MapContext.CHANGE[4]</code>: international statute mile
+	 *  <li><code>MapContext.CHANGE[5]</code>: yard
+	 *  <li><code>MapContext.CHANGE[6]</code>: foot
+	 *  <li><code>MapContext.CHANGE[7]</code>: inch
+	 *  <li><code>MapContext.CHANGE[8]</code>: grade
+	 * </ul>
+	 *
+	 * <p><h3>Examples:</h3>
+	 * <pre>1 international statute mile / MapContext.CHANGE[4] = X centimeters</pre>
+	 * <pre>1 kilometer / MapContext.CHANGE[0] = X centimeters</pre>
+	 * <pre>1 grade / MapContext.CHANGE[8] = X centimeters</pre>
+	 * </p>
+	 *
+	 * <p><h3>Grade conversion value: <code>MapContext.CHANGE[8]</code></h3>
+	 * The value of <code>MapContext.CHANGE[8]</code> represents the centimeters of a straight line between two
+	 *  points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
+	 *  a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations:
+	 * <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre>
+	 * <pre>MapContext.CHANGE[8] = 1 / D</pre>
+	 * <h4>Explanation:</h4>
+	 * We get an isosceles triangle with the center of the Earth and the 2 points on the surface. This triangle can be divided into
+	 * two rectangle triangles. We know two values, the angle of 1 grade, that will be 0.50 grades in each triangle, and the Earth radius that
+	 * is the hypotenuse. Then we apply trigonometry and get the distance <i>D</i> between both points on the Earth surface.</p>
+	 * <p>Now we only must invert that value to obtain <code>MapContext.CHANGE[8]</code>.</p>
+	 * @deprecated use getDistanceTrans2Meter() * 100
+	 */
+	public static final double[] CHANGE = { 100000, 100, 1, 0.1, 160934.4,
+			91.44, 30.48, 2.54, 1/8.983152841195214E-4 };
+
+	/* Do not alter the order and the values of this array, if you need append values.*/
+	/**
+	 * <p>Gets the name of all distance measurements supported by <code>MapContext</code>.</p>
+	 */
+//	public static final String[] NAMES= {
+//		Messages.getString("Kilometros"),
+//		Messages.getString("Metros"),
+//		Messages.getString("Centimetros"),
+//		Messages.getString("Milimetros"),
+//		Messages.getString("Millas"),
+//		Messages.getString("Yardas"),
+//		Messages.getString("Pies"),
+//		Messages.getString("Pulgadas"),
+//		Messages.getString("Grados"),
+//	};
+
+	public static final int EQUALS = 0;
+
+	public static final int DISJOINT = 1;
+
+	public static final int INTERSECTS = 2;
+
+	public static final int TOUCHES = 3;
+
+	public static final int CROSSES = 4;
+
+	public static final int WITHIN = 5;
+
+	public static final int CONTAINS = 6;
+
+	public static final int OVERLAPS = 7;
+
+	/**
+	 * A hierarchy of {@link FLayers FLayers} nodes.
+	 *
+	 * @see #getLayers()
+	 * @see #print(Graphics2D, double, PrintAttributes)
+	 */
+	protected FLayers layers;
+
+	/**
+	 * A layer with graphical items: geometries and symbols.
+	 *
+	 * @see #getGraphicsLayer()
+	 * @see #setGraphicsLayer(GraphicLayer)
+	 * @see #print(Graphics2D, double, PrintAttributes)
+	 */
+	private GraphicLayer tracLayer = null;
+		//MapContextLocator.getMapContextManager().createGraphicsLayer(getProjection());
+
+	/**
+	 * Information for draw layers in a view.
+	 *
+	 * @see #getViewPort()
+	 * @see #setViewPort(ViewPort)
+	 */
+	private ViewPort viewPort;
+
+	// private ArrayList invalidationListeners = new ArrayList();
+
+	/**
+	 * Array list with all {@link LegendListener LegendListener} registered to this map.
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #removeLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	private ArrayList legendListeners = new ArrayList();
+
+	/**
+	 * Array list with all {@link LayerDrawingListener LayerDrawingListener} registered to this map.
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	private ArrayList layerDrawingListeners = new ArrayList();
+
+	/**
+	 * <p>Buffer that is used to store and eject events produced on this map:
+	 * <ul>
+	 *  <li>Layer collection events.
+	 *  <li>View port events.
+	 *  <li>Atomic events.
+	 *  <li>Layer events.
+	 *  <li>Legend events on a {@link Classificable Classificable} layer.
+	 *  <li>Selection events on an {@link AlphanumericData AlphanumericData} data layer.
+	 * </ul>
+	 * </p>
+	 *
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see #beginAtomicEvent()
+	 * @see #endAtomicEvent()
+	 */
+	private EventBuffer eventBuffer = new EventBuffer();
+
+	/**
+	 * Event listener for the collection of layers of this map.
+	 */
+	private LayerEventListener layerEventListener = null;
+
+	/**
+	 * List with information of all errors produced on all layers.
+	 *
+	 * @see #addLayerError(String)
+	 * @see #getLayersError()
+	 * @see #clearErrors()
+	 */
+	private ArrayList layersError = new ArrayList();
+
+	/**
+	 * Array list with all {@link ErrorListener ErrorListener} registered to this map.
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	private ArrayList errorListeners = new ArrayList();
+
+
+
+	// public static ResourceBundle myResourceBundle =
+	// ResourceBundle.getBundle("FMap");
+
+	/**
+	 * <p>Default <i>zoom in</i> factor.</p>
+	 * <p>Doing a <i>zoom in</i> operation, decreases the focal distance and increases the eyesight angle to the surface. This allows view an smaller
+	 * area but with the items bigger.</p>
+	 */
+	public static double ZOOMINFACTOR=2;
+
+	/**
+	 * <p>Default <i>zoom out</i> factor.</p>
+	 * <p>Doing a <i>zoom out</i> operation, increases the focal distance and decreases the eyesight angle to the surface. This allows view a bigger
+	 * area but with the items smaller.</p>
+	 */
+	public static double ZOOMOUTFACTOR=0.5;
+
+	/**
+	 * 	 * Draw version of the context. It's used for know when de componend has
+	 * changed any visualization property
+	 *
+	 *  @see getDrawVersion
+	 *  @see updateDrawVersion
+	 */
+	private long drawVersion= 0L;
+
+	/**
+	 * Object to Manage Draw of MapContext
+	 */
+	private MapContextDrawer mapContextDrawer= null;
+
+	/**
+	 * Object to Manage Draw of MapContext
+	 */
+	private Class mapContextDrawerClass = null;
+
+	/**
+	 * <p>Color used to represent the selections.</p>
+	 */
+	private static Color selectionColor = Color.YELLOW;
+	private ArrayList layersToSnap = new ArrayList();
+
+
+	/**
+	 * <p>Gets the color used to represent the selections.</p>
+	 *
+	 * @return color used to represent the selections
+	 */
+	public static Color getSelectionColor() {
+		return selectionColor;
+	}
+
+	/**
+	 * <p>Sets the color used to represent the selections.</p>
+	 *
+	 * @param selectionColor color used to represent the selections
+	 */
+	public static void setSelectionColor(Color selectionColor) {
+		MapContext.selectionColor = selectionColor;
+	}
+
+	/**
+	 * <p>Creates a new map context with the drawing information defined in the view port argument, and
+	 *  without layers.</p>
+	 *
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 */
+	public MapContext(ViewPort vp) {
+        this(new FLayers(), vp);
+	}
+
+	public MapContext() { }
+
+	/**
+	 * <p>Creates a new map context with the layers and the drawing information defined in the view port arguments.</p>
+	 *
+	 * @param fLayers the initial hierarchy of nodes of layers that this map will have
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 */
+	public MapContext(FLayers fLayers, ViewPort vp) {
+		this.layers = fLayers;
+		
+		layerEventListener = new LayerEventListener();
+
+		if (layers != null) {
+			layers.setMapContext(this);
+			layers.addLayerCollectionListener(layerEventListener);
+			layers.addLayerCollectionListener(eventBuffer);
+		}
+
+		setViewPort(vp);
+	}
+
+	/**
+	 * <p>Reports to all driver error listeners registered of a bundle of driver exceptions caused in the same map atomic transaction.</p>
+	 *
+	 * @param introductoryText introductory text specified by developer. If <code>null</code>, use ""
+	 * @param driverExceptions list with a bundle of driver exceptions caught during an atomic event
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 */
+	public synchronized void reportDriverExceptions(String introductoryText,
+													List driverExceptions){
+		for (int i = 0; i < errorListeners.size(); i++) {
+			((ErrorListener) errorListeners.get(i)).
+				reportDriverExceptions(introductoryText, driverExceptions);
+		}
+	}
+
+	/**
+	 * <p>Adds the specified legend listener (if didn't exist) to receive legend events from this map.</p>
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #removeLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	public void addLayerListener(LegendListener listener) {
+		if (!legendListeners.contains(listener)){
+			legendListeners.add(listener);
+		}
+	}
+	// SUGERENCIA DE PABLO
+	//	public void addLegendListener(LegendListener listener) {
+	//		if (!legendListeners.contains(listener))
+	//			legendListeners.add(listener);
+	//	}
+
+	/**
+	 * <p>Adds the specified layer drawing listener to catch and handle drawing events from layers of this map.</p>
+	 *
+	 * @param listener the listener to add
+	 *
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	public void addLayerDrawingListener(LayerDrawingListener listener) {
+		layerDrawingListeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes the specified layer drawing listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	public void removeLayerDrawListener(LayerDrawingListener listener) {
+		layerDrawingListeners.remove(listener);
+	}
+
+	/**
+	 * <p>Adds the specified error listener to receive error events from this map.</p>
+	 *
+	 * @param listener the listener to add
+	 *
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public void addErrorListener(ErrorListener listener) {
+		errorListeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes the specified error listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public void removeErrorListener(LegendListener listener) {
+		legendListeners.remove(listener);
+	}
+
+	// SUGERENCIA DE PABLO:
+	//public void removeErrorListener(ErrorListener listener) {
+	//	errorListeners.remove(listener);
+	//}
+
+	/**
+	 * <p>Notifies to all legend listeners registered, that one legend has changed.</p>
+	 * <p>This method must be called only if it's wanted to reflect a legend change.</p>
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #removeLayerListener(LegendListener)
+	 */
+	public synchronized void callLegendChanged() {
+		for (int i = 0; i < legendListeners.size(); i++) {
+			((LegendListener) legendListeners.get(i)).legendChanged(null);
+		}
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Fires a layer drawing event to all {@link LayerDrawingListener LayerDrawingListener} listeners registered,
+	 *  distinguishing the kind of event.</p>
+	 *
+	 * @param e the event
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 */
+	public synchronized void fireLayerDrawingEvent(LayerDrawEvent e) {
+		for (int i = 0; i < layerDrawingListeners.size(); i++)
+		{
+			LayerDrawingListener listener = (LayerDrawingListener) layerDrawingListeners.get(i);
+			switch (e.getEventType())
+			{
+				case LayerDrawEvent.LAYER_BEFORE_DRAW:
+					listener.beforeLayerDraw(e);
+					break;
+				case LayerDrawEvent.LAYER_AFTER_DRAW:
+					listener.afterLayerDraw(e);
+					break;
+				case LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW:
+					listener.beforeGraphicLayerDraw(e);
+					break;
+				case LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW:
+					listener.afterLayerGraphicDraw(e);
+					break;
+			}
+		}
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Notifies to all error listeners registered, that one error has been produced.</p>
+	 *
+	 * @param e the event with information of the error
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public synchronized void callNewErrorEvent(ErrorEvent e) {
+		for (int i = 0; i < errorListeners.size(); i++) {
+			((ErrorListener) errorListeners.get(i)).errorThrown(e);
+		}
+		errorListeners.clear();
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Removes the specified layer listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	public void removeLayerListener(LegendListener listener) {
+		legendListeners.remove(listener);
+	}
+
+	// SUGERENCIA DE PABLO:
+	// public void removeLegendListener(LegendListener listener) {
+	// 	legendListeners.remove(listener);
+	// }
+
+	/**
+	 * <p>Returns the hierarchy of {@link FLayers FLayers} nodes stored in this map.</p>
+	 *
+	 * @return the hierarchy of nodes of layers stored in this map
+	 */
+	public FLayers getLayers() {
+		return layers;
+	}
+
+	/**
+	 * <p>Draws the visible layers of this map according its view port, on the image parameter.</p>
+	 *
+	 * @param b image with an accessible buffer of image data
+	 */
+	public void drawLabels(BufferedImage b) {
+	}
+
+	/**
+	 * @see #redraw()
+	 */
+	public void invalidate() {
+		if (getLayers().getLayersCount() > 0) {
+			getLayers().moveTo(0, 0);
+		}
+	}
+
+    /**
+     * <p>
+     * Prints the layers of this map using the {@link Graphics2D Graphics2D}
+     * argument, that usually is the {@link Graphics Graphics} of the printer.
+     * </p>
+     * 
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @param scale
+     *            the scale of the view. Must be between
+     *            {@linkplain FLayer#getMinScale()} and
+     *            {@linkplain FLayer#getMaxScale()}.
+     * @param properties
+     *            a set with the settings to be applied to a whole print job and
+     *            to all the documents in the print job
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * 
+     * @throws ReadDriverException
+     *             if fails reading with driver.
+     * 
+     * @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable,
+     *      double)
+     */
+	public void print(Graphics2D g, double scale,
+			PrintAttributes properties) throws ReadException,
+            MapContextException {
+		
+		CompatLocator.getGraphicsUtils().setRenderingHintsForPrinting(g);
+
+		Cancellable cancel = new Cancellable() {
+			public boolean isCanceled() {
+				return false;
+			}
+
+			public void setCanceled(boolean canceled) {
+				// No queremos que se pueda cancelar la impresi�n.
+
+			}
+		};
+		this.getMapContextDrawer().print(this.layers, g, cancel, scale,properties);
+		if (tracLayer != null) {
+			tracLayer.draw(null, g, viewPort, cancel, scale);
+		}
+	}
+
+	/**
+	 * <p>Returns a new <code>MapContext</code> instance with the information of the <code>vp</code> argument, and the layers of this map.</p>
+	 *
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 *
+	 * @return a new <code>MapContext</code> instance projected by <code>vp</code>
+	 */
+	public MapContext createNewFMap(ViewPort vp) {
+		MapContext ret = new MapContext(vp);
+		ret.layers = this.layers;
+
+		return ret;
+	}
+
+	/**
+	 * <p>Creates a new independent <code>MapContext</code> instance, that has a clone of the layers and the view port of this one.</p>
+	 * <p>The new map will have the same data source drivers to avoid waste memory, and work faster.</p>
+	 *
+	 * @return the new <code>MapContext</code> instance
+	 *
+	 * @throws XMLException if fails cloning the view port or a layer
+	 *
+	 * @see FLayer#cloneLayer()
+	 * @see ViewPort#cloneViewPort()
+	 */
+	public MapContext cloneFMap() {
+		ViewPort vp;
+        try {
+            vp = (ViewPort) getViewPort().clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+		FLayers antLayers = getLayers();
+		MapContext ret = new MapContext(vp);
+		FLayers aux = new FLayers();//(ret,null);
+		aux.setMapContext(ret);
+		for (int i=0; i < antLayers.getLayersCount(); i++)
+		{
+			FLayer lyr = antLayers.getLayer(i);
+			try {
+				FLayer auxLayer = lyr.cloneLayer();
+				aux.addLayer(auxLayer);
+				auxLayer.dispose();
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		}
+		ret.layers = aux;
+		return ret;
+
+
+	}
+
+	/**
+	 * Like {@linkplain #cloneFMap()}, but now doesn't clone the layers, rather copies them.
+	 *
+	 * @return the new map
+	 */
+	public MapContext cloneToDraw() {
+		ViewPort vp;
+        try {
+            vp = (ViewPort) getViewPort().clone();
+            MapContext mapContext=new MapContext(getLayers(),vp);
+            return mapContext;
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+	}
+
+
+	/**
+	 * <p>Adds a layer to the group of layers that are at a upper level in the tree.</p>
+	 *
+	 * @param vectorial the layer to add
+	 */
+	public void addToTrackLayer(FLayer vectorial) {
+	}
+
+	/**
+	 * <p>Returns the scale of the view in the screen.</p>
+	 *
+	 * @return one of this values:
+	 * <ul>
+	 * <li>the scale of the adjusted extent scale of the view in the screen
+	 * <li><code>-1</code> if there is no image
+	 * <li><code>0</code> if there is no extent defined for the image
+	 * </ul>
+	 *
+	 * @see #setScaleView(long)
+	 * @see ViewPort#getAdjustedExtent()
+	 * @see IProjection#getScale(double, double, double, double)
+	 */
+	public long getScaleView() {
+		double dpi = getScreenDPI();
+		IProjection proj = viewPort.getProjection();
+
+		if (viewPort.getImageSize() == null) {
+			return -1;
+		}
+
+		if (viewPort.getAdjustedExtent() == null) {
+			return 0;
+		}
+		double[] trans2Meter=getDistanceTrans2Meter();
+		if (proj == null) {
+			double w = ((viewPort.getImageSize().width / dpi) * 2.54);
+			return (long) (viewPort.getAdjustedExtent().getLength(0) / w * trans2Meter[getViewPort()
+					.getMapUnits()]);
+		}
+
+		return Math.round(proj.getScale((viewPort.getAdjustedExtent().getMinimum(0)*trans2Meter[getViewPort().getMapUnits()]),
+				(viewPort.getAdjustedExtent().getMaximum(0)*trans2Meter[getViewPort().getMapUnits()]),
+				viewPort.getImageSize().width, dpi));
+
+	}
+
+	/**
+	 * <p>Sets the new extent of the view, calculated using the scale argument.</p>
+	 * <p>Doesn't updates the scale if there isn't information about the dimension of the image or the
+	 *  adjusted extent.</p>
+	 *
+	 * @param scale the new scale for the view
+	 *
+	 * @see ViewPort#setProjection(IProjection)
+	 * @see #getScaleView()
+	 */
+	public void setScaleView(long scale) {
+		double dpi = getScreenDPI();
+		if (viewPort.getImageSize() == null) {
+			return;
+		}
+		IProjection proj = viewPort.getProjection();
+		if (viewPort.getAdjustedExtent() == null) {
+			return;
+		}
+		double[] trans2Meter=getDistanceTrans2Meter();
+		Envelope env=viewPort.getAdjustedExtent();
+		Rectangle2D r=new Rectangle2D.Double(env.getMinimum(0),env.getMinimum(1),env.getLength(0),env.getLength(1));
+		Rectangle2D rec=proj.getExtent(r,scale,viewPort.getImageWidth(),viewPort.getImageHeight(),100*getDistanceTrans2Meter()[getViewPort().getMapUnits()],trans2Meter[getViewPort().getDistanceUnits()],dpi);
+		try {
+			getViewPort().setEnvelope(geomManager.createEnvelope(rec.getX(),rec.getY(),rec.getMaxX(),rec.getMaxY(), SUBTYPES.GEOM2D));
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error seting the bounding box");
+		}
+	}
+
+	/**
+	 * <p>Returns the screen resolution (Dots Per Inch) as it was defined by the user's preference, or
+	 * by default as it is defined in the default Toolkit.</p>
+	 *
+	 * @return double with the screen's dpi
+	 */
+	public static double getScreenDPI() {
+		return CompatLocator.getGraphicsUtils().getScreenDPI();
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#setVectorial(com.iver.cit.gvsig.fmap.VectorialAdapter)
+	 */
+//	public void setVectorial(VectorialAdapter v) {
+//	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#process(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor)
+	 */
+	public void process(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#processSelected(com.iver.cit.gvsig.fmap.FeatureVisitor)
+	 */
+	public void processSelected(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#select(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor,
+	 *      VectorialSubSet)
+	 */
+	public void select(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#selectFromSelection()
+	 */
+	public void selectFromSelection() {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#createIndex()
+	 */
+	public void createIndex() {
+	}
+
+	/**
+	 * @see org.cresques.geo.Projected#getProjection()
+	 *
+	 * @see ViewPort#getProjection()
+	 * @see #setProjection(IProjection)
+	 * @see #reProject(ICoordTrans)
+	 */
+	public IProjection getProjection() {
+		return getViewPort().getProjection();
+	}
+
+	/**
+	 * <p>Sets the new projection.</p>
+	 *
+	 * @param proj the new projection
+	 *
+	 * @see #getProjection()
+	 * @see ViewPort#setProjection(IProjection)
+	 * @see #reProject(ICoordTrans)
+	 */
+	public void setProjection(IProjection proj) {
+		if (getViewPort() != null) {
+			getViewPort().setProjection(proj);
+		}
+	}
+
+	/**
+	 * @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans)
+	 */
+	public void reProject(ICoordTrans arg0) {
+		// TODO implementar reprojecci�n (lo que sea eso)
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#getSelectionBounds()
+	 *
+	 * @see SelectedZoomVisitor#getSelectBound()
+	 */
+	public Envelope getSelectionBounds() throws BaseException {
+		SelectedZoomVisitor visitor = new SelectedZoomVisitor();
+
+		layers.accept(visitor);
+
+		return visitor.getSelectBound();
+	}
+
+    /**
+     * <p>
+     * Draws this map if its {@link ViewPort ViewPort} has an extent defined:<br>
+     * <ol>
+     * <li>Selects only the layers that have to be drawn:
+     * {@linkplain #prepareDrawing(BufferedImage, Graphics2D, double)}.
+     * <li>Sets quality: antialiasing by text and images, and quality rendering.
+     * <li>Draws the layers.
+     * <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW</code>.
+     * <li>Draws the graphic layer.
+     * <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW</code>.
+     * <li>Invokes the garbage collector and memory clean.
+     * </ol>
+     * </p>
+     * 
+     * @param image
+     *            buffer used sometimes instead <code>g</code> to accelerate the
+     *            draw. For example, if two points are as closed that can't be
+     *            distinguished, draws only one.
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @param cancel
+     *            shared object that determines if this layer can continue being
+     *            drawn
+     * @param scale
+     *            the scale of the view. Must be between
+     *            {@linkplain FLayer#getMinScale()} and
+     *            {@linkplain FLayer#getMaxScale()}.
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * @throws ReadDriverException
+     *             if fails reading with the driver.
+     */
+	public void draw(BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException, MapContextException {
+		if (viewPort.getEnvelope() == null) {
+			return;
+		}
+
+		CompatLocator.getGraphicsUtils().setRenderingHintsForDrawing(g);
+
+		this.getMapContextDrawer().draw(this.layers, image, g, cancel, scale);
+
+		if (tracLayer != null) {
+			LayerDrawEvent beforeTracLayerEvent =
+					new LayerDrawEvent(tracLayer, g, viewPort,
+							LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW);
+			fireLayerDrawingEvent(beforeTracLayerEvent);
+			tracLayer.draw(image, g, viewPort, cancel, scale);
+			LayerDrawEvent afterTracLayerEvent =
+					new LayerDrawEvent(tracLayer, g, viewPort,
+							LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW);
+			fireLayerDrawingEvent(afterTracLayerEvent);
+		}
+
+		System.gc();
+	}
+
+	/**
+	 * <p>Draws only the internal graphic layer using the information of the {@link ViewPort ViewPort} of this map.</p>
+	 *
+	 * @param image image used to accelerate the screen draw
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param cancel shared object that determines if this layer can continue being drawn
+	 * @param scale value that represents the scale
+	 * @throws ReadDriverException if fails reading with the driver.
+	 *
+	 * @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	public void drawGraphics(BufferedImage image, Graphics2D g,
+			Cancellable cancel, double scale) throws ReadException {
+		if (viewPort == null) {
+			return;
+		}
+		if (tracLayer != null) {
+			tracLayer.draw(image, g, viewPort, cancel, scale);
+		}
+	}
+
+    /**
+     * <p>
+     * Like
+     * {@linkplain MapContext#draw(BufferedImage, Graphics2D, Cancellable, double)}
+     * , but creating the task as cancellable.
+     * </p>
+     * 
+     * @param image
+     *            buffer used sometimes instead <code>g</code> to accelerate the
+     *            draw. For example, if two points are as closed that can't be
+     *            distinguished, draws only one.
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @param scale
+     *            the scale of the view. Must be between
+     *            {@linkplain FLayer#getMinScale()} and
+     *            {@linkplain FLayer#getMaxScale()}.
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * 
+     * @throws ReadDriverException
+     *             if the driver fails reading.
+     * 
+     * @see #draw(BufferedImage, Graphics2D, Cancellable, double)
+     */
+	public void draw(BufferedImage image, Graphics2D g, double scale)
+			throws ReadException, MapContextException {
+		draw(image, g, new Cancellable() {
+			/**
+			 * @see org.gvsig.utils.swing.threads.Cancellable#isCanceled()
+			 */
+			public boolean isCanceled() {
+				return false;
+			}
+
+			public void setCanceled(boolean canceled) {
+				// Do nothing
+			}
+		}, scale);
+	}
+
+	/**
+	 * <p>Gets the {@link ViewPort ViewPort} associated to this map.</p>
+	 *
+	 * @return the view port
+	 *
+	 * @see #setViewPort(ViewPort)
+	 */
+	public ViewPort getViewPort() {
+		return viewPort;
+	}
+
+	/**
+	 * <p>Sets a {@link ViewPort ViewPort} with the drawing information
+	 *  of this map.</p>
+	 * <p>If there was a previous view port, removes its {@link EventBuffer EventBuffer} and
+	 *  adds the new one.</p>
+	 *
+	 * @param viewPort the viewPort
+	 *
+	 * @see #getViewPort()
+	 */
+	public void setViewPort(ViewPort viewPort) {
+		if (this.viewPort != null) {
+			this.viewPort.removeViewPortListener(eventBuffer);
+		}
+
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.setViewPort(viewPort);
+		}
+
+		this.viewPort = viewPort;
+		if (viewPort != null) {
+			viewPort.addViewPortListener(eventBuffer);
+		}
+	}
+
+	/**
+	 * <p>Sets the given extent to the {@link ViewPort ViewPort} and updates the view with the new zoom.</p>
+	 *
+	 * @param extent the extent of the new zoom
+	 */
+	public void zoomToEnvelope(Envelope extent) {
+		if (extent!=null) {
+			getViewPort().setEnvelope(extent);
+		}
+	}
+
+	/**
+	 * <p>Returns the union of all extents of all layers of this map.</p>
+	 *
+	 * @return full extent of layers of this map
+	 * @throws ReadDriverException if the driver fails reading.
+	 *
+	 * @see FLayers#getFullEnvelope()
+	 */
+	public Envelope getFullEnvelope() throws ReadException {
+		return layers.getFullEnvelope();
+	}
+
+
+
+	/**
+	 * <p>Adds a listener of atomic events to the internal {@link EventBuffer EventBuffer}.</p>
+	 *
+	 * @param listener the new listener
+	 *
+	 * @return <code>true</code> if has added the listener successfully
+	 *
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see EventBuffer#addAtomicEventListener(AtomicEventListener)
+	 */
+	public boolean addAtomicEventListener(AtomicEventListener listener) {
+		return eventBuffer.addAtomicEventListener(listener);
+	}
+
+	/**
+	 * <p>Removes a listener of atomic events from the internal {@link EventBuffer EventBuffer}.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+     * @return <tt>true</tt> if the list contained the specified element
+	 *
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see EventBuffer#removeAtomicEventListener(AtomicEventListener)
+	 */
+	public boolean removeAtomicEventListener(AtomicEventListener listener) {
+		return eventBuffer.removeAtomicEventListener(listener);
+	}
+
+	/**
+	 * @see EventBuffer#beginAtomicEvent()
+	 *
+	 * @see #endAtomicEvent()
+	 */
+	public void beginAtomicEvent() {
+		eventBuffer.beginAtomicEvent();
+	}
+
+	/**
+	 * @see EventBuffer#endAtomicEvent()
+	 *
+	 * @see #beginAtomicEvent()
+	 */
+	public void endAtomicEvent() {
+		eventBuffer.endAtomicEvent();
+	}
+
+	/**
+	 * <p>The class <code>LayerEventListener</code> implements the methods of {@link LayerCollectionListener LayerCollectionListener}
+	 *  that handles the "layer added" or "layer removed" events in a map.</p>
+	 * <p>Is designed as a listener for all layers in a {@link MapContext MapContext}.</p>
+	 *
+	 * @author Fernando Gonz�lez Cort�s
+	 */
+	public class LayerEventListener implements LayerCollectionListener {
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerAdded(LayerCollectionEvent e) {
+			// Si es la primera capa, fijamos su extent al ViewPort
+			// if (getLayers().getLayersCount() == 1) {
+			if (getViewPort().getEnvelope() == null) {
+				FLayer lyr = e.getAffectedLayer();
+				if (lyr.isAvailable()) {
+					try {
+						getViewPort().setEnvelope(lyr.getFullEnvelope());
+					} catch (ReadException ex) {
+					    logger.error(
+					        MessageFormat.format(
+					                "Can't set envelope to view port from layer {0}",
+					                new Object[] {lyr.getName() }
+					            ),
+					        ex
+					    );
+					}
+				}
+			}
+
+			// Registramos al FMap como listener del legend de las capas
+			FLayer lyr = e.getAffectedLayer();
+			selectionListener(lyr);
+			if (lyr instanceof SingleLayer){
+				if (((SingleLayer) lyr).getDataStore() != null) {
+					((SingleLayer) lyr).getDataStore().addObserver(
+							MapContext.this);
+				}
+			}
+		}
+
+		/**
+		 * <p>Registers an event buffer as a listener for all layers as argument.</p>
+		 *
+		 * <p>Each {@link FLayer FLayer} of this map must have an event buffer for all kind
+		 * of specific listeners of that layer. This method distinguish between {@link Classifiable Classifiable},
+		 * {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one,
+		 * registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p>
+		 *
+		 * @param the layer or layers
+		 */
+		private void selectionListener(FLayer lyr){
+			lyr.addLayerListener(eventBuffer);
+
+			if (lyr instanceof Classifiable) {
+				Classifiable c = (Classifiable) lyr;
+				c.addLegendListener(eventBuffer);
+			}
+
+			if (lyr instanceof FLayers){
+				FLayers lyrs=(FLayers)lyr;
+				for(int i=0;i<lyrs.getLayersCount();i++){
+					selectionListener(lyrs.getLayer(i));
+				}
+			}
+
+		}
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+		 */
+		public void layerMoved(LayerPositionEvent e) {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerRemoved(LayerCollectionEvent e) {
+			FLayer lyr = e.getAffectedLayer();
+
+			lyr.removeLayerListener(eventBuffer);
+
+			if (lyr instanceof Classifiable) {
+				Classifiable c = (Classifiable) lyr;
+				c.removeLegendListener(eventBuffer);
+			}
+
+			if (lyr instanceof SingleLayer && ((SingleLayer) lyr).getDataStore()!=null) {
+				((SingleLayer) lyr).getDataStore().deleteObserver(
+						MapContext.this);
+			}
+
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerAdding(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+		 */
+		public void layerMoving(LayerPositionEvent e)
+				throws CancelationException {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoving(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerRemoving(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void visibilityChanged(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+	}
+
+	/**
+	 * <p>Adds the {@link LayerEventListener LayerEventListener} of this map to the
+	 *  collection of layers argument.</p>
+	 *
+	 * @param a collection of layers
+	 */
+	public void addAsCollectionListener(FLayers layers2) {
+		layers2.addLayerCollectionListener(layerEventListener);
+	}
+
+	/**
+	 * <p>Returns the internal {@link GraphicLayer GraphicLayer}.</p>
+	 *
+	 * @return the graphic layer of this map
+	 *
+	 * @see #setGraphicsLayer(GraphicLayer)
+	 */
+	public GraphicLayer getGraphicsLayer() {
+		if (tracLayer == null) {
+			if (getViewPort() != null) {
+				this.tracLayer =
+						MapContextLocator.getMapContextManager()
+								.createGraphicsLayer(
+										getViewPort().getProjection());
+			} else {
+				this.tracLayer =
+						MapContextLocator.getMapContextManager()
+								.createGraphicsLayer(null);
+			}
+		}
+		return tracLayer;
+	}
+
+	/**
+	 * <p>Sets a new {@link GraphicLayer GraphicLayer} to this map.</p>
+	 *
+	 * @param graphicLayer the new graphic layer
+	 *
+	 * @see #getGraphicsLayer()
+	 */
+	public void setGraphicsLayer(GraphicLayer graphicLayer) {
+		tracLayer = graphicLayer;
+	}
+
+	/**
+	 * <p>Indicates whether some other object is "equal to" this map.</p>
+	 * <p>Returns <code>true</code> if success one of this options:
+	 * <ul>
+	 * <li>Both objects are equal according to {@linkplain Object#equals(Object)}.
+	 * <li>Both maps have the same layers.
+	 * <li>Both maps have the same number of layers and with the same name.
+	 * </ul>
+	 * </p>
+	 *
+	 * @param obj the reference object with which to compare.
+     * @return <code>true</code> if this object is the same as the <code>arg0</code> argument;  otherwise <code>false</code>.
+	 *
+	 * @see Object#equals(Object)
+	 */
+	public boolean equals(Object arg0) {
+		if (!(arg0 instanceof MapContext)) {
+			return false;
+		}
+		MapContext map = (MapContext) arg0;
+		if (super.equals(arg0)) {
+			return true;
+		}
+		if (getLayers() == map.getLayers()) {
+			return true;
+		}
+		boolean isEqual = true;
+		if (map.getLayers().getLayersCount() == getLayers().getLayersCount()) {
+			for (int i = 0; i < getLayers().getLayersCount(); i++) {
+
+				if (!getLayers().getLayer(i).getName().equals(
+						map.getLayers().getLayer(i).getName())) {
+					isEqual = false;
+				}
+
+			}
+		} else {
+			isEqual = false;
+		}
+		return isEqual;
+	}
+
+	/**
+	 * <p>Registers the message of an error associated to this map.</p>
+	 *
+	 * @param stringProperty the error message
+	 *
+	 * @see #getLayersError()
+	 * @see #clearErrors()
+	 */
+	public void addLayerError(String stringProperty) {
+		layersError.add(stringProperty);
+	}
+
+	/**
+	 * <p>Gets the list with all error messages registered to this map.</p>
+	 *
+	 * @return the list of errors registered to this map
+	 *
+	 * @see #addLayerError(String)
+	 * @see #clearErrors()
+	 */
+	public ArrayList getLayersError() {
+		return layersError;
+	}
+
+	/**
+	 * <p>Removes all error messages associated to this map.</p>
+	 *
+	 * @see #addLayerError(String)
+	 * @see #getLayersError()
+	 */
+	public void clearErrors() {
+		layersError.clear();
+	}
+
+	/**
+	 * <p>Creates and returns a new group of layers that belongs to this <code>MapContext</code>.</p>
+	 *
+	 * @param parent layer node in this <code>MapContexte</code> that will be the parent of the new node
+	 * @return the new layer node
+	 */
+	public FLayers getNewGroupLayer(FLayers parent) {
+		FLayers group1 = new FLayers();//(this,parent);
+		group1.setMapContext(this);
+		group1.setParentLayer(parent);
+	    return group1;
+	}
+
+	public String getClassName() {
+		return null;
+	}
+
+	public ArrayList getLayersToSnap() {
+		return layersToSnap;
+	}
+
+	public void setLayersToSnap(ArrayList layersToSnap) {
+		this.layersToSnap = layersToSnap;
+
+	}
+
+	public void update(Observable observable, Object notification) {
+		// TODO REVISAR ESTO!!!
+		String ntype=null;
+		if (notification instanceof FeatureStoreNotification) {
+			FeatureStoreNotification fsNotification = (FeatureStoreNotification) notification;
+			ntype =fsNotification.getType();
+			if (
+					ntype.equals(FeatureStoreNotification.LOAD_FINISHED)||
+					ntype.equals(FeatureStoreNotification.SELECTION_CHANGE)
+			) {
+				getLayers().moveTo(0, 0);
+			}
+		}
+	}
+
+	public long getDrawVersion() {
+		return this.drawVersion;
+	}
+
+	protected void updateDrawVersion(){
+		this.drawVersion++;
+	}
+
+	public MapContextDrawer getMapContextDrawer() throws ReadException,
+            MapContextException {
+		if (this.mapContextDrawer == null){
+		    if (mapContextDrawerClass == null) {
+                this.mapContextDrawer = mapContextManager
+                        .createDefaultMapContextDrawerInstance();
+            } else {
+                this.mapContextDrawer = mapContextManager
+                        .createMapContextDrawerInstance(mapContextDrawerClass);
+            }
+		    this.mapContextDrawer.setMapContext(this);
+            this.mapContextDrawer.setViewPort(viewPort);
+		}
+
+		return this.mapContextDrawer;
+	}
+	
+	public void setMapContextDrawerClass(Class mapContextDrawerClass)
+            throws MapContextException {
+		mapContextManager.validateMapContextDrawer(mapContextDrawerClass);
+		this.mapContextDrawerClass = mapContextDrawerClass;
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.dispose();
+			this.mapContextDrawer = null;
+		}
+	}
+
+	public void setMapContextDrawer(MapContextDrawer drawer){
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.dispose();
+			this.mapContextDrawer = null;
+		}
+		this.mapContextDrawer = drawer;
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.setMapContext(this);
+			this.mapContextDrawer.setViewPort(viewPort);
+		}
+	}
+	
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		
+		ViewPort vp = (ViewPort) state.get("ViewPort");
+		setViewPort(vp);
+		
+		layers = (FLayers) state.get("layers");
+		layers.setName("root layer");
+		loadLayers(layers);
+		layers.setMapContext(this);
+		
+		layerEventListener = new LayerEventListener();
+		layers.addLayerCollectionListener(layerEventListener);
+		
+		layers.addLayerCollectionListener(eventBuffer);
+		layers.setProjection(vp.getProjection());
+		
+		
+	}
+
+	private void loadLayers(FLayers lyrs) {
+		
+		int sz = lyrs.getLayersCount();
+		for (int i=0; i<sz; i++) {
+			try {
+				lyrs.getLayer(i).load();
+			} catch (LoadLayerException e) {
+				logger.error("While loading layer: " + lyrs.getLayer(i).getName());
+			}
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("ViewPort", viewPort);
+		state.set("layers", layers);
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MapContext.class,
+				"MapContext",
+				"MapContext Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldObject("ViewPort")
+			.setClassOfValue(ViewPort.class)
+			.setMandatory(true);
+	
+		definition.addDynFieldObject("layers")
+			.setClassOfValue(FLayers.class)
+			.setMandatory(true);
+	}
+
+	protected void doDispose() throws BaseException {
+		dispose(layers);
+		dispose(tracLayer);
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java	(revision 35988)
@@ -0,0 +1,71 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+/**
+ * <p>All events produced on a layer must be of a particular type.</p>
+ *
+ * <p><code>FMapEvent</code> defines the least information that can have an event
+ *  produced on a layer, its <i>type</i>.</p>
+ */
+public class FMapEvent {
+	/**
+	 * Kind of event type.
+	 */
+	private int eventType;
+	/**
+	 * <p>Gets the type of this event.</p>
+	 * 
+	 * @return the type of this event
+	 */
+	public int getEventType() {
+		return eventType;
+	}
+	/**
+	 * <p>Sets the type of the event.</p>
+	 * 
+	 * @param eventType the number that identifies this event's type
+	 */
+	public void setEventType(int eventType) {
+		this.eventType = eventType;
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java	(revision 35988)
@@ -0,0 +1,84 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ErrorListener.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.2  2006-09-21 17:20:50  azabala
+* added method to report many driver exceptions
+*
+* Revision 1.1  2005/12/20 10:56:34  jaume
+* Added an error event to fmap
+*
+*
+*/
+/**
+ * 
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import java.util.List;
+
+import org.gvsig.fmap.mapcontext.events.ErrorEvent;
+
+
+/**
+ * @author jaume
+ *
+ */
+public interface ErrorListener {
+    /**
+     * Listen for error events
+     * (usually caused by driverExceptions)
+     * @param e
+     */
+	void errorThrown(ErrorEvent e);
+
+	/**
+	 * Report a bundle of driver exceptions caused in the same
+	 * fmap atomic transaction
+	 * @param introductoryText introductory text specified by developer. It null, used ""
+	 * @param driverExceptions list with a bundle of driver exceptions catched during
+	 * an atomic event
+	 */
+	void reportDriverExceptions(String introductoryText, List driverExceptions);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java	(revision 35988)
@@ -0,0 +1,59 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import org.gvsig.fmap.mapcontext.events.AtomicEvent;
+
+/**
+ * <p>Listener of {@link AtomicEvent AtomicEvent}.</p>
+ * 
+ * <p>An <code>AtomicEvent</p> represents a group of events that will be attended without any interruption.</p>
+ */
+public interface AtomicEventListener {
+	/**
+	 * <p>Called when is produced an <code>AtomicEvent</code> in the buffer of <code>MapControl</code>.</p>
+	 * 
+	 * @param e an atomic event
+	 * 
+	 * @see EventBuffer
+	 */
+	public void atomicEvent(AtomicEvent e);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java	(revision 35988)
@@ -0,0 +1,73 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+
+
+/**
+ * <p>Defines the interface for an object that listens to changes in a view port.</p>
+ */
+public interface ViewPortListener {
+	/**
+ 	 * <p>Called when the <i>extent</i> of the view port has changed.</p>
+	 *
+	 * @param e an extend event object
+	 */
+	void extentChanged(ExtentEvent e);
+
+	/**
+	 * <p>Called when the background color of the view port has changed.</p>
+	 * 
+	 * @param e a color event object
+	 */
+	void backColorChanged(ColorEvent e);
+
+	/**
+	 * <p>Called when the projection of the view port has changed.</p>
+	 *
+	 * @param e a projection event object
+	 */
+	void projectionChanged(ProjectionEvent e);
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+/**
+ * Interfaz que recibe el evento invalid. Deber�n implementar los elementos de
+ * la interfaz que se quieran actualizar cuando se produzca un cambio en el
+ * FMap
+ */
+public interface InvalidationListener {
+	/**
+	 * M�todo invocado cuando se produce un cambio en FMap que  afecta a la
+	 * representaci�n del mapa
+	 */
+	public void invalid();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java	(revision 35988)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+/**
+ * @author Fernando Gonz�lez Cort�s
+ */
+public interface ProgressListener {
+    public void progress(int n);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java	(revision 35988)
@@ -0,0 +1,394 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.events.AtomicEvent;
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerListener;
+import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+
+
+
+/**
+ * <p><code>EventBuffer</code> represents a buffer of events that allows store listeners of events produced in layers
+ *  of a <code>MapContext</code> instance, and configure its dispatching mode.</p>
+ * 
+ * <p>The <i>dispatching mode</i>:
+ * <ul>
+ *  <li><code>true</code> : dispatches each new event received.</li>
+ *  <li><code>false</code> : accumulates all new events received in a internal buffer, and only will dispatch them
+ *   (according to the order they were received) when changes the mode.</li>
+ * </ul>
+ * </p>
+ *
+ * @see LegendListener
+ * @see LayerCollectionListener
+ * @see SelectionListener
+ * @see ViewPortListener
+ * @see LegendListener
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class EventBuffer implements LegendListener, LayerCollectionListener,
+SelectionListener, ViewPortListener, LayerListener {
+
+	/**
+	 * List with all events received and don't dispatched.
+	 * 
+	 * @see #endAtomicEvent()
+	 * @see #legendChanged(LegendChangedEvent)
+	 * @see #layerAdded(LayerCollectionEvent)
+	 * @see #layerMoved(LayerPositionEvent)
+	 * @see #layerRemoved(LayerCollectionEvent)
+	 * @see #layerAdding(LayerCollectionEvent)
+	 * @see #layerMoving(LayerPositionEvent)
+	 * @see #layerRemoving(LayerCollectionEvent)
+	 * @see #visibilityChanged(LayerCollectionEvent)
+	 * @see #visibilityChanged(LayerEvent)
+	 * @see #selectionChanged(SelectionEvent)
+	 * @see #extentChanged(ExtentEvent)
+	 * @see #activationChanged(LayerEvent)
+	 * @see #nameChanged(LayerEvent)
+	 * @see #backColorChanged(ColorEvent)
+	 * @see #editionChanged(LayerEvent)
+	 * @see #projectionChanged(ProjectionEvent)
+	 * @see #fireAtomicEventListener
+	 */
+	private ArrayList events = new ArrayList();
+
+	/**
+	 * List with all listeners registered.
+	 * 
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 */ 
+	private ArrayList listeners = new ArrayList();
+
+	/**
+	 * Allows enable or disable the <i>dispatching mode</i>.
+	 * 
+	 * @see #beginAtomicEvent()
+	 * @see #endAtomicEvent()
+	 */
+	private boolean dispatching = true;
+
+	/**
+	 * <p>Enables buffer in <i>accumulation event</i> mode.<p>
+	 * 
+	 * <p>All new events received, will be accumulated and won't notified to their respective listeners,
+	 *  until this buffer would received a call to {@link #endAtomicEvent() endAtomicEvent}.</p>
+	 * 
+	 * @see #endAtomicEvent()
+	 */
+	public void beginAtomicEvent() {
+		dispatching = false;
+	}
+
+	/**
+	 * <p>Disables buffer in <i>accumulation event</i> mode.</p>
+	 * 
+	 * <p>All events accumulated will be notify to their respective
+	 *  listeners, in the same order as they arrived.</p>
+	 *  
+	 * @see #beginAtomicEvent()
+	 */
+	public void endAtomicEvent() {
+		fireAtomicEventListener();
+		events.clear();
+		dispatching = true;
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LegendListener#legendChanged(com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent)
+	 */
+	public void legendChanged(LegendChangedEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerAdded(LayerCollectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+	 */
+	public void layerMoved(LayerPositionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerRemoved(LayerCollectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerAdding(LayerCollectionEvent e) throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+	 */
+	public void layerMoving(LayerPositionEvent e) throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoving(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerRemoving(LayerCollectionEvent e)
+	throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void visibilityChanged(LayerCollectionEvent e)
+	throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.SelectionListener#selectionChanged(com.iver.cit.gvsig.fmap.layers.SelectionEvent)
+	 */
+	public void selectionChanged(SelectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#extentChanged(com.iver.cit.gvsig.fmap.ExtentEvent)
+	 */
+	public void extentChanged(ExtentEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/**
+	 * Appends, if wasn't, the specified listener to the end of the internal list of atomic event listeners.
+	 *
+	 * @param listener an object that implements the atomic event listener
+	 *
+	 * @return <code>true</code> if has added the listener successfully; otherwise <code>false</code>
+	 * 
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see #fireAtomicEventListener()
+	 */
+	public boolean addAtomicEventListener(AtomicEventListener listener) {
+		boolean bFound = false;
+		for (int i=0; i < listeners.size(); i++)
+			if (listeners.get(i) == listener)
+				bFound = true;
+		if (!bFound)
+			listeners.add(listener);
+		return true; 
+	}
+
+	/**
+	 * <p>Removes a single instance of the {@link AtomicEventListener AtomicEventListener} from the
+     * internal list, if it is present (optional operation). Returns <tt>true</tt>
+     * if the list contained the specified element (or equivalently, if the list changed as a
+     * result of the call).<p>
+     *
+     * @param o element to be removed from this list, if present
+     * @return <tt>true</tt> if the list contained the specified element
+     * 
+     * @see #addAtomicEventListener(AtomicEventListener)
+     * @see #fireAtomicEventListener()
+	 */
+	public boolean removeAtomicEventListener(AtomicEventListener listener) {
+		return listeners.remove(listener);
+	}
+
+	/**
+	 * Executes the {@linkplain AtomicEventListener#atomicEvent(AtomicEvent)} method of all listeners registered.
+	 * 
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 */
+	private void fireAtomicEventListener() {
+		if (events.size() == 0)
+			return; // No hay eventos que lanzar.
+		for (Iterator i = listeners.iterator(); i.hasNext();) {
+			AtomicEventListener listener = (AtomicEventListener) i.next();
+			AtomicEvent e = new AtomicEvent(events);
+			listener.atomicEvent(e);
+		}
+
+		events.clear();
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void visibilityChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#activationChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void activationChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#nameChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void nameChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#backColorChanged(com.iver.cit.gvsig.fmap.ColorEvent)
+	 */
+	public void backColorChanged(ColorEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#editionChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void editionChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#projectionChanged(com.iver.cit.gvsig.fmap.ProjectionEvent)
+	 */
+	public void projectionChanged(ProjectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	
+	public void drawValueChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java	(revision 35988)
@@ -0,0 +1,137 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Time;
+
+
+
+/**
+ * <p>Event produced when the adjusted extent or the time
+ * of the view port have changed.</p>
+ * <p>
+ * TODO: This class has to be renamed to ViewPortEvent.
+ * </p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ExtentEvent extends FMapEvent {
+	/**
+	 * <p>Reference to the new adjusted extent.</p>
+	 */
+	private Envelope newExtent;
+	
+	/**
+	 * <p>Reference to the new time.</p>
+	 */
+	private Time newTime;
+
+	/**
+	 * <p>Identifier of this kind of event.</p>
+	 */
+	private static final int EXTENT_EVENT = 0;
+	private static final int TIME_EVENT = 1;
+
+	/**
+	 * <p>Returns a new extent event.</p>
+	 *
+	 * @param c the new adjusted extent
+	 *
+	 * @return a new extent event
+	 * @deprecated
+	 *         use the constructor 
+	 */
+	public static ExtentEvent createExtentEvent(Envelope r){
+		return new ExtentEvent(r, EXTENT_EVENT);
+	}
+
+	/**
+	 * <p>Creates a new extent event.</p>
+	 *
+	 * @param c the new adjusted extent
+	 * @param eventType identifier of this kind of event
+	 */
+	private ExtentEvent(Envelope r, int eventType) {
+		setEventType(eventType);
+		newExtent = r;
+	}
+	
+	/**
+     * <p>Creates a new extent event.</p>
+     *
+     * @param c the new adjusted extent
+     */
+    public ExtentEvent(Envelope envelope) {
+        this(envelope, EXTENT_EVENT);       
+    }
+    
+    /**
+     * <p>Creates a new time event.</p>
+     * @param time
+     *          the new time
+     */
+    public ExtentEvent(Time time) {
+        setEventType(TIME_EVENT);
+        newTime = time;
+    }
+
+	/**
+	 * <p>Gets the new adjusted event.</p>
+	 *
+	 * @return the new adjusted extent
+	 */
+	public Envelope getNewExtent() {
+		return newExtent;
+	}
+	
+	/**
+     * <p>Gets the new time event.</p>
+     *
+     * @return the new time extent
+     */
+    public Time getNewTime() {
+        return newTime;
+    }
+}
+
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java	(revision 35988)
@@ -0,0 +1,119 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: ErrorEvent.java 20989 2008-05-28 11:05:57Z jmvivo $
+ * $Log$
+ * Revision 1.2  2005-12-20 11:23:43  jaume
+ * Added ErrorEvent to any Fmap, and error handling to FLayers
+ *
+ * Revision 1.1  2005/12/20 10:56:34  jaume
+ * Added an error event to fmap
+ *
+ *
+ */
+/**
+ * 
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+
+/**
+ * <p><code>ErrorEvent</code> stores all necessary information of an error produced on a layer.</p>
+ * 
+ * @see FMapEvent
+ * 
+ * 
+ * @author jaume
+ */
+/* 
+ * jjdc
+ *  
+ * FIXME: No esta claro que no se use.
+ *               Si se deja deprecated habria que documentar por que hay que sustituirla. 
+ * @deprecated As of release 1.0.2, don't used
+ */
+public class ErrorEvent extends FMapEvent {
+	/**
+	 * <p>Extra information about the error, like which layer was produced.</p>
+	 * 
+	 * @see #getMessage()
+	 */
+	private String message;
+    
+    /**
+     * <p>Exception associated to the error produced.</p>
+     * 
+     * @see #getException()
+     */
+	private Exception exception;
+
+    /**
+     * <p>Constructs an <code>ErrorEvent</code> with the specified, detailed message as extra information, and the exception thrown.</p>
+     * 
+     * @param message detailed error information
+     * @param e the exception thrown when the error was produced
+     */
+	public ErrorEvent(String message, Exception e){
+		this.message = message;
+		this.exception = e;
+	}
+
+    /**
+     * <p>Gets the <code>Exception</code> associated to the error produced.</p>
+     * 
+     * @return the exception thrown when the error was produced
+     */
+	public Exception getException() {
+		return exception;
+	}
+
+    /**
+     * <p>Gets detailed message with extra information.</p>
+     * 
+     * @return the detail message with extra information
+     */
+	public String getMessage() {
+		return message;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java	(revision 35988)
@@ -0,0 +1,227 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+
+
+/**
+ * <p>An atomic event represents a group of events that will be attended without any interruption.</p>
+ * 
+ * <p>This kind of events are created by the buffer of events of the {@link MapContext MapContext}.</p>
+ */
+public class AtomicEvent extends FMapEvent {
+	/**
+	 * <p>Events that constitute this one.</p>
+	 */
+	private ArrayList events;
+
+	/**
+	 * <p>Creates a new instance of this kind of event.</p>
+	 *
+	 * @param fmapEvents events that will constitute this one
+	 */
+	public AtomicEvent(ArrayList fmapEvents) {
+		this.events = (ArrayList) fmapEvents.clone();
+	}
+
+	/**
+	 * <p>Returns the event at the specified position in the internal list.</p>
+	 *
+	 * @param index index of event to return
+	 *
+	 * @return event at the specified position in this list
+	 */
+	public FMapEvent getEvent(int index) {
+		return (FMapEvent) events.get(index);
+	}
+
+	/**
+	 * <p>Returns the number of events that constitute this one.</p>
+	 *
+	 * @return number of events that constitute this one
+	 */
+	public int getEventCount() {
+		return events.size();
+	}
+
+	/**
+	 * <p>Returns all legend events that constitute this one.</p>
+	 *
+	 * @return an array with all legend events that constitute this one
+	 */
+	public LegendEvent[] getLegendEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LegendEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LegendEvent[]) ret.toArray(new LegendEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all layer collection events that constitute this one.</p>
+	 *
+	 * @return an array with all layer collection events that constitute this one
+	 */
+	public LayerCollectionEvent[] getLayerCollectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LayerCollectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LayerCollectionEvent[]) ret.toArray(new LayerCollectionEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all vector layer selection events that constitute this one.</p>
+	 *
+	 * @return an array with all vector layer selection events that constitute this one
+	 */
+	public SelectionEvent[] getSelectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof SelectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (SelectionEvent[]) ret.toArray(new SelectionEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all extent events that constitute this one.</p>
+	 *
+	 * @return an array with all extent events that constitute this one
+	 */
+	public ExtentEvent[] getExtentEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ExtentEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ExtentEvent[]) ret.toArray(new ExtentEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all layer events that constitute this one.</p>
+	 *
+	 * @return an array with all layer events that constitute this one
+	 */
+	public LayerEvent[] getLayerEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LayerEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LayerEvent[]) ret.toArray(new LayerEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all color events that constitute this one.</p>
+	 *
+	 * @return an array with all color events that constitute this one
+	 */
+	public ColorEvent[] getColorEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ColorEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ColorEvent[]) ret.toArray(new ColorEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all projection events that constitute this one.</p>
+	 *
+	 * @return an array with all projection events that constitute this one
+	 */
+	public ProjectionEvent[] getProjectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ProjectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ProjectionEvent[]) ret.toArray(new ProjectionEvent[0]);
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java	(revision 35988)
@@ -0,0 +1,49 @@
+package org.gvsig.fmap.mapcontext.events;
+
+import org.cresques.cts.IProjection;
+
+/**
+ * <p>Event produced when the projection of the view port has changed.</p>
+ */
+public class ProjectionEvent extends FMapEvent {
+	/**
+	 * <p>The new projection.</p>
+	 */
+	private IProjection newProyection;
+
+	/**
+	 * <p>Identifies this object as an event related with the projection.</p>
+	 */
+	private static final int PROJECTION_EVENT = 0;
+
+	/**
+	 * <p>Creates a new projection event.</p>
+	 * 
+	 * @param proj the new projection
+	 * 
+	 * @return a new projection event
+	 */
+	public static ProjectionEvent createProjectionEvent(IProjection proj){
+		return new ProjectionEvent(proj, PROJECTION_EVENT);
+	}
+
+	/**
+	 * <p>Creates a new projection event of the specified type.</p>
+	 *
+	 * @param proj the new projection
+	 * @param eventType identifier of this kind of event
+	 */
+	private ProjectionEvent(IProjection proj, int eventType) {
+		setEventType(eventType);
+		newProyection = proj;
+	}
+
+	/**
+	 * <p>Gets the new projection.</p>
+	 *
+	 * @return the new projection
+	 */
+	public IProjection getNewProjection() {
+		return newProyection;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java	(revision 35988)
@@ -0,0 +1,93 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+import java.awt.Color;
+
+
+/**
+ * <p>Event produced when changes the background color of the <i>view port</i>.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ColorEvent extends FMapEvent {
+	/**
+	 * <p>Identifier of this kind of event.</p>
+	 */
+	private static final int COLOR_EVENT = 0;
+	
+	/**
+	 * <p>Reference to the new color</p> 
+	 */
+	private Color color;
+
+	/**
+	 * <p>Returns a new color event.</p>
+	 * 
+	 * @param c the new color
+	 *
+	 * @return a new color event
+	 */
+	public static ColorEvent createColorEvent(Color c){
+		return new ColorEvent(c, COLOR_EVENT);
+	}
+	
+	/**
+	 * <p>Creates a new color event.</p>
+	 *
+	 * @param c the new color
+	 * @param eventType identifier of this kind of event
+	 */
+	private ColorEvent(Color c, int eventType) {
+		color = c;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the new color.</p>
+	 *
+	 * @return the new color
+	 */
+	public Color getNewColor() {
+		return color;
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.tools.task.Cancellable;
+
+public interface MapContextDrawer {
+
+	public void setMapContext(MapContext mapContext);
+	public void setViewPort(ViewPort viewPort);
+	public void draw(FLayers root, BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException;
+	public void print(FLayers root, Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties) throws ReadException;
+	public void dispose();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 35988)
@@ -0,0 +1,218 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * <p><code>ExtentHistory</code> is designed for managing a history of extents.</p>
+ *
+ * <p>Note: An <i>extent</i> is a re.setMandatory(true)ctangular area, with information of its top-left 2D corner.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ExtentHistory implements Persistent {
+	
+	/**
+	 * <p>Maximum number of extents that can store.</p>
+	 */
+	private int NUMREC;
+
+	/**
+	 * <p>Array with the extents.</p>
+	 *
+	 * @see #hasPrevious()
+	 * @see #put(Rectangle2D)
+	 * @see #get()
+	 * @see #removePrev()
+	 */
+	private Rectangle2D[] extents;
+
+	/**
+	 * <p>Number of extents stored.</p>
+	 *
+	 * @see #hasPrevious()
+	 * @see #put(Rectangle2D)
+	 * @see #get()
+	 * @see #removePrev()
+	 */
+	private int num = 0;
+
+	
+	/**
+	 * <p>Creates a new instance of <code>ExtentsHistory</code> with an history of 10 extents.</p>
+	 */
+	public ExtentHistory() {
+		this(10);
+	}
+
+	
+	/**
+	 * <p>Creates a new instance of <code>ExtentsHistory</code> with an history of <code>numEntries</code> extents.</p>
+	 *
+	 * @param numEntries the maximum number of extents that will store the instance
+	 */
+	public ExtentHistory(int numEntries) {
+		NUMREC = numEntries;
+		extents = new Rectangle2D[NUMREC];
+	}
+
+	/**
+	 * <p>Appends the specified extent to the end of this history.</p>
+	 *
+	 * @param ext the new extent
+	 *
+	 * @see #get()
+	 * @see #hasPrevious()
+	 */
+	public void put(Rectangle2D ext) {
+		if ((ext != null) && ((num < 1) || (ext != extents[num - 1]))) {
+			if (num < (NUMREC)) {
+				extents[num] = ext;
+				num = num + 1;
+			} else {
+				for (int i = 0; i < (NUMREC - 1); i++) {
+					extents[i] = extents[i + 1];
+				}
+
+				extents[num - 1] = ext;
+			}
+		}
+	}
+
+	/**
+	 * <p>Returns <code>true</code> if there are extents registered.</p>
+	 *
+	 * @return <code>true</code> if there are extents registered; <code>false</code> otherwise
+	 *
+	 * @see #put(Rectangle2D)
+	 * @see #removePrev()
+	 * @see #get()
+	 */
+	public boolean hasPrevious() {
+		return num > 0;
+	}
+
+	/**
+	 * <p>Returns the last extent in the history.</p>
+	 *
+	 * @return the last extent in the history
+	 *
+	 * @see #put(Rectangle2D)
+	 * @see #getXMLEntity()
+	 */
+	public Rectangle2D get() {
+		if (num <= 0) {
+			return null;
+		}
+		Rectangle2D ext = extents[num - 1];
+
+		return ext;
+	}
+
+	/**
+	 * <p>Extracts (removing) the last extent from the history.</p>
+	 *
+	 * @return last extent in the history
+	 *
+	 * @see #hasPrevious()
+	 */
+	public Rectangle2D removePrev() {
+		if (num <= 0) {
+			return null;
+		}
+		Rectangle2D ext = extents[--num];
+		return ext;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		
+		num = state.getInt("num");
+		NUMREC = state.getInt("numrec");
+		extents = (Rectangle2D[]) state.getArray("extents", Rectangle2D.class);
+	}
+
+	/**
+	 * <p>
+	 * Returns information of this object. All information is stored as
+	 * properties:<br>
+	 * </p>
+	 * <p>
+	 * <b>Properties:</b>
+	 * <ul>
+	 * <li><i>className</i>: name of this class.
+	 * <li><i>num</i>: number of extents registered.
+	 * <li><i>numrec</i>: maximum number of extents that can register.
+	 * <li><i>extents</i>: .
+	 * </ul>
+	 * </p>
+	 * 
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		state.set("num", num);
+		state.set("numrec", NUMREC);
+		state.set("extents", extents);
+	}
+
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ExtentHistory.class,
+				"ExtentHistory",
+				"ExtentHistory Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("num").setMandatory(true);
+		definition.addDynFieldInt("numrec").setMandatory(true);
+		definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class).setMandatory(true);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/pom.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/pom.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/pom.xml	(revision 35988)
@@ -0,0 +1,482 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                      http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.gvsig</groupId>
+	<artifactId>org.gvsig.fmap.mapcontext</artifactId>
+	<packaging>jar</packaging>
+	<version>2.0-SNAPSHOT</version>
+	<name>libFMap_mapcontext</name>
+	<url>http://gvsig.org</url>
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>gvsig-base-library-pom</artifactId>
+		<version>2.0-SNAPSHOT</version>
+	</parent>	
+	<distributionManagement>
+		<site>
+			<id>gvsig-repository</id>
+			<url>${site-repository}/</url>
+		</site>
+	</distributionManagement>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<type>test-jar</type>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.compat</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.projection</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+			<classifier>operation</classifier>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.dal</artifactId>
+            <scope>compile</scope>
+		</dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+			<groupId>com.vividsolutions</groupId>
+			<artifactId>jts</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>easymock</groupId>
+			<artifactId>easymock</artifactId>
+			<version>1.2_Java1.3</version>
+			<scope>test</scope>
+		</dependency>
+        <dependency>
+            <groupId>javax.media</groupId>
+            <artifactId>jai_core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.media</groupId>
+            <artifactId>jai_codec</artifactId>
+            <scope>test</scope>
+        </dependency>		
+	</dependencies>
+	<properties>
+		<build-dir>${basedir}/../build</build-dir>
+        <eclipse.project.name>libFMap_mapcontext</eclipse.project.name>
+	</properties>
+	<build>
+		<sourceDirectory>src</sourceDirectory>
+		<testSourceDirectory>src-test</testSourceDirectory>
+		<resources>
+			<resource>
+				<directory>src</directory>
+				<includes>
+					<include>**/*.gif</include>
+					<include>**/*.png</include>
+					<include>**/*.PNG</include>
+					<include> **/*.bmp</include>
+					<include> **/*.jpg</include>
+					<include> **/*.jpeg</include>
+				</includes>
+			</resource>
+		</resources>
+		<testResources>
+			<testResource>
+				<directory>resources-test</directory>
+			</testResource>
+		</testResources>
+		<plugins>
+			<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skipTests>true</skipTests>
+				</configuration>
+			</plugin>		
+		</plugins>	
+	</build>
+	<profiles>
+		<profile>
+			<id>se</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<dependencies>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.tools.lib</artifactId>
+					<type>test-jar</type>
+					<scope>test</scope>
+				</dependency>
+
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.compat</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>se</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.projection</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>cresques-impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.geometry</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>spi</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-main</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-legacy</artifactId>
+				</dependency>
+				<dependency>
+					<groupId>org.opengis</groupId>
+				    <artifactId>geoapi</artifactId>
+					<scope>test</scope>
+				</dependency>
+							
+			</dependencies>
+			<build>
+
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-compiler-plugin</artifactId>
+						<configuration>
+							<source>1.4</source>
+							<target>1.4</target>
+							<!-- put your configurations here -->
+							<encoding>ISO-8859-1</encoding>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-jar-plugin</artifactId>
+						<!--
+							Generates a jar file only with the mapcontext API
+							TODO: make a good configuration of excludes and 
+							includes, when the api and implementation of
+							the mapcontext library would be performed. 
+						-->
+						<configuration>
+						  <excludes>
+							<exclude>org/gvsig/fmap/geom/**</exclude>
+						  </excludes>
+						</configuration>		
+						<executions>
+							<!--
+								Generates a jar file only with the mapcontext implementation
+							-->
+							<execution>
+								<id>impl</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>impl</classifier>
+									<excludes>
+										<exclude>**/**</exclude>
+									</excludes>
+								</configuration>
+							</execution>
+							<!--
+								Generates a jar file only with the mapcontext geometries operations
+							-->
+							<execution>
+								<id>operation</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>operation</classifier>
+									<excludes>
+										<exclude>NONE</exclude>
+									</excludes>
+									<includes>
+										<include>org/gvsig/fmap/geom/**</include>
+									</includes>
+								</configuration>
+							</execution>
+							<execution>
+								<goals>
+									<goal>test-jar</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>services</id>
+								<phase>package</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/api" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/impl" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/operation" />
+										</jar>
+									</tasks>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<additionalClasspathElements>
+								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement>
+							</additionalClasspathElements>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+
+		</profile>
+		<profile>
+			<id>cdc</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+			
+			<dependencies>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.tools.lib</artifactId>
+					<type>test-jar</type>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+				  <groupId>org.gvsig.mobile</groupId>
+				  <artifactId>org.gvsig.mobile.compat</artifactId>
+				  <version>2.0-SNAPSHOT</version>
+				  <scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig.mobile</groupId>
+					<artifactId>org.gvsig.mobile.libProjection</artifactId>
+					<version>0.0.1-SNAPSHOT</version>
+					<scope>test</scope>
+				</dependency>
+                <dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.geometry</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>spi</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				
+			</dependencies>
+
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-compiler-plugin</artifactId>
+						<configuration>
+							<source>1.4</source>
+							<target>1.4</target>
+							<!-- put your configurations here -->
+							<encoding>ISO-8859-1</encoding>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-jar-plugin</artifactId>
+						<!--
+							Generates a jar file only with the mapcontext API
+							TODO: make a good configuration of excludes and 
+							includes, when the api and implementation of
+							the mapcontext library would be performed. 
+						-->
+						<configuration>
+						  <excludes>
+							<exclude>org/gvsig/fmap/geom/**</exclude>
+						  </excludes>
+						</configuration>		
+						<executions>
+							<!--
+								Generates a jar file only with the mapcontext implementation
+							-->
+							<execution>
+								<id>impl</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>impl</classifier>
+									<excludes>
+										<exclude>**/**</exclude>
+									</excludes>
+								</configuration>
+							</execution>
+							<!--
+								Generates a jar file only with the mapcontext geometries operations
+							-->
+							<execution>
+								<id>operation</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>operation</classifier>
+									<excludes>
+										<exclude>NONE</exclude>
+									</excludes>
+									<includes>
+										<include>org/gvsig/fmap/geom/**</include>
+									</includes>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>services</id>
+								<phase>package</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/api" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/impl" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/operation" />
+										</jar>
+									</tasks>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<additionalClasspathElements>
+								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement>
+							</additionalClasspathElements>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+
+		</profile>
+		<profile>
+			<id>eclipse-project</id>
+			<build>
+				<defaultGoal>antrun:run</defaultGoal>
+				<plugins>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<configuration>
+							<tasks>
+								<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
+									target="eclipse.all"/>
+							</tasks>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>				
+		</profile>		
+	</profiles>
+</project>
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library	(revision 35988)
@@ -0,0 +1 @@
+org.gvsig.fmap.geom.operation.MapContextGeomOperationsLibrary
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/impl/META-INF/services/org.gvsig.tools.library.Library
===================================================================
Index: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 35988)
@@ -0,0 +1,2 @@
+org.gvsig.fmap.mapcontext.MapContextLibrary
+org.gvsig.fmap.mapcontext.impl.MapContextImplLibrary
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_mapcontext
___________________________________________________________________
Added: svn:ignore
   + .classpath 
.project 
.settings 
maven-eclipse.xml
target
bin
hs_err_pid*
.externalToolBuilders
.settings
.classpath
.project


Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java	(revision 35988)
@@ -0,0 +1,353 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {Iver T.I.}   {Task}
+ */
+
+package org.gvsig.fmap.dal.store.memory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+
+import com.vividsolutions.jts.util.Assert;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class MemoryStoreProviderTest extends AbstractLibraryAutoInitTestCase {
+	protected Logger logger = LoggerFactory.getLogger(getClass());;
+	protected static DataManager dataManager = null;
+	protected static GeometryManager geomManager = null;
+
+	protected static final String ID = "id";
+	protected static final String GEOM = "geom";
+	protected static final String IDSYM = "idsym";
+	protected static final String LABEL = "label";
+	protected static final String FEATUREID = "featureid";
+
+	protected void doSetUp() throws Exception {
+		dataManager = DALLocator.getDataManager();
+		geomManager = GeometryLocator.getGeometryManager();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.BaseTestFeatureStore#getDefaultDataStoreParameters()
+	 */
+	public DataStoreParameters getDefaultDataStoreParameters()
+	throws DataException {
+		MemoryStoreParameters memoryParameters = null;
+
+		memoryParameters = (MemoryStoreParameters) dataManager
+		.createStoreParameters(MemoryStoreProvider.NAME);
+		return memoryParameters;
+	}
+
+	public void testInitializeStore() throws Exception {
+		FeatureStore store = (FeatureStore) dataManager.createStore(this
+				.getDefaultDataStoreParameters());
+
+		assertNotNull(store.getMetadataID());
+		assertNotNull(store.getName());
+		assertEquals(store.getEnvelope(), store.getDynValue("Envelope"));
+		assertTrue(store.getFeatureCount() == 0);
+		if (store.isLocksSupported()) {
+			assertNotNull(store.getLocks());
+		} else {
+			assertNull(store.getLocks());
+		}
+		store.dispose();
+	}
+
+	public void testAddFeatureType() throws DataException, ValidateDataParametersException{
+		FeatureStore store = createEditableFeatureStore();
+		FeatureAttributeDescriptor attributeDescriptor = store.getDefaultFeatureType().getAttributeDescriptor(ID);
+		assertNotNull(attributeDescriptor);
+		assertEquals(attributeDescriptor.getType(), DataTypes.OBJECT);
+
+		store.dispose();
+	}
+
+	protected FeatureStore createEditableFeatureStore() throws ValidateDataParametersException, InitializeException, ProviderNotRegisteredException, DataException{
+		FeatureStore store = (FeatureStore) dataManager.createStore(this
+				.getDefaultDataStoreParameters());
+
+		store.edit();
+
+		EditableFeatureType editableFeatureType = store.getDefaultFeatureType().getEditable();
+
+		EditableFeatureAttributeDescriptor idDescriptor = editableFeatureType.add(ID, DataTypes.OBJECT).setObjectClass(Object.class);
+		idDescriptor.setIsPrimaryKey(true);
+		EditableFeatureAttributeDescriptor geometryDescriptor = 
+			editableFeatureType.add(GEOM, DataTypes.GEOMETRY);
+		geometryDescriptor.setGeometryType(TYPES.GEOMETRY);
+		editableFeatureType.setDefaultGeometryAttributeName(GEOM);
+
+		editableFeatureType.add(IDSYM, DataTypes.OBJECT).setObjectClass(Object.class);
+		editableFeatureType.add(LABEL, DataTypes.STRING);
+		EditableFeatureAttributeDescriptor featureIdDescriptor = 
+			editableFeatureType.add(FEATUREID, DataTypes.OBJECT).setObjectClass(Object.class);		
+		
+		//editableFeatureType.setHasOID(true);
+
+		store.update(editableFeatureType);	
+		store.finishEditing();
+		return store;
+	}
+
+	public void testAddFeature() throws DataException, ValidateDataParametersException, CreateGeometryException{
+		FeatureStore store = createEditableFeatureStore();
+
+		store.edit();
+
+		EditableFeature feature = store.createNewFeature().getEditable();
+		feature.set(ID, "0");
+		feature.set(GEOM, geomManager.createPoint(0, 0, SUBTYPES.GEOM2D));
+
+		store.insert(feature);
+
+		Envelope envelope = store.getEnvelope();
+		assertNotNull(envelope);
+
+		store.finishEditing();
+
+		FeatureSet featureSet = store.getFeatureSet();
+		DisposableIterator it = featureSet.iterator();
+		while (it.hasNext()){
+			Feature feature2 = (Feature)it.next();
+			assertEquals(feature.getType().get(0), feature2.getType().get(0));
+			assertEquals(feature.get(0), feature2.get(0));
+
+			assertEquals(feature.getType().get(1), feature2.getType().get(1));
+			assertEquals(feature.get(1), feature2.get(1));
+		}	
+
+		envelope = store.getEnvelope();
+		assertNotNull(envelope);
+
+		store.dispose();
+	}
+
+	public void testAddFeatures() throws DataException, ValidateDataParametersException, CreateGeometryException{
+		FeatureStore store = createEditableFeatureStore();
+
+		store.edit();
+
+		EditableFeature feature = store.createNewFeature().getEditable();
+		feature.set(ID, "0");
+		feature.set(GEOM, geomManager.createPoint(0, 0, SUBTYPES.GEOM2D));
+
+		// One
+		store.insert(feature);
+
+		EditableFeature feature2 = store.createNewFeature().getEditable();
+		feature2.set(ID, "1");
+		GeneralPathX gpx=new GeneralPathX();
+		gpx.moveTo(0, 0);
+		gpx.lineTo(1, 0);
+		gpx.lineTo(1, 1);
+		gpx.lineTo(0, 1);
+		gpx.lineTo(0, 0);
+		gpx.closePath();
+		feature2.set(GEOM, geomManager.createCurve(gpx, SUBTYPES.GEOM2D));
+
+		// Two
+		store.insert(feature2);
+
+		EditableFeature feature3 = store.createNewFeature().getEditable();
+		feature3.set(ID, "2");
+		feature3.set(GEOM, geomManager.createSurface(gpx, SUBTYPES.GEOM2D));
+
+		//Three
+		store.insert(feature3);
+
+		Envelope envelope = store.getEnvelope();
+		assertNotNull(envelope);
+
+		store.finishEditing();
+
+		FeatureSet featureSet = store.getFeatureSet();
+		DisposableIterator it = featureSet.iterator();
+
+		//Count the features in the set
+		int i=0;
+		while (it.hasNext()){
+			Feature feat = (Feature)it.next();
+			i++;
+		}	
+
+		//Are all three inside?
+		assertEquals(3,i);
+
+		envelope = store.getEnvelope();
+		assertNotNull(envelope);
+
+		// Editing other time
+		store.edit();
+		EditableFeature feature4 = store.createNewFeature().getEditable();
+		feature4.set(ID, "4");
+		feature4.set(GEOM, geomManager.createSurface(gpx, SUBTYPES.GEOM2D));
+
+		//four
+		store.insert(feature4);
+
+		store.finishEditing();
+		
+		//Are all four inside?
+		assertEquals(4,store.getFeatureCount());
+
+		store.dispose();
+	}
+
+	public void testRemoveFeatures() throws DataException, ValidateDataParametersException, CreateGeometryException{
+		FeatureStore store = createEditableFeatureStore();
+
+		store.edit();
+
+		EditableFeature feature = store.createNewFeature().getEditable();
+		feature.set(ID, "0");
+		feature.set(GEOM, geomManager.createPoint(0, 0, SUBTYPES.GEOM2D));
+
+		// One
+		store.insert(feature);
+
+		EditableFeature feature2 = store.createNewFeature().getEditable();
+		feature2.set(ID, "1");
+		GeneralPathX gpx=new GeneralPathX();
+		gpx.moveTo(0, 0);
+		gpx.lineTo(1, 0);
+		gpx.lineTo(1, 1);
+		gpx.lineTo(0, 1);
+		gpx.lineTo(0, 0);
+		gpx.closePath();
+		feature2.set(GEOM, geomManager.createCurve(gpx, SUBTYPES.GEOM2D));
+
+		// Two
+		store.insert(feature2);
+
+		EditableFeature feature3 = store.createNewFeature().getEditable();
+		feature3.set(ID, "2");
+		feature3.set(GEOM, geomManager.createSurface(gpx, SUBTYPES.GEOM2D));
+
+		//Three
+		store.insert(feature3);
+
+		Envelope envelope = store.getEnvelope();
+		assertNotNull(envelope);
+
+		store.finishEditing();
+
+		// Editing other time and remove the second one
+		store.edit();
+			
+
+		FeatureSet featureSet = store.getFeatureSet();
+		DisposableIterator it = featureSet.iterator();
+
+		//Count the features in the set
+		int i=1;
+		Feature addedFeature2 = null;
+		while (it.hasNext()){
+			Feature feat = (Feature)it.next();
+			if (i == 2){
+				addedFeature2 = feat;
+			}			
+			i++;
+		}	
+		
+		store.delete(addedFeature2);
+
+		store.finishEditing();
+		//Are two inside?
+		assertEquals(2,store.getFeatureCount());
+
+		store.dispose();
+	}
+	
+	public void testUpdateFeatures() throws DataException, ValidateDataParametersException, CreateGeometryException{
+		FeatureStore store = createEditableFeatureStore();
+
+		store.edit();
+
+		EditableFeature feature = store.createNewFeature().getEditable();
+		feature.set(ID, "0");
+		feature.set(GEOM, geomManager.createPoint(0, 0, SUBTYPES.GEOM2D));
+		feature.set(LABEL, "Hi");		
+		store.insert(feature);
+		store.finishEditing();
+
+		// Editing other time and update 
+		store.edit();
+			
+		FeatureSet featureSet = store.getFeatureSet();
+		DisposableIterator it = featureSet.iterator();
+		
+		EditableFeature editableFeature = null;
+		while (it.hasNext()){			
+			Feature feat = (Feature)it.next();
+			editableFeature = feat.getEditable();
+			editableFeature.set(LABEL, "Bye");			
+		}
+		
+		store.update(editableFeature);
+		
+		store.finishEditing();
+		
+		//Check the value
+		featureSet = store.getFeatureSet();
+		it = featureSet.iterator();
+
+		while (it.hasNext()){
+			Feature feat = (Feature)it.next();
+			Assert.equals("Bye", feat.get(LABEL));
+		}	
+		
+		store.dispose();
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.commands;
+
+import junit.framework.TestCase;
+
+public class CommandTest extends TestCase {
+
+	public static void main(String[] args) {
+		junit.textui.TestRunner.run(CommandTest.class);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	public void testInitialize() {
+
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java	(revision 35988)
@@ -0,0 +1,10 @@
+package org.gvsig.fmap.dal;
+
+import junit.framework.TestCase;
+
+public class DataStoreTest extends TestCase {
+    
+    public void testVoid() {
+
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java	(revision 35988)
@@ -0,0 +1,125 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.resource.spi;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+
+/**
+ * Unit tests for the class {@link AbstractResource}
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class AbstractResourceTest extends TestCase {
+
+	private AbstractResource resource;
+	private MockControl paramsControl;
+	private ResourceParameters params;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		paramsControl = MockControl.createNiceControl(ResourceParameters.class);
+		params = (ResourceParameters) paramsControl.getMock();
+		resource = new TestResource(params);
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#getLastTimeOpen()}.
+	 */
+	public void testGetLastTimeOpen() throws ResourceNotifyOpenException {
+		long time = resource.getLastTimeOpen();
+		resource.notifyOpen();
+		assertTrue("The resource last time open hasn't been updated",
+				resource.getLastTimeOpen() > time);
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#getLastTimeUsed()}.
+	 */
+	public void testGetLastTimeUsed() throws Exception {
+		long time = resource.getLastTimeUsed();
+		resource.execute(new ResourceAction() {
+			public Object run() throws Exception {
+				try {
+					// Wait for 100 milliseconds
+					Thread.sleep(100);
+				} catch (InterruptedException e) {
+					// No problem
+				}
+				return null;
+			}
+		});
+		assertTrue("The resource last time used hasn't been updated",
+				resource.getLastTimeUsed() > time);
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#openCount()}.
+	 */
+	public void testOpenCount() throws Exception {
+		assertEquals(0, resource.openCount());
+		resource.notifyOpen();
+		assertEquals(1, resource.openCount());
+		resource.notifyOpen();
+		resource.notifyOpen();
+		assertEquals(3, resource.openCount());
+		resource.notifyClose();
+		assertEquals(2, resource.openCount());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#execute(java.lang.Runnable)}
+	 * .
+	 */
+	public void testExecute() throws Exception {
+		final MutableBoolean testValue = new MutableBoolean();
+		resource.execute(new ResourceAction() {
+			public Object run() throws Exception {
+				testValue.setValue(true);
+				return null;
+			}
+		});
+		assertTrue("Runnable execution not performed", testValue.isValue());
+	}
+
+	public class MutableBoolean {
+		private boolean value = false;
+
+		public void setValue(boolean value) {
+			this.value = value;
+		}
+
+		public boolean isValue() {
+			return value;
+		}
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java	(revision 35988)
@@ -0,0 +1,58 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+
+/**
+ * Test resource implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class TestNonBlockingResource extends AbstractNonBlockingResource {
+
+	protected TestNonBlockingResource(ResourceParameters parameters)
+			throws InitializeException {
+		super(parameters);
+	}
+
+	public Object get() throws AccessResourceException {
+		return getName();
+	}
+
+	public String getName() throws AccessResourceException {
+		return getClass().getName();
+	}
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException {
+		return false;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java	(revision 35988)
@@ -0,0 +1,75 @@
+package org.gvsig.fmap.dal.resource.spi;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+
+public class TestAbstractResourcePerformance extends TestCase {
+	private MockControl paramsControl;
+	private ResourceParameters params;
+	private AbstractResource resource;
+	private MockControl paramsControl2;
+	private ResourceParameters params2;
+	private AbstractNonBlockingResource nonBlockingResource;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		paramsControl = MockControl.createNiceControl(ResourceParameters.class);
+		params = (ResourceParameters) paramsControl.getMock();
+		resource = new TestResource(params);
+		paramsControl2 =
+				MockControl.createNiceControl(ResourceParameters.class);
+		params2 = (ResourceParameters) paramsControl2.getMock();
+		nonBlockingResource = new TestNonBlockingResource(params2);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#execute(java.lang.Runnable)}
+	 * .
+	 */
+	public void testExecuteBlockingPerformance() throws Exception {
+		executePerformance(new ResourceAction() {
+			public Object run() throws Exception {
+				return null;
+			}
+		}, resource);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#execute(java.lang.Runnable)}
+	 * .
+	 */
+	public void testExecuteNonBlockingPerformance() throws Exception {
+		executePerformance(new ResourceAction() {
+			public Object run() throws Exception {
+				return null;
+			}
+		}, nonBlockingResource);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.resource.spi.AbstractResource#execute(java.lang.Runnable)}
+	 * .
+	 */
+	public void executePerformance(ResourceAction action, Resource resource)
+			throws Exception {
+
+		final int executions = 100000;
+		long time1 = System.currentTimeMillis();
+		for (int i = 0; i < executions; i++) {
+			resource.execute(action);
+		}
+		long time2 = System.currentTimeMillis();
+
+		System.out.print(resource.getName());
+		System.out.print(": total time: " + (time2 - time1) + " ms.");
+		System.out.println(" - time per execution: "
+				+ ((float) (time2 - time1) / (float) executions) + " ms.");
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java	(revision 35988)
@@ -0,0 +1,58 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+
+/**
+ * Test non blocking resource implementation.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class TestResource extends AbstractResource {
+
+	protected TestResource(ResourceParameters parameters)
+			throws InitializeException {
+		super(parameters);
+	}
+
+	public Object get() throws AccessResourceException {
+		return getName();
+	}
+
+	public String getName() throws AccessResourceException {
+		return getClass().getName();
+	}
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException {
+		return false;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.dal;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.gvsig.fmap.dal.commands.CommandTest;
+import org.gvsig.fmap.dal.feature.FeatureTest;
+
+public class AllTests extends TestCase{
+	public static Test suite() {
+		TestSuite suite = new TestSuite("Test for libDataSource");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(CommandTest.class);
+		suite.addTestSuite(DataStoreTest.class);
+		suite.addTestSuite(FeatureTest.class);
+
+		//$JUnit-END$
+		return suite;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java	(revision 35988)
@@ -0,0 +1,1451 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.RemoveException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.fmap.dal.feature.testmulithread.DeleteFirstAndLastFeature;
+import org.gvsig.fmap.dal.feature.testmulithread.DeleteLastFeature;
+import org.gvsig.fmap.dal.feature.testmulithread.InsertFeature;
+import org.gvsig.fmap.dal.feature.testmulithread.StoreTask;
+import org.gvsig.fmap.dal.feature.testmulithread.UpdateFeature;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+import org.gvsig.tools.evaluator.EvaluatorFieldValue;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+
+/**
+ * @author jmvivo
+ *
+ */
+public abstract class BaseTestEditableFeatureStore extends BaseTestFeatureStore {
+
+	public abstract NewFeatureStoreParameters getDefaultNewDataStoreParameters()
+			throws Exception;
+
+	public abstract boolean resourcesNotifyChanges();
+
+	//=================================================
+	//=================================================
+
+
+	public void fillPrimaryKeyInserFeature(EditableFeature feature) {
+		return;
+	}
+
+	protected Evaluator getEvaluatorToLower(String attibuteName) {
+		return new ToLower(attibuteName);
+
+	}
+
+	protected Evaluator getEvaluatorToUpper(String attibuteName) {
+		return new ToUpper(attibuteName);
+	}
+
+	public class ToLower extends AbstractEvaluator {
+		private String attributeName;
+
+		public ToLower(String attrName) {
+			this.attributeName = attrName;
+			this.getFieldsInfo().addFieldValue(this.attributeName);
+		}
+
+		public Object evaluate(EvaluatorData data) throws EvaluatorException {
+			String value = (String) data.getDataValue(this.attributeName);
+			if (value == null) {
+				return null;
+			}
+			return value.toLowerCase();
+		}
+
+		public String getSQL() {
+			return null;
+		}
+
+		public String getDescription() {
+			return null;
+		}
+
+		public String getName() {
+			return null;
+		}
+
+	}
+
+	public class ToUpper extends AbstractEvaluator {
+		private String attributeName;
+
+		public ToUpper(String attrName) {
+			this.attributeName = attrName;
+			this.getFieldsInfo().addFieldValue(this.attributeName);
+		}
+
+		public Object evaluate(EvaluatorData data) throws EvaluatorException {
+			String value = (String) data.getDataValue(this.attributeName);
+			if (value == null) {
+				return null;
+			}
+			return value.toUpperCase();
+		}
+
+		public String getSQL() {
+			return null;
+		}
+
+		public String getDescription() {
+			return null;
+		}
+
+		public EvaluatorFieldValue[] getFieldValues(String name) {
+			return null;
+		}
+
+		public String getName() {
+			return null;
+		}
+
+	}
+
+	protected FeatureStore getStoreCopy(FeatureStore source,
+			NewFeatureStoreParameters targetParams) throws DataException,
+			ValidateDataParametersException {
+		DataServerExplorer explorer = source.getExplorer();
+		source.export(explorer, source.getProviderName(), targetParams);
+		FeatureStore result = (FeatureStore) dataManager.openStore(source.getProviderName(), targetParams);
+
+		return result;
+	}
+
+	protected void clearCopy(FeatureStore source,
+			NewFeatureStoreParameters targetParams) throws Exception {
+		DataServerExplorer explorer = source.getExplorer();
+		explorer.remove(targetParams);
+
+	}
+
+	protected boolean compareFeatures(Feature f1, Feature f2,
+			String[] attrsNames, UpdateFeature updated, long index,
+			long lastIndex) throws DataException, EvaluatorException {
+		FeatureAttributeDescriptor attr1;
+		FeatureAttributeDescriptor attr2;
+		EditableFeature f2e = f2.getEditable();
+		updated.applyUpdateList(f2e, index, lastIndex);
+
+		Object v1, v2;
+		for (int i = 0; i < attrsNames.length; i++) {
+			attr1 = f1.getType().getAttributeDescriptor(attrsNames[i]);
+			attr2 = f2e.getType().getAttributeDescriptor(attrsNames[i]);
+			if (attr1 != attr2) {
+				if (!compareAttributes(attr1, attr1)) {
+					return false;
+				}
+			}
+			v1 = f1.get(attr1.getName());
+			v2 = f2.get(attr2.getName());
+			if (!compareFeatureValue(v1, v2, attr1)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	protected boolean compareFeatures(Feature f1, Feature f2,
+			UpdateFeature updated, long index, long lastIndex)
+			throws DataException, EvaluatorException {
+		if (!compareTypes(f1.getType(), f2.getType())) {
+			System.out.println("compareFeatures() type !=");
+			return false;
+		}
+		Iterator iter = f1.getType().iterator();
+		FeatureAttributeDescriptor attr;
+		EditableFeature f1e = f1.getEditable();
+		updated.applyUpdateList(f1e, index, lastIndex);
+		Object v1, v2;
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			v1 = f1e.get(attr.getName());
+			v2 = f2.get(attr.getName());
+			if (!compareFeatureValue(v1, v2, attr)) {
+				return false;
+			}
+		}
+
+
+		return true;
+
+	}
+
+
+	//---------------
+
+
+
+
+	//=================================================
+	//=================================================
+
+
+
+
+	public void testExport() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+				.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		fullStoreIteratorTest(result);
+
+		FeatureSet set;
+		FeatureSet originalSet;
+		if (result.getDefaultFeatureType().getPrimaryKey() != null
+				&& result.getDefaultFeatureType().getPrimaryKey().length > 0) {
+			FeatureQuery queryR = result.createFeatureQuery();
+			FeatureQuery queryO = store.createFeatureQuery();
+			FeatureAttributeDescriptor[] pk = result.getDefaultFeatureType()
+					.getPrimaryKey();
+			for (int i = 0; i < pk.length; i++) {
+				queryO.getOrder().add(pk[i].getName(), true);
+				queryR.getOrder().add(pk[i].getName(), true);
+			}
+
+
+			set = result.getFeatureSet(queryR);
+			originalSet = store.getFeatureSet(queryO);
+
+
+		} else {
+			set = result.getFeatureSet();
+			originalSet = store.getFeatureSet();
+		}
+		assertEquals(set.getSize(), originalSet.getSize());
+
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+		assertTrue(compareFeatureIterators(originalIter, iter));
+		originalIter.dispose();
+		iter.dispose();
+
+		if (store.getEnvelope() != result.getEnvelope()) {
+			if (store.getEnvelope() != null) {
+				assertTrue(store.getEnvelope().equals(result.getEnvelope()));
+			} else {
+				fail("Envelope: src=" + store.getEnvelope() + " traget="
+						+ store.getEnvelope());
+			}
+		}
+
+		set.dispose();
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+	}
+
+	public void testRemove() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+				.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		FeatureSet set = result.getFeatureSet(getDefaultQuery(result));
+		FeatureSet originalSet = store.getFeatureSet(getDefaultQuery(store));
+		assertEquals(set.getSize(), originalSet.getSize());
+
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+		int i = 0;
+		while (iter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+
+		iter.remove();
+
+
+		assertEquals(originalSet.getSize() - 1, set.getSize());
+
+		iter.dispose();
+		originalIter.dispose();
+
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (iter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+
+		iter.remove();
+
+		assertEquals(originalSet.getSize() - 2, set.getSize());
+
+		iter.dispose();
+		originalIter.dispose();
+
+		set.dispose();
+
+		result.finishEditing();
+
+		set = result.getFeatureSet();
+		assertEquals(originalSet.getSize() - 2, set.getSize());
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (iter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+
+		iter.dispose();
+		originalIter.dispose();
+
+
+		set.dispose();
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+
+	}
+
+	public void testInsert() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+
+		FeatureStore store = (FeatureStore) dataManager
+		.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			//Do nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		FeatureSet set = result.getFeatureSet(getDefaultQuery(result));
+		FeatureSet originalSet = store.getFeatureSet(getDefaultQuery(store));
+		assertEquals(set.getSize(), originalSet.getSize());
+
+		EditableFeature newFeature = result.createNewFeature(true);
+		fillPrimaryKeyInserFeature(newFeature);
+		set.insert(newFeature);
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+		int i = 0;
+		while (originalIter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter
+					.next(), (Feature) iter.next()));
+			i++;
+		}
+		assertTrue(iter.hasNext());
+		assertNotNull(iter.next());
+		assertFalse(iter.hasNext());
+
+		assertEquals(originalSet.getSize() + 1, set.getSize());
+
+		iter.dispose();
+		originalIter.dispose();
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (originalIter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter
+					.next(), (Feature) iter.next()));
+			i++;
+		}
+		assertTrue(iter.hasNext());
+		assertNotNull(iter.next());
+
+		newFeature = result.createNewFeature(true);
+		fillPrimaryKeyInserFeature(newFeature);
+		set.insert(newFeature);
+
+		assertEquals(originalSet.getSize() + 2, set.getSize());
+
+		iter.dispose();
+		originalIter.dispose();
+
+		set.dispose();
+
+		result.finishEditing();
+
+		set = result.getFeatureSet();
+		assertEquals(originalSet.getSize() + 2, set.getSize());
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (originalIter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter
+					.next(), (Feature) iter.next()));
+			i++;
+		}
+
+		assertNotNull(iter.next());
+		assertNotNull(iter.next());
+		assertFalse(iter.hasNext());
+
+		iter.dispose();
+		originalIter.dispose();
+
+		set.dispose();
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+
+	}
+
+
+
+	public void testConcurrentRemove() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		DeleteFirstAndLastFeature deleteFeature = new DeleteFirstAndLastFeature(
+				"1", result, StoreTask.TIME_TO_WAIT_NO_WAIT);
+
+		FeatureSet set = result.getFeatureSet();
+
+		DisposableIterator iter = set.iterator();
+		assertTrue(iter.hasNext());
+		assertNotNull(iter.next());
+
+		deleteFeature.start();
+
+		while (deleteFeature.getCurrentStatus() <= StoreTask.STATUS_RUNING) {
+			Thread.yield();
+			Thread.sleep(100);
+			if (deleteFeature.isOutOfDate()) {
+				break;
+			}
+		}
+
+		assertEquals(deleteFeature.getCurrentStatus(),
+				StoreTask.STATUS_FINISHED_OK);
+
+		Exception ex = null;
+		try {
+			iter.next();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		ex = null;
+		try {
+			set.getSize();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		iter.dispose();
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+	}
+
+	public void testConcurrentInsert() throws Exception{
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		InsertFeature insertFeature = new InsertFeature("1", result,
+				StoreTask.TIME_TO_WAIT_NO_WAIT, this);
+
+		FeatureSet set = result.getFeatureSet();
+
+		DisposableIterator iter = set.iterator();
+		assertTrue(iter.hasNext());
+		assertNotNull(iter.next());
+
+		insertFeature.start();
+
+		while (insertFeature.getCurrentStatus() <= StoreTask.STATUS_RUNING) {
+			Thread.yield();
+			Thread.sleep(100);
+			if (insertFeature.isOutOfDate()) {
+				break;
+			}
+		}
+
+		assertEquals(StoreTask.STATUS_FINISHED_OK, insertFeature
+				.getCurrentStatus());
+
+		Exception ex = null;
+		try {
+			iter.next();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		ex = null;
+		try {
+			set.getSize();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		iter.dispose();
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+	}
+
+	public void testConcurrentUpdate() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		UpdateFeature updateFeature = new UpdateFeature("1", result,
+				StoreTask.TIME_TO_WAIT_NO_WAIT);
+
+		FeatureType fType = result.getDefaultFeatureType();
+		FeatureAttributeDescriptor attr;
+		Iterator fTypeIter = fType.iterator();
+		String attrName = null;
+		while (fTypeIter.hasNext()){
+			attr = (FeatureAttributeDescriptor) fTypeIter.next();
+			if (attr.getType() == DataTypes.STRING && !attr.isReadOnly() && !attr.isPrimaryKey() && !attr.isAutomatic()){
+				attrName= attr.getName();
+			}
+		}
+		if (attrName == null) {
+			fail("This test needs an normal attribute String (no Pk, no ReadOnly & no Auto)");
+			return;
+		}
+
+
+		updateFeature.addUpdate(UpdateFeature.UPDATE_ALL_FEATURES, attrName,
+				"XXX");
+
+		FeatureSet set = result.getFeatureSet();
+
+		DisposableIterator iter = set.iterator();
+		assertTrue(iter.hasNext());
+		assertNotNull(iter.next());
+
+		updateFeature.start();
+
+		while (updateFeature.getCurrentStatus() <= StoreTask.STATUS_RUNING) {
+			Thread.yield();
+			Thread.sleep(100);
+			if (updateFeature.isOutOfDate()) {
+				break;
+			}
+		}
+
+		assertEquals(StoreTask.STATUS_FINISHED_OK, updateFeature
+				.getCurrentStatus());
+
+		Exception ex = null;
+		try {
+			iter.next();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		ex = null;
+		try {
+			set.getSize();
+		} catch (Exception e) {
+			ex = e;
+		}
+		assertNotNull(ex);
+		assertEquals(ConcurrentDataModificationException.class, ex.getClass());
+
+		iter.dispose();
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+
+
+	}
+
+	public void testSequencedRemove() throws Exception {
+		DataStoreParameters parameters = null;
+
+		int ntimes = 3;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		DeleteLastFeature[] deletesFeature = new DeleteLastFeature[ntimes];
+		int i;
+		for (i = 0; i < deletesFeature.length; i++) {
+			deletesFeature[i] = new DeleteLastFeature("DeleteLastFeature:" + i,
+					result, 300 * i);
+		}
+
+		for (i = 0; i < deletesFeature.length; i++) {
+			deletesFeature[i].start();
+		}
+
+		try {
+			for (int x = 0; x < (deletesFeature.length + 2); x++) {
+				Thread.yield();
+				Thread.sleep(500);
+			}
+
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			result.dispose();
+			fail();
+			return;
+		}
+
+		boolean testAll = false;
+		boolean restart;
+		DeleteLastFeature item;
+		while (!testAll) {
+			restart = false;
+			for (i = 0; i < deletesFeature.length; i++) {
+				item = deletesFeature[i];
+				if (item.getCurrentStatus() <= StoreTask.STATUS_RUNING) {
+					if (item.isOutOfDate()) {
+						result.dispose();
+						fail("OutOfDate: " + i);
+						return;
+					}
+					try {
+						Thread.yield();
+						Thread.sleep(400);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+						result.dispose();
+						fail();
+						return;
+					}
+					restart = true;
+					break;
+				} else if (item.getCurrentStatus() == StoreTask.STATUS_ERROR) {
+					item.getException().printStackTrace();
+					result.dispose();
+					fail("ERROR: " + i);
+					return;
+				} else if (item.getCurrentStatus() != StoreTask.STATUS_FINISHED_OK) {
+					item.getException().printStackTrace();
+					result.dispose();
+					fail("Data ERROR: " + i);
+					return;
+				}
+			}
+			if (restart) {
+				continue;
+			}
+			testAll = true;
+		}
+
+		FeatureSet set = result.getFeatureSet(getDefaultQuery(result));
+		FeatureSet originalSet = store.getFeatureSet(getDefaultQuery(store));
+		assertEquals(originalSet.getSize() - deletesFeature.length, set
+				.getSize());
+
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+
+		i = 0;
+		while (iter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+
+		originalIter.dispose();
+		iter.dispose();
+
+		set.dispose();
+
+		result.finishEditing();
+
+		set = result.getFeatureSet(getDefaultQuery(result));
+		assertEquals(originalSet.getSize() - deletesFeature.length, set
+				.getSize());
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (iter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+
+
+		originalIter.dispose();
+		iter.dispose();
+
+		set.dispose();
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+	}
+
+	public void testSequencedInsert() throws Exception {
+		DataStoreParameters parameters = null;
+
+		int ntimes = 3;
+
+		parameters = getDefaultDataStoreParameters();
+
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		InsertFeature[] insertsFeature = new InsertFeature[ntimes];
+		int i;
+		for (i = 0; i < insertsFeature.length; i++) {
+			insertsFeature[i] = new InsertFeature("InsertFeature:" + i, result,
+					300 * i, this);
+		}
+
+		for (i = 0; i < insertsFeature.length; i++) {
+			insertsFeature[i].start();
+		}
+
+		try {
+
+			for (int x = 0; x < (insertsFeature.length + 2); x++) {
+				Thread.yield();
+				Thread.sleep(500);
+			}
+
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			result.dispose();
+			fail();
+			return;
+		}
+
+		boolean testAll = false;
+		boolean restart;
+		InsertFeature item;
+		while (!testAll) {
+			restart = false;
+			for (i = 0; i < insertsFeature.length; i++) {
+				item = insertsFeature[i];
+				if (item.getCurrentStatus() <= StoreTask.STATUS_RUNING) {
+					if (item.isOutOfDate()) {
+						result.dispose();
+						fail("OutOfDate: " + i);
+						return;
+					}
+					try {
+						Thread.yield();
+						Thread.sleep(400);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+						result.dispose();
+						fail();
+						return;
+					}
+					restart = true;
+					break;
+				} else if (item.getCurrentStatus() == StoreTask.STATUS_ERROR) {
+					item.getException().printStackTrace();
+					result.dispose();
+					fail("ERROR: " + i);
+					return;
+				} else if (item.getCurrentStatus() == StoreTask.STATUS_FINISHED_NO_OK) {
+					result.dispose();
+					fail("No OK: " + i);
+					return;
+				} else if (item.getCurrentStatus() != StoreTask.STATUS_FINISHED_OK) {
+					item.getException().printStackTrace();
+					result.dispose();
+					fail("Data ERROR: " + i);
+					return;
+
+				}
+			}
+			if (restart) {
+				continue;
+			}
+			testAll = true;
+		}
+
+		FeatureSet set = result.getFeatureSet(getDefaultQuery(result));
+		FeatureSet originalSet = store.getFeatureSet(getDefaultQuery(store));
+		assertEquals(originalSet.getSize() + insertsFeature.length, set
+				.getSize());
+
+		DisposableIterator originalIter = originalSet.iterator();
+		DisposableIterator iter = set.iterator();
+
+		i = 0;
+		while (originalIter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+		for (; i < insertsFeature.length; i++) {
+			iter.next();
+		}
+
+
+		originalIter.dispose();
+		iter.dispose();
+
+		set.dispose();
+
+		result.finishEditing();
+
+		set = result.getFeatureSet();
+		assertEquals(originalSet.getSize() + insertsFeature.length, set
+				.getSize());
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (originalIter.hasNext()) {
+			assertTrue("" + i, compareFeatures((Feature) originalIter.next(),
+					(Feature) iter.next()));
+			i++;
+		}
+		for (; i < insertsFeature.length; i++) {
+			iter.next();
+		}
+
+		set.dispose();
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+	}
+
+
+	public void testUpdate() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit(FeatureStore.MODE_FULLEDIT);
+
+		FeatureSet set = result.getFeatureSet();
+		long size = set.getSize();
+
+		set.dispose();
+
+		UpdateFeature updater = new UpdateFeature("1", result,
+				UpdateFeature.TIME_TO_WAIT_NO_WAIT);
+		FeatureAttributeDescriptor attr = getFirstAttributeOfType(result
+				.getDefaultFeatureType(), DataTypes.STRING);
+		assertNotNull("No String attributes found", attr);
+
+		updater.addUpdate(UpdateFeature.UPDATE_ALL_FEATURES, attr.getName(),
+				getEvaluatorToLower(attr.getName()));
+
+		updater.run();
+		while (updater.getCurrentStatus() < StoreTask.STATUS_FINISHED_OK
+				&& !updater.isOutOfDate()) {
+			Thread.yield();
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+				fail();
+			}
+		}
+		set = result.getFeatureSet(getDefaultQuery(result));
+		DisposableIterator iter = set.iterator();
+
+		printFeatureTypeColNames(set.getDefaultFeatureType(), 15);
+		Feature f;
+		while (iter.hasNext()) {
+			f = (Feature) iter.next();
+			this.printFeature(f, false, 15);
+		}
+
+		iter.dispose();
+
+		FeatureSet originalSet = store.getFeatureSet(getDefaultQuery(store));
+
+		DisposableIterator originalIter = originalSet.iterator();
+
+		iter = set.iterator();
+
+		long i = 0;
+		while (originalIter.hasNext()) {
+			try {
+				assertTrue("" + i, compareFeatures((Feature) originalIter
+						.next(), (Feature) iter.next(), updater, i, size));
+			} catch (EvaluatorException e) {
+				e.printStackTrace();
+				fail();
+			}
+			i++;
+		}
+		iter.dispose();
+		originalIter.dispose();
+
+
+		set.dispose();
+
+		result.finishEditing();
+
+		set = result.getFeatureSet();
+		assertEquals(originalSet.getSize(), set.getSize());
+
+		originalIter = originalSet.iterator();
+		iter = set.iterator();
+		i = 0;
+		while (originalIter.hasNext()) {
+			try {
+				assertTrue("" + i, compareFeatures((Feature) originalIter
+						.next(), (Feature) iter.next(), updater, i, size));
+			} catch (EvaluatorException e) {
+				e.printStackTrace();
+				fail();
+			}
+			i++;
+		}
+
+
+		iter.dispose();
+		originalIter.dispose();
+		set.dispose();
+
+
+		updater = new UpdateFeature("1", result,
+				UpdateFeature.TIME_TO_WAIT_NO_WAIT);
+
+		updater.addUpdate(UpdateFeature.UPDATE_ALL_FEATURES, attr.getName(),
+				getEvaluatorToLower(attr.getName()));
+
+		updater.run();
+		while (updater.getCurrentStatus() < StoreTask.STATUS_FINISHED_OK
+				&& !updater.isOutOfDate()) {
+			Thread.yield();
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+				fail();
+			}
+		}
+		set = result.getFeatureSet();
+
+		iter = set.iterator();
+		originalIter = originalSet.iterator();
+		i = 0;
+		while (originalIter.hasNext()) {
+			try {
+				assertTrue("" + i, compareFeatures((Feature) originalIter
+						.next(), (Feature) iter.next(), updater, i, size));
+			} catch (EvaluatorException e) {
+				e.printStackTrace();
+				fail();
+			}
+			i++;
+		}
+
+		iter.dispose();
+		originalIter.dispose();
+		set.dispose();
+
+
+
+
+
+		originalSet.dispose();
+
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+	}
+
+
+	public void testResourceChangeNotification() throws Exception{
+		if (!resourcesNotifyChanges()) {
+			return;
+		}
+
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		FeatureStore result2 = (FeatureStore) dataManager
+		.createStore(newParams);
+
+		FeatureAttributeDescriptor attr = getFirstAttributeOfType(result
+				.getDefaultFeatureType(), DataTypes.STRING);
+		assertNotNull("No String attributes found", attr);
+
+
+		UpdateFeature updater = new UpdateFeature("1", result,
+				UpdateFeature.TIME_TO_WAIT_NO_WAIT);
+
+		updater.addUpdate(UpdateFeature.UPDATE_LAST_FEATURE, attr.getName(),
+				getEvaluatorToLower(attr.getName()));
+
+		StoreObserverForNotify observer = new StoreObserverForNotify(result2,
+				FeatureStoreNotification.RESOURCE_CHANGED);
+		result2.addObserver(observer);
+
+		result.edit();
+		updater.run();
+		while (updater.getCurrentStatus() < StoreTask.STATUS_FINISHED_OK
+				&& !updater.isOutOfDate()) {
+			Thread.yield();
+			try {
+				Thread.sleep(200);
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+				fail();
+			}
+		}
+
+		result.finishEditing();
+
+		assertTrue("The observer hasn't been notified", observer.notified());
+
+		result2.refresh();
+
+		FeatureSet set = result.getFeatureSet();
+		FeatureSet set2 = result2.getFeatureSet();
+
+		DisposableIterator iter1 = set.iterator();
+		DisposableIterator iter2 = set2.iterator();
+		assertTrue(this.compareFeatureIterators(iter1, iter2));
+		iter1.dispose();
+		iter2.dispose();
+
+		set2.dispose();
+		set.dispose();
+
+		// TODO checks FeatureType change
+
+		result2.dispose();
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+	}
+
+	public abstract class StoreObserver implements Observer{
+
+		public DataStore store = null;
+
+	}
+
+	public class StoreObserverForNotify implements Observer{
+
+		public DataStore store = null;
+
+		public String notifyType = null;
+
+		private boolean notifyRecived = false;
+
+		public StoreObserverForNotify(DataStore store,String notifyType){
+			this.store = store;
+			this.notifyType = notifyType;
+			this.notifyRecived = false;
+		}
+
+		public boolean notified(){
+			return notifyRecived;
+		}
+
+		public void update(Observable observable, Object notification) {
+			if (!(observable == this.store)){
+				return;
+			}
+			if (!(notification instanceof FeatureStoreNotification)){
+				return;
+			}
+			FeatureStoreNotification fsNotification = (FeatureStoreNotification) notification;
+
+			if (fsNotification.getType().equals(this.notifyType)){
+				notifyRecived = true;
+			}
+		}
+
+	}
+
+	public void testUpdateFeatureType_AddField() throws Exception {
+		DataStoreParameters parameters = null;
+
+		parameters = getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager
+		.createStore(parameters);
+
+		NewFeatureStoreParameters newParams = this
+		.getDefaultNewDataStoreParameters();
+		try {
+			this.clearCopy(store, newParams);
+		} catch (RemoveException e) {
+			// Dp nothing
+		}
+
+		int pkAttributesCount = 0;
+
+		FeatureStore result = this.getStoreCopy(store, newParams);
+
+		result.edit();
+
+
+		String[] orgAttNames = new String[result.getDefaultFeatureType()
+		                                  .size()];
+
+		Iterator iter = result.getDefaultFeatureType().iterator();
+		int i = 0;
+
+		while (iter.hasNext()) {
+			FeatureAttributeDescriptor attr = ((FeatureAttributeDescriptor) iter
+					.next());
+			orgAttNames[i] = attr.getName();
+			i++;
+			if (attr.isPrimaryKey()) {
+				pkAttributesCount++;
+			}
+		}
+
+		EditableFeatureType edFtype = result
+		.getDefaultFeatureType().getEditable();
+
+		edFtype.add("__ATTR1__", DataTypes.STRING).setSize(10)
+		.setDefaultValue(
+				"HOLA");
+
+		result.update(edFtype);
+
+		assertEquals(store.getDefaultFeatureType().size() + 1, result
+				.getDefaultFeatureType().size());
+
+		testIterationFastAndStandart(result);
+
+		FeatureSet orgSet = store.getFeatureSet(getDefaultQuery(store));
+		FeatureSet curSet = result.getFeatureSet(getDefaultQuery(result));
+
+		assertEquals(orgSet.getDefaultFeatureType().size() + 1, curSet
+				.getDefaultFeatureType().size());
+
+		DisposableIterator orgIter = orgSet.iterator();
+		DisposableIterator curIter = curSet.iterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.fastIterator();
+		curIter = curSet.fastIterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.iterator();
+		curIter = curSet.fastIterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.fastIterator();
+		curIter = curSet.iterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		curIter = curSet.iterator();
+		Feature feature;
+		while (curIter.hasNext()) {
+			feature = (Feature) curIter.next();
+			assertEquals("HOLA", feature.get("__ATTR1__"));
+		}
+		curIter.dispose();
+		curSet.dispose();
+
+		FeatureQuery query = this.getDefaultQuery(result);
+		query.setAttributeNames(new String[] { "__ATTR1__" });
+		curSet = result.getFeatureSet(query);
+
+		assertEquals(1 + pkAttributesCount, curSet.getDefaultFeatureType()
+				.size());
+
+		assertEquals(orgSet.getSize(), curSet.getSize());
+		curIter = curSet.iterator();
+		while (curIter.hasNext()) {
+			feature = (Feature) curIter.next();
+			assertEquals("HOLA", feature.get("__ATTR1__"));
+		}
+		curIter.dispose();
+		curSet.dispose();
+
+		result.finishEditing();
+
+		testIterationFastAndStandart(result);
+
+		assertEquals(store.getDefaultFeatureType().size() + 1, result
+				.getDefaultFeatureType().size());
+
+
+		orgSet = store.getFeatureSet(getDefaultQuery(store));
+		curSet = result.getFeatureSet(getDefaultQuery(result));
+
+		assertEquals(orgSet.getDefaultFeatureType().size() + 1, curSet
+				.getDefaultFeatureType().size());
+
+		orgIter = orgSet.iterator();
+		curIter = curSet.iterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.fastIterator();
+		curIter = curSet.fastIterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.iterator();
+		curIter = curSet.fastIterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		orgIter = orgSet.fastIterator();
+		curIter = curSet.iterator();
+
+		assertTrue(compareFeatureIterators(orgIter, curIter, orgAttNames));
+		orgIter.dispose();
+		curIter.dispose();
+
+		curIter = curSet.iterator();
+		while (curIter.hasNext()) {
+			feature = (Feature) curIter.next();
+			assertEquals("HOLA", feature.get("__ATTR1__"));
+		}
+		curIter.dispose();
+		curSet.dispose();
+
+		query = this.getDefaultQuery(result);
+		query.setAttributeNames(new String[] { "__ATTR1__" });
+		curSet = result.getFeatureSet(query);
+
+		assertEquals(1 + pkAttributesCount, curSet.getDefaultFeatureType()
+				.size());
+
+		assertEquals(orgSet.getSize(), curSet.getSize());
+		curIter = curSet.iterator();
+		while (curIter.hasNext()) {
+			feature = (Feature) curIter.next();
+			assertEquals("HOLA", feature.get("__ATTR1__"));
+		}
+		curIter.dispose();
+		curSet.dispose();
+
+		orgSet.dispose();
+		result.dispose();
+		this.clearCopy(store, newParams);
+		store.dispose();
+
+
+	}
+
+	public void testResourcesLocks() throws Exception {
+
+
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java	(revision 35988)
@@ -0,0 +1,150 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.testmulithread;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DeleteFirstAndLastFeature extends StoreTask {
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public DeleteFirstAndLastFeature(String id, FeatureStore store) {
+		super(id, store);
+	}
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public DeleteFirstAndLastFeature(String id, FeatureStore store, int timeToWait) {
+		super(id, store, timeToWait);
+	}
+
+	public void run() {
+		if (!this.startProcess()) {
+			return;
+		}
+		FeatureSet set;
+		DisposableIterator iter = null;
+		try {
+			set = this.store.getFeatureSet();
+		} catch (DataException e) {
+			finishedError(e);
+			return;
+		}
+
+		try {
+			long size = set.getSize();
+			try {
+
+				iter = set.iterator();
+
+				if (!iter.hasNext()) {
+					finishedNoOk();
+					return;
+				}
+				iter.next();
+
+				try {
+					iter.remove();
+					size--;
+				} catch (DataRuntimeException e) {
+					if (e.getCause() instanceof ConcurrentDataModificationException) {
+						finishedConcurrentError(e);
+						return;
+					}
+					finishedError(e);
+					return;
+
+				} catch (RuntimeException e) {
+					finishedError(e);
+					return;
+				}
+
+
+				if (size != set.getSize()) {
+					finishedNoOk();
+					return;
+				}
+
+				while (iter.hasNext()) {
+					iter.next();
+				}
+			} catch (ConcurrentDataModificationException e) {
+				finishedConcurrentError(e);
+				return;
+			} catch (DataException e) {
+				finishedError(e);
+				return;
+			}
+			try {
+
+				iter.remove();
+				size--;
+			} catch (DataRuntimeException e) {
+				if (e.getCause() instanceof ConcurrentDataModificationException) {
+					finishedConcurrentError(e);
+					return;
+				}
+				finishedError(e);
+				return;
+
+			} catch (RuntimeException e) {
+				finishedError(e);
+				return;
+			}
+			if (size != set.getSize()) {
+				finishedNoOk();
+			} else {
+				finishedOk();
+			}
+		} catch (Throwable e) {
+			finishedError(e);
+			return;
+		} finally {
+			iter.dispose();
+			set.dispose();
+		}
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java	(revision 35988)
@@ -0,0 +1,197 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.testmulithread;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class UpdateFeature extends StoreTask {
+
+	private List updateList = new ArrayList();
+
+	public static final int UPDATE_ALL_FEATURES = -2;
+	public static final int UPDATE_LAST_FEATURE = -1;
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public UpdateFeature(String id, FeatureStore store) {
+		super(id, store);
+	}
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public UpdateFeature(String id, FeatureStore store, int timeToWait) {
+		super(id, store, timeToWait);
+	}
+
+	public void addUpdate(int featureToUpdate, String attName, Object newValue) {
+		UpdateItem item = new UpdateItem();
+		item.featureToUpdate = featureToUpdate;
+		item.attributeName = attName;
+		item.newValue = newValue;
+		item.evaluator = null;
+		this.updateList.add(item);
+	}
+
+	public void addUpdate(int featureToUpdate, String attName,
+			Evaluator evaluator) {
+		UpdateItem item = new UpdateItem();
+		item.featureToUpdate = featureToUpdate;
+		item.attributeName = attName;
+		item.newValue = null;
+		item.evaluator = evaluator;
+		this.updateList.add(item);
+	}
+
+	public Iterator getUpdateList() {
+		return this.updateList.iterator();
+	}
+
+	public UpdateItem getUpdate(int index) {
+		return (UpdateItem) this.updateList.get(index);
+	}
+
+	public int getUpdateListSize() {
+		return this.updateList.size();
+	}
+
+	public EditableFeature applyUpdateList(Feature feature, long index,
+			long lastIndex)
+			throws DataException, EvaluatorException {
+		Iterator iter = this.getUpdateList();
+		EditableFeature editable = feature.getEditable();
+		boolean hasChanges = false;
+		while (iter.hasNext()) {
+			UpdateItem update = (UpdateItem) iter.next();
+			if (index == update.featureToUpdate
+					|| update.featureToUpdate == UPDATE_ALL_FEATURES
+					|| (update.featureToUpdate == UPDATE_LAST_FEATURE && (index == lastIndex))) {
+				if (update.evaluator != null) {
+					editable.set(update.attributeName, update.evaluator
+							.evaluate((EvaluatorData) feature));
+				} else {
+					editable.set(update.attributeName, update.newValue);
+				}
+				hasChanges = true;
+			}
+
+		}
+		if (hasChanges) {
+			return editable;
+		}
+		return null;
+	}
+
+	public void run() {
+		if (!this.startProcess()) {
+			return;
+		}
+		if (this.updateList.size() == 0) {
+			finishedNoOk();
+			return;
+		}
+		FeatureSet set;
+		DisposableIterator iter = null;
+		try {
+			set = this.store.getFeatureSet();
+		} catch (DataException e) {
+			finishedError(e);
+			return;
+		}
+		try {
+			long size = set.getSize();
+			EditableFeature newFeature = this.store.createNewFeature(true);
+
+			long i = 0;
+			try {
+
+				iter = set.iterator();
+				while (iter.hasNext()) {
+					Feature feature = (Feature) iter.next();
+					EditableFeature result = this.applyUpdateList(feature,
+							i, size - 1);
+					if (result != null) {
+						set.update(result);
+					}
+					i++;
+				}
+			} catch (ConcurrentDataModificationException e) {
+				finishedConcurrentError(e);
+				return;
+			} catch (DataException e) {
+				finishedError(e);
+				return;
+			}
+
+			if ((size == set.getSize()) && (set.getSize() == i)) {
+				finishedOk();
+			} else {
+				finishedNoOk();
+			}
+		} catch (Throwable e) {
+			finishedError(e);
+			return;
+		} finally {
+			iter.dispose();
+			set.dispose();
+		}
+	}
+
+
+	public class UpdateItem{
+		public long featureToUpdate = UPDATE_ALL_FEATURES;
+		public String attributeName = null;
+		public Evaluator evaluator = null;
+		public Object newValue = null;
+
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java	(revision 35988)
@@ -0,0 +1,193 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.feature.testmulithread;
+
+import java.util.Random;
+
+import org.gvsig.fmap.dal.feature.FeatureStore;
+
+public abstract class StoreTask extends Thread {
+
+	public static final int STATUS_NONE = -1;
+	public static final int STATUS_WAITING = 0;
+	public static final int STATUS_RUNING = 1;
+
+	public static final int STATUS_FINISHED_OK = 20;
+	public static final int STATUS_FINISHED_NO_OK = 30;
+	public static final int STATUS_FINISHED_ERROR = 40;
+	public static final int STATUS_FINISHED_CONCURRENT_ERROR = 50;
+	public static final int STATUS_ERROR = 60;
+
+	public static final int TIME_TO_WAIT_RANDOM = -1;
+	public static final int TIME_TO_WAIT_NO_WAIT = 0;
+
+	private long startTimer = 0;
+	private long afterWaitTimer = 0;
+	private long finishTimer = 0;
+
+	private int timeToWait = 0;
+	private int finalTimeToWait = 0;
+
+	private int timeToOutOfDate = 5000;
+
+	private int curStatus = STATUS_NONE;
+
+	protected FeatureStore store;
+	protected Throwable exception;
+
+	public StoreTask(String name, FeatureStore store) {
+		super(name);
+		this.store = store;
+		this.timeToWait = TIME_TO_WAIT_NO_WAIT;
+	}
+
+	public StoreTask(String name, FeatureStore store, int timeToWait) {
+		super(name);
+		this.store = store;
+		this.timeToWait = timeToWait;
+	}
+
+	public int getTimeToOutOfDate() {
+		return this.timeToOutOfDate;
+	}
+
+	public void setTimeToOutOfDate(int mlSeconds) {
+		this.timeToOutOfDate = mlSeconds;
+	}
+
+	public long getStartTimer() {
+		return this.startTimer;
+	}
+
+	public long getAfterWaitTimer() {
+		return this.afterWaitTimer;
+	}
+
+	public long getFinishTimer() {
+		return this.finishTimer;
+	}
+
+	public int getCurrentStatus() {
+		return this.curStatus;
+	}
+
+	public boolean isFinishedOk() {
+		return this.curStatus == STATUS_FINISHED_OK;
+	}
+
+	public Throwable getException() {
+		return exception;
+	}
+
+	public boolean isOutOfDate() {
+		if (curStatus < STATUS_RUNING) {
+			return false;
+		}
+		long curTimer = System.currentTimeMillis();
+		if ((curTimer - afterWaitTimer) > (finalTimeToWait + 5000)) {
+			return true;
+		}
+		return false;
+	}
+
+	protected boolean startProcess() {
+		if (this.curStatus != STATUS_NONE) {
+			throw new IllegalStateException();
+		}
+		this.startTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_WAITING;
+		if (timeToWait != TIME_TO_WAIT_NO_WAIT) {
+			if (timeToWait == TIME_TO_WAIT_RANDOM) {
+				Random rnd = new Random();
+				rnd.setSeed(System.currentTimeMillis());
+				finalTimeToWait = rnd.nextInt(200) + 4;
+
+			} else {
+				finalTimeToWait = timeToWait;
+			}
+			try {
+				for (int x = 0; x < 4; x++) {
+					yield();
+					sleep(finalTimeToWait / 4);
+				}
+			} catch (InterruptedException e) {
+				this.curStatus = STATUS_FINISHED_ERROR;
+				this.exception = e;
+				return false;
+			}
+		}
+		this.afterWaitTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_RUNING;
+
+		return true;
+	}
+
+	protected void finishedOk() {
+		if (this.curStatus != STATUS_RUNING) {
+			throw new IllegalStateException();
+		}
+		this.finishTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_FINISHED_OK;
+
+	}
+
+	protected void finishedNoOk() {
+		if (this.curStatus != STATUS_RUNING) {
+			throw new IllegalStateException();
+		}
+		this.finishTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_FINISHED_NO_OK;
+
+	}
+
+	protected void finishedError(Throwable ex) {
+		if (this.curStatus != STATUS_RUNING) {
+			throw new IllegalStateException();
+		}
+		this.finishTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_FINISHED_ERROR;
+		this.exception = ex;
+	}
+
+	protected void finishedConcurrentError(Exception ex) {
+		if (this.curStatus != STATUS_RUNING) {
+			throw new IllegalStateException();
+		}
+		this.finishTimer = System.currentTimeMillis();
+		this.curStatus = STATUS_FINISHED_CONCURRENT_ERROR;
+		this.exception = ex;
+	}
+
+
+	public boolean isFinished() {
+		return curStatus >= STATUS_FINISHED_OK;
+
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java	(revision 35988)
@@ -0,0 +1,124 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.testmulithread;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.BaseTestEditableFeatureStore;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class InsertFeature extends StoreTask {
+
+	private BaseTestEditableFeatureStore test;
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public InsertFeature(String id, FeatureStore store,
+			BaseTestEditableFeatureStore test) {
+		super(id, store);
+		this.test = test;
+	}
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public InsertFeature(String id, FeatureStore store, int timeToWait,
+			BaseTestEditableFeatureStore test) {
+		super(id, store, timeToWait);
+		this.test = test;
+	}
+
+	public void run() {
+		if (!this.startProcess()) {
+			return;
+		}
+		FeatureSet set;
+		DisposableIterator iter = null;
+		try {
+			set = this.store.getFeatureSet();
+		} catch (DataException e) {
+			finishedError(e);
+			return;
+		}
+		try {
+			long size = set.getSize();
+			EditableFeature newFeature = this.store.createNewFeature(true);
+			test.fillPrimaryKeyInserFeature(newFeature);
+
+
+			long i = 0;
+			try {
+
+				iter = set.iterator();
+				set.insert(newFeature);
+				iter.dispose();
+				iter = set.iterator();
+				while (iter.hasNext()) {
+					iter.next();
+					i++;
+				}
+			} catch (ConcurrentDataModificationException e) {
+				finishedConcurrentError(e);
+				return;
+			} catch (DataException e) {
+				finishedError(e);
+				return;
+			}
+
+			if ((size + 1 == set.getSize()) && (set.getSize() == i)) {
+				finishedOk();
+			} else {
+				finishedNoOk();
+			}
+		} catch (Throwable e) {
+			finishedError(e);
+			return;
+		} finally {
+			if (iter != null) {
+				iter.dispose();
+			}
+			if (set != null) {
+				set.dispose();
+			}
+		}
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java	(revision 35988)
@@ -0,0 +1,114 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.testmulithread;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DeleteLastFeature extends StoreTask {
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public DeleteLastFeature(String id, FeatureStore store) {
+		super(id, store);
+	}
+
+	/**
+	 * @param store
+	 * @param timeToWait
+	 */
+	public DeleteLastFeature(String id, FeatureStore store, int timeToWait) {
+		super(id, store, timeToWait);
+	}
+
+	public void run() {
+		if (!this.startProcess()) {
+			return;
+		}
+		FeatureSet set;
+		DisposableIterator iter = null;
+		try {
+			set = this.store.getFeatureSet();
+		} catch (DataException e) {
+			finishedError(e);
+			return;
+		}
+		try {
+
+			try {
+				iter = set.iterator();
+				while (iter.hasNext()) {
+					iter.next();
+				}
+			} catch (ConcurrentDataModificationException e) {
+				finishedConcurrentError(e);
+				return;
+			} catch (DataException e) {
+				finishedError(e);
+				return;
+			}
+			try {
+
+				iter.remove();
+			} catch (DataRuntimeException e) {
+				if (e.getCause() instanceof ConcurrentDataModificationException) {
+					finishedConcurrentError(e);
+					return;
+				}
+				finishedError(e);
+				return;
+
+			} catch (RuntimeException e) {
+				finishedError(e);
+				return;
+			}
+			finishedOk();
+		} catch (Throwable e) {
+			finishedError(e);
+			return;
+		} finally {
+			iter.dispose();
+			set.dispose();
+		}
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java	(revision 35988)
@@ -0,0 +1,137 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}   {{Test indexed iterator retrieval}}
+ */
+package org.gvsig.fmap.dal.feature;
+
+import junit.framework.TestCase;
+
+import org.geotools.feature.AbstractFeatureCollection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+
+/**
+ * Unit tests for the {@link AbstractFeatureCollection} class.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public abstract class FeatureSetTestParent extends TestCase {
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        register();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.dal.feature.AbstractFeatureCollection#iterator(int)}
+     * .
+     *
+     * @throws Exception
+     */
+    public void testIteratorInt() throws Exception {
+        FeatureSet featureSet = createFeatureCollection();
+        testIteratorInt(featureSet);
+        featureSet.dispose();
+    }
+
+    public void testIteratorInt(FeatureSet featureSet) throws DataException {
+
+        if (featureSet.getSize() < 3) {
+            fail("The Collection to create for the test must contain "
+                    + "at least 3 values");
+        }
+
+        try {
+            featureSet.iterator(-5);
+            fail("Iterator index accepted with a value < 0");
+        } catch (Exception ex) {
+            // Good
+        }
+
+        try {
+            featureSet.iterator(featureSet.getSize() + 2);
+            fail("Iterator index accepted with a value > collection size");
+        } catch (Exception ex) {
+            // Good
+        }
+
+        long index = featureSet.getSize() - 3l;
+        DisposableIterator iter = featureSet.iterator(index);
+        int iterations = 0;
+        while (iter.hasNext()) {
+            iter.next();
+            iterations++;
+        }
+        assertEquals("The number of iterations remaining is not correct", 3,
+                iterations);
+        iter.dispose();
+
+        iter = featureSet.iterator(0);
+        iterations = 0;
+        while (iter.hasNext()) {
+            iter.next();
+            iterations++;
+        }
+        assertEquals("The number of iterations is not the "
+                + "total size of the collection", featureSet.getSize(),
+                iterations);
+        iter.dispose();
+    }
+
+    protected FeatureSet createFeatureCollection() throws Exception {
+        FeatureStore store = createFeatureStore();
+        FeatureType ft = store.getDefaultFeatureType();
+        return createFeatureCollection(store, ft);
+    }
+
+    protected FeatureStore createFeatureStore() throws Exception {
+        DataManager manager = DALLocator.getDataManager();
+        return (FeatureStore) manager
+                .createStore(createStoreParameters(manager));
+    }
+
+    protected abstract void register();
+
+    protected abstract DataStoreParameters createStoreParameters(
+            DataManager manager)
+            throws Exception;
+
+    /**
+     * If this method is rewritten, the returned FeatureCollection must have at
+     * least 3 values.
+     */
+    protected abstract FeatureSet createFeatureCollection(
+            FeatureStore store,
+            FeatureType ft) throws DataException;
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java	(revision 35988)
@@ -0,0 +1,218 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultFeatureReferenceSelectionTest extends AbstractLibraryAutoInitTestCase {
+
+    private FeatureReferenceSelection selection;
+    private MockControl refControl1;
+    private FeatureReference ref1;
+    private MockControl refControl2;
+    private FeatureReference ref2;
+    private MockControl storeControl;
+    private FeatureStore store;
+    private MockControl fsetControl;
+    private FeatureSet featureSet;
+    private MockControl helperControl;
+    private FeatureSelectionHelper helper;
+
+    private int total = 10;
+
+    protected void doSetUp() throws Exception {     
+        refControl1 = MockControl.createNiceControl(FeatureReference.class);
+        ref1 = (FeatureReference) refControl1.getMock();
+        refControl2 = MockControl.createNiceControl(FeatureReference.class);
+        ref2 = (FeatureReference) refControl2.getMock();
+
+        storeControl = MockControl.createNiceControl(FeatureStore.class);
+        store = (FeatureStore) storeControl.getMock();
+        storeControl.expectAndReturn(store.getFeatureCount(), total);
+
+        helperControl = MockControl
+                .createNiceControl(FeatureSelectionHelper.class);
+        helper = (FeatureSelectionHelper) helperControl.getMock();
+        helperControl.expectAndDefaultReturn(helper.getFeatureStoreDeltaSize(),
+                0);
+
+        fsetControl = MockControl.createNiceControl(FeatureSet.class);
+        featureSet = (FeatureSet) fsetControl.getMock();
+
+        storeControl.expectAndReturn(store.getFeatureSet(), featureSet);
+        fsetControl.expectAndReturn(featureSet.getSize(), total);
+
+
+
+        storeControl.replay();
+        fsetControl.replay();
+        helperControl.replay();
+
+        selection = new DefaultFeatureReferenceSelection(store, helper);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testSelect() throws Exception {
+        // Add a feature
+        selection.select(ref1);
+        assertTrue(selection.isSelected(ref1));
+        assertFalse(selection.isSelected(ref2));
+
+        selection.select(ref2);
+        assertTrue(selection.isSelected(ref2));
+    }
+
+    public void testSelectAll() throws Exception {
+        selection.selectAll();
+        assertTrue(selection.isSelected(ref1));
+        assertTrue(selection.isSelected(ref2));
+    }
+
+    public void testDeselect() throws Exception {
+        // Remove a feature
+        selection.select(ref1);
+        selection.select(ref2);
+        assertTrue(selection.isSelected(ref2));
+        selection.deselect(ref2);
+        assertFalse(selection.isSelected(ref2));
+        selection.deselect(ref1);
+        assertFalse(selection.isSelected(ref1));
+    }
+
+    public void testDeselectAll() throws Exception {
+        selection.select(ref1);
+        selection.select(ref2);
+        selection.deselectAll();
+        assertFalse(selection.isSelected(ref1));
+        assertFalse(selection.isSelected(ref2));
+    }
+
+    public void testReverse() throws Exception {
+        // Reverse selection
+        selection.select(ref1);
+        selection.reverse();
+        assertFalse(selection.isSelected(ref1));
+        assertTrue(selection.isSelected(ref2));
+    }
+
+    public void testGetSelectedCount() throws Exception {
+        // None selected
+        assertEquals(0, selection.getSelectedCount());
+        selection.select(ref1);
+        selection.select(ref2);
+        // Two selected
+        assertEquals(2, selection.getSelectedCount());
+        // Deselect one, so one left selected
+        selection.deselect(ref2);
+        assertEquals(1, selection.getSelectedCount());
+        // Reverse the selection, so all buy one selected
+        selection.reverse();
+        assertEquals(total - 1, selection.getSelectedCount());
+        // Deselect another one, so all but two selected
+        selection.deselect(ref2);
+        assertEquals(total - 2, selection.getSelectedCount());
+        // Deselect an already deselected one, nothing changes
+        selection.deselect(ref2);
+        assertEquals(total - 2, selection.getSelectedCount());
+    }
+
+    public void testGetSelectedValues() throws DataException {
+        selection.deselectAll();
+        selection.select(ref1);
+        selection.select(ref2);
+
+        boolean ref1Pending = true;
+        boolean ref2Pending = true;
+
+        for (Iterator references = selection.referenceIterator(); references
+                .hasNext();) {
+            FeatureReference reference = (FeatureReference) references.next();
+            if (reference.equals(ref1)) {
+                if (ref1Pending) {
+                    ref1Pending = false;
+                } else {
+                    fail("FeatureReference 1 was already obtained");
+                }
+            } else if (reference.equals(ref2)) {
+                if (ref2Pending) {
+                    ref2Pending = false;
+                } else {
+                    fail("FeatureReference 2 was already obtained");
+                }
+            } else {
+                fail("A reference not selected was obtained: " + reference);
+            }
+        }
+    }
+
+    public void testDispose() {
+        selection.select(ref1);
+        selection.select(ref2);
+        selection.dispose();
+        assertFalse(selection.isSelected(ref1));
+        assertFalse(selection.isSelected(ref2));
+    }
+
+    public void testAccept() throws BaseException {
+        // Create a Mopck Visitor and add expected usage
+        MockControl visitorControl = MockControl
+                .createNiceControl(Visitor.class);
+        Visitor visitor = (Visitor) visitorControl.getMock();
+
+        visitor.visit(ref1);
+        visitor.visit(ref2);
+        visitorControl.replay();
+
+        // Add selected references
+        selection.select(ref1);
+        selection.select(ref2);
+
+        // Use visitor
+        selection.accept(visitor);
+
+        // check correct visitor usage
+        visitorControl.verify();
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java	(revision 35988)
@@ -0,0 +1,207 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import org.easymock.MockControl;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+
+/**
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultFeatureSelectionTest extends AbstractLibraryAutoInitTestCase {
+    private FeatureSelection selection;
+    private MockControl refControl1;
+    private FeatureReference ref1;
+    private MockControl refControl2;
+    private FeatureReference ref2;
+    private MockControl fControl1;
+    private Feature feature1;
+    private MockControl fControl2;
+    private Feature feature2;
+    private MockControl storeControl;
+    private FeatureType featureType;
+    private MockControl fTypeControl;
+    private FeatureStore store;
+    private MockControl fsetControl;
+    private FeatureSet featureSet;
+    private MockControl helperControl;
+    private FeatureSelectionHelper helper;
+
+    private int total = 10;
+
+    protected void doSetUp() throws Exception { 
+        refControl1 = MockControl.createNiceControl(FeatureReference.class);
+        ref1 = (FeatureReference) refControl1.getMock();
+        refControl2 = MockControl.createNiceControl(FeatureReference.class);
+        ref2 = (FeatureReference) refControl2.getMock();
+
+        fControl1 = MockControl.createControl(Feature.class);
+        feature1 = (Feature) fControl1.getMock();
+        fControl2 = MockControl.createControl(Feature.class);
+        feature2 = (Feature) fControl2.getMock();
+
+        fTypeControl = MockControl.createNiceControl(FeatureType.class);
+        featureType = (FeatureType) fTypeControl.getMock();
+
+        fControl1.expectAndDefaultReturn(feature1.getType(), featureType);
+        fControl2.expectAndDefaultReturn(feature2.getType(), featureType);
+
+        storeControl = MockControl.createNiceControl(FeatureStore.class);
+        store = (FeatureStore) storeControl.getMock();
+        storeControl.expectAndReturn(store.getFeatureCount(), total);
+
+        helperControl = MockControl
+                .createNiceControl(FeatureSelectionHelper.class);
+        helper = (FeatureSelectionHelper) helperControl.getMock();
+        helperControl.expectAndDefaultReturn(helper.getFeatureStoreDeltaSize(),
+                0);
+
+        fsetControl = MockControl.createNiceControl(FeatureSet.class);
+        featureSet = (FeatureSet) fsetControl.getMock();
+
+        storeControl.expectAndReturn(store.getFeatureSet(), featureSet);
+        fsetControl.expectAndReturn(featureSet.getSize(), total);
+
+        storeControl.replay();
+        fsetControl.replay();
+        helperControl.replay();
+
+        selection = new DefaultFeatureSelection(store, helper);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection#select(org.gvsig.fmap.dal.feature.Feature)}
+     * .
+     */
+    public void testSelectFeature() {
+        fControl1.expectAndReturn(feature1.getReference(), ref1, 2);
+        fControl2.expectAndReturn(feature2.getReference(), ref2, 3);
+        fControl1.replay();
+        fControl2.replay();
+
+        // Add a feature
+        selection.select(feature1);
+        assertTrue("Selected feature1 is not recognized as selected", selection
+                .isSelected(feature1));
+        assertFalse("Selected feature2 is recognized as selected", selection
+                .isSelected(feature2));
+
+        selection.select(feature2);
+        assertTrue(selection.isSelected(feature2));
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection#deselect(org.gvsig.fmap.dal.feature.Feature)}
+     * .
+     */
+    public void testDeselectFeature() {
+        fControl1.expectAndReturn(feature1.getReference(), ref1, 3);
+        fControl2.expectAndReturn(feature2.getReference(), ref2, 4);
+        fControl1.replay();
+        fControl2.replay();
+
+        // Remove a feature
+        selection.select(feature1);
+        selection.select(feature2);
+        assertTrue(selection.isSelected(feature2));
+        selection.deselect(feature2);
+        assertFalse(selection.isSelected(feature2));
+        selection.deselect(feature1);
+        assertFalse(selection.isSelected(feature1));
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection#getSize()}
+     * .
+     */
+    public void testGetSize() throws Exception {
+        fControl1.expectAndReturn(feature1.getReference(), ref1, 1);
+        fControl2.expectAndReturn(feature2.getReference(), ref2, 4);
+        fControl1.replay();
+        fControl2.replay();
+
+        // None selected
+        assertEquals(0, selection.getSize());
+        selection.select(feature1);
+        selection.select(feature2);
+        // Two selected
+        assertEquals(2, selection.getSize());
+        // Deselect one, so one left selected
+        selection.deselect(feature2);
+        assertEquals(1, selection.getSize());
+        // Reverse the selection, so all buy one selected
+        selection.reverse();
+        assertEquals(total - 1, selection.getSize());
+        // Deselect another one, so all but two selected
+        selection.deselect(feature2);
+        assertEquals(total - 2, selection.getSize());
+        // Deselect an already deselected one, nothing changes
+        selection.deselect(feature2);
+        assertEquals(total - 2, selection.getSize());
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection#isEmpty()}
+     * .
+     */
+    public void testIsEmpty() throws Exception {
+        fControl1.expectAndReturn(feature1.getReference(), ref1, 1);
+        fControl2.expectAndReturn(feature2.getReference(), ref2, 4);
+        fControl1.replay();
+        fControl2.replay();
+
+        // None selected
+        assertTrue(selection.isEmpty());
+
+        // One selected
+        selection.select(feature1);
+        assertFalse(selection.isEmpty());
+
+        // Deselect all
+        selection.deselectAll();
+        assertTrue(selection.isEmpty());
+
+        // Reverse
+        selection.reverse();
+        assertFalse(selection.isEmpty());
+    }
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java	(revision 35988)
@@ -0,0 +1,208 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dispose.DisposeUtils;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class JoinTransform extends AbstractFeatureStoreTransform {
+
+	/**
+	 * Store from which the join transform will get the additional attributes
+	 */
+	private FeatureStore store2;
+
+	/**
+	 * name of the key attr in store1 that will be used to match features in
+	 * store2
+	 */
+	private String keyAttr1;
+
+	/**
+	 * name of the key attr in store2 that will be used to match features in
+	 * store1
+	 */
+	private String keyAttr2;
+
+	/**
+	 * names of the attributes to join from store2 to store1
+	 */
+	private String[] attrs;
+
+	/**
+	 * Attribute names may change after transformation if they are repeated in
+	 * both stores. This map keeps correspondence between store2 original names
+	 * and their transformed counterparts.
+	 */
+	private Map targetNamesMap;
+
+	private FeatureType originalFeatureType;
+
+	/**
+	 * A default constructor
+	 */
+	public JoinTransform() {
+		targetNamesMap = new HashMap();
+	}
+
+	/**
+	 * Initializes all the necessary data for this transform
+	 *
+	 * @param store1
+	 *            store whose default feature type is the target of this
+	 *            transform
+	 *
+	 * @param store2
+	 *            store whose default feature type will provide the new
+	 *            attributes to join
+	 *
+	 * @param keyAttr1
+	 *            key attribute in store1 that matches keyAttr2 in store2
+	 *            (foreign key), used for joining both stores.
+	 *
+	 * @param keyAttr2
+	 *            key attribute in store2 that matches keyAttr1 in store2
+	 *            (foreign key), used for joining both stores.
+	 *
+	 * @param attrs
+	 *            names of the attributes in store2 that will be joined to
+	 *            store1.
+	 */
+	public void initialize(FeatureStore store1, FeatureStore store2,
+			String keyAttr1, String keyAttr2, String[] attrs)
+			throws DataException {
+
+		// Initialize needed data
+		this.setFeatureStore(store1);
+
+		this.store2 = store2;
+		this.keyAttr1 = keyAttr1;
+		this.keyAttr2 = keyAttr2;
+		this.attrs = attrs;
+		this.originalFeatureType = this.getFeatureStore()
+				.getDefaultFeatureType();
+
+		// calculate this transform resulting feature type
+		// by adding all specified attrs from store2 to store1's default
+		// feature type
+		EditableFeatureType type = this.getFeatureStore().getDefaultFeatureType().getEditable();
+
+		for (int i = 0; i < attrs.length; i++) {
+			String name = attrs[i];
+
+			// If an attribute already exists with the same name in store1's
+			// default feature type,
+			// calculate an alternate name and add it to our type
+			int j = 0;
+			while (type.getIndex(name) >= 0) {
+				name = attrs[i] + "_" + ++j;
+			}
+			type.add(name, store2.getDefaultFeatureType()
+					.getAttributeDescriptor(attrs[i]).getType());
+
+			// keep correspondence between original name and transformed name
+			this.targetNamesMap.put(attrs[i], name);
+		}
+
+		// assign calculated feature type as this transform's feature type
+		FeatureType[] types = new FeatureType[] { type.getNotEditableCopy() };
+		setFeatureTypes(Arrays.asList(types), types[0]);
+	}
+
+	/**
+	 *
+	 *
+	 * @param source
+	 *
+	 * @param target
+	 *
+	 * @throws DataException
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+
+		// copy the data from store1 into the resulting feature
+		target.copyFrom(source);
+
+		// ask store2 for the specified attributes, filtering by the key
+		// attribute value
+		// from the source feature
+		Evaluator eval = DALLocator.getDataManager().createExpresion(
+				keyAttr2 + "=" + source.get(keyAttr1));
+		FeatureQuery query = this.getFeatureStore().createFeatureQuery();
+		query.setAttributeNames(attrs);
+		query.setFilter(eval);
+
+		FeatureSet set = null;
+		DisposableIterator it = null;
+
+		try {
+			set = store2.getFeatureSet(query);
+
+			// In this join implementation, we will take only the first matching
+			// feature found in store2
+			it = set.iterator();
+			if (it.hasNext()) {
+				Feature feat = (Feature) it.next();
+
+				// copy all attributes from joined feature to target
+				Iterator it2 = feat.getType().iterator();
+				while (it2.hasNext()) {
+					FeatureAttributeDescriptor attr =
+							(FeatureAttributeDescriptor) it2.next();
+					// find original attribute name
+					String targetName =
+							(String) this.targetNamesMap.get(attr.getName());
+					// copy its value to target feature attribute
+					target.set(targetName, feat.get(attr.getName()));
+				}
+			}
+		} finally {
+			DisposeUtils.dispose(set);
+			DisposeUtils.dispose(it);
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.FeatureStoreTransform#getSourceFeatureTypeFrom
+	 * (org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		return this.originalFeatureType;
+	}
+
+	public boolean isTransformsOriginalValues() {
+		return false;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java	(revision 35988)
@@ -0,0 +1,125 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Arrays;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ *
+ * This transform adds a new attribute of type Geometry to the original store's
+ * default FeatureType. When applying the transform to a single feature this new
+ * attribute is assigned the value of a point whose coordinates proceed from two
+ * numeric attributes from the store, called xname, yname.
+ *
+ */
+class MyTransform extends AbstractFeatureStoreTransform {
+
+	private FeatureType originalType;
+	private String geomName;
+	private String xname;
+	private String yname;
+
+	/**
+	 * Empty default constructor
+	 */
+	public MyTransform() {
+	}
+
+	/**
+	 * Initializes the transform by assigning the source store and the names of
+	 * the necessary attributes.
+	 *
+	 * @param store
+	 *            source store.
+	 *
+	 * @param geomName
+	 *            name of the geometry attribute in the default feature type
+	 *            from the source store.
+	 *
+	 * @param xname
+	 *            name of the attribute containing the X coordinates
+	 *
+	 * @param yname
+	 *            name of the attribute containing the Y coordinates
+	 *
+	 * @throws DataException
+	 */
+	public void initialize(FeatureStore store, String geomName, String xname, String yname) throws DataException {
+
+		// Initialize some data
+		this.setFeatureStore(store);
+		this.geomName = geomName;
+		this.xname = xname;
+		this.yname = yname;
+
+		this.originalType = store.getDefaultFeatureType();
+		// obtain the feature type, add the new attribute and keep a reference to the resulting feature type
+		EditableFeatureType type = store.getDefaultFeatureType().getEditable();
+		type.add(geomName, DataTypes.GEOMETRY);
+		FeatureType[] types = new FeatureType[] { type.getNotEditableCopy() };
+		setFeatureTypes(Arrays.asList(types), types[0]);
+	}
+
+	/**
+	 * Applies this transform to a target editable feature, using data from the
+	 * source feature.
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+
+		// copy source feature data over target feature
+		target.copyFrom(source);
+
+		// calculate and assign new attribute's value
+		GeometryManager geomManager = GeometryLocator.getGeometryManager();
+		Point point;
+		try {
+			point = (Point)geomManager.create(TYPES.POINT, SUBTYPES.GEOM2D);
+			point.setX(source.getDouble(xname));
+			point.setY(source.getDouble(yname));
+			target.setGeometry(this.geomName, point);
+		} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+        	throw new CreateGeometryException(TYPES.POINT, SUBTYPES.GEOM2D, e);
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("geomName", this.geomName);
+		state.set("xname", this.xname);
+		state.set("yname", this.yname);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.FeatureStoreTransform#getSourceFeatureTypeFrom
+	 * (org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		return originalType;
+	}
+
+	public boolean isTransformsOriginalValues() {
+		return false;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java	(revision 35988)
@@ -0,0 +1,2113 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I. S.A.   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.TreeSet;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder.FeatureQueryOrderMember;
+import org.gvsig.fmap.dal.feature.testmulithread.StoreTask;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+import org.gvsig.tools.evaluator.EvaluatorFieldsInfo;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jmvivo
+ *
+ */
+public abstract class BaseTestFeatureStore extends
+		AbstractLibraryAutoInitTestCase {
+
+	private static Logger logger = null;
+
+	protected DataManager dataManager = null;
+	private static Random rnd;
+
+	public Logger getLogger() {
+		if (logger == null) {
+			logger = LoggerFactory.getLogger(this.getClass());
+		}
+		return logger;
+	}
+
+	public abstract boolean usesResources();
+
+	public abstract boolean hasExplorer();
+
+	public FeatureQuery getDefaultQuery(FeatureStore store)
+			throws DataException {
+		FeatureQuery query = store.createFeatureQuery();
+		FeatureAttributeDescriptor[] key = store.getDefaultFeatureType()
+				.getPrimaryKey();
+		for (int i = 0; i < key.length; i++) {
+			query.getOrder().add(key[i].getName(), true);
+		}
+
+		return query;
+	}
+
+
+	public abstract DataStoreParameters getDefaultDataStoreParameters()
+			throws DataException;
+
+
+	protected void doSetUp() throws Exception {
+		dataManager = DALLocator.getDataManager();
+	}
+
+
+	//=================================================
+
+
+	public void printFeature(Feature feature, int maxColSize) {
+		printFeature(feature, true, maxColSize);
+	}
+
+
+	public void printFeature(Feature feature, boolean showColName,int maxColSize) {
+		FeatureType fType = feature.getType();
+		if (showColName){
+			this.printFeatureTypeColNames(feature.getType(), maxColSize);
+		}
+		StringBuffer row = new StringBuffer();
+		Iterator iter = fType.iterator();
+		FeatureAttributeDescriptor attr;
+
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			row.append(truncateOrFillString(feature.get(attr.getName()),
+					maxColSize + 1, ' '));
+		}
+		System.out.println(row.toString());
+	}
+
+	public String truncateOrFillString(Object str, int max, char fillWith) {
+		if (str == null) {
+			return truncateOrFillString("{null}", max, fillWith);
+		}
+		return truncateOrFillString(str.toString(), max, fillWith);
+	}
+
+	public String truncateOrFillString(String str, int max, char fillWith) {
+		if (str.length() > max) {
+			return str.substring(0, max - 1) + " ";
+		} else {
+			StringBuffer strB = new StringBuffer(str);
+			while (strB.length() < max) {
+				strB.append(fillWith);
+			}
+			return strB.toString();
+		}
+
+	}
+
+	public void printFeatureTypeColNames(FeatureType fType, int maxColSize) {
+		Iterator iter = fType.iterator();
+		FeatureAttributeDescriptor attr;
+		StringBuffer colNames = new StringBuffer();
+		StringBuffer typeNames = new StringBuffer();
+		StringBuffer sep = new StringBuffer();
+		if (maxColSize < 1){
+			maxColSize = 15;
+		}
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			colNames.append(truncateOrFillString(attr.getName(), maxColSize + 1, ' '));
+			typeNames.append(truncateOrFillString("(" + attr.getDataTypeName() + ")",
+					maxColSize + 1, ' '));
+			sep.append(truncateOrFillString("", maxColSize, '='));
+			sep.append(' ');
+		}
+
+		System.out.println("");
+		System.out.println("");
+		System.out.println(colNames.toString());
+		System.out.println(typeNames.toString());
+		System.out.println(sep.toString());
+	}
+
+	protected FeatureAttributeDescriptor getFirstAttributeOfType(
+			FeatureType ftype, int dataType) {
+		return getFirstAttributeOfType(ftype, new int[] { dataType });
+	}
+
+	protected FeatureAttributeDescriptor getFirstAttributeOfType(
+			FeatureType ftype, int[] dataTypes) {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = ftype.iterator();
+		int i;
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			for (i = 0; i < dataTypes.length; i++) {
+				if (attr.getType() == dataTypes[i]) {
+					return attr;
+				}
+			}
+		}
+		return null;
+	}
+
+	protected boolean compareDynObject(DynObject obj1, DynObject obj2) {
+		DynClass dynClass = obj1.getDynClass();
+		if (!dynClass.getName().equals(obj2.getDynClass().getName())) {
+			return false;
+		}
+
+		DynField[] fields = dynClass.getDeclaredDynFields();
+		String fieldName;
+		Object v1, v2;
+		for (int i = 0; i < fields.length; i++) {
+			fieldName = fields[i].getName();
+			v1 = obj1.getDynValue(fieldName);
+			v2 = obj2.getDynValue(fieldName);
+			if (v1 == v2) {
+				continue;
+			} else if (v1 != null) {
+				if (!v1.equals(v2)) {
+					return false;
+				}
+			}
+		}
+
+		return true;
+	}
+
+	protected boolean compareStores(FeatureStore store1, FeatureStore store2)
+			throws DataException {
+		if (store1.getParameters().getClass() != store2.getParameters()
+				.getClass()) {
+			return false;
+		}
+		if (!compareDynObject(store1.getParameters(), store2.getParameters())) {
+			return false;
+		}
+
+		if (store1.getEnvelope() != store2.getEnvelope()) {
+			if (store1.getEnvelope() != null) {
+				return store1.getEnvelope().equals(store2.getEnvelope());
+			} else {
+				return false;
+			}
+		}
+
+		if (!store1.getName().equals(store2.getName())) {
+			return false;
+		}
+		if (((FeatureSelection) store1.getSelection()).getSize() != ((FeatureSelection) store2
+				.getSelection()).getSize()) {
+			return false;
+		}
+		DisposableIterator iter1 = ((FeatureSelection) store1.getSelection())
+				.fastIterator();
+		DisposableIterator iter2 = ((FeatureSelection) store2.getSelection())
+				.fastIterator();
+		if (!compareFeatureIterators(iter1, iter2)) {
+			return false;
+		}
+		iter1.dispose();
+		iter2.dispose();
+
+		if (store1.getFeatureTypes().size() != store2.getFeatureTypes().size()) {
+			return false;
+		}
+		Iterator iterTypes1 = store1.getFeatureTypes().iterator();
+		Iterator iterTypes2 = store2.getFeatureTypes().iterator();
+		while (iterTypes1.hasNext()) {
+			if (!compareTypes((FeatureType) iterTypes1.next(),
+					(FeatureType) iterTypes2
+					.next())) {
+				return false;
+			}
+		}
+		if (!compareTypes(store1.getDefaultFeatureType(), store2
+				.getDefaultFeatureType())) {
+			return false;
+		}
+
+		if (store1.getLocks() != null) {
+			if (store1.getLocks().getLocksCount() != store2.getLocks()
+					.getLocksCount()) {
+				return false;
+			}
+			if (!compareFeatureIterators(store1.getLocks().getLocks(), store2
+					.getLocks().getLocks())) {
+				return false;
+			}
+
+		} else if (store2.getLocks() != null) {
+			return false;
+		}
+
+		return true;
+	}
+
+	protected boolean compareFeatureIterators(Iterator iter1, Iterator iter2) {
+		Feature feature;
+		Feature ffeature;
+		while (iter1.hasNext()) {
+			feature = (Feature) iter1.next();
+			ffeature = (Feature) iter2.next();
+			if (!this.compareFeatures(feature, ffeature)) {
+				return false;
+			}
+		}
+
+		if (!iter2.hasNext()) {
+			return true;
+		} else {
+			getLogger().warn("size !=");
+			return false;
+		}
+
+	}
+
+	protected boolean compareFeatureIterators(Iterator iter1, Iterator iter2,
+			String[] attrNames) {
+		Feature feature;
+		Feature ffeature;
+		while (iter1.hasNext()) {
+			feature = (Feature) iter1.next();
+			ffeature = (Feature) iter2.next();
+			if (!this.compareFeatures(feature, ffeature, attrNames)) {
+				return false;
+			}
+		}
+
+		return !iter2.hasNext();
+
+	}
+
+
+
+	protected boolean compareTypes(FeatureType ft1, FeatureType ft2) {
+		if (ft1.size() != ft2.size()) {
+			getLogger().warn("size !=");
+			return false;
+		}
+		if (ft1.getDefaultGeometryAttributeIndex() != ft2
+				.getDefaultGeometryAttributeIndex()) {
+			getLogger().warn(
+					"getDefaultGeometryAttributeIndex "
+							+ ft1.getDefaultGeometryAttributeIndex() +
+					" !="+ ft2.getDefaultGeometryAttributeIndex());
+			return false;
+		}
+		if (ft1.getDefaultGeometryAttributeIndex() > -1) {
+			if (ft1.getDefaultSRS() != null) {
+				if (!ft1.getDefaultSRS().equals(ft2.getDefaultSRS())) {
+					getLogger().warn("getDefaultSRS !=");
+					return false;
+				}
+
+			} else {
+				if (ft2.getDefaultSRS() != null) {
+					getLogger().warn("getDefaultSRS !=");
+					return false;
+				}
+			}
+		}
+
+		if (ft1.getDefaultGeometryAttributeName() != null) {
+			if (!ft1.getDefaultGeometryAttributeName().equals(
+					ft2.getDefaultGeometryAttributeName())) {
+				getLogger().warn("getDefaultGeometryAttributeName !=");
+
+				return false;
+			}
+		} else {
+			if (ft2.getDefaultGeometryAttributeName() != null) {
+				getLogger().warn("getDefaultGeometryAttributeName !=");
+				return false;
+			}
+		}
+
+
+
+		FeatureAttributeDescriptor attr1, attr2;
+		for (int i = 0; i < ft1.size(); i++) {
+			attr1 = ft1.getAttributeDescriptor(i);
+			attr2 = ft2.getAttributeDescriptor(i);
+
+			if (!compareAttributes(attr1, attr2)) {
+				return false;
+			}
+
+		}
+		return true;
+
+	}
+
+	protected boolean compareAttributes(FeatureAttributeDescriptor attr1,
+			FeatureAttributeDescriptor attr2) {
+		if (attr1 == null || attr2 == null) {
+			getLogger().warn("attr1 == null || attr2 == null");
+			return false;
+		}
+		if (!attr1.getName().equals(attr2.getName())) {
+			getLogger().warn(
+					"name '" + attr1.getName() + "' != '" + attr2.getName()
+							+ "'");
+			return false;
+		}
+
+		if (attr1.getDataType() != attr2.getDataType()) {
+			getLogger().warn(
+					attr1.getName() + ":" +
+					"dataType '" + attr1.getDataTypeName() + "'["
+							+ attr1.getDataType() + "] != '"
+							+ attr2.getDataTypeName() + "'["
+							+ attr2.getDataType() + "]");
+			return false;
+		}
+
+		if (attr1.getSize() != attr2.getSize()) {
+			getLogger().warn(
+					attr1.getName() + ":" +
+					"size " + attr1.getSize() + " != " + attr2.getSize());
+			return false;
+		}
+
+		if (attr1.getPrecision() != attr2.getPrecision()) {
+			getLogger().warn(
+					attr1.getName() + ":" +
+					"precision " + attr1.getPrecision() + " != "
+							+ attr1.getPrecision());
+			return false;
+		}
+
+		if (attr1.getGeometryType() != attr2.getGeometryType()) {
+			getLogger().warn(
+					attr1.getName() + ":" +
+					"GeometryType " + attr1.getGeometryType() + " != "
+							+ attr2.getGeometryType());
+			return false;
+		}
+
+		if (attr1.getGeometrySubType() != attr2.getGeometrySubType()) {
+			getLogger().warn(
+					attr1.getName() + ":" +
+					"GeometrySubType " + attr1.getGeometrySubType() + " != "
+							+ attr2.getGeometrySubType());
+
+			return false;
+		}
+
+		if (attr1.getSRS() != null) {
+			if (!attr1.getSRS().equals(attr2.getSRS())) {
+				getLogger().warn(
+						attr1.getName() + ":" +
+						"srs " + attr1.getSRS() + " != " + attr2.getSRS());
+				return false;
+			}
+		} else {
+			if (attr2.getSRS() != null) {
+				getLogger().warn(
+						attr1.getName() + ":" +
+						"srs " + attr1.getSRS() + " != " + attr2.getSRS());
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	protected boolean compareFeatures(Feature f1, Feature f2,
+			String[] attrsNames) {
+		FeatureAttributeDescriptor attr1;
+		FeatureAttributeDescriptor attr2;
+		Object v1, v2;
+		for (int i = 0; i < attrsNames.length; i++) {
+			attr1 = f1.getType().getAttributeDescriptor(attrsNames[i]);
+			attr2 = f2.getType().getAttributeDescriptor(attrsNames[i]);
+			if (attr1 != attr2) {
+				if (!compareAttributes(attr1, attr1)) {
+					return false;
+				}
+			}
+			v1 = f1.get(attr1.getName());
+			v2 = f2.get(attr2.getName());
+			if (!compareFeatureValue(v1, v2, attr1)) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	protected boolean compareFeatures(Feature f1, Feature f2) {
+		if (!compareTypes(f1.getType(), f2.getType())) {
+			return false;
+		}
+		Iterator iter = f1.getType().iterator();
+		FeatureAttributeDescriptor attr;
+		Object v1, v2;
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			v1 = f1.get(attr.getName());
+			v2 = f2.get(attr.getName());
+			if (!compareFeatureValue(v1, v2, attr)) {
+				return false;
+			}
+		}
+
+		return true;
+
+	}
+
+	protected boolean compareFeatureValue(Object v1, Object v2,
+			FeatureAttributeDescriptor attr) {
+
+		if ((v1 == null || v2 == null) &&  !attr.allowNull() ){
+			getLogger().warn("null and !allowNull:"
+							+ attr.getName());
+			return false;
+		}
+
+		if (v1 == v2) {
+			return true;
+		} else if (v1 == null) {
+			getLogger().warn(" v1 == null and v2 != null:"
+							+ attr.getName());
+			return false;
+		} else if (v2 == null) {
+			getLogger().warn("v2 == null and v1 != null:"
+							+ attr.getName());
+			return false;
+
+		}
+		switch (attr.getType()) {
+		case DataTypes.GEOMETRY:
+			Geometry geom1 = (Geometry) v1;
+			Geometry geom2 = (Geometry) v2;
+			if (!geom1.equals(geom2)) {
+				getLogger().warn(" v1 != v2 (Geom):" + attr.getName());
+				return false;
+
+			}
+			return true;
+		case DataTypes.DOUBLE:
+			double diff = ((Double) v1).doubleValue()
+					- ((Double) v1).doubleValue();
+			if (!(Math.abs(diff) < 0.000001)) {
+				getLogger().warn(" v1 != v2 (Dobule):" + attr.getName());
+				return false;
+
+			}
+			return true;
+
+		case DataTypes.OBJECT:
+			if (!v1.equals(v2)) {
+				getLogger().warn(
+						" v1 != v2 (object):" + attr.getName() + " [ignored]");
+				return false;
+			}
+			return true;
+
+		default:
+			if (!v1.equals(v2)) {
+				getLogger()
+						.warn(
+								" v1 != v2:" + attr.getName() + ": " + v1
+										+ " != " + v2);
+				return false;
+			}
+		}
+		return true;
+
+	}
+
+
+	//------------------------------------------------
+
+	public void testSimpleIteration(FeatureStore store) {
+		this.testSimpleIteration(store, null);
+	}
+
+	protected String[] getRandomAttibuteList(FeatureType fType) {
+		String[] attrNames = new String[fType.size()];
+		Iterator iter = fType.iterator();
+		int i = 0;
+		while (iter.hasNext()) {
+			attrNames[i] = ((FeatureAttributeDescriptor) iter.next()).getName();
+			i++;
+		}
+		return this.getRandomAttibuteList(attrNames);
+	}
+
+	protected Random getRandom(){
+		if (rnd == null){
+			rnd = new Random();
+			rnd.setSeed(System.currentTimeMillis());
+		}
+		return rnd;
+	}
+
+	protected String[] getRandomAttibuteList(String[] attrNames) {
+		int nAttributes = getRandom().nextInt(
+				attrNames.length + (attrNames.length / 2)) + 1;
+		TreeSet set = new TreeSet();
+		for (int i = 0; i < nAttributes; i++) {
+			set.add(attrNames[getRandom().nextInt(attrNames.length)]);
+		}
+		return (String[]) set.toArray(new String[0]);
+	}
+
+	public void testIterationFastAndStandart(FeatureStore store)
+			throws Exception {
+		this.testIterationFastAndStandart(store, null);
+
+		FeatureQuery query = this.getDefaultQuery(store);
+		// Random Attribute list
+		query.setAttributeNames(getRandomAttibuteList(store
+				.getDefaultFeatureType()));
+		this.testIterationFastAndStandart(store, query);
+
+		// Sorted
+		FeatureAttributeDescriptor attr = getFirstAttributeOfType(store
+				.getDefaultFeatureType(), new int[] { DataTypes.INT,
+				DataTypes.LONG, DataTypes.STRING, DataTypes.DOUBLE, DataTypes.FLOAT });
+		{
+			// asure that attr is in query attributes
+			boolean attrFound = false;
+			String[] curAttrs = query.getAttributeNames();
+			for (int i = 0; i < curAttrs.length; i++) {
+				if (curAttrs[i].equals(attr.getName())) {
+					attrFound = true;
+					break;
+
+				}
+			}
+			if (!attrFound) {
+				String[] newAttrs = new String[curAttrs.length + 1];
+				for (int i = 0; i < curAttrs.length; i++) {
+					newAttrs[i] = curAttrs[i];
+				}
+				newAttrs[curAttrs.length] = attr.getName();
+				query.setAttributeNames(newAttrs);
+			}
+		}
+
+
+		query.getOrder().add(attr.getName(), true);
+		this.testIterationFastAndStandart(store, query);
+
+		// Filter
+		query = this.getDefaultQuery(store);
+
+		query.setFilter(new Evaluator(){
+		    private EvaluatorFieldsInfo evaluatorFieldsInfo = new EvaluatorFieldsInfo();
+		    
+			public Object evaluate(EvaluatorData data)
+					throws EvaluatorException {
+				// TODO Auto-generated method stub
+				return Boolean.TRUE;
+			}
+
+			public String getSQL() {
+				return "true = true";
+			}
+
+			public String getDescription() {
+				// TODO Auto-generated method stub
+				return null;
+			}
+
+			public String getName() {
+				return "AlwaysTrue";
+			}
+
+			public EvaluatorFieldsInfo getFieldsInfo() {				
+				return evaluatorFieldsInfo;
+			}
+
+		});
+		this.testIterationFastAndStandart(store, query);
+
+		// Filter + Sorted
+		query.getOrder().add(attr.getName(), true);
+		this.testIterationFastAndStandart(store, query);
+	}
+
+	public void testSimpleIteration(FeatureStore store, FeatureQuery query) {
+		FeatureSet set;
+		try {
+
+			if (query == null) {
+				query = this.getDefaultQuery(store);
+			}
+			set = store.getFeatureSet(query);
+			FeatureType type = set.getDefaultFeatureType();
+
+			DisposableIterator it = set.iterator();
+			Feature feature;
+			printFeatureTypeColNames(type, 15);
+			while (it.hasNext()) {
+
+				feature = (Feature) it.next();
+				printFeature(feature, false, 15);
+			}
+
+			it.dispose();
+			set.dispose();
+
+		} catch (DataException e3) {
+			e3.printStackTrace();
+			fail();
+			return;
+		}
+
+	}
+
+	public void testIterationFastAndStandart(FeatureStore store,
+			FeatureQuery query) {
+		FeatureSet set;
+		try {
+
+			if (query == null) {
+				query = this.getDefaultQuery(store);
+			}
+			set = store.getFeatureSet(query);
+
+			DisposableIterator it = set.iterator();
+			DisposableIterator fit = set.fastIterator();
+
+			assertTrue(this.compareFeatureIterators(it, fit));
+
+			it.dispose();
+			fit.dispose();
+			set.dispose();
+
+		} catch (DataException e3) {
+			e3.printStackTrace();
+			fail();
+			return;
+		}
+
+	}
+
+	public void testSimpleIteration(DataStoreParameters parameters)
+			throws Exception {
+		FeatureStore store = null;
+		store = (FeatureStore) dataManager.openStore(parameters
+				.getDataStoreName(), parameters);
+
+		this.testSimpleIteration(store);
+
+		store.dispose();
+
+	}
+
+	public void testIterationFastAndStandart(DataStoreParameters parameters)
+			throws Exception {
+		FeatureStore store = null;
+		store = (FeatureStore) dataManager.openStore(parameters
+				.getDataStoreName(), parameters);
+
+		this.testIterationFastAndStandart(store);
+
+		store.dispose();
+
+	}
+
+	/**
+	 *
+	 * @param count
+	 *            if (< 0) list.size() >= 1 else list.size() == count
+	 * @throws Exception
+	 */
+	public void testExplorerList(int count) throws Exception {
+		FeatureStore store = null;
+		DataStoreParameters params = getDefaultDataStoreParameters();
+		store = (FeatureStore) dataManager.openStore(params.getDataStoreName(),
+				params);
+
+		DataServerExplorer explorer;
+		explorer = store.getExplorer();
+
+		if (count < 0) {
+			assertTrue(explorer.list().size() >= 1);
+		} else {
+			assertTrue(explorer.list().size() == count);
+		}
+
+		store.dispose();
+
+		explorer.dispose();
+	}
+
+	//=================================================
+	//=================================================
+
+
+
+
+	public void testIterationFastAndStandart() throws Exception {
+		this.testIterationFastAndStandart(this.getDefaultDataStoreParameters());
+	}
+
+	public void testSimpleIteration() throws Exception {
+		this.testSimpleIteration(this.getDefaultDataStoreParameters());
+	}
+
+	public void testInitializeStore() throws Exception {
+		DataStoreParameters params = getDefaultDataStoreParameters();
+		FeatureStore store = (FeatureStore) dataManager.openStore(params
+				.getDataStoreName(), params);
+
+		assertNotNull(store.getMetadataID());
+		assertNotNull(store.getName());
+		assertEquals(store.getEnvelope(), store.getDynValue("Envelope"));
+		assertTrue("Feature count not > 0", store.getFeatureCount() > 0);
+		if (store.isLocksSupported()) {
+			assertNotNull(store.getLocks());
+		} else {
+			assertNull(store.getLocks());
+		}
+		store.dispose();
+	}
+
+
+	public void testExplorer() throws Exception {
+		if (!this.hasExplorer()) {
+			return;
+		}
+		this.testExplorerList(-1);
+
+	}
+
+	public void testSelection() throws Exception {
+		DataStoreParameters parameters = this.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(parameters
+				.getDataStoreName(), parameters);
+		FeatureSet set = store.getFeatureSet();
+
+		assertTrue(store.getFeatureSelection().isEmpty());
+		store.setSelection(set);
+		assertFalse(store.getFeatureSelection().isEmpty());
+
+		assertEquals(set.getSize(), store.getFeatureSelection().getSize());
+
+		DisposableIterator iter = set.iterator();
+		while (iter.hasNext()) {
+			assertTrue(store.getFeatureSelection().isSelected(
+					(Feature) iter.next()));
+		}
+		iter.dispose();
+
+		store.getFeatureSelection().reverse();
+		assertTrue(store.getFeatureSelection().isEmpty());
+		assertEquals(0, store.getFeatureSelection().getSize());
+		iter = set.iterator();
+		while (iter.hasNext()) {
+			assertFalse(store.getFeatureSelection().isSelected(
+					(Feature) iter.next()));
+		}
+		iter.dispose();
+
+		store.getFeatureSelection().reverse();
+		assertEquals(set.getSize(), store.getFeatureSelection().getSize());
+		assertFalse(store.getFeatureSelection().isEmpty());
+
+		set.dispose();
+
+	}
+
+	public void testCustomFTypeSet() throws Exception {
+		DataStoreParameters dbfParameters = this
+				.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(dbfParameters
+				.getDataStoreName(), dbfParameters);
+
+		testCustomFTypeSet(store);
+
+		store.dispose();
+	}
+
+	public void testCustomFTypeSet(FeatureStore store) throws Exception{
+
+		FeatureSet set, set1;
+		FeatureQuery query;
+		DisposableIterator iter, iter1;
+		Iterator attrIter;
+		FeatureAttributeDescriptor attr;
+
+		set = store.getFeatureSet(this.getDefaultQuery(store));
+		attrIter = store.getDefaultFeatureType().iterator();
+
+		String[] names;
+		while (attrIter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) attrIter.next();
+			int fieldIndex = attr.getIndex();
+
+			query = this.getDefaultQuery(store);
+			String fieldName = store.getDefaultFeatureType()
+			.getAttributeDescriptor(fieldIndex).getName();
+
+			names = new String[] { fieldName };
+			query.setAttributeNames(names);
+			set1 = store.getFeatureSet(query);
+
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+
+			assertTrue(compareFeatureIterators(iter, iter1, names));
+
+			iter.dispose();
+			iter1.dispose();
+			set1.dispose();
+		}
+
+		int ntimes = getRandom().nextInt(10) + 5;
+		FeatureType type = store.getDefaultFeatureType();
+		query = this.getDefaultQuery(store);
+		for (int i = 0; i < ntimes; i++) {
+			names = getRandomAttibuteList(type);
+
+			query.setAttributeNames(names);
+			set1 = store.getFeatureSet(query);
+
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+
+			assertTrue(compareFeatureIterators(iter, iter1, names));
+
+			iter.dispose();
+			iter1.dispose();
+
+			iter1 = set1.fastIterator();
+			assertTrue(checksAttributesPositions(iter1, names));
+			iter1.dispose();
+
+			iter1 = set1.iterator();
+			assertTrue(checksAttributesPositions(iter1, names));
+			iter1.dispose();
+
+			set1.dispose();
+
+
+		}
+
+
+
+		set.dispose();
+
+	}
+
+	protected boolean checksAttributesPositions(DisposableIterator iter,
+			String[] names) {
+		Feature feature;
+		FeatureType type;
+		FeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			feature = (Feature) iter.next();
+			type = feature.getType();
+			for (int i = 0; i < names.length; i++) {
+				attr = type.getAttributeDescriptor(i);
+				if (!names[i].equals(attr.getName())) {
+					getLogger().error(
+							"Error in attribute {} (expected: '{}' have: '{}'",
+							new Object[] { new Integer(i), names[i],
+									attr.getName() });
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	 public void testPersistence() throws Exception {
+		if (ToolsLocator.getPersistenceManager() == null) {
+			fail("Default Persistence Manager not register");
+		}
+		DataStoreParameters params = this.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(params
+				.getDataStoreName(), params);
+
+		testSimpleIteration(store);
+
+		PersistentState state = ToolsLocator.getPersistenceManager().getState(
+				store);
+
+		FeatureStore store2 = (FeatureStore) ToolsLocator
+				.getPersistenceManager().create(state);
+
+		testSimpleIteration(store2);
+
+		assertTrue(compareStores(store, store2));
+
+		store.dispose();
+		store2.dispose();
+
+	}
+
+
+	public void testSort() throws Exception {
+		DataStoreParameters dbfParameters = this
+				.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(dbfParameters
+				.getDataStoreName(), dbfParameters);
+
+		testSort(store);
+
+		store.dispose();
+
+	}
+
+	public void testSort(FeatureStore store) throws Exception{
+		FeatureSet set1;
+		FeatureQuery query;
+		DisposableIterator iter1;
+		Iterator attrIter;
+		FeatureAttributeDescriptor attr;
+
+		attrIter = store.getDefaultFeatureType().iterator();
+
+		String[] names;
+		while (attrIter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) attrIter.next();
+
+			if (attr.getType() == DataTypes.GEOMETRY) {
+				continue;
+			}
+			query = this.getDefaultQuery(store);
+			String fieldName = attr.getName();
+
+
+
+			names = new String[] { fieldName };
+			query.setAttributeNames(names);
+			query.getOrder().add(fieldName, getRandom().nextBoolean());
+
+			set1 = store.getFeatureSet(query);
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+
+			assertTrue(checkSort(iter1, query));
+
+			iter1.dispose();
+			set1.dispose();
+		}
+
+		int ntimes = getRandom().nextInt(10) + 5;
+		FeatureType type = store.getDefaultFeatureType();
+		query = this.getDefaultQuery(store);
+		for (int i = 0; i < ntimes; i++) {
+			names = getRandomAttibuteList(type);
+
+			int nShortFields = getRandom().nextInt(names.length) + 1;
+			query.getOrder().clear();
+			for (int j = 0; j < nShortFields; j++) {
+				attr = store.getDefaultFeatureType().getAttributeDescriptor(names[getRandom().nextInt(names.length)]);
+				if (attr.getType() == DataTypes.INT
+						|| attr.getType() == DataTypes.LONG
+						|| attr.getType() == DataTypes.DOUBLE
+						|| attr.getType() == DataTypes.STRING
+						|| attr.getType() == DataTypes.DATE
+						|| attr.getType() == DataTypes.BOOLEAN
+						|| attr.getType() == DataTypes.BYTE
+						|| attr.getType() == DataTypes.FLOAT) {
+
+					query.getOrder().add(attr.getName(),
+							getRandom().nextBoolean());
+				}
+			}
+
+			query.setAttributeNames(names);
+			set1 = store.getFeatureSet(query);
+
+			// if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+				// } else {
+				// iter1 = set1.iterator();
+				// }
+
+				assertTrue(checkSort(iter1, query));
+
+				iter1.dispose();
+				set1.dispose();
+
+		}
+
+	}
+
+
+	public boolean checkSort(Iterator iter, FeatureQuery query) {
+
+		FeatureQueryOrderMember order;
+		Feature prevFeature = null;
+		Feature currFeature = null;
+		boolean isFirst = true;
+		Comparable v1, v2;
+		Object o1, o2;
+		int v;
+		FeatureQueryOrder queryOrder = query.getOrder();
+
+		Iterator orderIter;
+
+		//for debug only
+		/*
+		System.out.println("\nCheck order:");
+		Iterator orderIter = queryOrder.iterator();
+		while (orderIter.hasNext()) {
+			order = (FeatureQueryOrderMember) orderIter.next();
+			System.out.print(order.getAttributeName() + " ");
+			if (order.getAscending()) {
+				System.out.print("Asc, ");
+			} else {
+				System.out.print("Desc, ");
+			}
+		}
+		System.out.println(";");
+		*/
+
+		while (iter.hasNext()) {
+			currFeature = (Feature) iter.next();
+			if (isFirst) {
+				prevFeature = currFeature.getCopy();
+				// printFeature(prevFeature, true, 15);
+				isFirst = false;
+				continue;
+			}
+			// printFeature(currFeature, false, 15);
+			orderIter = queryOrder.iterator();
+			while (orderIter.hasNext()) {
+				order = (FeatureQueryOrderMember) orderIter.next();
+				if (order.hasEvaluator()) {
+					try {
+						o1 = order.getEvaluator().evaluate(
+								(EvaluatorData) prevFeature);
+						o2 = order.getEvaluator().evaluate(
+								(EvaluatorData) currFeature);
+					} catch (EvaluatorException e) {
+						throw new DataEvaluatorRuntimeException(e);
+					}
+				} else {
+
+					o1 = prevFeature.get(order.getAttributeName());
+					o2 = currFeature.get(order.getAttributeName());
+				}
+				if (o1 instanceof Comparable && o2 instanceof Comparable) {
+					v1 = (Comparable) o1;
+					v2 = (Comparable) o2;
+				} else {
+					// uncomparable objets
+					break;
+				}
+				if (v1 == null) {
+					if (v2 == null) {
+						break;
+					} else {
+						v = 1;
+					}
+				} else {
+					v = v1.compareTo(v2);
+				}
+				if (v != 0) {
+					if (!order.getAscending()) {
+						v = -v;
+					}
+				}
+				if (v < 0) {
+					break;
+				} else if (v > 0) {
+					// Checks for ignore case short
+					if (v1 instanceof String && v2 instanceof String) {
+						v1 = ((String)v1).toLowerCase();
+						v2 = ((String)v2).toLowerCase();
+						v = v1.compareTo(v2);
+						if (v != 0) {
+							if (!order.getAscending()) {
+								v = -v;
+							}
+						}
+						if (v < 0) {
+							getLogger()
+									.warn("Short compartor String ok with ignore case");
+							break;
+						} else if (v > 0) {
+							return false;
+						}
+					} else {
+						return false;
+					}
+				}
+			}
+			prevFeature = currFeature.getCopy();
+		}
+
+		return true;
+	}
+
+	protected void fullStoreIteratorTest(FeatureStore store) throws Exception{
+		testIterationFastAndStandart(store);
+		testCustomFTypeSet(store);
+		testSort(store);
+	}
+
+
+	public void testTransformsData() throws Exception {
+		DataStoreParameters dbfParameters = this
+				.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(dbfParameters
+				.getDataStoreName(), dbfParameters);
+
+		FeatureStore store1 = (FeatureStore) dataManager.openStore(
+				dbfParameters.getDataStoreName(), dbfParameters);
+
+		FeatureStoreTransform transform = new StringsToLowerTransform();
+		transform.setFeatureStore(store);
+
+		store.getTransforms().add(transform);
+
+		FeatureSet set, set1;
+		DisposableIterator iter, iter1;
+		Iterator iterAttr;
+		FeatureAttributeDescriptor attr;
+		Feature feature, feature1;
+		int i, ntimes;
+		Object v1, v2;
+
+
+		fullStoreIteratorTest(store);
+
+		set = store.getFeatureSet();
+		set1 = store1.getFeatureSet();
+		ntimes = getRandom().nextInt(3) + 1;
+		for (i = 0; i < ntimes; i++) {
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+			while (iter.hasNext()) {
+				feature = (Feature) iter.next();
+				feature1 = (Feature) iter1.next();
+
+				iterAttr = set.getDefaultFeatureType().iterator();
+				while (iterAttr.hasNext()) {
+					attr = (FeatureAttributeDescriptor) iterAttr.next();
+					v1 = feature.get(attr.getIndex());
+					v2 = feature1.get(attr.getIndex());
+					if (attr.getType() == DataTypes.STRING) {
+						if (v2 != null) {
+							v2 = ((String) v2).toLowerCase();
+						}
+
+					}
+					if (!v1.equals(v2)){
+					    v1 = feature.get(attr.getIndex());
+					    v2 = feature1.get(attr.getIndex());
+					    int type1 = attr.getType();
+					    int type2 = feature1.getType().getAttributeDescriptor(22).getType();
+					    
+					    System.out.println(v1.toString() + " - " + v2.toString());
+					}
+					assertTrue(compareFeatureValue(v1, v2, attr));
+				}
+			}
+			assertFalse(iter1.hasNext());
+			iter.dispose();
+			iter1.dispose();
+		}
+
+
+		set.dispose();
+		set1.dispose();
+
+
+		transform = new StringsToUpperTransform();
+		transform.setFeatureStore(store);
+
+		store.getTransforms().add(transform);
+
+		fullStoreIteratorTest(store);
+
+		set = store.getFeatureSet();
+		set1 = store1.getFeatureSet();
+		ntimes = getRandom().nextInt(3) + 1;
+		for (i = 0; i < ntimes; i++) {
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+			while (iter.hasNext()) {
+				feature = (Feature) iter.next();
+				feature1 = (Feature) iter1.next();
+
+				iterAttr = set.getDefaultFeatureType().iterator();
+				while (iterAttr.hasNext()) {
+					attr = (FeatureAttributeDescriptor) iterAttr.next();
+					v1 = feature.get(attr.getIndex());
+					v2 = feature1.get(attr.getIndex());
+					if (attr.getType() == DataTypes.STRING) {
+						if (v2 != null) {
+							v2 = ((String) v2).toUpperCase();
+						}
+
+					}
+					compareFeatureValue(v1, v2, attr);
+				}
+			}
+			assertFalse(iter1.hasNext());
+			iter.dispose();
+			iter1.dispose();
+		}
+		set.dispose();
+		set1.dispose();
+
+
+		transform = new AddPrefixAttributeName("_");
+		transform.setFeatureStore(store);
+
+		store.getTransforms().add(transform);
+
+		fullStoreIteratorTest(store);
+
+		set = store.getFeatureSet();
+		set1 = store1.getFeatureSet();
+		ntimes = getRandom().nextInt(3) + 1;
+		for (i = 0; i < ntimes; i++) {
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+			while (iter.hasNext()) {
+				feature = (Feature) iter.next();
+				feature1 = (Feature) iter1.next();
+
+				iterAttr = set1.getDefaultFeatureType().iterator();
+				while (iterAttr.hasNext()) {
+					attr = (FeatureAttributeDescriptor) iterAttr.next();
+					v1 = feature.get("_" + attr.getName());
+					v2 = feature1.get(attr.getIndex());
+					if (attr.getType() == DataTypes.STRING) {
+						if (v2 != null) {
+							v2 = ((String) v2).toUpperCase();
+						}
+
+					}
+					compareFeatureValue(v1, v2, attr);
+				}
+			}
+			assertFalse(iter1.hasNext());
+			iter.dispose();
+			iter1.dispose();
+		}
+		set.dispose();
+		set1.dispose();
+
+		transform = new AddAttribute("__new__", DataTypes.STRING, "$$OK$$", 10);
+		transform.setFeatureStore(store);
+
+		store.getTransforms().add(transform);
+
+		fullStoreIteratorTest(store);
+
+		set = store.getFeatureSet();
+		set1 = store1.getFeatureSet();
+		ntimes = getRandom().nextInt(3) + 1;
+		for (i = 0; i < ntimes; i++) {
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+			while (iter.hasNext()) {
+				feature = (Feature) iter.next();
+				feature1 = (Feature) iter1.next();
+
+				iterAttr = set1.getDefaultFeatureType().iterator();
+				while (iterAttr.hasNext()) {
+					attr = (FeatureAttributeDescriptor) iterAttr.next();
+					v1 = feature.get("_" + attr.getName());
+					v2 = feature1.get(attr.getIndex());
+					if (attr.getType() == DataTypes.STRING) {
+						if (v2 != null) {
+							v2 = ((String) v2).toUpperCase();
+						}
+
+					}
+					compareFeatureValue(v1, v2, attr);
+				}
+				compareFeatureValue(feature.get("__new__"), "$$OK$$", set1
+						.getDefaultFeatureType().getAttributeDescriptor(
+								"__new__"));
+			}
+			assertFalse(iter1.hasNext());
+			iter.dispose();
+			iter1.dispose();
+		}
+		set.dispose();
+		set1.dispose();
+
+
+		transform = new RemoveAttribute("__new__");
+		transform.setFeatureStore(store);
+
+		store.getTransforms().add(transform);
+
+		fullStoreIteratorTest(store);
+
+		set = store.getFeatureSet();
+		set1 = store1.getFeatureSet();
+		ntimes = getRandom().nextInt(3) + 1;
+		for (i = 0; i < ntimes; i++) {
+			if (getRandom().nextBoolean()) {
+				iter = set.fastIterator();
+			} else {
+				iter = set.iterator();
+			}
+			if (getRandom().nextBoolean()) {
+				iter1 = set1.fastIterator();
+			} else {
+				iter1 = set1.iterator();
+			}
+			while (iter.hasNext()) {
+				feature = (Feature) iter.next();
+				feature1 = (Feature) iter1.next();
+
+				iterAttr = set1.getDefaultFeatureType().iterator();
+				while (iterAttr.hasNext()) {
+					attr = (FeatureAttributeDescriptor) iterAttr.next();
+					v1 = feature.get("_" + attr.getName());
+					v2 = feature1.get(attr.getIndex());
+					if (attr.getType() == DataTypes.STRING) {
+						if (v2 != null) {
+							v2 = ((String) v2).toUpperCase();
+						}
+
+					}
+					compareFeatureValue(v1, v2, attr);
+				}
+				assertNull(feature.getType().getAttributeDescriptor("__new__"));
+			}
+			assertFalse(iter1.hasNext());
+			iter.dispose();
+			iter1.dispose();
+		}
+		set.dispose();
+		set1.dispose();
+
+		store.getTransforms().clear();
+
+		compareStores(store, store1);
+
+
+		store.dispose();
+		store1.dispose();
+	}
+
+	abstract class myTransform implements FeatureStoreTransform {
+		protected FeatureStore store;
+		protected FeatureType orgDefaultFType;
+		protected List orgFTypes;
+
+		public void applyTransform(Feature source, EditableFeature target)
+				throws DataException {
+
+			Iterator iter = target.getType().iterator();
+			FeatureAttributeDescriptor attr;
+			while (iter.hasNext()) {
+				attr = (FeatureAttributeDescriptor) iter.next();
+				this.setValue(source, target, attr);
+			}
+
+		}
+
+		protected void setValue(Feature source, EditableFeature target,
+				FeatureAttributeDescriptor attrTarget) throws DataException {
+			target.set(attrTarget.getIndex(), source.get(attrTarget.getName()));
+		}
+
+		public void saveToState(PersistentState state)
+		throws PersistenceException {
+			// TODO Auto-generated method stub
+
+		}
+
+		public void loadFromState(PersistentState state) throws PersistenceException {
+			// TODO Auto-generated method stub
+
+		}
+
+		public FeatureType getDefaultFeatureType() throws DataException {
+			return orgDefaultFType;
+		}
+
+		public FeatureStore getFeatureStore() {
+			return store;
+		}
+
+		public List getFeatureTypes() throws DataException {
+			return orgFTypes;
+		}
+
+		public void setFeatureStore(FeatureStore featureStore) {
+			this.store = featureStore;
+			try {
+				this.orgDefaultFType = this.store.getDefaultFeatureType();
+				this.orgFTypes = this.store.getFeatureTypes();
+
+			} catch (DataException e) {
+				throw new RuntimeException(e);
+			}
+
+		}
+
+		public PersistentState getState() throws PersistenceException {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureType getSourceFeatureTypeFrom(
+				FeatureType targetFeatureType) {
+
+			return targetFeatureType;
+		}
+		
+        public String getName() {
+            System.out
+                .println("\nmyFeatureStore.getname(): " + store.getName());
+            return store.getName();
+        }
+
+        public String getDescription() {
+            System.out.println("\nmyFeatureStore.getDescription(getfullname): "
+                + store.getFullName());
+            return store.getFullName();
+        }
+
+	}
+
+	abstract class TransformTypeTransform extends myTransform {
+
+		private FeatureType myDefaultFeatureType = null;
+		private List myFeatureTypes = null;
+
+		public FeatureType getDefaultFeatureType() throws DataException {
+			if (this.myDefaultFeatureType == null) {
+				this.myDefaultFeatureType = this.transformType(orgDefaultFType);
+			}
+
+			return this.myDefaultFeatureType;
+		}
+
+		protected abstract FeatureType transformType(FeatureType type);
+
+		protected abstract FeatureType restoreType(FeatureType type);
+
+
+		public List getFeatureTypes() throws DataException {
+			if (this.myFeatureTypes == null) {
+				ArrayList list = new ArrayList();
+				Iterator iter = orgFTypes.iterator();
+				while (iter.hasNext()) {
+					FeatureType type = (FeatureType) iter.next();
+					if (type.getId().equals(
+							this.getDefaultFeatureType().getId())) {
+						list.add(this.getDefaultFeatureType());
+					} else {
+						list.add(this.transformType(type));
+					}
+				}
+				this.myFeatureTypes = Collections.unmodifiableList(list);
+			}
+			return this.myFeatureTypes;
+		}
+
+		public boolean isTransformsOriginalValues() {
+			return false;
+		}
+
+		public FeatureType getSourceFeatureTypeFrom(
+				FeatureType targetFeatureType) {
+			FeatureType org = null;
+			FeatureType cur = null;
+			Iterator iter = null;
+			try {
+				iter = this.getFeatureTypes().iterator();
+			} catch (DataException e) {
+				new RuntimeException(e);
+			}
+			while (iter.hasNext()) {
+				cur = (FeatureType) iter.next();
+				if (cur.getId().equals(targetFeatureType.getId())) {
+					org = cur;
+					break;
+				}
+			}
+			if (org == null) {
+				throw new RuntimeException();
+			}
+
+			return this.restoreType(org);
+		}
+
+	}
+
+	abstract class TransformAttributeNameTransform extends
+			TransformTypeTransform {
+
+		protected void setValue(Feature source, EditableFeature target,
+				FeatureAttributeDescriptor attrTarget) throws DataException {
+			target.set(attrTarget.getIndex(), source.get(this
+					.restoreAttributeName(attrTarget.getName())));
+		}
+
+
+		protected FeatureType transformType(FeatureType type) {
+			EditableFeatureType result = type.getEditable();
+			Iterator iter = result.iterator();
+			EditableFeatureAttributeDescriptor attr;
+			while (iter.hasNext()) {
+				attr = (EditableFeatureAttributeDescriptor) iter.next();
+				attr.setName(transformAttributeName(attr.getName()));
+			}
+			return result.getNotEditableCopy();
+		}
+
+		protected abstract String transformAttributeName(String source);
+
+		protected abstract String restoreAttributeName(String target);
+
+		protected FeatureType restoreType(FeatureType type) {
+			EditableFeatureType result;
+			if (type instanceof EditableFeatureType) {
+				result = (EditableFeatureType) type.getCopy();
+			} else {
+				result = type.getEditable();
+			}
+			Iterator iter = result.iterator();
+			EditableFeatureAttributeDescriptor attr;
+			while (iter.hasNext()) {
+				attr = (EditableFeatureAttributeDescriptor) iter.next();
+
+				attr.setName(restoreAttributeName(attr.getName()));
+			}
+			return result.getNotEditableCopy();
+		}
+
+		public FeatureType getSourceFeatureTypeFrom(
+				FeatureType targetFeatureType) {
+			FeatureType org = null;
+			FeatureType cur = null;
+			Iterator iter = null;
+			iter = this.orgFTypes.iterator();
+			while (iter.hasNext()) {
+				cur = (FeatureType) iter.next();
+				if (cur.getId().equals(targetFeatureType.getId())) {
+					org = cur;
+					break;
+				}
+			}
+			if (cur == null) {
+				throw new RuntimeException();
+			}
+			EditableFeatureType r = org.getEditable();
+			iter = r.iterator();
+			FeatureAttributeDescriptor attr;
+			while (iter.hasNext()) {
+				attr = (FeatureAttributeDescriptor) iter.next();
+				if (targetFeatureType.getIndex(transformAttributeName(attr
+						.getName())) == -1) {
+					iter.remove();
+				}
+			}
+			return r.getNotEditableCopy();
+		}
+
+	}
+
+
+	class AddPrefixAttributeName extends TransformAttributeNameTransform {
+
+		private String prefix;
+
+		AddPrefixAttributeName(String prefix) {
+			this.prefix = prefix;
+		}
+
+		protected String restoreAttributeName(String target) {
+			return target.substring(getPrefix().length(), target.length());
+		}
+
+		private String getPrefix() {
+			return prefix;
+		}
+
+		protected String transformAttributeName(String source) {
+			return getPrefix() + source;
+		}
+
+	}
+
+	class AddAttribute extends TransformTypeTransform {
+
+		private String name;
+		private int type;
+		private Object defValue;
+		private int size;
+		private Evaluator eval;
+
+		AddAttribute(String name) {
+			this(name, DataTypes.STRING, null, 15);
+		}
+
+		AddAttribute(String name, int type) {
+			this(name, type, null, 15);
+		}
+
+		AddAttribute(String name, int type, Object defValue) {
+			this(name, type, defValue, 15);
+		}
+
+		AddAttribute(String name, int type, Evaluator evaluator, int size) {
+			this.name = name;
+			this.type = type;
+			this.defValue = null;
+			this.size = size;
+			this.eval = evaluator;
+		}
+
+		AddAttribute(String name, int type, Object defValue, int size) {
+			this.name = name;
+			this.type = type;
+			this.defValue = defValue;
+			this.size = size;
+			this.eval = null;
+		}
+
+
+
+		protected FeatureType restoreType(FeatureType type) {
+			EditableFeatureType result;
+			if (type instanceof EditableFeatureType) {
+				result = (EditableFeatureType) type.getCopy();
+			} else {
+				result = type.getEditable();
+			}
+			result.remove(this.name);
+			return result.getNotEditableCopy();
+		}
+
+		protected FeatureType transformType(FeatureType type) {
+			EditableFeatureType result = type.getEditable();
+
+			EditableFeatureAttributeDescriptor att;
+			if (this.eval == null) {
+				att = result.add(name, this.type)
+						.setDefaultValue(this.defValue);
+			} else {
+				att = result.add(name, this.type, this.eval);
+			}
+			att.setSize(size);
+
+
+			return result.getNotEditableCopy();
+		}
+
+		protected void setValue(Feature source, EditableFeature target,
+				FeatureAttributeDescriptor attrTarget) throws DataException {
+			if (attrTarget.getName().equals(this.name)) {
+				target.set(attrTarget.getIndex(), attrTarget.getDefaultValue());
+			} else {
+				target.set(attrTarget.getIndex(), source.get(attrTarget
+						.getName()));
+			}
+		}
+	}
+
+
+	class RemoveAttribute extends TransformTypeTransform {
+
+		private String attributeName;
+		private String fTypeIdToRemoveAttribute = null;
+		private FeatureAttributeDescriptor attr;
+
+		RemoveAttribute(String attributeName) {
+			this.attributeName = attributeName;
+		}
+
+		RemoveAttribute(String attributeName, FeatureType fType) {
+			this.attributeName = attributeName;
+		}
+
+		protected FeatureType restoreType(FeatureType type) {
+			if (!type.getId().equals(this.fTypeIdToRemoveAttribute)) {
+				return type;
+			}
+			EditableFeatureType result = type.getEditable();
+
+			EditableFeatureAttributeDescriptor att;
+			if (this.attr.getEvaluator() == null) {
+				att = result.add(attributeName, this.attr.getType())
+						.setDefaultValue(this.attr.getDefaultValue());
+			} else {
+				att = result.add(attributeName, this.attr.getType(),
+						this.attr.getEvaluator());
+			}
+			att.setSize(this.attr.getSize());
+			att.setAllowNull(this.attr.allowNull());
+			att.setGeometryType(this.attr.getGeometryType());
+			att.setSRS(this.attr.getSRS());
+			att.setPrecision(this.attr.getPrecision());
+			// TODO
+
+
+			return result.getNotEditableCopy();
+		}
+
+		protected FeatureType transformType(FeatureType type) {
+			if (!type.getId().equals(this.fTypeIdToRemoveAttribute)) {
+				return type;
+			}
+
+			EditableFeatureType result;
+			if (type instanceof EditableFeatureType) {
+				result = (EditableFeatureType) type.getCopy();
+			} else {
+				result = type.getEditable();
+			}
+			result.remove(this.attributeName);
+			return result.getNotEditableCopy();
+
+		}
+
+		public void setFeatureStore(FeatureStore featureStore) {
+			Iterator iter;
+			try {
+				iter = featureStore.getFeatureTypes().iterator();
+			} catch (DataException e) {
+				throw new RuntimeException(e);
+			}
+			FeatureType type;
+			FeatureAttributeDescriptor attrTmp;
+			while (iter.hasNext()) {
+				type = (FeatureType) iter.next();
+				attrTmp = type.getAttributeDescriptor(this.attributeName);
+				if (attrTmp != null) {
+					this.fTypeIdToRemoveAttribute = type.getId();
+					this.attr = attrTmp;
+					break;
+				}
+			}
+			super.setFeatureStore(featureStore);
+		}
+
+		public void applyTransform(Feature source, EditableFeature target)
+				throws DataException {
+			// TODO Auto-generated method stub
+			super.applyTransform(source, target);
+		}
+
+
+
+	}
+
+
+	public class StringsToLowerTransform extends myTransform {
+
+		public boolean isTransformsOriginalValues() {
+			return true;
+		}
+
+		protected void setValue(Feature source, EditableFeature target,
+				FeatureAttributeDescriptor attr) throws DataException {
+			if (attr.getType() == DataTypes.STRING) {
+				String v = ((String) source.get(attr.getName()));
+				if (v != null){
+					v = v.toLowerCase();
+				} else if (!attr.allowNull()) {
+					v = (String) attr.getDefaultValue();
+					v = v.toLowerCase();
+				}
+				target.set(attr.getName(), v);
+			} else {
+				target.set(attr.getName(), source.get(attr.getName()));
+			}
+		}
+
+	}
+
+	class StringsToUpperTransform extends StringsToLowerTransform {
+		protected void setValue(Feature source, EditableFeature target,
+				FeatureAttributeDescriptor attr) throws DataException {
+			if (attr.getType() == DataTypes.STRING) {
+				String v = ((String) source.get(attr.getName()));
+				if (v != null) {
+					v = v.toUpperCase();
+				} else if (!attr.allowNull()) {
+					v = (String) attr.getDefaultValue();
+					v.toUpperCase();
+				}
+				target.set(attr.getName(), v);
+			} else {
+				target.set(attr.getName(), source.get(attr.getName()));
+			}
+		}
+
+	}
+
+
+	public void testFeatureReference() throws Exception {
+		DataStoreParameters dbfParameters = this
+				.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(dbfParameters
+				.getDataStoreName(), dbfParameters);
+
+		Feature feature, refered;
+		FeatureSet set;
+		int nTimes2 = getRandom().nextInt(2) + 1;
+
+		for (int j = 0; j < nTimes2; j++) {
+			set = store.getFeatureSet();
+			DisposableIterator iter;
+
+			int nTimes = getRandom().nextInt(2) + 3;
+			for (int i = 0; i < nTimes; i++) {
+				if (getRandom().nextBoolean()) {
+					iter = set.fastIterator();
+				} else {
+					iter = set.fastIterator();
+				}
+				while (iter.hasNext()) {
+					feature = (Feature) iter.next();
+					refered = feature.getReference().getFeature();
+					compareFeatures(feature, refered);
+				}
+				iter.dispose();
+			}
+
+			set.dispose();
+		}
+
+		nTimes2 = getRandom().nextInt(5) + 2;
+		FeatureQuery query = store.createFeatureQuery();
+
+		for (int j = 0; j < nTimes2; j++) {
+			DisposableIterator iter;
+
+			query.setAttributeNames(getRandomAttibuteList(store
+					.getDefaultFeatureType()));
+			set = store.getFeatureSet(query);
+
+			int nTimes = getRandom().nextInt(3) + 3;
+			for (int i = 0; i < nTimes; i++) {
+				if (getRandom().nextBoolean()) {
+					iter = set.fastIterator();
+				} else {
+					iter = set.fastIterator();
+				}
+				while (iter.hasNext()) {
+					feature = (Feature) iter.next();
+					refered = feature.getReference().getFeature(
+							set.getDefaultFeatureType());
+					compareFeatures(feature, refered);
+				}
+				iter.dispose();
+			}
+
+			set.dispose();
+		}
+
+
+
+		store.dispose();
+
+	}
+
+	public void testResourcesLocks() throws Exception {
+
+		if (!this.usesResources()) {
+			return;
+		}
+
+		DataStoreParameters dbfParameters = this
+				.getDefaultDataStoreParameters();
+
+		FeatureStore store = (FeatureStore) dataManager.openStore(dbfParameters
+				.getDataStoreName(), dbfParameters);
+
+		int nThreads = getRandom().nextInt(4) + 2;
+		List threads = new ArrayList();
+		TaskTestIterators task;
+		for (int i = 0; i < nThreads; i++) {
+			task = new TaskTestIterators(this, "" + i, store);
+			threads.add(task);
+			task.start();
+		}
+
+		Iterator iter;
+		List stillAlives = new ArrayList();
+		stillAlives.addAll(threads);
+
+		while (!stillAlives.isEmpty()) {
+			iter = stillAlives.iterator();
+			while (iter.hasNext()) {
+				task = (TaskTestIterators) iter.next();
+				if (!task.isAlive()) {
+					iter.remove();
+				} else if ((!task.isFinished()) && task.isOutOfDate()) {
+					iter.remove();
+					getLogger().error("task {} outOfDate", task.getName());
+				} else {
+					Thread.yield();
+					Thread.sleep(100);
+				}
+			}
+		}
+
+		store.dispose();
+
+		iter = threads.iterator();
+		while (iter.hasNext()) {
+			task = (TaskTestIterators) iter.next();
+			assertTrue(task.isFinishedOk());
+		}
+	}
+
+	class TaskTestIterators extends StoreTask {
+		private BaseTestFeatureStore testInstance;
+
+		public TaskTestIterators(BaseTestFeatureStore testInstance,
+				String name, FeatureStore store) {
+			super(name, store);
+			this.testInstance = testInstance;
+		}
+
+		public TaskTestIterators(BaseTestFeatureStore testInstance,
+				String name, FeatureStore store, int timeToWait) {
+			super(name, store, timeToWait);
+			this.testInstance = testInstance;
+		}
+
+		public void run() {
+			if (!this.startProcess()) {
+				return;
+			}
+			try {
+				this.testInstance.fullStoreIteratorTest(store);
+
+				finishedOk();
+			} catch (Throwable e) {
+				finishedError(e);
+				return;
+			}
+		}
+
+
+	}
+
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		if (!usesResources()) {
+			return;
+		}
+
+		ResourceManager resMan = DALLocator.getResourceManager();
+		resMan.closeResources();
+	}
+
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java	(revision 35988)
@@ -0,0 +1,365 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 {}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.paging.impl;
+
+import junit.framework.TestCase;
+
+import org.gvsig.tools.paging.PagingCalculator.Sizeable;
+
+/**
+ * Unit tests for the {@link OneSubsetOneSetPagingCalculator} class.
+ * 
+ * @author gvSIG team
+ */
+public class OneSubsetOneSetPagingCalculatorTest extends
+ TestCase {
+
+	private static final int MAX_PAGE_SIZE = 4;
+
+	private TestSizeable sizeable1 = new TestSizeable(6);
+	private TestSizeable sizeable2 = new TestSizeable(17);
+
+	private OneSubsetOneSetPagingCalculator calculator;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		calculator =
+            new OneSubsetOneSetPagingCalculator(sizeable1, sizeable2,
+                MAX_PAGE_SIZE);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getFirstSetSize()}
+	 * .
+	 */
+	public void testGetFirstSetSize() {
+		assertEquals(sizeable1.getSize(), calculator.getFirstSetSize());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getSecondSetSize()}
+	 * .
+	 */
+	public void testGetSecondSetSize() {
+		assertEquals(sizeable2.getSize() - sizeable1.getSize(), calculator.getSecondSetSize());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getFirstSetInitialIndex()}
+	 * .
+	 */
+	public void testGetFirstSetInitialIndex() {
+		calculator.setCurrentPage(0);
+		assertEquals(0, calculator.getFirstSetInitialIndex());
+
+		calculator.setCurrentPage(1);
+		assertEquals(0 + MAX_PAGE_SIZE, calculator.getFirstSetInitialIndex());
+
+		calculator.setCurrentPage(2);
+		assertEquals(-1, calculator.getFirstSetInitialIndex());
+
+		calculator.setCurrentPage(3);
+		assertEquals(-1, calculator.getFirstSetInitialIndex());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertEquals(-1, calculator.getFirstSetInitialIndex());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertEquals(0, calculator.getFirstSetInitialIndex());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getSecondSetInitialIndex()}
+	 * .
+	 */
+	public void testGetSecondSetInitialIndex() {
+		calculator.setCurrentPage(0);
+		assertEquals(-1, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(1);
+		assertEquals(0, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(2);
+		assertEquals(2, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(3);
+		assertEquals(2 + MAX_PAGE_SIZE, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertEquals(2 + ((calculator.getNumPages() - 3) * MAX_PAGE_SIZE),
+				calculator.getSecondSetInitialIndex());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertEquals(0, calculator.getSecondSetInitialIndex());
+
+		// Set the two sets equal, so all elements in the first set are
+		// contained in the second one
+		sizeable1.setSize(15l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(4);
+
+		calculator.setCurrentPage(0);
+		assertEquals(-1, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(1);
+		assertEquals(-1, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(2);
+		assertEquals(-1, calculator.getSecondSetInitialIndex());
+
+		calculator.setCurrentPage(3);
+		assertEquals(-1, calculator.getSecondSetInitialIndex());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getFirstSetHowMany()}
+	 * .
+	 */
+	public void testGetFirstSetHowMany() {
+		calculator.setCurrentPage(0);
+		assertEquals(MAX_PAGE_SIZE, calculator.getFirstSetHowMany());
+
+		calculator.setCurrentPage(1);
+		assertEquals(2, calculator.getFirstSetHowMany());
+
+		calculator.setCurrentPage(2);
+		assertEquals(0, calculator.getFirstSetHowMany());
+
+		calculator.setCurrentPage(3);
+		assertEquals(0, calculator.getFirstSetHowMany());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertEquals(0, calculator.getFirstSetHowMany());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertEquals(1, calculator.getFirstSetHowMany());
+
+		// Change values so all data is available into the first set
+		sizeable1.setSize(25l);
+		sizeable2.setSize(25l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertEquals(20, calculator.getFirstSetHowMany());
+
+		calculator.setCurrentPage(1);
+		assertEquals(5, calculator.getFirstSetHowMany());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#getSecondSetHowMany()}
+	 * .
+	 */
+	public void testGetSecondSetHowMany() {
+		calculator.setCurrentPage(0);
+		assertEquals(0l, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(1);
+		assertEquals(2l, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(2);
+		assertEquals(MAX_PAGE_SIZE, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(3);
+		assertEquals(MAX_PAGE_SIZE, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertEquals(1l, calculator.getSecondSetHowMany());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertEquals(14l, calculator.getSecondSetHowMany());
+
+		// Set the two sets equal, so all elements in the first set are
+		// contained in the second one
+		sizeable1.setSize(15l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(4);
+
+		calculator.setCurrentPage(0);
+		assertEquals(0l, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(1);
+		assertEquals(0l, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(2);
+		assertEquals(0l, calculator.getSecondSetHowMany());
+
+		calculator.setCurrentPage(3);
+		assertEquals(0l, calculator.getSecondSetHowMany());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#hasCurrentPageAllValuesInFirstSet()}
+	 * .
+	 */
+	public void testHasCurrentPageAllValuesInFirstSet() {
+		calculator.setCurrentPage(0);
+		assertTrue(calculator.hasCurrentPageAllValuesInFirstSet());
+
+		calculator.setCurrentPage(1);
+		assertFalse(calculator.hasCurrentPageAllValuesInFirstSet());
+
+		calculator.setCurrentPage(2);
+		assertFalse(calculator.hasCurrentPageAllValuesInFirstSet());
+
+		calculator.setCurrentPage(3);
+		assertFalse(calculator.hasCurrentPageAllValuesInFirstSet());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertFalse(calculator.hasCurrentPageAllValuesInFirstSet());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertFalse(calculator.hasCurrentPageAllValuesInFirstSet());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#hasCurrentPageAnyValuesInFirstSet()}
+	 * .
+	 */
+	public void testHasCurrentPageAnyValuesInFirstSet() {
+		calculator.setCurrentPage(0);
+		assertTrue(calculator.hasCurrentPageAnyValuesInFirstSet());
+
+		calculator.setCurrentPage(1);
+		assertTrue(calculator.hasCurrentPageAnyValuesInFirstSet());
+
+		calculator.setCurrentPage(2);
+		assertFalse(calculator.hasCurrentPageAnyValuesInFirstSet());
+
+		calculator.setCurrentPage(3);
+		assertFalse(calculator.hasCurrentPageAnyValuesInFirstSet());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertFalse(calculator.hasCurrentPageAnyValuesInFirstSet());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertTrue(calculator.hasCurrentPageAnyValuesInFirstSet());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.dal.feature.paging.impl.OneSubsetOneSetPagingCalculator#hasCurrentPageAnyValuesInSecondSet()}
+	 * .
+	 */
+	public void testHasCurrentPageAnyValuesInSecondSet() {
+		calculator.setCurrentPage(0);
+		assertFalse(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(1);
+		assertTrue(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(2);
+		assertTrue(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(3);
+		assertTrue(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(calculator.getNumPages() - 1);
+		assertTrue(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		// Change values so all data fits into a single page
+		sizeable1.setSize(1l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(20);
+
+		calculator.setCurrentPage(0);
+		assertTrue(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		// Set the two sets equal, so all elements in the first set are
+		// contained in the second one
+		sizeable1.setSize(15l);
+		sizeable2.setSize(15l);
+		calculator.setMaxPageSize(4);
+
+		calculator.setCurrentPage(0);
+		assertFalse(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(1);
+		assertFalse(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(2);
+		assertFalse(calculator.hasCurrentPageAnyValuesInSecondSet());
+
+		calculator.setCurrentPage(3);
+		assertFalse(calculator.hasCurrentPageAnyValuesInSecondSet());
+	}
+
+    private class TestSizeable implements Sizeable {
+
+		private long size;
+
+		public TestSizeable(long size) {
+			this.size = size;
+		}
+
+		public long getSize() {
+			return size;
+		}
+
+		public void setSize(long size) {
+			this.size = size;
+		}
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java	(revision 35988)
@@ -0,0 +1,11 @@
+package org.gvsig.fmap.dal.feature;
+
+import junit.framework.TestCase;
+
+public class FeatureTest extends TestCase {
+
+    public void testVoid() {
+
+    }
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources-test/log4j.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/resources-test/log4j.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/resources-test/log4j.xml	(revision 35988)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n"/>
+        </layout>
+    </appender>
+
+  <category name="org.gvsig.fmap.dal">
+    <priority value="WARN"/>
+  </category>
+
+    <root>
+        <priority value="INFO" />
+        <appender-ref ref="CONSOLE" />
+    </root>
+</log4j:configuration>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources-test/log4j.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.dal.raster;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreFactory;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.raster.impl.DefaultCoverageStore;
+
+public class DefaultCoverageStoreFactory implements DataStoreFactory {
+
+    public void setParameters(DataParameters parameters) {
+        // Do Nothing
+        
+    }
+
+    public DataStore createStore() throws InitializeException {
+        return new DefaultCoverageStore();
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java	(revision 35988)
@@ -0,0 +1,34 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.raster;
+
+import org.gvsig.fmap.dal.DataSet;
+
+public interface CoverageSet extends DataSet {
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java	(revision 35988)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.dal.raster;
+
+import org.gvsig.fmap.dal.DataStore;
+
+public interface CoverageStore extends DataStore {
+	
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java	(revision 35988)
@@ -0,0 +1,39 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.raster.spi;
+
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+
+public interface CoverageStoreProvider extends DataStoreProvider {
+	public String getProviderName();
+
+	public CoverageStoreProviderServices getStoreServices();
+
+	public boolean allowWrite();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java	(revision 35988)
@@ -0,0 +1,224 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.raster.spi;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.raster.CoverageSelection;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+
+
+/**
+ * @author jmvivo
+ *
+ */
+public abstract class AbstractCoverageStoreProvider extends AbstractDisposable
+		implements CoverageStoreProvider {
+	protected CoverageStoreProviderServices store;
+	protected DelegatedDynObject metadata;
+	protected DataStoreParameters parameters;
+
+
+	protected AbstractCoverageStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices, DynObject metadata) {
+		init(params, storeServices, metadata);
+	}
+
+	protected AbstractCoverageStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices) {
+		init(params, storeServices, null);
+	}
+	
+	protected AbstractCoverageStoreProvider() {
+	}
+	
+	protected void init(DataStoreParameters params,
+			DataStoreProviderServices storeServices, DynObject metadata) {
+		this.store = (CoverageStoreProviderServices) storeServices;
+		this.metadata = (DelegatedDynObject) metadata;
+		this.parameters = params;
+	}
+	
+	/**
+	 * Gets the DataStoreParameters
+	 * @return DataStoreParameters
+	 */
+	public DataStoreParameters getDataStoreParameters() {
+		return parameters;
+	}
+
+	/**
+	 * Set metada container if this not set at construction time and only in one
+	 * time. In other case an Exception will be throw
+	 *
+	 * @param metadata
+	 */
+	protected void setMetadata(DynObject metadata) {
+		if (this.metadata != null) {
+			// FIXME Exception
+			throw new IllegalStateException();
+		}
+		this.metadata = (DelegatedDynObject) metadata;
+	}
+
+	protected ResourceProvider createResource(String type, Object[] params)
+			throws InitializeException {
+		ResourceManagerProviderServices manager = (ResourceManagerProviderServices) DALLocator
+				.getResourceManager();
+		ResourceProvider resource = manager.createAddResource(type, params);
+		return resource;
+	}
+
+	public CoverageStoreProviderServices getStoreServices() {
+		return this.store;
+	}
+
+	public String getClassName() {
+		return this.getClass().getName();
+	}
+
+	public boolean allowWrite() {
+		return false;
+	}
+
+	public CoverageSelection createCoverageSelection() throws DataException {
+		return this.store.createDefaultCoverageSelection();
+	}
+
+	public void refresh() throws OpenException {
+		// Do nothing by default
+	}
+
+	public void close() throws CloseException {
+		// Do nothing by default
+	}
+
+	protected void doDispose() throws BaseException {
+		this.metadata = null;
+		this.store = null;
+		this.parameters = null;
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		return null;
+	}
+
+	public abstract DataServerExplorer getExplorer() throws ReadException,
+			ValidateDataParametersException;
+
+	public void delegate(DynObject dynObject) {
+		if (this.metadata == null) {
+			return;
+		}
+		this.metadata.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		if (this.metadata == null) {
+			return null;
+		}
+		return this.metadata.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		if (this.metadata == null) {
+			return false;
+		}
+		// TODO this.open??
+		return this.metadata.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		if (this.metadata == null) {
+			return;
+		}
+		this.metadata.implement(dynClass);
+
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.invokeDynMethod(this, code, context);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.invokeDynMethod(this, name, context);
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		if (this.metadata == null) {
+			return;
+		}
+		// TODO this.open??
+		this.metadata.setDynValue(name, value);
+	}
+
+	public void clear() {
+		if (metadata != null) {
+			metadata.clear();
+		}
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java	(revision 35988)
@@ -0,0 +1,56 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.raster.spi;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.raster.CoverageSelection;
+import org.gvsig.fmap.dal.raster.CoverageStore;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.undo.command.Command;
+
+public interface CoverageStoreProviderServices extends
+		DataStoreProviderServices, CoverageStore {
+	public void notifyChange(String notification);
+
+	public void notifyChange(String notification, Resource resource);
+
+	public void notifyChange(String notification, Command command);
+
+	public CoverageSelection createDefaultCoverageSelection()
+			throws DataException;
+
+	public DataManager getManager();
+
+	public CoverageStoreProvider getProvider();
+
+	public CoverageStore getCoverageStore();
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java	(revision 35988)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.dal.raster;
+
+
+public interface CoveragerStoreParameters {
+
+	public String getDataStoreName();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.raster package documentation</title>
+</head>
+<body>
+
+<p>Provides API for accessing and managing raster data.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java	(revision 35988)
@@ -0,0 +1,32 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.raster;
+
+public interface CoverageSelection extends CoverageSet {
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java	(revision 35988)
@@ -0,0 +1,514 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.raster.impl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreNotification;
+import org.gvsig.fmap.dal.impl.DefaultDataManager;
+import org.gvsig.fmap.dal.raster.CoverageSelection;
+import org.gvsig.fmap.dal.raster.CoverageStore;
+import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider;
+import org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.spi.DataStoreInitializer;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.timesupport.RelativeInterval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.command.Command;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DefaultCoverageStore extends AbstractDisposable implements
+		CoverageStore, CoverageStoreProviderServices, DataStoreInitializer {
+
+//	final static private Logger logger = LoggerFactory
+//			.getLogger(DefaultFeatureStore.class);
+
+	private DataStoreParameters parameters = null;
+	private CoverageSelection selection;
+
+//	private long versionOfUpdate = 0;
+
+	private DefaultDataManager dataManager = null;
+
+	private CoverageStoreProvider provider = null;
+
+	private DelegatedDynObject metadata;
+
+	private DelegateWeakReferencingObservable delegateObservable = new DelegateWeakReferencingObservable(
+			this);
+
+	public DefaultCoverageStore() {
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.impl.DataStoreImplementation#intializePhase1(org.gvsig
+	 * .fmap.dal.impl.DefaultDataManager,
+	 * org.gvsig.fmap.dal.DataStoreParameters)
+	 */
+	public void intializePhase1(DataManager dataManager,
+			DataStoreParameters parameters) throws InitializeException {
+		DynObjectManager dynManager = ToolsLocator.getDynObjectManager();
+
+		this.metadata = (DelegatedDynObject) dynManager
+				.createDynObject( 
+						MetadataLocator.getMetadataManager().getDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME)
+				);
+		this.dataManager = (DefaultDataManager)dataManager;
+		this.parameters = parameters;
+
+	}
+
+
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.impl.DataStoreImplementation#intializePhase2(org.gvsig
+	 * .fmap.dal.spi.DataStoreProvider)
+	 */
+	public void intializePhase2(DataStoreProvider provider)
+			throws InitializeException {
+
+		this.provider = (CoverageStoreProvider) provider;
+		this.delegate(provider);
+
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#createSelection()
+	 */
+	public DataSet createSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getChildren()
+	 */
+	public Iterator getChildren() {
+		return this.provider.getChilds();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getDataSet()
+	 */
+	public DataSet getDataSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.fmap.dal.DataQuery)
+	 */
+	public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		// TODO Auto-generated method stub
+	}
+
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException {
+		// TODO Auto-generated method stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.tools.observer.Observer)
+	 */
+	public void getDataSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getDataSet(org.gvsig.fmap.dal.DataQuery, org.gvsig.tools.observer.Observer)
+	 */
+	public void getDataSet(DataQuery dataQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getExplorer()
+	 */
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException {
+		return provider.getExplorer();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getParameters()
+	 */
+	public DataStoreParameters getParameters() {
+		return this.parameters;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#getSelection()
+	 */
+	public DataSet getSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#refresh()
+	 */
+	public void refresh() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.DataStore#setSelection(org.gvsig.fmap.dal.DataSet)
+	 */
+	public void setSelection(DataSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.ComplexObservable#beginComplexNotification()
+	 */
+	public void beginComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.ComplexObservable#disableNotifications()
+	 */
+	public void disableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.ComplexObservable#enableNotifications()
+	 */
+	public void enableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.ComplexObservable#endComplexNotification()
+	 */
+	public void endComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.Observable#addObserver(org.gvsig.tools.observer.Observer)
+	 */
+	public void addObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.Observable#deleteObserver(org.gvsig.tools.observer.Observer)
+	 */
+	public void deleteObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.observer.Observable#deleteObservers()
+	 */
+	public void deleteObservers() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#getState()
+	 */
+	public PersistentState getState() throws PersistenceException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#loadState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#setState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		// TODO Auto-generated method stub
+
+	}
+
+	//
+	// ====================================================================
+	// Metadata related methods
+	//
+
+	public Object getMetadataID() {
+		return this.provider.getSourceId();
+	}
+
+	public void delegate(DynObject dynObject) {
+		this.metadata.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		return this.metadata.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		return this.metadata.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		return this.metadata.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		this.metadata.implement(dynClass);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		return this.metadata.invokeDynMethod(this, name, context);
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		return this.metadata.invokeDynMethod(this, code, context);
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		this.metadata.setDynValue(name, value);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+	 */
+	public Set getMetadataChildren() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.metadata.Metadata#getMetadataName()
+	 */
+	public String getMetadataName() {
+		return this.provider.getProviderName();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#createDefaultCoverageSelection()
+	 */
+	public CoverageSelection createDefaultCoverageSelection()
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#getManager()
+	 */
+	public DataManager getManager() {
+		return this.dataManager;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProviderServices#getProvider()
+	 */
+	public CoverageStoreProvider getProvider() {
+		return this.provider;
+	}
+
+	public void notifyChange(String notification) {
+		delegateObservable
+				.notifyObservers(new DefaultCoverageStoreNotification(
+				this, notification));
+
+	}
+
+
+	public void notifyChange(String notification, Command command) {
+		delegateObservable
+				.notifyObservers(new DefaultCoverageStoreNotification(
+				this, notification, command));
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices#notifyChange
+	 * (java.lang.String, org.gvsig.fmap.dal.resource.Resource)
+	 */
+	public void notifyChange(String notification, Resource resource) {
+		delegateObservable.notifyObservers(new DefaultFeatureStoreNotification(
+				this, FeatureStoreNotification.RESOURCE_CHANGED));
+	}
+
+	public void open() throws OpenException {
+		// TODO: Se puede hacer un open estando en edicion ?
+		this.notifyChange(DataStoreNotification.BEFORE_OPEN);
+		this.provider.open();
+		this.notifyChange(DataStoreNotification.AFTER_OPEN);
+	}
+
+	public void close() throws CloseException {
+		// TODO: Se puede hacer un close estando en edicion ?
+		this.notifyChange(DataStoreNotification.BEFORE_CLOSE);
+		this.provider.close();
+		this.notifyChange(DataStoreNotification.AFTER_CLOSE);
+	}
+
+	protected void doDispose() throws BaseException {
+		this.notifyChange(DataStoreNotification.BEFORE_DISPOSE);
+		this.provider.dispose();
+		if (this.selection != null) {
+			this.selection.dispose();
+			this.selection = null;
+		}
+
+		this.parameters = null;
+		this.notifyChange(DataStoreNotification.AFTER_DISPOSE);
+		this.delegateObservable.deleteObservers();
+		this.delegateObservable = null;
+	}
+
+	public boolean allowWrite() {
+		return this.provider.allowWrite();
+	}
+
+	public DataQuery createQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataStore getStore() {
+		return this;
+	}
+
+	public CoverageStore getCoverageStore() {
+		return this;
+	}
+
+	public void clear() {
+		if (metadata != null) {
+			metadata.clear();
+		}
+	}
+
+	public String getProviderName() {
+		return this.provider.getProviderName();
+	}
+	
+	public String getName() {
+		return this.provider.getProviderName();
+	}
+
+	public String getFullName() {
+		return this.provider.getFullName();
+	}
+
+    public Interval getInterval() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }   
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java	(revision 35988)
@@ -0,0 +1,57 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.raster.impl;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.tools.undo.command.Command;
+
+public class DefaultCoverageStoreNotification implements DataStoreNotification {
+
+	public DefaultCoverageStoreNotification(
+			DefaultCoverageStore defaultCoverageStore, String notification,
+			Command command) {
+		// TODO Auto-generated constructor stub
+	}
+
+	public DefaultCoverageStoreNotification(
+			DefaultCoverageStore defaultCoverageStore, String notification) {
+		// TODO Auto-generated constructor stub
+	}
+
+	public DataStore getSource() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getType() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java	(revision 35988)
@@ -0,0 +1,130 @@
+package org.gvsig.fmap.dal;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.Disposable;
+
+/**
+ * DataServerExplorer is an abstraction for any type of data server. It allows
+ * connecting to the server and browsing its contents.
+ *
+ * More specifically, this interface provides a list of the available data
+ * stores in a server.
+ */
+public interface DataServerExplorer extends Disposable {
+
+	/**
+	 * Returns the DataServerExplorer's name
+	 *
+	 * @return String containing this DataServerExplorer's name
+	 */
+	public String getProviderName();
+
+	/**
+	 * Indicates whether this DataServerExplorer can create a new DataStore in the
+	 * server.
+	 *
+	 * @return true if this DataServerExplorer can be created or false otherwise.
+	 */
+	public boolean canAdd();
+
+	/**
+	 * Indicates whether this DataServerExplorer can create a new DataStore in
+	 * the server, given the store name.
+	 *
+	 * @param storeName
+	 *            store name.
+	 *
+	 * @return true if this DataServerExplorer can create a new store or false
+	 *         otherwise.
+	 *
+	 * @throws DataException
+	 */
+	public boolean canAdd(String storeName)
+			throws DataException;
+
+	/**
+	 * Provides a list of available stores in the server.
+	 *
+	 * @return list of DataStoreParameters
+	 *
+	 * @throws DataException
+	 */
+	public List list() throws DataException;
+
+	public static final int MODE_ALL = 0;
+	public static final int MODE_FEATURE = 1;
+	public static final int MODE_GEOMETRY = 2;
+	public static final int MODE_RASTER = 4;
+
+	/**
+	 * Provides a list of available stores in the server of a type.
+	 * 
+	 * @param mode
+	 *            , filter store from a type: {@link #MODE_ALL},
+	 *            {@link #MODE_FEATURE}, {@link #MODE_FEATURE_GEOMETRY},
+	 *            {@link #MODE_RASTER}
+	 * 
+	 * @return list of DataStoreParameters
+	 * 
+	 * @throws DataException
+	 */
+	public List list(int mode) throws DataException;
+
+	/**
+	 * Creates a new DataStore in this server.
+	 *
+	 * @param parameters
+	 *            , an instance of DataStoreParameters from
+	 *            {@link DataServerExplorer#getAddParameters(String)} that
+	 *            describes the new DataStore.
+	 * @param overwrite
+	 *            if the store already exists
+	 *
+	 * @return true if the DataStoreParameters were successfully added, false
+	 *         otherwise.
+	 *
+	 * @throws DataException
+	 */
+	public boolean add(String provider, NewDataStoreParameters parameters, boolean overwrite)
+			throws DataException;
+
+	/**
+	 * Removes a store from the server given its DataStoreParameters. If the
+	 * store is a file then this method deletes the file, if it is a table in a
+	 * database then this method drops the table, and so on.
+	 *
+	 * @param parameters
+	 * @throws DataException
+	 */
+	void remove(DataStoreParameters parameters) throws DataException;
+
+	/**
+	 * Given the store's name, returns its parameters for creation.
+	 *
+	 * @param storeName
+	 *
+	 * @return parameters to create a store
+	 *
+	 * @throws DataException
+	 */
+	public NewDataStoreParameters getAddParameters(String storeName)
+			throws DataException;
+
+	/**
+	 * Returns this DataServerExplorer parameters
+	 *
+	 * @return an instance of DataServerExplorerParameters containing this
+	 *         DataServerExplorer parameters.
+	 */
+	public DataServerExplorerParameters getParameters();
+
+	/**
+	 * Return the list of provider names that this server allow.
+	 *  
+	 * @return List of provider names
+	 */
+	public List getDataStoreProviderNames();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 35988)
@@ -0,0 +1,154 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.xmlpull.v1.XmlPullParserException;
+
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureQuery;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.DayToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.DayToRelativeInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.HourToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.HourToRelativeInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.MilliToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.MilliToRelativeInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.MinuteToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.MinuteToRelativeInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.MonthToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.SecondToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.SecondToRelativeInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.impl.attributegetter.YearToAbsoluteInstantFeatureAttributeGetter;
+import org.gvsig.fmap.dal.resource.impl.DefaultResourceManager;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+
+/**
+ * Initialize the implementation of DAL.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class DALDefaultImplLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsImplementationOf(DALLibrary.class);
+    }
+
+    protected void doInitialize() throws LibraryException {
+        DALLocator.registerDefaultDataManager(DefaultDataManager.class);
+        DALLocator.registerResourceManager(DefaultResourceManager.class);
+    }
+
+    protected void doPostInitialize() throws LibraryException {
+        List exs = new ArrayList();
+        try {
+            registerBaseNewProvidersParametersDefinition();
+        } catch (XmlPullParserException e) {
+            exs.add(e);
+        } catch (IOException e) {
+            exs.add(e);
+        }
+
+        DefaultFeatureQuery.registerPersistent();
+        DefaultFeatureReference.registerPersistent();
+        DefaultFeatureStoreTransforms.registerPersistent();
+        AbstractFeatureStoreTransform.registerPersistent();
+        DefaultFeatureReferenceSelection.registerPersistent();
+        DefaultFeatureSelection.registerPersistent();
+        // DefaultCoverageStore.registerPersistent();
+
+        DefaultFeatureStore.registerPersistenceDefinition();
+        try {
+            DefaultFeatureStore.registerMetadataDefinition();
+        } catch (MetadataException e) {
+            exs.add(e);
+        }
+
+        // DefaultFeatureAttributeDescriptor.registerPersistent();
+        
+      //Register the FeatureAttributeTransform
+        DataManager dataManager = DALLocator.getDataManager();
+        if (dataManager == null) {
+            throw new ReferenceNotRegisteredException(
+                    DALLocator.DATA_MANAGER_NAME, DALLocator.getInstance());
+        }
+        dataManager.registerFeatureAttributeGetter("milliToRelativeInstant", MilliToRelativeInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("milliToAbsoluteInstant", MilliToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("secondToRelativeInstant", SecondToRelativeInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("secondToAbsoluteInstant",SecondToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("minuteToRelativeInstant",MinuteToRelativeInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("minuteToAbsoluteInstant", MinuteToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("hourToRelativeInstant", HourToRelativeInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("hourToAbsoluteInstant", HourToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("dayToAbsoluteInstant", DayToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("dayToRelativeInstant", DayToRelativeInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("monthToAbsoluteInstant", MonthToAbsoluteInstantFeatureAttributeGetter.class);
+        dataManager.registerFeatureAttributeGetter("yearToAbsoluteInstant", YearToAbsoluteInstantFeatureAttributeGetter.class);
+
+        if (exs.size() > 0) {
+            throw new LibraryException(this.getClass(), exs);
+        }
+    }
+
+    private void registerBaseNewProvidersParametersDefinition()
+        throws XmlPullParserException, IOException {
+        DynObjectManager manager = ToolsLocator.getDynObjectManager();
+        if (manager
+            .get(
+                "DAL",
+                DataStoreProviderServices.BASE_NEWPARAMETERS_PROVIDER_DEFINITION_NAME) == null) {
+            Map definitions =
+                manager
+                    .importDynClassDefinitions(
+                        DataStoreProviderServices.class
+                            .getResourceAsStream("ProviderParametersDefinition.xml"),
+                        DataStoreProviderServices.class.getClassLoader());
+            manager
+                .add((DynClass) definitions
+                    .get(DataStoreProviderServices.BASE_NEWPARAMETERS_PROVIDER_DEFINITION_FULLNAME));
+            manager
+                .add((DynClass) definitions
+                    .get(DataStoreProviderServices.BASE_PARAMETERS_PROVIDER_DEFINITION_FULLNAME));
+        }
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java	(revision 35988)
@@ -0,0 +1,53 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.impl;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
+
+public class DefaultDataServerExplorerProviderServices implements
+		DataServerExplorerProviderServices {
+
+	public EditableFeatureType createNewFeatureType() {
+		return new DefaultEditableFeatureType();
+	}
+
+	public Resource createResource(String name, Object[] params)
+			throws InitializeException {
+		ResourceManagerProviderServices manager = (ResourceManagerProviderServices) DALLocator
+				.getResourceManager();
+		ResourceProvider resource = manager.createAddResource(name, params);
+		return resource;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 35988)
@@ -0,0 +1,755 @@
+package org.gvsig.fmap.dal.impl;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreFactory;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+import org.gvsig.fmap.dal.OpenErrorHandler;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureIndex;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper;
+import org.gvsig.fmap.dal.feature.paging.impl.FeaturePagingHelperImpl;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProvider;
+import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProviderFactory;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.fmap.dal.spi.DataServerExplorerProvider;
+import org.gvsig.fmap.dal.spi.DataStoreInitializer;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.dal.store.memory.MemoryStoreParameters;
+import org.gvsig.fmap.dal.store.memory.MemoryStoreProvider;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.extensionpoint.ExtensionPoint;
+import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
+import org.gvsig.tools.operations.OperationManager;
+
+public class DefaultDataManager implements DataManager,
+DataManagerProviderServices {
+
+    final static private String DATA_MANAGER_STORE = "Data.manager.stores";
+    final static private String DATA_MANAGER_STORE_DESCRIPTION = "DAL stores providers";
+
+    final static private String DATA_MANAGER_STORE_PARAMS = "Data.manager.stores.params";
+    final static private String DATA_MANAGER_STORE_PARAMS_DESCRIPTION = "DAL stores providers parameters";
+
+    final static private String DATA_MANAGER_EXPLORER = "Data.manager.explorers";
+    final static private String DATA_MANAGER_EXPLORER_DESCRIPTION = "DAL explorers providers";
+
+    final static private String DATA_MANAGER_EXPLORER_PARAMS = "Data.manager.explorers.params";
+    final static private String DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION = "DAL explorer providers parameters";
+
+    final static private String DATA_MANAGER_INDEX = "Data.manager.indexes";
+    final static private String DATA_MANAGER_INDEX_DESCRIPTION = "DAL index providers";
+
+    final static private String DATA_MANAGER_CACHE = "Data.manager.caches";
+    final static private String DATA_MANAGER_CACHE_DESCRIPTION = "DAL cache providers";
+
+    final static private String DATA_MANAGER_EXPRESION_EVALUATOR = "Data.manager.expresion.evaluator";
+    final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT = "default";
+    final static private String DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION = "DAL expresion evaluators.";
+
+    final static private String DATA_MANAGER_STORE_FACTORY = "Data.manager.stores.factory";
+    final static private String DATA_MANAGER_STORE_FACTORY_DESCRIPTION = "DAL stores factories";
+
+    final static private String DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER = "Data.manager.feature.attribute.getter";
+    final static private String DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER_DESCRIPTION = "DAL feature attribute getters";
+
+    /** This map contains the name of the default provider for each data type */
+    private Map defaultDataIndexProviders;
+
+    private OpenErrorHandler openErrorHandler;
+
+    public DefaultDataManager() {
+        /*
+         * Create te extensions point in te registry.
+         */
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE,
+            DATA_MANAGER_STORE_DESCRIPTION);
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS,
+            DATA_MANAGER_STORE_PARAMS_DESCRIPTION);
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER,
+            DATA_MANAGER_EXPLORER_DESCRIPTION);
+
+        ToolsLocator.getExtensionPointManager().add(
+            DATA_MANAGER_EXPLORER_PARAMS,
+            DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION);
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_INDEX,
+            DATA_MANAGER_INDEX_DESCRIPTION);
+
+        ToolsLocator.getExtensionPointManager().add(
+            DATA_MANAGER_EXPRESION_EVALUATOR,
+            DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION);
+
+        initializeIndexes();
+    }
+
+    /**
+     *
+     * @return ResourceManager
+     */
+
+    public ResourceManager getResourceManager() {
+        return DALLocator.getResourceManager();
+    }
+
+    public OperationManager getOperationManager() {
+        return ToolsLocator.getOperationManager();
+    }
+
+    public String getTemporaryDirectory() {
+        // FIXME Define a better tempdir solution
+        String tmp = System.getProperty("TMP");
+        if (tmp == null) {
+            tmp = System.getProperty("TEMP");
+        }
+        if (tmp == null) {
+            File tmp_file = new File(System.getProperty("HOME"), "_daltmp_");
+            int i = 1;
+            while (!tmp_file.exists() || !tmp_file.isDirectory()) {
+                tmp_file = new File(tmp_file.getAbsolutePath() + i);
+                i++;
+            }
+            if (!tmp_file.exists()) {
+                tmp_file.mkdir();
+            }
+            tmp = tmp_file.getAbsolutePath();
+        }
+        return tmp;
+    }
+
+    /*
+     * ====================================================================
+     * 
+     * Store related services
+     */
+    public void registerStoreProvider(String name, Class storeProviderClass,
+        Class parametersClass) {
+        if (name == null || storeProviderClass == null
+            || parametersClass == null) {
+            // FIXME Exception
+            throw new IllegalArgumentException("Any parameters can be null");
+        }
+
+        if (!DataStoreParameters.class.isAssignableFrom(parametersClass)) {
+            // FIXME Exception
+            throw new IllegalArgumentException(parametersClass.getName()
+                + " must implement org.gvsig.fmap.dal.DataStoreParameters");
+        }
+
+        if (CoverageStoreProvider.class.isAssignableFrom(storeProviderClass)) {
+
+        } else if (FeatureStoreProvider.class
+            .isAssignableFrom(storeProviderClass)) {
+
+        } else {
+            // FIXME Exception
+            throw new IllegalArgumentException(
+                "Not supported implemtation: name=" + name
+                + " provider class=" + storeProviderClass.getName());
+        }
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE,
+            DATA_MANAGER_STORE_DESCRIPTION).append(name, null,
+                storeProviderClass);
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_PARAMS,
+            DATA_MANAGER_STORE_PARAMS_DESCRIPTION).append(name, null,
+                parametersClass);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.gvsig.fmap.dal.spi.DataManagerProviderServices#registerStoreFactory(java.lang.String, java.lang.Class)
+     */
+    public void registerStoreFactory(String name, Class storeProviderClass) {
+        if (name == null || storeProviderClass == null) {
+            // FIXME Exception
+            throw new IllegalArgumentException("Any parameters can be null");
+        }
+
+        if(!(DataStoreFactory.class.isAssignableFrom(storeProviderClass))) {
+            // FIXME Exception
+            throw new IllegalArgumentException(
+                "Not supported implemtation: name=" + name
+                + " provider class=" + storeProviderClass.getName());
+        }
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_STORE_FACTORY,
+            DATA_MANAGER_STORE_FACTORY_DESCRIPTION).append(name, null,
+                storeProviderClass);
+    }
+
+    public DataStoreParameters createStoreParameters(String name)
+    throws InitializeException, ProviderNotRegisteredException {
+        try {
+            DataStoreParameters params = (DataStoreParameters) ToolsLocator
+            .getExtensionPointManager().get(DATA_MANAGER_STORE_PARAMS)
+            .create(name);
+            if (params == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            return params;
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        } catch (SecurityException e) {
+            throw new InitializeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    public DataStore localOpenStore(String provider, DataStoreParameters parameters)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+        String name = provider; //parameters.getDataStoreName();
+
+        parameters.validate();
+
+        DataStore store;
+        Extension storeProviderExtension = ToolsLocator
+        .getExtensionPointManager().get(DATA_MANAGER_STORE).get(name);
+
+        if (storeProviderExtension == null) {
+            throw new ProviderNotRegisteredException(name);
+        }
+
+        Class providerClass = storeProviderExtension.getExtension();
+        if (providerClass == null) {
+            throw new ProviderNotRegisteredException(name);
+        }
+
+        if (CoverageStoreProvider.class.isAssignableFrom(providerClass)) {
+            ExtensionPoint.Extension point = ToolsLocator.getExtensionPointManager().
+            get(DATA_MANAGER_STORE_FACTORY).get(name);
+            DataStoreFactory factory = null;
+            try {
+                factory = (DataStoreFactory)point.create();
+            } catch (InstantiationException e) {
+                throw new InitializeException(e);
+            } catch (IllegalAccessException e) {
+                throw new InitializeException(e);
+            }
+            factory.setParameters(parameters);
+            store = factory.createStore();
+        } else if (FeatureStoreProvider.class.isAssignableFrom(providerClass)) {
+
+            store = new DefaultFeatureStore();
+
+        } else {
+            // FIXME Exception
+            throw new InitializeException(name, new RuntimeException(
+                "Not supported implemtation: name=" + name
+                + " provider class=" + providerClass.getName()));
+        }
+
+        this.intializeDataStore(store, parameters);
+
+        return store;
+    }
+
+    public DataStore openStore(String provider, DataStoreParameters parameters)
+            throws InitializeException, ProviderNotRegisteredException,
+            ValidateDataParametersException {
+
+//      try {
+            return localOpenStore(provider, parameters);
+//      } catch (Exception e) {
+//          // TODO: handle exception
+//      }
+        
+    }
+
+    /**
+     * @deprecated see openStore
+     */
+    public DataStore createStore(DataStoreParameters parameters)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+        return openStore(parameters.getDataStoreName(), parameters);
+    }
+
+    public List getStoreProviders() {
+        return ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_STORE)
+        .getNames();
+    }
+
+    public List getStoreProviders(String name) {
+        return getStoreProviders(); // FIXME: need filter from the name of
+        // the explorer
+    }
+
+    public NewDataStoreParameters createNewStoreParameters(String explorer,
+        String provider) throws InitializeException,
+        ProviderNotRegisteredException {
+
+        DataServerExplorerParameters parameters;
+        DataServerExplorer server;
+        try {
+            parameters = this.createServerExplorerParameters(explorer);
+            server = this.openServerExplorerWithoutValidate(explorer, parameters);
+            return server.getAddParameters(provider);
+        } catch (ValidateDataParametersException e) {
+            throw new InitializeException(e);
+        } catch (DataException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    public void newStore(String explorer, String provider, NewDataStoreParameters parameters, boolean overwrite)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+
+        parameters.validate();
+
+        DataServerExplorerParameters explorerParameters;
+        DataServerExplorer server;
+        explorerParameters = this.createServerExplorerParameters(explorer);
+        server = this.openServerExplorerWithoutValidate(explorer, explorerParameters);
+        try {
+            server.add(provider, parameters, overwrite);
+        } catch (DataException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    /*
+     * ====================================================================
+     *
+     * Explorer related services
+     */
+    public void registerExplorerProvider(String name, Class explorerClass,
+        Class parametersClass) {
+
+        if (name == null || explorerClass == null || parametersClass == null) {
+            // FIXME Exception
+            throw new IllegalArgumentException("Any parameters can be null");
+        }
+
+        if (!DataServerExplorerParameters.class
+            .isAssignableFrom(parametersClass)) {
+            // FIXME Exception
+            throw new IllegalArgumentException(
+                parametersClass.getName()
+                + " must implement org.gvsig.fmap.dal.DataServerExplorerParameters");
+        }
+
+        if (!DataServerExplorer.class.isAssignableFrom(explorerClass)) {
+            // FIXME Exception
+            throw new IllegalArgumentException(explorerClass.getName()
+                + " must implement org.gvsig.fmap.dal.DataServerExplorer");
+        }
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_EXPLORER,
+            DATA_MANAGER_EXPLORER_DESCRIPTION).append(name, null,
+                explorerClass);
+
+        ToolsLocator.getExtensionPointManager().add(
+            DATA_MANAGER_EXPLORER_PARAMS,
+            DATA_MANAGER_EXPLORER_PARAMS_DESCRIPTION).append(name, null,
+                parametersClass);
+    }
+
+    public DataServerExplorerParameters createServerExplorerParameters(
+        String name) throws InitializeException,
+        ProviderNotRegisteredException {
+        try {
+            DataServerExplorerParameters params = (DataServerExplorerParameters) ToolsLocator
+            .getExtensionPointManager().get(
+                DATA_MANAGER_EXPLORER_PARAMS).create(name);
+            if (params == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            return params;
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        } catch (SecurityException e) {
+            throw new InitializeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    public DataServerExplorer openServerExplorer(
+        String explorer, 
+        DataServerExplorerParameters parameters)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+
+        if( parameters != null ) {
+            parameters.validate();
+        }
+        return this.openServerExplorerWithoutValidate(explorer, parameters);
+    }
+
+    private DataServerExplorer openServerExplorerWithoutValidate(
+        String explorerName, 
+        DataServerExplorerParameters parameters)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+
+        String name = explorerName; //parameters.getExplorerName();
+
+        try {
+            DataServerExplorerProvider server = (DataServerExplorerProvider) ToolsLocator
+            .getExtensionPointManager()
+            .get(DATA_MANAGER_EXPLORER)
+            .create(
+                name,
+                new Object[] {
+                    parameters,
+                    new DefaultDataServerExplorerProviderServices() });
+            if (server == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            return server;
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        } catch (SecurityException e) {
+            throw new InitializeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new InitializeException(e);
+        } catch (NoSuchMethodException e) {
+            throw new InitializeException(e);
+        } catch (InvocationTargetException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    /**
+     * @deprecated see openServerExplorer
+     */
+    public DataServerExplorer createServerExplorer(
+        DataServerExplorerParameters parameters)
+    throws InitializeException, ProviderNotRegisteredException,
+    ValidateDataParametersException {
+        return openServerExplorer(parameters.getExplorerName(), parameters);
+    }
+
+    public List getExplorerProviders() {
+        return ToolsLocator.getExtensionPointManager().get(
+            DATA_MANAGER_EXPLORER).getNames();
+    }
+
+    /*
+     * ====================================================================
+     *
+     * Expresion evaluation related services
+     */
+    public Evaluator createExpresion(String expresion)
+    throws InitializeException {
+        try {
+            return (Evaluator) ToolsLocator.getExtensionPointManager().get(
+                DATA_MANAGER_EXPRESION_EVALUATOR).create(
+                    DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT,
+                    new Object[] { expresion });
+        } catch (SecurityException e) {
+            throw new InitializeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new InitializeException(e);
+        } catch (NoSuchMethodException e) {
+            throw new InitializeException(e);
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        } catch (InvocationTargetException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    public void registerDefaultEvaluator(Class evaluatorClass) {
+        if (!Evaluator.class.isAssignableFrom(evaluatorClass)) {
+            throw new ClassCastException();
+        }
+        ToolsLocator.getExtensionPointManager().add(
+            DATA_MANAGER_EXPRESION_EVALUATOR,
+            DATA_MANAGER_EXPRESION_EVALUATOR_DESCRIPTION).append(
+                DATA_MANAGER_EXPRESION_EVALUATOR_DEFAULT,
+                "Default expresion evaluator for use in DAL", evaluatorClass);
+    }
+
+    /*
+     * ====================================================================
+     *
+     * Index related services
+     */
+
+    public List getFeatureIndexProviders() {
+        return ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_INDEX)
+        .getNames();
+    }
+
+    public void setDefaultFeatureIndexProviderName(int dataType, String name) {
+        defaultDataIndexProviders.put(new Integer(dataType), name);
+    }
+
+    public String getDefaultFeatureIndexProviderName(int dataType) {
+        return (String) defaultDataIndexProviders.get(new Integer(dataType));
+    }
+
+    public FeatureIndexProviderServices createFeatureIndexProvider(String name,
+        FeatureStore store, FeatureType type, String indexName,
+        FeatureAttributeDescriptor attr) throws InitializeException,
+        ProviderNotRegisteredException {
+
+        if (name == null) {
+            name = getDefaultFeatureIndexProviderName(attr.getType());
+        }
+
+        if (name == null) {
+            throw new InitializeException(
+                "There not any index provider registered.", null);
+        }
+
+        try {
+            FeatureIndexProvider provider = (FeatureIndexProvider) ToolsLocator
+            .getExtensionPointManager().get(DATA_MANAGER_INDEX).create(
+                name);
+            if (provider == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            FeatureIndexProviderServices services = new DefaultFeatureIndex(
+                (FeatureStoreProviderServices) store, type, provider, attr
+                .getName(), indexName);
+            services.initialize();
+            return services;
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        } catch (SecurityException e) {
+            throw new InitializeException(e);
+        } catch (IllegalArgumentException e) {
+            throw new InitializeException(e);
+        }
+    }
+
+    public void registerFeatureIndexProvider(String name, String description,
+        Class clazz, int dataType) {
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_INDEX,
+            DATA_MANAGER_INDEX_DESCRIPTION).append(name, null, clazz);
+
+        if (getDefaultFeatureIndexProviderName(dataType) == null) {
+            setDefaultFeatureIndexProviderName(dataType, name);
+        }
+    }
+
+    private void initializeIndexes() {
+        this.defaultDataIndexProviders = new HashMap();
+    }
+
+    public void intializeDataStore(DataStore store,
+        DataStoreParameters parameters) throws InitializeException,
+        ProviderNotRegisteredException {
+
+        ((DataStoreInitializer)store).intializePhase1(this, parameters);
+        DataStoreProvider provider = this.createProvider((DataStoreProviderServices) store, parameters);
+        ((DataStoreInitializer)store).intializePhase2(provider);
+
+    }
+
+    public DataStoreProvider createProvider(DataStoreProviderServices providerServices, DataStoreParameters parameters) throws InitializeException, ProviderNotRegisteredException {
+        String name = parameters.getDataStoreName();
+        DataStoreProvider provider = null;
+        boolean retry = true;
+        while (retry){
+        	try {
+        		provider = (DataStoreProvider) ToolsLocator
+        		.getExtensionPointManager().get(DATA_MANAGER_STORE).create(
+        				name,
+        				new Object[] { parameters, providerServices });
+            	retry = false;
+        	} catch (Exception e) {
+        		if (openErrorHandler != null){
+        			retry = openErrorHandler.canRetryOpen(e, parameters);
+        		} else {
+        			retry = false;
+        		}
+        		if (!retry){
+        			throw new InitializeException(parameters.getDataStoreName(), e);
+        		}
+        	}
+        }
+        if (provider == null) {
+            throw new ProviderNotRegisteredException(name);
+        }
+        return provider;
+    }
+
+    public void registerFeatureCacheProvider(
+        FeatureCacheProviderFactory providerFactory) {
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_CACHE,
+            DATA_MANAGER_CACHE_DESCRIPTION).append(
+                providerFactory.getName(), "", 
+                providerFactory);                   
+    }
+
+    public FeatureCacheProvider createFeatureCacheProvider(String name,
+        DynObject parameters) throws DataException {
+        if (name == null) {
+            throw new InitializeException("It is necessary to provide a cache name", null);
+        }
+        if (parameters == null){
+            throw new InitializeException("It is necessary to provide parameters to create the explorer", null);
+        }
+        FeatureCacheProviderFactory featureCacheProviderFactory;
+        try {
+            featureCacheProviderFactory = (FeatureCacheProviderFactory) ToolsLocator
+            .getExtensionPointManager().get(DATA_MANAGER_CACHE).create(name);
+            if (featureCacheProviderFactory == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            return featureCacheProviderFactory.createCacheProvider(parameters);     
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        }       
+    }
+
+    public List getFeatureCacheProviders() {
+        ExtensionPoint extensionPoint = ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_CACHE);
+        if (extensionPoint != null){
+            return ToolsLocator.getExtensionPointManager().get(
+                DATA_MANAGER_CACHE).getNames();
+        }else{
+            return new ArrayList();
+        }  
+    }
+
+    public DynObject createCacheParameters(String name)
+    throws InitializeException, ProviderNotRegisteredException {
+        if (name == null) {
+            throw new InitializeException("It is necessary to provide a cache name", null);
+        }
+        FeatureCacheProviderFactory featureCacheProviderFactory;
+        try {
+            featureCacheProviderFactory = (FeatureCacheProviderFactory) ToolsLocator
+            .getExtensionPointManager().get(DATA_MANAGER_CACHE).create(name);
+            if (featureCacheProviderFactory == null) {
+                throw new ProviderNotRegisteredException(name);
+            }
+            return featureCacheProviderFactory.createParameters();      
+        } catch (InstantiationException e) {
+            throw new InitializeException(e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException(e);
+        }       
+    }
+
+    public DataStoreParameters createMemoryStoreParameters(
+        String autoOrderAttributeName) throws InitializeException {
+
+        DataStoreParameters parameters;
+        try {
+            parameters = createStoreParameters(MemoryStoreProvider.NAME);
+            if (autoOrderAttributeName != null) {
+                parameters.setDynValue(
+                    MemoryStoreParameters.ORDER_PARAMETER_NAME,
+                    autoOrderAttributeName);
+            }
+            return parameters;
+        } catch (ProviderNotRegisteredException e) {
+            throw new InitializeException("MemoryStoreProvider", e);
+        }
+    }
+
+    public FeatureStore createMemoryStore(String autoOrderAttributeName)
+    throws InitializeException {
+
+        DataStoreParameters parameters = createMemoryStoreParameters(autoOrderAttributeName);
+        try {
+            return (FeatureStore) createStore(parameters);
+        } catch (ValidateDataParametersException e) {
+            throw new InitializeException("MemoryStoreProvider", e);
+        } catch (ProviderNotRegisteredException e) {
+            throw new InitializeException("MemoryStoreProvider", e);
+        }
+    }
+
+    public FeaturePagingHelper createFeaturePagingHelper(
+        FeatureStore featureStore, int pageSize) throws BaseException {
+        return new FeaturePagingHelperImpl(featureStore, pageSize);
+    }
+
+    public FeaturePagingHelper createFeaturePagingHelper(
+        FeatureStore featureStore, FeatureQuery featureQuery, int pageSize)
+    throws BaseException {
+        return new FeaturePagingHelperImpl(featureStore, featureQuery, pageSize);
+    }
+
+    public void registerFeatureAttributeGetter(String name, Class clazz) {
+        if (name == null || clazz == null) {           
+            throw new IllegalArgumentException("Any parameters can be null");
+        }
+
+        if(!(FeatureAttributeGetter.class.isAssignableFrom(clazz))) {            
+            throw new IllegalArgumentException(
+                "Not supported implemtation: name=" + name
+                + " class=" + clazz.getName());
+        }
+
+        ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER,
+            DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER_DESCRIPTION).append(name, null,
+                clazz);
+
+    }
+
+    public FeatureAttributeGetter createFeatureAttributeGetter(String name) throws InitializeException {
+        if (name == null) {           
+            throw new IllegalArgumentException("The parameter can not be null");
+        }
+
+        try{
+            return (FeatureAttributeGetter) ToolsLocator.getExtensionPointManager().get(DATA_MANAGER_FEATURE_ATTTRIBUTE_GETTER).create(name);
+        } catch (InstantiationException e) {
+            throw new InitializeException("FeatureAttributeGetter", e);
+        } catch (IllegalAccessException e) {
+            throw new InitializeException("FeatureAttributeGetter", e);
+        }
+    }
+
+	public void setOpenErrorHandler(OpenErrorHandler handler) {
+		openErrorHandler = handler;
+		
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java	(revision 35988)
@@ -0,0 +1,43 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+ 
+/**
+ * 
+ */
+package org.gvsig.fmap.dal;
+
+/**
+ * This class is used to distinguish a new instance of DataStoreParameters
+ * that still needs to be initialized (and therefore lacks of any valid parameter 
+ * values), from a ready to use initialized instance.
+ * 
+ * @author jmvivo
+ *
+ */
+public interface NewDataStoreParameters extends DataStoreParameters {
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java	(revision 35988)
@@ -0,0 +1,143 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.tools.locator.AbstractLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+/**
+ *
+ * This locator is the entry point of gvSIG's DAL, providing access to all DAL services.
+ * DAL services are grouped in two managers {@link DataManager} and {@link ResourceManager}.
+ *
+ * This locator offers methods for registering as well as for obtaining both managers' unique instances.
+ *
+ * @see Locator
+ */
+public class DALLocator extends AbstractLocator {
+
+	private static final String LOCATOR_NAME = "DALLocator";
+
+	/**
+	 * DataManager name used by the locator to access the instance
+	 */
+	public static final String DATA_MANAGER_NAME = "DataManager";
+
+	private static final String DATA_MANAGER_DESCRIPTION = "DataManager of gvSIG Data Access Library";
+
+	/**
+	 * ResourceManager name used by the locator to access the instance
+	 */
+	public static final String RESOURCE_MANAGER_NAME = "ResourceManager";
+
+	private static final String RESOURCE_MANAGER_DESCRIPTION = "ResourceManager of gvSIG Data Access Library";
+
+	/**
+	 * Unique instance.
+	 */
+	private static final DALLocator instance = new DALLocator();
+
+	/**
+	 * Return the singleton instance.
+	 *
+	 * @return the singleton instance
+	 */
+	public static DALLocator getInstance() {
+		return instance;
+	}
+
+	/**
+	 * Returns the Locator name.
+	 *
+	 * @return String containing the locator name.
+	 */
+	public String getLocatorName() {
+		return LOCATOR_NAME;
+	}
+
+	/**
+	 * Return a reference to DataManager.
+	 *
+	 * @return a reference to DataManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static DataManager getDataManager() throws LocatorException {
+		return (DataManager) getInstance().get(DATA_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the DataManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the DataManager interface
+	 */
+	public static void registerDataManager(Class clazz) {
+		getInstance().register(DATA_MANAGER_NAME, DATA_MANAGER_DESCRIPTION,
+				clazz);
+	}
+
+	/**
+	 * Registers a class as the default DataManager.
+	 *
+	 * @param clazz
+	 * 			  implementing the DataManager interface
+	 */
+	public static void registerDefaultDataManager(Class clazz) {
+		getInstance().registerDefault(DATA_MANAGER_NAME, DATA_MANAGER_DESCRIPTION,
+				clazz);
+	}
+
+	/**
+	 * Return a reference to ResourceManager.
+	 *
+	 * @return a reference to ResourceManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static ResourceManager getResourceManager() throws LocatorException {
+		return (ResourceManager) getInstance().get(RESOURCE_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the MDManager interface.
+	 *
+	 * @param clazz
+	 *            implementing the MDManager interface
+	 */
+	public static void registerResourceManager(Class clazz) {
+		getInstance().register(RESOURCE_MANAGER_NAME,
+				RESOURCE_MANAGER_DESCRIPTION, clazz);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java	(revision 35988)
@@ -0,0 +1,39 @@
+package org.gvsig.fmap.dal;
+
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * <p> Interface that represents a generic set of data. It may proceed either from a data 
+ * query, a user selection or a collection of locked elements.</p>
+ */
+public interface DataSet extends Visitable, Disposable {
+	
+	/**
+	 * Indicates whether this DataSet belongs to a specific store
+	 * @param store 
+	 * 			a DataStore   
+	 * @return true if this belongs to the given DataStore, false if not.
+	 */
+	public boolean isFromStore(DataStore store);
+
+    /**
+     * Provides each value of this Store to the provided {@link Visitor}.
+     * The values received through the {@link Visitor#visit(Object)} method
+     * may be transient, reused or externally modifiable, so they can't
+     * be used to be stored in any external form out of the visit method.
+     * 
+     * If you need to store any of the values out of the
+     * {@link Visitor#visit(Object)} method execution, create a copy or clone
+     * the received value in order to be stored.
+     * 
+     * @param visitor
+     *            the visitor to apply to each value.
+     * @exception BaseException
+     *                if there is an error while performing the visit
+     */
+    public void accept(Visitor visitor) throws BaseException;
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java	(revision 35988)
@@ -0,0 +1,159 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.fmap.dal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.feature.spi.memory.MemoryResource;
+import org.gvsig.fmap.dal.feature.spi.memory.MemoryResourceParameters;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.dal.resource.spi.MultiResource;
+import org.gvsig.fmap.dal.resource.spi.MultiResourceParameters;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.geom.GeometryLibrary;
+import org.gvsig.metadata.MetadataLibrary;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.timesupport.AbsoluteInstant;
+import org.gvsig.timesupport.AbsoluteInterval;
+import org.gvsig.timesupport.RelativeInstant;
+import org.gvsig.timesupport.RelativeInterval;
+import org.gvsig.tools.ToolsLibrary;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+
+/**
+ * Initializes gvSIG's desktop DAL by registering the default implementation for
+ * {@link DataManager} and {@link ResourceManager}.
+ * 
+ */
+public class DALLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsAPI(DALLibrary.class);
+        require(GeometryLibrary.class);
+        require(ToolsLibrary.class);
+        require(MetadataLibrary.class);
+    }
+
+    protected void doInitialize() throws LibraryException {
+        // Do nothing
+    }
+
+    protected void doPostInitialize() throws LibraryException {
+        List exs = new ArrayList();
+        
+        try {
+            registerDataStoreMetadataDefinition();
+        } catch (MetadataException e) {
+            exs.add(e);
+        }
+        try {
+            registerSpatialDataStoreMetadataDefinition();
+        } catch (MetadataException e) {
+            exs.add(e);
+        }
+        try {
+            registerFeatureStoreMetadataDefinition();
+        } catch (MetadataException e) {
+            exs.add(e);
+        }
+
+        // Validate there is any implementation registered.
+        DataManager dataManager = DALLocator.getDataManager();
+        if (dataManager == null) {
+            throw new ReferenceNotRegisteredException(
+                DALLocator.DATA_MANAGER_NAME, DALLocator.getInstance());
+        }
+
+        ResourceManagerProviderServices resourceManager =
+            (ResourceManagerProviderServices) DALLocator.getResourceManager();
+        if (resourceManager == null) {
+            throw new ReferenceNotRegisteredException(
+                DALLocator.RESOURCE_MANAGER_NAME, DALLocator.getInstance());
+        }
+
+        if (!resourceManager.getResourceProviders().contains(
+            MultiResource.TYPE_NAME)) {
+            resourceManager.register(MultiResource.TYPE_NAME,
+                MultiResource.DESCRIPTION, MultiResource.class,
+                MultiResourceParameters.class);
+        }
+
+        if (!resourceManager.getResourceProviders().contains(
+            MemoryResource.NAME)) {
+            resourceManager.register(MemoryResource.NAME,
+                MemoryResource.DESCRIPTION, MemoryResource.class,
+                MemoryResourceParameters.class);
+        }
+
+        if (exs.size() > 0) {
+            throw new LibraryException(this.getClass(), exs);
+        }
+    }
+
+    private void registerDataStoreMetadataDefinition() throws MetadataException {
+        MetadataManager manager = MetadataLocator.getMetadataManager();
+        if (manager.getDefinition(DataStore.METADATA_DEFINITION_NAME) == null) {
+            manager
+                .addDefinition(DataStore.METADATA_DEFINITION_NAME,
+                    DALLibrary.class
+                        .getResourceAsStream("MetadataDefinitions.xml"),
+                    DALLibrary.class.getClassLoader());
+        }
+    }
+
+    private void registerSpatialDataStoreMetadataDefinition()
+        throws MetadataException {
+        MetadataManager manager = MetadataLocator.getMetadataManager();
+        if (manager.getDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME) == null) {
+            manager
+                .addDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME,
+                    DALLibrary.class
+                        .getResourceAsStream("MetadataDefinitions.xml"),
+                    DALLibrary.class.getClassLoader());
+        }
+    }
+
+    private void registerFeatureStoreMetadataDefinition()
+        throws MetadataException {
+        MetadataManager manager = MetadataLocator.getMetadataManager();
+        if (manager.getDefinition(DataStore.FEATURE_METADATA_DEFINITION_NAME) == null) {
+            manager
+                .addDefinition(DataStore.FEATURE_METADATA_DEFINITION_NAME,
+                    DALLibrary.class
+                        .getResourceAsStream("MetadataDefinitions.xml"),
+                    DALLibrary.class.getClassLoader());
+        }
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java	(revision 35988)
@@ -0,0 +1,300 @@
+package org.gvsig.fmap.dal;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.metadata.Metadata;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.timesupport.RelativeInterval;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * <p>
+ * This is the basic interface for all data stores. Depending on the context, it
+ * can represent a geographic layer, an alphanumeric database table or any data
+ * file. DataStore offers generic services like:
+ * <ul>
+ * <li>Open and close data stores</li>
+ * <li>Access to data sets, with the possibility of loading data in background.</li>
+ * <li>Use of selection and locks, as well as data sets</li>
+ * <li>Editing</li>
+ * <li>Register event observers through the Observable interface</li>
+ * <li>Access to embedded data stores (like GML)</li>
+ * <li>Information about the Spatial Reference Systems used by the data store</li>
+ * </ul>
+ * </p>
+ * <br>
+ *
+ */
+public interface DataStore extends ComplexWeakReferencingObservable,
+		Persistent, Metadata, Disposable, Visitable {
+
+	public static final String METADATA_DEFINITION_NAME = "DataProvider";
+
+	public static final String FEATURE_METADATA_DEFINITION_NAME = "FeatureProvider";
+
+	public static final String SPATIAL_METADATA_DEFINITION_NAME = "SpatialProvider";
+
+	/**
+	 * Metadata property name for the provider name provided by the data provider.
+	 * 
+	 * This metadata is provided by all data providers.
+	 */
+	public static final String METADATA_PROVIDER = "ProviderName";
+
+	/**
+	 * Metadata property name for Container name provided by the data provider.
+	 * By explample, in a dbf file, this is the name of dbf.
+	 * 
+	 * This metadata is provided by all data providers.
+	 */
+	public static final String METADATA_CONTAINERNAME = "ContainerName";
+
+	/**
+	 * Metadata property name for the feature type provided by the data provider.
+	 * 
+	 * This metadata is provided by all tabular data providers.
+	 */
+	public static final String METADATA_FEATURETYPE = "FeatureType";
+
+	/**
+	 * Metadata property name for CRS provided by the data provider.
+	 * 
+	 * This metadata is only provided by data provider with spatial 
+	 * information.
+	 */
+	public static final String METADATA_CRS = "CRS";
+
+	/**
+	 * Metadata property name for Envelope provided by the data provider
+	 * 
+	 * This metadata is only provided by data provider with spatial 
+	 * information.
+	 */
+	public static final String METADATA_ENVELOPE = "Envelope";
+
+	/**
+	 * Returns the name associated to the store.
+	 * This name is provided for informational purposes only.
+	 * Explamples:
+	 * 
+	 * In a dbf the filename without the path
+	 * 
+	 * In a DDBB table the name of the table
+	 * 
+	 * In a WFS layer the name of the layer.
+	 *
+	 * @return String containing this store's name.
+	 */
+	public String getName();
+	
+	/**
+	 * Returns a more descriptive name for the store that getName.
+	 * This name is provided for informational purposes only.
+	 * Explamples:
+	 * 
+	 * In a file based store may return the full name of the filename, path and filename.
+	 * 
+	 * In a data base based store may return "server:dbname:tablename"
+	 * 
+	 * In a WFS layer based store may return "server:layername"
+	 * 
+	 * @return String Containing the full name of the store
+	 */
+	public String getFullName();
+
+	/**
+	 * Return the of parameters of this store
+	 *
+	 * @return parameters of this store
+	 */
+	public DataStoreParameters getParameters();
+
+	/**
+	 * Return the provider name that use this store.
+	 * 
+	 * @return provider name of this store
+	 */
+	public String getProviderName();
+	
+	/**
+	 * Refreshes this store state.
+	 *
+	 * @throws DataException
+	 */
+	public void refresh() throws DataException;
+
+	/**
+	 * Returns all available data.
+	 *
+	 * @return a set of data
+	 * @throws DataException
+	 *             if there is any error while loading the data
+	 */
+	DataSet getDataSet() throws DataException;
+
+	/**
+	 * Returns a subset of data taking into account the properties and
+	 * restrictions of the DataQuery.
+	 *
+	 * @param dataQuery
+	 *            defines the properties of the requested data
+	 * @return a set of data
+	 * @throws DataException
+	 *             if there is any error while loading the data
+	 */
+	DataSet getDataSet(DataQuery dataQuery) throws DataException;
+
+    /**
+     * Provides each value of this Store to the provided {@link Visitor}.
+     * The values received through the {@link Visitor#visit(Object)} method
+     * may be transient, reused or externally modifiable, so they can't
+     * be used to be stored in any external form out of the visit method.
+     * 
+     * If you need to store any of the values out of the
+     * {@link Visitor#visit(Object)} method execution, create a copy or clone
+     * the received value in order to be stored.
+     * 
+     * @param visitor
+     *            the visitor to apply to each value.
+     * @exception BaseException
+     *                if there is an error while performing the visit
+     */
+    public void accept(Visitor visitor) throws BaseException;
+
+	/**
+     * Provides each value of this Store to the provided {@link Visitor}.
+     * The values received through the {@link Visitor#visit(Object)} method
+     * may be transient, reused or externally modifiable, so they can't
+     * be used to be stored in any external form out of the visit method.
+     * 
+     * If you need to store any of the values out of the
+     * {@link Visitor#visit(Object)} method execution, create a copy or clone
+     * the received value in order to be stored.
+     * 
+     * @param visitor
+     *            the visitor to apply to each value.
+     * @param dataQuery
+     *            defines the properties of the data to visit
+     * @exception BaseException
+     *                if there is an error while performing the visit
+     */
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException;
+
+	/**
+	 * Loads all available data and notifies the observer for each loaded block of data.
+	 *
+	 * @param observer
+	 *            to be notified for each block of data loaded
+	 * @throws DataException
+	 *             if there is any error while loading the data
+	 */
+	void getDataSet(Observer observer) throws DataException;
+
+	/**
+	 * Loads a subset of data taking into account the properties and
+	 * restrictions of the DataQuery. Data loading is performed by calling the
+	 * Observer, once each data block is loaded.
+	 *
+	 * @param dataQuery
+	 *            defines the properties of the requested data
+	 * @param observer
+	 *            to be notified for each block of data loaded
+	 * @throws DataException
+	 *             if there is any error while loading the data
+	 */
+	void getDataSet(DataQuery dataQuery, Observer observer) throws DataException;
+
+	/**
+	 * Returns the selected set of data
+	 *
+	 * @return DataSet
+	 */
+
+	public DataSet getSelection() throws DataException;
+
+	/**
+	 * Sets the current data selection with the given data set.
+	 *
+	 * @param DataSet
+	 *            selection
+	 * @throws DataException
+	 */
+	public void setSelection(DataSet selection) throws DataException;
+
+	/**
+	 * Creates a new selection.
+	 *
+	 * @return DataSet that contains the selection
+	 *
+	 * @throws DataException
+	 */
+	public DataSet createSelection() throws DataException;
+
+	/**
+	 * Returns an iterator over this store children
+	 *
+	 * @return Iterator over this DataStore children
+	 */
+	public Iterator getChildren();
+
+	/**
+	 * Returns the DataServerExplorer to which this DataStore belongs, if there
+	 * is any.
+	 * 
+	 * @return DataServerExplorer to which this DataStore belongs, or
+	 *         <code>null</code> if this was not accessed through any
+	 *         DataServerExplorer.
+	 * 
+	 * @throws DataException
+	 * @throws ValidateDataParametersException
+	 */
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException;
+
+
+	/**
+	 * Returns a new instance of a {@link DataQuery}.
+	 *
+	 * @return new {@link DataQuery} instance.
+	 *
+	 * @throws DataException
+	 */
+	public DataQuery createQuery();
+	
+	/**
+	 * Gets the {@link Interval} of the store, that means the temporal
+	 * interval where the store has valid data.
+	 * @return
+	 *         a time interval or null if there is not time support
+	 */
+	public Interval getInterval();
+	
+	/**
+	 * Gets all the possible values of time for which the store has data.  
+	 * @return
+	 *         a collection of {@link Time} objects.
+	 */
+	public Collection getTimes();
+	
+	/**
+	 * Gets all the possible values of time for which the store has data
+	 * and intersects with an interval.
+	 * @param interval
+	 *         the interval of time
+	 * @return
+	 *         a collection of {@link Time} objects.
+	 */
+	public Collection getTimes(Interval interval);
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java	(revision 35988)
@@ -0,0 +1,59 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * This interface is a generic persistent parameter container. It is used in a
+ * variety of contexts in which a set of arbitrary parameters is needed.
+ */
+public interface DataParameters extends Persistent, DynObject {
+
+	/**
+	 * clears the parameter container.
+	 */
+	public void clear();
+
+	/**
+	 * Creates and returns a new copy of this DataParameters.
+	 *
+	 * @return a new copy of this
+	 */
+	public DataParameters getCopy();
+
+	/**
+	 * Checks its valid
+	 *
+	 * @throws ValidateDataParametersException
+	 *             if any problem was detected
+	 */
+	public void validate() throws ValidateDataParametersException;
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java	(revision 35988)
@@ -0,0 +1,51 @@
+package org.gvsig.fmap.dal;
+
+/**
+ * This interface represents a notification produced by a DataStore.
+ * 
+ * Notifications can be of several types. This interface also defines a set 
+ * of constants that represent the types of notifications that a DataStore 
+ * can produce.
+ */
+public interface DataStoreNotification {
+
+	/** Complex notification for special situations */
+	public static final String COMPLEX_NOTIFICATION = "complex_notification";
+
+	/** Fired before opening the store */
+	public static final String BEFORE_OPEN = "before_Open_DataStore";
+	
+	/** Fired after opening the store */
+	public static final String AFTER_OPEN = "after_Open_DataStore";
+
+	/** Fired before closing the store */
+	public static final String BEFORE_CLOSE = "before_Close_DataStore";
+	
+	/** Fired after closing the store */
+	public static final String AFTER_CLOSE = "after_Close_DataStore";
+
+	/** Fired before disposing the store */
+	public static final String BEFORE_DISPOSE = "before_Dispose_DataStore";
+	
+	/** Fired after disposing the store */
+	public static final String AFTER_DISPOSE = "after_Dispose_DataStore";
+
+	/** Fired after the store selection has changed */
+	public static final String SELECTION_CHANGE = "after_SelectionChange_DataStore";
+
+	/** Fired when a resource of the store has changed */
+	public static final String RESOURCE_CHANGED = "resourceChange_DataStore";
+
+	/**
+	 * Returns the DataStore that produced this notification
+	 * @return DataStore source of this
+	 */
+	public DataStore getSource();
+	
+	/**
+	 * Returns the type of this notification, represented by one of the constants defined in this interface.
+	 * @return a String containing this notification's type
+	 */
+	public String getType();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java	(revision 35988)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal;
+
+/**
+ * This interface defines a set of constants for all data types supported by the
+ * DAL.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public interface DataTypes extends org.cresques.DataTypes,
+    org.gvsig.fmap.geom.DataTypes, org.gvsig.timesupport.DataTypes {
+
+	
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java	(revision 35988)
@@ -0,0 +1,80 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create Parameter object to define queries}
+ */
+package org.gvsig.fmap.dal;
+
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Defines the properties of a collection of data, as a result of a query
+ * through a DataStore.
+ * <p>
+ * The scale parameter can be used by the DataStore as a hint about the quality
+ * or resolution of the data needed to view or operate with the data returned.
+ * As an example, it may use the scale to return only a representative subset of
+ * the data, or maybe to return Data with less detail, like a point or a line
+ * instead of a polygon.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface DataQuery extends Persistent {
+
+    /**
+     * Sets the scale.
+     *
+     * @param scale
+     *            the scale to set
+     */
+	void setScale(double scale);
+
+	/**
+	 * Returns the scale of the data to load.
+	 * 
+	 * @return the scale of the data to load
+	 */
+	double getScale();
+
+	/**
+	 * Returns the value of an query parameter.
+	 *
+	 * @param name
+	 *            of the parameter
+	 * @return the parameter value
+	 */
+	Object getQueryParameter(String name);
+
+	/**
+	 * Sets the value of an query parameter.
+	 *
+	 * @param name
+	 *            of the query parameter
+	 * @param value
+	 *            for the query parameter
+	 */
+	void setQueryParameter(String name, Object value);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java	(revision 35988)
@@ -0,0 +1,403 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.fmap.dal;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.dal.store.memory.MemoryStoreProvider;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * There are two top level management roles within DAL: data access and resource management.
+ *
+ * This class is responsible of the data access management role. It provides ways
+ * for registering and instantiating {@link DataServerExplorer}(s), {@link DataStore}(s),
+ * {@link Evaluator}(s) and {@link FeatureIndex}(es).
+ *
+ * @see ResourceManager
+ *
+ */
+
+public interface DataManager {
+
+	/**
+	 * Returns the default DAL's temporary directory
+	 *
+	 * @return Temporary directory name
+	 */
+	public String getTemporaryDirectory();
+
+	/*
+	 * ====================================================================
+	 *
+	 * Store related services
+	 */
+
+	/**
+	 * Creates, initializes and returns an instance of DataStoreParameters given
+	 * the name with which their provider is registered.
+	 * 
+	 * @param name
+	 *            provider name
+	 * 
+	 * @throws ProviderNotRegisteredException
+	 *             if the memory provider is not registered
+	 * @throws InitializeException
+	 *             if there is an error initializing the parameters for the
+	 *             memory provider
+	 **/
+	public DataStoreParameters createStoreParameters(String name)
+			throws InitializeException, ProviderNotRegisteredException;
+
+	/**
+	 * 
+	 * Creates, initializes and returns an instance of NewDataStoreParameters
+	 * given the name with which their provider is registered.
+	 * 
+	 * @param name
+	 * 
+	 * @throws InitializeException
+	 * @throws ProviderNotRegisteredException
+	 */
+	public NewDataStoreParameters createNewStoreParameters(String explorer, String provider)
+			throws InitializeException, ProviderNotRegisteredException;
+
+	/**
+	 * 
+	 * Creates, initializes and returns an instance of DataStore given the
+	 * DataStoreParameters.
+	 * 
+	 * @param parameters
+	 *            parameters used to instantiate and initialize the DataStore
+	 * 
+	 * @throws ProviderNotRegisteredException
+	 *             if the memory provider is not registered
+	 * @throws InitializeException
+	 *             if there is an error initializing the parameters for the
+	 *             memory provider
+	 * @throws ValidateDataParametersException
+	 *             if the parameters to open the memory based store are not
+	 *             valid
+	 */
+	public DataStore openStore(String provider, DataStoreParameters parameters)
+			throws InitializeException, ProviderNotRegisteredException,
+			ValidateDataParametersException;
+
+	/**
+	 * @deprecated see openStore
+	 */
+	public DataStore createStore(DataStoreParameters parameters)
+			throws InitializeException, ProviderNotRegisteredException,
+			ValidateDataParametersException;
+
+	/**
+	 * Create a new physical store 
+	 *  
+	 * @param parameters
+	 *
+	 * @throws InitializeException
+	 * @throws ProviderNotRegisteredException
+	 * @throws ValidateDataParametersException
+	 */
+	public void newStore(String explorer, String provider, NewDataStoreParameters parameters, boolean overwrite)
+			throws InitializeException, ProviderNotRegisteredException,
+			ValidateDataParametersException;
+
+	/**
+	 * Returns a list of Strings containing the names of all available DataStore
+	 * providers.
+	 *
+	 * @return list of String containing available DataStore provider names
+	 */
+	public List getStoreProviders();
+
+	/**
+	 * Returns a list of Strings containing the names of all available DataStore
+	 * providers for an explorer.
+	 * 
+	 * @param explorer
+	 *            name
+	 */
+	public List getStoreProviders(String name);
+
+	/*
+	 * ====================================================================
+	 *
+	 * Explorer related services
+	 */
+	/**
+	 * Returns an instance of {@link DataServerExplorerParameters} corresponding to
+	 * the given name.
+	 *
+	 * @param name
+	 *            name of a registered server explorer provider
+	 *
+	 * @throws InitializeException
+	 * 			if parameter initialization causes an error.
+	 *
+	 * @throws ProviderNotRegisteredException
+	 * 			if could not find a provider by the given name.
+	 *
+	 **/
+	public DataServerExplorerParameters createServerExplorerParameters(
+			String name)
+			throws InitializeException, ProviderNotRegisteredException;
+
+	/**
+	 * Returns an instance of {@link DataServerExplorer} given its parameters.
+	 *
+	 * @param parameters
+	 *            parameters used to instantiate and initialize the
+	 *            {@link DataServerExplorer}.
+	 *
+	 * @return an instance of {@link DataServerExplorer}.
+	 *
+	 * @throws InitializeException
+	 *
+	 * @throws ProviderNotRegisteredException
+	 * @throws ValidateDataParametersException
+	 */
+	public DataServerExplorer openServerExplorer(
+			String name,
+			DataServerExplorerParameters parameters)
+			throws InitializeException, ProviderNotRegisteredException,
+			ValidateDataParametersException;
+
+	/**
+	 * @deprecated see openServerExplorer
+	 */
+	public DataServerExplorer createServerExplorer(
+			DataServerExplorerParameters parameters)
+			throws InitializeException, ProviderNotRegisteredException,
+			ValidateDataParametersException;
+
+	/**
+	 * Returns a list of String containing the names of the available
+	 * DataServerExplorer providers.
+	 *
+	 * @return list of String containing the names of the available
+	 *         DataServerExplorer providers.
+	 */
+	public List getExplorerProviders();
+
+	/*
+	 * ====================================================================
+	 *
+	 * Expression evaluation related services
+	 */
+
+	/**
+	 * Registers the default expression evaluator. It is used by DAL to evaluate
+	 * and resolve query filters and expressions.
+	 *
+	 * @param evaluator
+	 *            Class that will be called to evaluate the expression. It must
+	 *            implement {@link Evaluator}.
+	 */
+	public void registerDefaultEvaluator(Class evaluator);
+
+	/**
+	 * Creates an instance of Evaluator that represents the given expression.
+	 *
+	 * @param expression
+	 *            String containing a CQL expression.
+	 * @return instance of Evaluator representing the given expression.
+	 * @throws InitializeException
+	 */
+	public Evaluator createExpresion(String expression)
+			throws InitializeException;
+
+	/*
+	 * ====================================================================
+	 *
+	 * Index related services
+	 */
+
+
+	/**
+	 * Returns a list of String containing the names of the available index providers.
+	 *
+	 * @return
+	 * 		list of strings with the names of the available index providers
+	 */
+	public List getFeatureIndexProviders();
+
+	/**
+	 * Sets the default DataIndexProvider for the given data type.
+	 *
+	 * @param dataType
+	 * 				one of the data types defined in {@link DataTypes}.
+	 * @param name
+	 * 			Provider's name
+	 */
+    public void setDefaultFeatureIndexProviderName(int dataType, String name);
+
+	/**
+	 * Returns the default DataIndexProvider name, given a data type. Data types
+	 * are defined in {@link DataTypes}.
+	 *
+	 * @param dataType
+	 *            one of the constants in {@link DataTypes}.
+	 *
+	 * @return
+	 * 		the name of the default {@link FeatureIndexProvider} if there is
+	 * 		anyone available for the given data type.
+	 */
+    public String getDefaultFeatureIndexProviderName(int dataType);
+
+    /**
+	 * Returns a list of String containing the names of the available cache providers.
+	 *
+	 * @return
+	 * 		list of strings with the names of the available cache providers
+	 */    
+    public List getFeatureCacheProviders();
+
+	/**
+	 * Returns an instance of {@link DataServerExplorerParameters} corresponding
+	 * to the given name used by the cache to create a store to save the
+	 * retrieved data.
+	 * 
+	 * @param name
+	 *            name of a registered feature cache provider
+	 * 
+	 * @throws InitializeException
+	 *             if parameter initialization causes an error.
+	 * 
+	 * @throws ProviderNotRegisteredException
+	 *             if could not find a cache provider by the given name.
+	 * 
+	 */
+	public DynObject createCacheParameters(String name)
+			throws InitializeException, ProviderNotRegisteredException;
+
+	/**
+	 * Utility method to create the {@link DataStoreParameters} to create a
+	 * {@link FeatureStore} based on the {@link MemoryStoreProvider}.
+	 * 
+	 * @param autoOrderAttributeName
+	 *            the name of the {@link Feature} attribute to be used to order
+	 *            the store {@link Feature}s by default. Set to null if you
+	 *            don't want any order by default
+	 * @return the parameters for the memory based store
+	 * @throws InitializeException
+	 *             if there is an error initializing the parameters for the
+	 *             memory provider
+	 */
+	public DataStoreParameters createMemoryStoreParameters(
+			String autoOrderAttributeName) throws InitializeException;
+
+	/**
+	 * Utility method to create the a {@link FeatureStore} based on the
+	 * {@link MemoryStoreProvider}.
+	 * 
+	 * @param autoOrderAttributeName
+	 *            the name of the {@link Feature} attribute to be used to order
+	 *            the store {@link Feature}s by default. Set to null if you
+	 *            don't want any order by default
+	 * @return the the memory based store
+	 * @throws InitializeException
+	 *             if there is an error initializing the parameters for the
+	 *             memory provider
+	 */
+	public FeatureStore createMemoryStore(String autoOrderAttributeName)
+			throws InitializeException;
+
+    /**
+     * Creates a {@link FeaturePagingHelper} to paginate data from a
+     * {@link FeatureStore}.
+     * 
+     * @param featureStore
+     *            to get the {@link Feature}s from
+     * @param pageSize
+     *            the page size
+     * @return a {@link FeaturePagingHelper}
+     * @throws BaseException
+     *             if there is an error creating the helper
+     */
+	public FeaturePagingHelper createFeaturePagingHelper(
+        FeatureStore featureStore, int pageSize) throws BaseException;
+
+	/**
+     * Creates a {@link FeaturePagingHelper} to paginate data from a
+     * {@link FeatureStore}.
+     * 
+     * @param featureStore
+     *            to get the {@link Feature}s from
+     * @param featureQuery
+     *            to filter and/or order the data
+     * @param pageSize
+     *            the page size
+     * @return a {@link FeaturePagingHelper}
+     * @throws BaseException
+     *             if there is an error creating the helper
+     */
+	public FeaturePagingHelper createFeaturePagingHelper(
+			FeatureStore featureStore, FeatureQuery featureQuery, int pageSize)
+        throws BaseException;
+	
+	/**
+	 * Registers a class that can be used to create a {@link FeatureAttributeGetter}
+	 * and associate it to a {@link FeatureAttributeDescriptor}.
+	 * 
+   	 * @param name
+   	 *             the name used to register the class.
+	 * @param clazz
+	 *             it has to be an instance of {@link FeatureAttributeDescriptor}         
+	 */
+	public void registerFeatureAttributeGetter(String name, Class clazz);
+	
+	/**
+	 * Creates a {@link FeatureAttributeGetter} by name. If there is not any class
+	 * registered with this name or if there is any error an exception is thrown.
+	 * 
+	 * @param name
+	 *             the name that was used to register the class              
+	 * @return
+	 *             a {@link FeatureAttributeGetter}
+	 * @throws InitializeException
+	 *             if there is any error creating the object
+	 */
+	public FeatureAttributeGetter createFeatureAttributeGetter(String name) throws InitializeException;
+	
+	public void setOpenErrorHandler(OpenErrorHandler handler);
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java	(revision 35988)
@@ -0,0 +1,45 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal;
+
+/**
+ * DataServerExplorer parameter container. Provides a way to obtain the name 
+ * of the specific data explorer type described by this parameters.
+ * 
+ */
+public interface DataServerExplorerParameters extends DataParameters {
+
+	/**
+	 * Returns the name of the data explorer type of the DataServerExplorer
+	 * represented by this DataServerExplorerParameters
+	 * 
+	 * @return a String containing the name of the data explorer type
+	 */
+	public String getExplorerName();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java	(revision 35988)
@@ -0,0 +1,164 @@
+package org.gvsig.fmap.dal.resource;
+
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
+
+/**
+ * Encapsulates a system resource (file, database connection, etc). 
+ * It is used to manage usage and availability of shared system 
+ * resources. This interface allows monitoring a resource and helps 
+ * preventing dead locks on it as well as being freed as soon as
+ * it is not being used.
+ * 
+ * Data providers can provide implementations for their own resources. This
+ * is specially interesting when resources require a specific treatment
+ * beyond the standard shared file or connection, for instance to manage 
+ * connections to a server through its own connection pool.
+ */
+public interface Resource {
+
+	/**
+	 * Returns the resource's name.
+	 * 
+	 * @return resource's name
+	 * 
+	 * @throws AccessResourceException
+	 */
+	public String getName() throws AccessResourceException;
+
+	/**
+	 * Returns the resource parameters. These parameters contain
+	 * all the necessary information to access the resource.
+	 * 
+	 * @return resource parameters.
+	 */
+	public ResourceParameters getParameters();
+
+	/**
+	 * Returns the date and time in which this resource was opened for the last
+	 * time.
+	 * 
+	 * @return date and time in which this resource was opened for the last
+	 *         time, in milliseconds.
+	 */
+	public long getLastTimeOpen();
+
+	/**
+	 * Returns the date and time in which this resource was accessed for the
+	 * last time.
+	 * 
+	 * @return date and time in which this resource was accessed for the last
+	 *         time, in milliseconds.
+	 */
+	public long getLastTimeUsed();
+
+	/**
+	 * Returns whether this resource is already in use by someone.
+	 * 
+	 * @return
+	 * 		true if this resource is in use, false if not.
+	 */
+	public boolean inUse();
+
+	/**
+	 * Returns whether this resource is opened.
+	 * 
+	 * @return
+	 * 		true if this resource is opened, false if not.
+	 */
+	public boolean isOpen();
+
+	/**
+	 * Returns the number of times this resource has been opened 
+	 * since it was created.
+	 * 
+	 * @return 
+	 * 		number of times this resource has been opened 
+	 * since it was created.
+	 */
+	public int openCount();
+
+	/**
+	 * Executes an action which uses the current {@link Resource}.
+	 * 
+	 * @param runnable
+	 *            to execute
+	 * @return the action return value
+	 * @throws ResourceException
+	 *             if there is an error executing the action
+	 */
+	public Object execute(ResourceAction action)
+			throws ResourceExecuteException;
+
+	/**
+	 * If the resource is not in use, calling this method will send a close request 
+	 * to all consumers referencing this resource. If the resource is in use, 
+	 * calling this method will do nothing.
+	 * 
+	 * @throws ResourceException
+	 */
+	public void closeRequest() throws ResourceException;
+
+	/**
+	 * Adds a consumer to this resource. This will create a weak reference 
+	 * to the consumer in this resource's consumer list.
+	 * 
+	 * @param consumer
+	 * 				the consumer that will be added to this resource's consumer list.
+	 */
+	public void addConsumer(ResourceConsumer consumer);
+
+	/**
+	 * Removes a consumer from this resource's consumer list.
+	 * 
+	 * @param consumer
+	 * 				the consumer that will be removed.
+	 */
+	public void removeConsumer(ResourceConsumer consumer);
+
+	/**
+	 * Returns this resource's current number of consumers.
+	 * 
+	 * @return
+	 * 		current number of consumers of this resource.
+	 */
+	public int getConsumersCount();
+	
+	/**
+	 * Returns an object that represents the resource. The actual type
+	 * depends on the resource provider. It could be a string with a 
+	 * descriptive name or something more elaborated.
+	 * 
+	 * @return
+	 * 		an object that represents the resource.
+	 * 
+	 * @throws AccessResourceException
+	 */
+	public Object get() throws AccessResourceException;
+
+	/**
+	 * Returns a custom object containing extended data relative to 
+	 * this resource.
+	 * 
+	 * This is part of a simple mechanism to allow passing further data to 
+	 * the resource that may be necessary for optimal treatment.
+	 * 
+	 * @return
+	 * 		data related to this resource
+	 */
+	public Object getData();
+
+	/**
+	 * Sets a custom object as this resource's extended data.
+     *
+	 * This is part of a simple mechanism to allow passing further data to 
+	 * the resource that may be necessary for optimal treatment.
+	 *
+	 * @param data
+	 * 			a custom object containing data related to this resource.
+	 */
+	public void setData(Object data);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java	(revision 35988)
@@ -0,0 +1,22 @@
+package org.gvsig.fmap.dal.resource;
+
+import org.gvsig.fmap.dal.DataParameters;
+
+/**
+ * Interface that contains any resource parameters.
+ * Each specific subtype of resource will extend this
+ * interface with its own relevant parameters.
+ *
+ */
+public interface ResourceParameters extends DataParameters {
+
+	/**
+	 * Returns the type name of the related resource.
+	 * 
+	 * @return
+	 * 		type name of the resource.
+	 */
+	public String getTypeName();
+
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java	(revision 35988)
@@ -0,0 +1,38 @@
+package org.gvsig.fmap.dal.resource.spi;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+
+public interface ResourceManagerProviderServices extends ResourceManager {
+
+	public boolean register(String type, String description, Class handler,
+			Class params);
+
+	public DataParameters createParameters(String type)
+			throws InitializeException;
+
+	public ResourceProvider createAddResource(ResourceParameters params)
+			throws InitializeException;
+
+	public ResourceProvider createResource(ResourceParameters params)
+			throws InitializeException;
+
+	public ResourceProvider createAddResource(String type, Object[] params)
+			throws InitializeException;
+
+	public ResourceProvider createResource(String type, Object[] params)
+			throws InitializeException;
+
+	public void remove(Resource resource) throws DataException;
+
+	public void remove(String name) throws DataException;
+	
+	public List getResourceProviders();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java	(revision 35988)
@@ -0,0 +1,246 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.dal.resource.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.PrepareResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyDisposeException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Resource implementation which is able to show an unique interface to a group
+ * of Resources.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class MultiResource extends AbstractResource {
+
+	public static final String TYPE_NAME = "multi";
+
+	public static final String DESCRIPTION = "Group of multiple resources";
+
+	private static final Logger LOG =
+			LoggerFactory.getLogger(MultiResource.class);
+
+	private List resources = new ArrayList();
+
+	// Initially, the first one
+	private int defaultResourcePos = 0;
+
+	/**
+	 * Creates a new {@link MultiResource} from the given parameters.
+	 * 
+	 * @param parameters
+	 *            to create the resource from
+	 * @throws InitializeException
+	 *             if there is an error creating the resource
+	 */
+	public MultiResource(MultiResourceParameters parameters)
+			throws InitializeException {
+		super(parameters);
+	}
+
+	private List getResources() {
+		return resources;
+	}
+
+	/**
+	 * Adds a new {@link ResourceProvider} to the list of Resources managed by
+	 * this group.
+	 * 
+	 * @param parameters
+	 *            to create the resource from
+	 * @param defaultResource
+	 *            if the added resource is to be used as the multi resource
+	 *            default one
+	 * @throws InitializeException
+	 *             if there is an error adding the resource
+	 */
+	public void addResource(ResourceParameters parameters,
+			boolean defaultResource) throws InitializeException {
+		ResourceProvider resourceProvider =
+				((ResourceManagerProviderServices) DALLocator.getResourceManager()).createResource(parameters);
+		resources.add(resourceProvider);
+		if (defaultResource) {
+			defaultResourcePos = resources.size() - 1;
+		}
+	}
+
+	/**
+	 * Adds a new {@link ResourceProvider} to the list of Resources managed by
+	 * this group.
+	 * 
+	 * @param name
+	 *            of the resource to add
+	 * @param params
+	 *            parameters to create the resource with
+	 * @param defaultResource
+	 *            if the added resource is to be used as the multi resource
+	 *            default one
+	 * @throws InitializeException
+	 *             if there is an error adding the resource
+	 */
+	public void addResource(String name, Object[] params,
+			boolean defaultResource) throws InitializeException {
+		ResourceProvider resourceProvider =
+				((ResourceManagerProviderServices) DALLocator.getResourceManager()).createResource(
+						name, params);
+		resources.add(resourceProvider);
+		if (defaultResource) {
+			defaultResourcePos = resources.size() - 1;
+		}
+	}
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException {
+		if (parameters instanceof MultiResourceParameters) {
+			MultiResourceParameters multiParams =
+					(MultiResourceParameters) parameters;
+			return multiParams.getName() != null
+					&& multiParams.getName().equals(
+							getMultiResourceParameters().getName());
+		}
+
+		return false;
+	}
+
+	public void notifyChanges() throws ResourceNotifyChangesException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).notifyChanges();
+		}
+	}
+
+	public void notifyClose() throws ResourceNotifyCloseException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).notifyClose();
+		}
+	}
+
+	public void notifyDispose() throws ResourceNotifyDisposeException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).notifyDispose();
+		}
+	}
+
+	public void notifyOpen() throws ResourceNotifyOpenException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).notifyOpen();
+		}
+	}
+
+	public void prepare() throws PrepareResourceException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).prepare();
+		}
+	}
+
+	public void closeRequest() throws ResourceException {
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			((ResourceProvider) getResources().get(i)).closeRequest();
+		}
+	}
+
+	public Object get() throws AccessResourceException {
+		ResourceProvider defaultResource = getDefaultResource();
+		if (defaultResource == null) {
+			return null;
+		} else {
+			return defaultResource.get();
+		}
+	}
+
+	public Object getData() {
+		ResourceProvider defaultResource = getDefaultResource();
+		if (defaultResource == null) {
+			return null;
+		} else {
+			return defaultResource.getData();
+		}
+	}
+
+	private MultiResourceParameters getMultiResourceParameters() {
+		return (MultiResourceParameters) getParameters();
+	}
+
+	public String getName() throws AccessResourceException {
+		StringBuffer buffer =
+				new StringBuffer().append("MultiResource ").append(
+						getMultiResourceParameters().getName()).append(":: ");
+		List resources = getResources();
+		for (int i = 0; i < resources.size(); i++) {
+			buffer.append(((ResourceProvider) resources.get(i)).getName());
+			if (defaultResourcePos == i) {
+				buffer.append(" (default)");
+			}
+			if (i < resources.size() - 1) {
+				buffer.append(", ");
+			}
+		}
+		return buffer.toString();
+	}
+
+	public String toString() {
+		try {
+			return getName();
+		} catch (AccessResourceException e) {
+			LOG.error("Error getting the resource name", e);
+		}
+		return super.toString();
+	}
+
+	private ResourceProvider getDefaultResource() {
+		if (getResources().size() > 0) {
+			return (ResourceProvider) getResources().get(defaultResourcePos);
+		} else {
+			return null;
+		}
+	}
+
+	public void setData(Object data) {
+		ResourceProvider defaultResource = getDefaultResource();
+		if (defaultResource != null) {
+			defaultResource.setData(data);
+		}
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java	(revision 35988)
@@ -0,0 +1,27 @@
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.PrepareResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyDisposeException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+
+
+public interface ResourceProvider extends Resource {
+
+	public void notifyOpen() throws ResourceNotifyOpenException;
+
+	public void notifyClose() throws ResourceNotifyCloseException;
+
+	public void notifyDispose() throws ResourceNotifyDisposeException;
+
+	public void notifyChanges() throws ResourceNotifyChangesException;
+
+	public void prepare() throws PrepareResourceException;
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException;
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java	(revision 35988)
@@ -0,0 +1,11 @@
+package org.gvsig.fmap.dal.resource.spi;
+
+
+
+public interface ResourceConsumer {
+
+	public boolean closeResourceRequested(ResourceProvider resource);
+
+	public void resourceChanged(ResourceProvider resource);
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java	(revision 35988)
@@ -0,0 +1,100 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.feature.spi.memory.MemoryResource;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+
+/**
+ * Parameters for the creation of a multi resource.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class MultiResourceParameters extends AbstractResourceParameters {
+
+	public static final String DYNCLASS_NAME = "MultiResourceParameters";
+
+	private static final String FIELD_NAME = "name";
+
+	private DelegatedDynObject delegatedDynObject;
+
+	/**
+	 * Creates a new {@link MultiResourceParameters}.
+	 */
+	public MultiResourceParameters() {
+		this.delegatedDynObject =
+				(DelegatedDynObject) ToolsLocator.getDynObjectManager()
+						.createDynObject(registerDynClass());
+	}
+
+	/**
+	 * Creates a new {@link MultiResourceParameters}.
+	 * 
+	 * @param name
+	 *            for the parameters. Will be used as the name of the
+	 *            {@link MemoryResource} created with this parametres.
+	 */
+	public MultiResourceParameters(String name) {
+		this();
+		setName(name);
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return delegatedDynObject;
+	}
+
+	public String getTypeName() {
+		return MultiResource.TYPE_NAME;
+	}
+
+	public String getName() {
+		return (String) getDelegatedDynObject().getDynValue(FIELD_NAME);
+	}
+
+	public void setName(String name) {
+		getDelegatedDynObject().setDynValue(FIELD_NAME, name);
+	}
+
+	/**
+	 * Registers the {@link DynClass} of this parameters attributes.
+	 * 
+	 * @return the dyn class of this parameters
+	 */
+	private DynClass registerDynClass() {
+		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+		DynClass dynClass = dynman.get(DYNCLASS_NAME);
+		if (dynClass == null) {
+			dynClass = dynman.add(DYNCLASS_NAME);
+			dynClass.addDynFieldString(FIELD_NAME).setDescription(
+					"The name of the multi resource");
+		}
+		return dynClass;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java	(revision 35988)
@@ -0,0 +1,351 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource.spi;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.CopyParametersException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.ResourceNotification;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.PrepareResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyChangesException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyCloseException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyDisposeException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
+import org.gvsig.fmap.dal.resource.impl.DefaultResourceNotification;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+
+/**
+ * <p>
+ * Base implementation for Resource
+ * </p>
+ * 
+ * <p>
+ * This implementation not define the {@link Resource#begin()} and
+ * {@link Resource#end()}
+ * </p>
+ * 
+ * @author jmvivo
+ * 
+ */
+public abstract class AbstractResource implements ResourceProvider,
+		WeakReferencingObservable {
+
+	private DelegateWeakReferencingObservable delegateObservable;
+
+	private List consumers;
+
+	private long lastTimeOpen;
+	private long lastTimeUsed;
+
+	private ResourceParameters parameters;
+	private ResourceParameters preparedParameters;
+
+	private Object data;
+
+	private int openCount;
+
+	/**
+	 * Number of times an execute is being simultaneously performed with this
+	 * resource.
+	 */
+	private int executeCount = 0;
+
+	protected final Object lock;
+
+	protected AbstractResource(ResourceParameters parameters)
+			throws InitializeException {
+		consumers = new ArrayList();
+		lastTimeOpen = System.currentTimeMillis();
+		lastTimeUsed = lastTimeOpen;
+
+		openCount = 0;
+
+		preparedParameters = null;
+		delegateObservable = new DelegateWeakReferencingObservable(this);
+		lock = new Object();
+		try {
+			this.parameters = (ResourceParameters) parameters.getCopy();
+		} catch (CopyParametersException e) {
+			throw new InitializeException(e);
+		}
+
+	}
+
+	protected final void updateLastTimeUsed() {
+		lastTimeUsed = System.currentTimeMillis();
+	}
+
+	protected final void updateLastTimeOpen() {
+		lastTimeOpen = System.currentTimeMillis();
+		lastTimeUsed = lastTimeOpen;
+	}
+
+	public final long getLastTimeOpen() {
+		return lastTimeOpen;
+	}
+
+	public final long getLastTimeUsed() {
+		return lastTimeUsed;
+	}
+
+	public final ResourceParameters getParameters() {
+		if (preparedParameters != null) {
+			return preparedParameters;
+		}
+		return this.parameters;
+	}
+
+	public void prepare(ResourceParameters params)
+			throws PrepareResourceException {
+		ResourceNotification notification =
+				new DefaultResourceNotification(this,
+						ResourceNotification.PREPARE, params);
+		this.delegateObservable.notifyObservers(notification);
+	}
+
+	public void prepare() throws PrepareResourceException {
+		if (preparedParameters == null) {
+			try {
+				ResourceParameters params =
+						(ResourceParameters) parameters.getCopy();
+				prepare(params);
+				preparedParameters = params;
+			} catch (CopyParametersException e) {
+				throw new PrepareResourceException(this, e);
+			}
+		}
+
+	}
+
+	public void notifyOpen() throws ResourceNotifyOpenException {
+		this.notifyObserver(ResourceNotification.OPEN);
+		updateLastTimeOpen();
+		openCount++;
+	}
+
+	public void notifyClose() throws ResourceNotifyCloseException {
+		if (openCount <= 0) {
+			throw new IllegalStateException();
+		}
+		this.notifyObserver(ResourceNotification.CLOSE);
+		openCount--;
+	}
+
+	public void notifyChanges() throws ResourceNotifyChangesException {
+		this.notifyObserver(ResourceNotification.CHANGED);
+
+		Iterator it = consumers.iterator();
+		while (it.hasNext()) {
+			ResourceConsumer consumer =
+					(ResourceConsumer) ((WeakReference) it.next()).get();
+			if (consumer != null) {
+				consumer.resourceChanged(this);
+			} else {
+				it.remove();
+			}
+		}
+	}
+
+	public boolean isOpen() {
+		return this.openCount > 0;
+	}
+
+	public int openCount() {
+		return this.openCount;
+	}
+
+	public void addObserver(Observer o) {
+		this.delegateObservable.addObserver(o);
+	}
+
+	public void deleteObserver(Observer o) {
+		this.delegateObservable.deleteObserver(o);
+	}
+
+	public void deleteObservers() {
+		this.delegateObservable.deleteObservers();
+
+	}
+
+	public final void addObservers(BaseWeakReferencingObservable observers) {
+		this.delegateObservable.addObservers(observers);
+	}
+
+	public final void addConsumer(ResourceConsumer consumer) {
+		this.updateConsumersList();
+		consumers.add(new WeakReference(consumer));
+	}
+
+	public final void removeConsumer(ResourceConsumer consumer) {
+		ResourceConsumer cur;
+		Iterator it = consumers.iterator();
+		while (it.hasNext()) {
+			cur = (ResourceConsumer) ((WeakReference) it.next()).get();
+			if (cur == null || (cur == consumer)) {
+				it.remove();
+			}
+		}
+	}
+
+	public int getConsumersCount() {
+		this.updateConsumersList();
+		return consumers.size();
+	}
+
+	private synchronized void updateConsumersList() {
+		Iterator it = consumers.iterator();
+		WeakReference ref;
+		while (it.hasNext()) {
+			ref = (WeakReference) it.next();
+			if (ref.get() == null) {
+				it.remove();
+			}
+		}
+	}
+
+	public void closeRequest() throws ResourceException {
+		if (inUse()) {
+			return;
+		}
+		if (consumers != null) {
+			for (int i = 0; i < consumers.size(); i++) {
+
+			}
+		}
+		if (consumers != null) {
+			Iterator it = consumers.iterator();
+			while (it.hasNext()) {
+				ResourceConsumer consumer =
+						(ResourceConsumer) ((WeakReference) it.next()).get();
+				if (consumer != null) {
+					consumer.closeResourceRequested(this);
+				} else {
+					it.remove();
+				}
+			}
+		}
+	}
+
+	public void setData(Object data) {
+		this.data = data;
+	}
+
+	public Object getData() {
+		return this.data;
+	}
+
+	protected void notifyObserver(String type) {
+		if (delegateObservable != null) {
+			this.delegateObservable.notifyObservers(new DefaultResourceNotification(
+					this, type));
+		}
+	}
+
+	public void notifyDispose() throws ResourceNotifyDisposeException {
+		this.notifyObserver(ResourceNotification.DISPOSE);
+
+		if (consumers != null) {
+			consumers.clear();
+		}
+
+		lastTimeOpen = 0l;
+		lastTimeUsed = 0l;
+
+		data = null;
+
+		if (delegateObservable != null) {
+			delegateObservable.deleteObservers();
+		}
+	}
+
+	public final boolean inUse() {
+		return executeCount > 0;
+	}
+
+	public Object execute(ResourceAction action)
+			throws ResourceExecuteException {
+		Object value = null;
+		synchronized (lock) {
+			executeBegins();
+			try {
+				value = performExecution(action);
+			} catch (Exception e) {
+				throw new ResourceExecuteException(this, e);
+			} finally {
+				executeEnds();
+			}
+		}
+		return value;
+	}
+
+	protected Object performExecution(ResourceAction action) throws Exception {
+		return action.run();
+	}
+
+	protected final void executeBegins() {
+		executeCount++;
+	}
+
+	protected final void executeEnds() {
+		updateLastTimeUsed();
+		executeCount--;
+	}
+
+	/**
+	 * Returns the name of the {@link Resource}.
+	 * 
+	 * @throws AccessResourceException
+	 *             if there is an error while accessing the resource
+	 */
+	public abstract String getName() throws AccessResourceException;
+
+	/**
+	 * Returns the real resource represented by this object.
+	 * 
+	 * @throws AccessResourceException
+	 *             if there is an error while accessing the resource
+	 */
+	public abstract Object get() throws AccessResourceException;
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java	(revision 35988)
@@ -0,0 +1,74 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException;
+
+/**
+ * <p>
+ * Abstract Implementation for Resource that allows the concurrent access.
+ * </p>
+ * 
+ * @author jmvivo
+ * 
+ */
+public abstract class AbstractNonBlockingResource extends AbstractResource {
+
+	/**
+	 * @param parameters
+	 * @throws InitializeException
+	 */
+	public AbstractNonBlockingResource(ResourceParameters parameters)
+			throws InitializeException {
+		super(parameters);
+	}
+
+	public Object execute(ResourceAction action)
+			throws ResourceExecuteException {
+		Object value = null;
+		synchronized (lock) {
+			executeBegins();
+		}
+		try {
+			value = performExecution(action);
+		} catch (Exception e) {
+			throw new ResourceExecuteException(this, e);
+		} finally {
+			synchronized (lock) {
+				executeEnds();
+			}
+		}
+		return value;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java	(revision 35988)
@@ -0,0 +1,10 @@
+package org.gvsig.fmap.dal.resource.spi;
+
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+
+public abstract class AbstractResourceParameters extends AbstractDataParameters
+		implements ResourceParameters {
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java	(revision 35988)
@@ -0,0 +1,97 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource;
+
+
+/**
+ * A resource notification is related to a change in the state of a resource.
+ * It is sent to all resource observers when appropriate. The notification contains
+ * the type of change and access to the resource information.
+ * 
+ * This includes:
+ * 
+ * <ul>
+ * 	<li>A resource has been opened</li>
+ *  <li>A resource has been closed</li>
+ *  <li>A resource has been prepared</li>
+ *  <li>A resource property has been changed</li>
+ *  <li>A resource is being disposed</li>
+ *  <li>A resource is being opened</li>
+ *  <li>A resource is being closed</li>
+ * </ul>	
+ * 
+ * @author jmvivo
+ */
+public interface ResourceNotification {
+
+	/** A resource has been opened */
+	public static final String OPENED = "Opened_Resource";
+	/** A resource has been closed */
+	public static final String CLOSED = "Closed_Resource";
+	/** A resource has been prepared */
+	public static final String PREPARE = "Prepare_Resource";
+	/** A resource property has been changed */
+	public static final String CHANGED = "Changed_Resource";
+	/** A resource is being disposed */
+	public static final String DISPOSE = "Begin_Dispose_Resource";
+	/** A resource is being opened */
+	public static final String OPEN = "Begin_Open_Resource";
+	/** A resource is being closed */
+	public static final String CLOSE = "Begin_Close_Resource";
+
+	/**
+	 * Returns the parameters of the resource that caused
+	 * this notification.
+	 * 
+	 * @return
+	 * 		the parameters of this notification's source
+	 */
+	public ResourceParameters getParameters();
+	
+	/**
+	 * Returns the resource that caused this notification.
+	 * 
+	 * @return
+	 * 		this notification's source
+	 */
+	public Resource getResource();
+	
+	/**
+	 * Returns the type of this notification.
+	 * 
+	 * @return
+	 * 		this notification's type. For the allowed values see the 
+	 * constants defined in this interface.
+	 */
+	public String getType();
+
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature.resource.exception package documentation</title>
+</head>
+<body>
+
+<p>Provides DAL's resource level exceptions.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class ResourceNotClosedOnDisposeManagerException extends ResourceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4030443484190503144L;
+	private final static String MESSAGE_FORMAT = "The '%(resource)' still open when the manager begin to dispose.";
+	private final static String MESSAGE_KEY = "_ResourceNotClosedOnDisposeManagerException";
+
+	public ResourceNotClosedOnDisposeManagerException(Resource resource) {
+		super(resource, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class ResourceNotifyOpenException extends ResourceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1114089673521505999L;
+	private final static String MESSAGE_FORMAT = "Resource '%(resource)s' changed.";
+	private final static String MESSAGE_KEY = "_ResourceNotifyOpenException";
+
+	public ResourceNotifyOpenException(Resource resource) {
+		super(resource, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.exception.DataListException;
+
+public class DisposeResorceManagerException extends DataListException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -1818272776768733342L;
+
+	private final static String MESSAGE_FORMAT = "Exception disposing.";
+	private final static String MESSAGE_KEY = "_DisposeResorceManagerException";
+
+	public DisposeResorceManagerException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class PrepareResourceException extends ResourceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2198478752691400900L;
+	private final static String MESSAGE_FORMAT = "Exception preparing '%(resource)s'.";
+	private final static String MESSAGE_KEY = "_PrepareResourceException";
+
+	public PrepareResourceException(Resource resource, Throwable cause) {
+		super(resource, MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+
+public class ResourceNotRegisteredException extends InitializeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3783563399272946137L;
+	private final static String MESSAGE_FORMAT = "The '%(resourceType)' resource type is not registered.";
+	private final static String MESSAGE_KEY = "_ResourceNotRegisteredException";
+
+	public ResourceNotRegisteredException(String resourceType) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.values.put("resourceType", resourceType);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class ResourceNotifyCloseException extends ResourceException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -805056352573291250L;
+	private final static String MESSAGE_FORMAT = "Resource '%(resource)s' changed.";
+	private final static String MESSAGE_KEY = "_ResourceNotifyCloseExceptionn";
+
+	public ResourceNotifyCloseException(Resource resource) {
+		super(resource, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java	(revision 35988)
@@ -0,0 +1,61 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.resource.Resource;
+
+public abstract class ResourceException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1L;
+
+	protected Map values = new HashMap();
+
+	private Resource resource;
+
+	public ResourceException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public ResourceException(String messageFormat, String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+	public ResourceException(Resource resource, String messageFormat,
+			Throwable cause, String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+		this.resource = resource;
+		try {
+			setValue("resource", resource.getName());
+		} catch (AccessResourceException e) {
+			setValue("resource", "unknow");
+		}
+	}
+
+	public ResourceException(Resource resource, String messageFormat,
+			String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+		this.resource = resource;
+		try {
+			setValue("resource", resource.getName());
+		} catch (AccessResourceException e) {
+			setValue("resource", "unknow");
+		}
+	}
+
+	public Resource getResource() {
+		return resource;
+	}
+
+	protected void setValue(String name, String value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java	(revision 35988)
@@ -0,0 +1,16 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class ResourceNotifyDisposeException extends ResourceException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7470242143471869600L;
+	private final static String MESSAGE_FORMAT = "Resource '%(resource)s' changed.";
+	private final static String MESSAGE_KEY = "_ResourceNotifyDisposeException";
+
+	public ResourceNotifyDisposeException(Resource resource) {
+		super(resource, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+public class AccessResourceException extends ResourceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4409107196914175174L;
+	private final static String MESSAGE_FORMAT = "Error while atemp to access resource '%(resource)'.";
+	private final static String MESSAGE_KEY = "_AccessResourceException";
+
+	public AccessResourceException(Resource resource, Throwable cause) {
+		super(resource, MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java	(revision 35988)
@@ -0,0 +1,50 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+
+
+
+public class ResourceNotifyChangesException extends ResourceException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -2048575104684692260L;
+	private final static String MESSAGE_FORMAT = "Resource '%(resource)s' changed.";
+	private final static String MESSAGE_KEY = "_ResourceNotifyChangesException";
+
+	public ResourceNotifyChangesException(Resource resource) {
+		super(resource, MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java	(revision 35988)
@@ -0,0 +1,52 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.resource.exception;
+
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+/**
+ * Exception thrown when there is an error in the
+ * {@link Resource#execute(org.gvsig.fmap.dal.resource.ResourceAction)} method.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ResourceExecuteException extends BaseRuntimeException {
+
+	private static final long serialVersionUID = 1879135914687984787L;
+	private final static String MESSAGE_FORMAT =
+			"Error while executing an action in resource '%(resource)'.";
+	private final static String MESSAGE_KEY = "_ResourceExecuteException";
+
+	/**
+	 * Create a new {@link ResourceExecuteException}.
+	 * 
+	 * @param resource
+	 *            the resource where the exception was produced
+	 * @param cause
+	 *            the original cause of the exception
+	 */
+	public ResourceExecuteException(Resource resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.resource package documentation</title>
+</head>
+<body>
+
+<p>Provides API for system resource management.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java	(revision 35988)
@@ -0,0 +1,363 @@
+package org.gvsig.fmap.dal.resource.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Map.Entry;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.exception.CopyParametersException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.DisposeResorceManagerException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotClosedOnDisposeManagerException;
+import org.gvsig.fmap.dal.resource.exception.ResourceNotRegisteredException;
+import org.gvsig.fmap.dal.resource.spi.AbstractResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class DefaultResourceManager implements ResourceManagerProviderServices {
+
+	final static private String DATA_MANAGER_RESOURCE = "Data.manager.resources";
+	final static private String DATA_MANAGER_RESOURCE_PARAMS = "Data.manager.resources.params";
+
+	// FIXME: rellenar las cadenas
+	private static final String DATA_MANAGER_RESOURCE_DESCRIPTION = "DAL Resources types";
+	private static final String DATA_MANAGER_RESOURCE_PARAMS_DESCRIPTION = "DAL Resources types Parameters";
+
+	private Map resources = new HashMap();
+
+	private DelegateWeakReferencingObservable delegateObservable = new DelegateWeakReferencingObservable(this);
+
+	private Timer timer = null;
+	private Logger logger;
+
+	private long mlsecondsToBeIdle = 0;
+
+	public DefaultResourceManager() {
+		/*
+		 * Create te extensions point in te registry.
+		 */
+		ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_RESOURCE,
+				DATA_MANAGER_RESOURCE_DESCRIPTION);
+
+		ToolsLocator.getExtensionPointManager().add(
+				DATA_MANAGER_RESOURCE_PARAMS,
+				DATA_MANAGER_RESOURCE_PARAMS_DESCRIPTION);
+	}
+
+	public Logger getLogger() {
+		if (this.logger == null) {
+			this.logger = LoggerFactory.getLogger(this.getClass());
+		}
+		return this.logger;
+	}
+
+	public synchronized void remove(Resource resource)
+			throws DataException {
+		remove(resource.getName());
+	}
+
+	public synchronized void remove(String name)
+			throws DataException {
+		ResourceProvider res = (ResourceProvider) this.resources.get(name);
+		if (res == null){
+			throw new IllegalArgumentException("Resource not register:" + name);
+		}
+		if (res.getConsumersCount() < 1) {
+			this.resources.remove(name);
+			res.notifyDispose();
+		}
+		res = null;
+	}
+
+	public Resource getResource(String key){
+		return (Resource)this.resources.get(key);
+	}
+
+	public Iterator iterator(){
+		return this.resources.values().iterator();
+	}
+
+	public void addObserver(Observer o) {
+		// TODO a�adir el observador a los recursos que ya existiesen
+		this.delegateObservable.addObserver(o);
+	}
+
+	public void deleteObserver(Observer o) {
+		this.delegateObservable.deleteObserver(o);
+	}
+
+	public void deleteObservers() {
+		this.delegateObservable.deleteObservers();
+	}
+
+	public synchronized void collectResources() throws
+			DataException {
+		ResourceProvider res;
+		Iterator iter = this.resources.entrySet().iterator();
+		while (iter.hasNext()) {
+			Entry entry = (Entry) iter.next();
+			res = (ResourceProvider) entry.getValue();
+			if (res.getConsumersCount() < 1) {
+				res.closeRequest();
+				res.notifyDispose();
+				iter.remove();
+				continue;
+			}
+			if (mlsecondsToBeIdle > 0
+					&& System.currentTimeMillis()
+							- res.getLastTimeUsed() > mlsecondsToBeIdle) {
+
+			}
+
+		}
+	}
+
+	private AbstractResource findResource(ResourceParameters params) {
+		AbstractResource res;
+		Iterator iter = this.resources.values().iterator();
+		while (iter.hasNext()) {
+			res = (AbstractResource) iter.next();
+			try {
+				if (res.isThis(params)) {
+					return res;
+				}
+			} catch (ResourceException e) {
+				getLogger()
+						.warn(
+								"Se ha producido un error comprobando si se puede reutilizar el recurso.",
+								e);
+			} catch (CopyParametersException e) {
+				getLogger()
+						.warn(
+								"Se ha producido un error comprobando si se puede reutilizar el recurso.",
+								e);
+			}
+		}
+		return null;
+	}
+
+	private AbstractResource addResource(AbstractResource resource)
+			throws AccessResourceException {
+		resources.put(resource.getName(), resource);
+		resource.addObservers(this.delegateObservable);
+		return resource;
+	}
+
+	public void startResourceCollector(long milis, Observer observer) {
+		if (this.timer == null){
+			this.timer = new Timer();
+		} else{
+			this.timer.cancel();
+		}
+		// TODO observer
+		this.timer.scheduleAtFixedRate(new TimerTask() {
+
+
+			public void run() {
+				try {
+					DALLocator.getResourceManager().collectResources();
+				} catch (DataException e) {
+					// TODO Notificar con el observer
+				}
+			}
+
+		}, milis, milis);
+	}
+
+	public void stopResourceCollector() {
+		if (this.timer != null) {
+			this.timer.cancel();
+		}
+
+	}
+
+	public DataParameters createParameters(String type, Object[] args)
+			throws InitializeException {
+		try {
+			DataParameters parameters;
+			if (args == null) {
+				parameters = (DataParameters) ToolsLocator.getExtensionPointManager()
+						.get(
+						DATA_MANAGER_RESOURCE_PARAMS).create(type);
+			} else {
+
+				parameters = (DataParameters) ToolsLocator.getExtensionPointManager()
+						.get(DATA_MANAGER_RESOURCE_PARAMS).create(type, args);
+			}
+			if (parameters == null){
+				throw new ResourceNotRegisteredException(type);
+			}
+			return parameters;
+		} catch (InstantiationException e) {
+			throw new InitializeException(type, e);
+		} catch (IllegalAccessException e) {
+			throw new InitializeException(type, e);
+		} catch (SecurityException e) {
+			throw new InitializeException(type, e);
+		} catch (IllegalArgumentException e) {
+			throw new InitializeException(type, e);
+		} catch (NoSuchMethodException e) {
+			throw new InitializeException(type, e);
+		} catch (InvocationTargetException e) {
+			throw new InitializeException(type, e);
+		}
+	}
+
+	public DataParameters createParameters(String type)
+			throws InitializeException {
+		return createParameters(type, null);
+	}
+
+	public ResourceProvider createAddResource(String type, Object[] params)
+			throws InitializeException {
+		return createAddResource((ResourceParameters) createParameters(type,
+				params));
+	}
+
+	public ResourceProvider createResource(String type, Object[] params)
+			throws InitializeException {
+		return createResource((ResourceParameters) createParameters(type,
+				params));
+	}
+
+	public ResourceProvider createResource(ResourceParameters params)
+			throws InitializeException {
+		AbstractResource resource = this.findResource(params);
+		if (resource != null) {
+			return resource;
+		}
+
+		try {
+
+			resource = (AbstractResource) ToolsLocator
+					.getExtensionPointManager().get(DATA_MANAGER_RESOURCE)
+					.create(
+							params.getTypeName(), new Object[] { params }
+				);
+			if (resource == null) {
+				throw new ResourceNotRegisteredException(params.getTypeName());
+			}
+		} catch (InstantiationException e) {
+			throw new InitializeException(e);
+		} catch (IllegalAccessException e) {
+			throw new InitializeException(e);
+		} catch (SecurityException e) {
+			throw new InitializeException(e);
+		} catch (IllegalArgumentException e) {
+			throw new InitializeException(e);
+		} catch (NoSuchMethodException e) {
+			throw new InitializeException(e);
+		} catch (InvocationTargetException e) {
+			throw new InitializeException(e);
+		}
+
+		return resource;
+	}
+
+	public ResourceProvider createAddResource(ResourceParameters params)
+			throws InitializeException {
+
+		try {
+			return addResource((AbstractResource) createResource(params));
+		} catch (AccessResourceException e) {
+			throw new InitializeException(params.getTypeName(), e);
+		}
+	}
+
+	public boolean register(String type, String description,
+			Class resourceHandler, Class resourceParams) {
+
+
+		ToolsLocator.getExtensionPointManager().add(DATA_MANAGER_RESOURCE,
+				DATA_MANAGER_RESOURCE_DESCRIPTION).append(type, description,
+						resourceHandler);
+
+		ToolsLocator.getExtensionPointManager().add(
+				DATA_MANAGER_RESOURCE_PARAMS,
+				DATA_MANAGER_RESOURCE_PARAMS_DESCRIPTION).append(type,
+				description, resourceParams);
+
+		return true;
+	}
+
+	public List getResourceProviders() {
+		return ToolsLocator.getExtensionPointManager().get(
+				DATA_MANAGER_RESOURCE).getNames();
+	}
+
+	public void closeResources() throws DataException {
+		this.collectResources();
+		Resource res;
+		Iterator iter = this.resources.values().iterator();
+		while (iter.hasNext()) {
+			res = (Resource) iter.next();
+			res.closeRequest();
+		}
+	}
+
+	public void dispose() throws DisposeResorceManagerException {
+		DisposeResorceManagerException exception = new DisposeResorceManagerException();
+
+		try {
+			this.collectResources();
+		} catch (DataException e) {
+			exception.add(e);
+		}
+		Resource res;
+		Iterator iter = this.resources.values().iterator();
+		while (iter.hasNext()) {
+			res = (Resource) iter.next();
+			try {
+				res.closeRequest();
+				if (res.openCount() > 0) {
+					exception
+							.add(new ResourceNotClosedOnDisposeManagerException(
+									res));
+				}
+				iter.remove();
+			} catch (ResourceException e) {
+				exception.add(e);
+			}
+		}
+
+		this.resources = null;
+		this.delegateObservable.deleteObservers();
+		this.delegateObservable = null;
+
+		if (!exception.isEmpty()) {
+			throw exception;
+		}
+	}
+
+	public int getTimeToBeIdle() {
+		if (mlsecondsToBeIdle == 0) {
+			return 0;
+		}
+		return (int) (mlsecondsToBeIdle / 1000);
+	}
+
+	public void setTimeToBeIdle(int seconds) {
+		if (seconds < 0) {
+			throw new IllegalArgumentException("seconds must be >= 0");
+		}
+		mlsecondsToBeIdle = seconds * 1000;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java	(revision 35988)
@@ -0,0 +1,77 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.resource.impl;
+
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceNotification;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class DefaultResourceNotification implements ResourceNotification {
+
+	private Resource resource;
+	private String type;
+	private Object data = null;
+
+
+	public DefaultResourceNotification(Resource resource,String type){
+		this.resource = resource;
+		this.type = type;
+		this.data = null;
+	}
+
+	public DefaultResourceNotification(Resource resource, String type,
+			Object data) {
+		this.resource = resource;
+		this.type = type;
+		this.data = data;
+	}
+
+	public Resource getResource() {
+		return this.resource;
+	}
+
+	public String getType() {
+		return this.type;
+	}
+
+	public Object getData() {
+		return this.data;
+	}
+
+	public ResourceParameters getParameters() {
+		return (ResourceParameters) this.data;
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java	(revision 35988)
@@ -0,0 +1,89 @@
+package org.gvsig.fmap.dal.resource;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.resource.exception.DisposeResorceManagerException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+
+/**
+ * This interface is the responsible of shared resources management.
+ *
+ * Allows getting a resource, iterating over the available resources, and
+ * collecting resources to free them as they become unused
+ *
+ */
+public interface ResourceManager extends WeakReferencingObservable {
+	public Resource getResource(String name);
+
+	/**
+	 * Returns an iterator over the available resources.
+	 *
+	 * @return
+	 * 		iterator over the resources.
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Iterates over the resources and frees them if they are ready to be freed
+	 * or try to close them if they are idle.
+	 * 
+	 * @throws DataException
+	 * @see {@link ResourceManager#getTimeToBeIdle()}
+	 *      {@link ResourceManager#setTimeToBeIdle(int)}
+	 */
+	public void collectResources() throws DataException;
+
+	/**
+	 * Returns the wait time to consider that a resource is idle in seconds.
+	 * Used in collect resouces action. <br>
+	 * if is lower than 1 never is idle.
+	 *
+	 * @return seconds
+	 *
+	 * @see {@link ResourceManager#collectResources()}
+	 * @see {@link ResourceManager#startResourceCollector(long, Observer)}
+	 */
+	public int getTimeToBeIdle();
+
+	/**
+	 * Sets the wait time to consider that a resource is idle. Used in collect
+	 * resouces action. <br>
+	 * if is lower than 1 never is idle.
+	 *
+	 * @see {@link ResourceManager#collectResources()}
+	 * @see {@link ResourceManager#startResourceCollector(long, Observer)}
+	 */
+
+	public void setTimeToBeIdle(int seconds);
+
+	/**
+	 * Initializes the resource collection background process. Allows setting
+	 * of the delay between each execution of the collector and also an
+	 * observer to be notified on each execution.
+	 *
+	 * @param milis
+	 * 			delay between each execution of the resource collection process, in milliseconds.
+	 *
+	 * @param observer
+	 * 			an observer that will be notified on each execution of the resource collection process.
+	 */
+	public void startResourceCollector(long milis, Observer observer);
+
+	/**
+	 * Stops successive executions of the resource collector process. It does not interrupt
+	 * the process if it is currently running, but it will not be executed anymore times.
+	 */
+	public void stopResourceCollector();
+
+	/**
+	 * Close all register resources.
+	 *
+	 * @throws DataException
+	 */
+	public void closeResources() throws DataException;
+
+	public void dispose() throws DisposeResorceManagerException;
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java	(revision 35988)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.resource;
+
+/**
+ * Action to execute in the context of a {@link Resource}. This is used to run
+ * actions which use a {@link Resource}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface ResourceAction {
+
+	/**
+	 * Executes the action to perform with a {@link Resource}.
+	 * 
+	 * @return the result of the action, or null if none required
+	 * @throws Exception
+	 *             if there is an error executing the action
+	 */
+	Object run() throws Exception;
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java	(revision 35988)
@@ -0,0 +1,23 @@
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.DataParameters;
+
+/**
+ * This class is used to handle errors that occur at not finding the data source
+ * by opening a layer.
+ * 
+ */
+public interface OpenErrorHandler {
+
+	/**
+	 * Returns true if the opening can be retried.
+	 * 
+	 * @param e
+	 * @param parameters
+	 * 
+	 * @return true if the opening can be retried.
+	 */
+
+	public boolean canRetryOpen(Exception e, DataParameters parameters);
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java	(revision 35988)
@@ -0,0 +1,78 @@
+package org.gvsig.fmap.dal;
+
+/**
+ * This interface describes the properties of a parameter. It is useful 
+ * for any component that needs to know how to edit or visualize it.
+ *
+ */
+public interface DataParameterDescriptor {
+	
+	/** Accepts a single value */
+	public static final int SINGLE = 1;
+	/** Accepts a single value from a value set */
+	public static final int CHOICE = 2;
+	/** Accepts a range of values defined with a minimum and a maximum value */
+	public static final int RANGE = 3;
+
+	/**
+	 * Returns the parameter's name
+	 * 
+	 * @return String containing the parameter's name
+	 */
+	public String getName();
+	
+	/**
+	 * Returns the parameter's description
+	 * 
+	 * @return String containing the parameter's description.
+	 */
+	public String getDescription();
+
+	/**
+	 * Returns the parameter's data type.
+	 * 
+	 * @return parameter's data type.
+	 * 
+	 * @see DataTypes
+	 */
+	public int getDataType();
+
+	/**
+	 * Returns the parameter's default value.
+	 * 
+	 * @return an Object containing the default value. Use the data type to cast.
+	 */
+	public Object getDefaultValue();
+	
+	/**
+	 * Returns one of the available values type.
+	 * 
+	 * @return an <code>int</code> with one of the available values type.
+	 * 
+	 * @see #SINGLE
+	 * @see #CHOICE
+	 * @see #RANGE
+	 */
+	public int getAvailableValuesType();
+
+	/**
+	 * Returns an array containing the available values accepted by the parameter.
+	 * 
+	 * @return array of Object containing the available values accepted by the parameter. Use the data type to cast.
+	 */
+	public Object[] getAvailableValues();
+
+	/**
+	 * Returns the minimum value when the parameter accepts a range of values.
+	 * 
+	 * @return range's minimum value
+	 */
+	public Object getMinValue();
+
+	/**
+	 * Returns the maximum value when the parameter accepts a range of values.
+	 * 
+	 * @return range's maximum value.
+	 */
+	public Object getMaxValue();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java	(revision 35988)
@@ -0,0 +1,59 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal;
+
+
+/**
+ * This interface is used by any store implementation that requires
+ * store specific parameters.
+ * 
+ */
+public interface DataStoreParameters extends
+		DataParameters {
+
+	/**
+	 * Returns the DataStore's name
+	 * 
+	 * @return a String containing the DataStore's name
+	 */
+	public abstract String getDataStoreName();
+
+	/**
+	 * Indicates whether these parameters are valid.
+	 * 
+	 * @return true if these parameters are valid, false if not.
+	 */
+	public abstract boolean isValid();
+
+	/**
+	 * Returns the DataStore's description
+	 * 
+	 * @return a String containing the DataStore's description
+	 */
+	public abstract String getDescription();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java	(revision 35988)
@@ -0,0 +1,163 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.spi;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.exception.CopyParametersException;
+import org.gvsig.fmap.dal.exception.ParameterMissingException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public abstract class AbstractDataParameters implements DataParameters {
+
+	public Object getDynValue(String name) {
+		return getDelegatedDynObject().getDynValue(name);
+	}
+
+	public void setDynValue(String name, Object value) {
+		getDelegatedDynObject().setDynValue(name, value);
+		// return this ???
+	}
+
+	public void clear() {
+		// TODO Delegar en el DynObject cuando tenga este servicio
+
+		DynField[] fields =
+				getDelegatedDynObject().getDynClass()
+				.getDeclaredDynFields();
+
+		for (int i = 0; i < fields.length; i++) {
+			this.setDynValue(fields[i].getName(), fields[i].getDefaultValue());
+		}
+	}
+
+	protected void copyValuesTo(AbstractDataParameters target) {
+		// TODO Delegar en el DynObject cuando tenga este servicio
+		DynField[] fields =
+				getDelegatedDynObject().getDynClass()
+				.getDynFields();
+
+
+		for (int i = 0; i < fields.length; i++) {
+			target.setDynValue(fields[i].getName(), this.getDynValue(fields[i]
+					.getName()));
+		}
+	}
+
+	public DataParameters getCopy() {
+		// TODO Delegar en el DynObject cuando tenga este servicio
+		AbstractDataParameters copy;
+		try {
+			copy = (AbstractDataParameters) this.getClass().newInstance();
+		} catch (InstantiationException e) {
+			throw new CopyParametersException("data parameters", e);
+		} catch (IllegalAccessException e) {
+			throw new CopyParametersException("data parameters", e);
+		}
+		this.copyValuesTo(copy);
+		return copy;
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		DynField[] fields =
+				getDelegatedDynObject().getDynClass().getDynFields();
+
+		for (int i = 0; i < fields.length; i++) {
+		    if (fields[i].isPersistent()) {
+		    	String name = fields[i].getName(); 
+		    	Object value = this.getDynValue(fields[i].getName()); 
+				state.set(name,value);
+			}
+		}
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		Iterator it = state.getNames();
+		while (it.hasNext()) {
+			String name = (String) it.next();
+			this.setDynValue(name, state.get(name));
+		}
+	}
+
+	public void delegate(DynObject dynObject) {
+		getDelegatedDynObject().delegate(dynObject);
+
+	}
+
+	public DynClass getDynClass() {
+		return getDelegatedDynObject().getDynClass();
+	}
+
+	public boolean hasDynValue(String name) {
+		return getDelegatedDynObject().hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		getDelegatedDynObject().implement(dynClass);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		return getDelegatedDynObject().invokeDynMethod(this, name, context);
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		return getDelegatedDynObject().invokeDynMethod(this, code, context);
+	}
+
+	public void validate() throws ValidateDataParametersException {
+	    try {
+            this.getDynClass().validate(this);
+        } catch (DynObjectValidateException e) {
+            throw new ValidateDataParametersException(e);
+        }
+	}
+
+	/**
+	 * Returns an instance of the {@link DynObject} to delegate to.
+	 * 
+	 * @return the delegate {@link DynObject}
+	 */
+	protected abstract DelegatedDynObject getDelegatedDynObject();
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java	(revision 35988)
@@ -0,0 +1,147 @@
+package org.gvsig.fmap.dal.spi;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dynobject.DynObject;
+
+/**
+ * Base interface for all data providers
+ * 
+ * @author jmvivo
+ *
+ */
+public interface DataStoreProvider extends DynObject, Disposable {
+
+	/**
+	 * Retruns an {@link java.util.Iterator} of SubStores from this store. it
+	 * this hasn't SubStores returns <code>null</code>.
+	 *
+	 * @return SubStores iterator
+	 */
+	public abstract Iterator getChilds();
+
+	/**
+	 * Create a {@link DataServerExplorer} from the same source that this store.
+	 *
+	 * @return ServerExplorer
+	 * @throws ReadException
+	 * @throws ValidateDataParametersException
+	 */
+	public abstract DataServerExplorer getExplorer() throws ReadException,
+			ValidateDataParametersException;
+
+	/**
+	 * Open store. You must call it before do anything whith store.<br>
+	 * This method can be called repeatly.
+	 *
+	 * @throws OpenException
+	 */
+	public abstract void open() throws OpenException;
+
+	/**
+	 * Request to close de source
+	 *
+	 * @throws CloseException
+	 */
+	public abstract void close() throws CloseException;
+
+	/**
+	 * Returns the {@link Resource} from where the data is being loaded.
+	 * 
+	 * @return the data {@link Resource}
+	 */
+	ResourceProvider getResource();
+
+	/**
+	 * Force to reload information of Store
+	 *
+	 * @throws OpenException
+	 * @throws InitializeException
+	 */
+	public abstract void refresh() throws OpenException, InitializeException;
+
+	/**
+	 * Returns the unique identifier of the Store
+	 *
+	 * FIXME add examples
+	 *
+	 * @return
+	 */
+	public abstract Object getSourceId();
+
+	/**
+	 * Return the name of the provider.
+	 * Examples: dbf, shp, jdbc, postgresql, wfs, gml
+	 * 
+	 * @return
+	 */
+	public String getProviderName();
+
+	/**
+	 * Returns the name associated to the provider.
+	 * This name is provided for informational purposes only.
+	 * Explamples:
+	 * 
+	 * In a dbf the filename without the path
+	 * 
+	 * In a DDBB table the name of the table
+	 * 
+	 * In a WFS layer the name of the layer.
+	 *
+	 * @return String containing this store's name.
+	 */
+	public String getName();
+	
+	/**
+	 * Returns a more descriptive name for the provider that getName.
+	 * This name is provided for informational purposes only.
+	 * Explamples:
+	 * 
+	 * In a file based store may return the full name of the filename, path and filename.
+	 * 
+	 * In a data base based store may return "server:dbname:tablename"
+	 * 
+	 * In a WFS layer based store may return "server:layername"
+	 * 
+	 * @return String Containing the full name of the store
+	 */
+	public String getFullName();
+	
+	/**
+     * Gets the {@link Interval} of the store, that means the temporal
+     * interval where the store has valid data.
+     * @return
+     *         a time interval or null if there is not time support
+     */
+    public Interval getInterval();
+    
+    /**
+     * Gets all the possible values of time for which the store has data.  
+     * @return
+     *         a collection of {@link Time} objects.
+     */
+    public Collection getTimes();
+    
+    /**
+     * Gets all the possible values of time for which the store has data
+     * and intersects with an interval.
+     * @param interval
+     *         the interval of time
+     * @return
+     *         a collection of {@link Time} objects.
+     */
+    public Collection getTimes(Interval interval);
+	
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java	(revision 35988)
@@ -0,0 +1,111 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+
+/**
+ * Abstract base implementation for data iterators.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractDataProviderIterator extends AbstractDisposable
+		implements DisposableIterator {
+
+	private final DataStoreProvider dataStoreProvider;
+
+	private final ResourceAction nextResourceAction = new ResourceAction() {
+		public Object run() throws Exception {
+			dataStoreProvider.open();
+			return internalNext();
+		}
+	};
+
+	private final ResourceAction hasNextResourceAction = new ResourceAction() {
+		public Object run() throws Exception {
+			boolean value = internalHasNext();
+			return value ? Boolean.TRUE : Boolean.FALSE;
+		}
+	};
+
+	/**
+	 * Creates a new iterator instance.
+	 * 
+	 * @param storeProvider
+	 *            to load the {@link FeatureProvider}s from
+	 */
+	public AbstractDataProviderIterator(DataStoreProvider dataStoreProvider) {
+		this.dataStoreProvider = dataStoreProvider;
+	}
+
+    public Object next() {
+		return getResource().execute(nextResourceAction);
+	}
+
+    public boolean hasNext() {
+		Object hasNext = getResource().execute(hasNextResourceAction);
+		return ((Boolean) hasNext).booleanValue();
+	}
+
+	/**
+	 * Returns the {@link Resource} from where the data is going to be loaded.
+	 * 
+	 * @return the {@link Resource} from where the data is going to be loaded
+	 */
+	protected final Resource getResource() {
+		return getDataStoreProvider().getResource();
+	}
+
+	/**
+	 * Returns the {@link DataStoreProvider} to load the Iterator data.
+	 * 
+	 * @return the {@link DataStoreProvider}
+	 */
+	protected DataStoreProvider getDataStoreProvider() {
+		return dataStoreProvider;
+	}
+
+	/**
+	 * Returns the next iterator element. It is the child classes implementation
+	 * for the {@link #next()} method.
+	 * 
+	 * @return the next element
+	 */
+	protected abstract Object internalNext();
+
+	/**
+	 * Returns if there are more elements to get from the iterator. It is the
+	 * child classes implementation for the {@link #hasNext()} method.
+	 * 
+	 * @return if there are more elements
+	 */
+	protected abstract boolean internalHasNext();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java	(revision 35988)
@@ -0,0 +1,156 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProvider;
+import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProviderFactory;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.tools.dynobject.DynObject;
+
+
+/**
+ * Inteface of DataManager of Services for data providers
+ *
+ * @author jmvivo
+ *
+ */
+public interface DataManagerProviderServices extends DataManager {
+
+	public void registerStoreProvider(String name,
+			Class dataStoreProviderClass,
+			Class parametersClass);
+	
+	/**
+	 * Registers a store factory. 
+	 * @param name
+	 * @param dataStoreProviderClass
+	 * @param factoryClass
+	 */
+	public void registerStoreFactory(String name,
+			Class storeFactoryClass);
+
+	/**
+	 * Register a new provider of data server explorer
+	 *
+	 * FIXME
+	 *
+	 * @param <code>name</code> of de provider
+	 * @param dataSourceClass
+	 *            class of provider
+	 * @param parametersClass
+	 *            parameters class of provider
+	 */
+	public void registerExplorerProvider(String name,
+			Class dataSourceClass, Class parametersClass);
+
+
+    /**
+     * Registers a new feature index provider.
+     *
+     * @param name
+     * 			provider's name
+     *
+     * @param description
+     * 			provider's description
+     *
+     * @param clazz
+     * 			a custom FeatureIndexProvider implementation
+     *
+     * @param dataType
+     * 			one of the constants in {@link DataTypes}. This means that this provider
+     * 			can build indexes based on attributes of this type.
+     */
+	public void registerFeatureIndexProvider(String name, String description, Class clazz, int dataType);
+
+	/**
+	 * Returns a DataIndexProvider compatible with the attribute data type.
+	 *
+	 * @param store
+	 *            associated FeatureStore
+	 * @param type
+	 *            associated FeatureType
+	 * @param attr
+	 *            associated FeatureAttributeDescriptor
+	 * @param providerNames
+	 *            array of strings containing one or more preferred providers
+	 * @return empty DataIndexProvider, initialized and ready to use
+	 */
+	public FeatureIndexProviderServices createFeatureIndexProvider(String name, FeatureStore store, FeatureType type,
+			String indexName,
+			FeatureAttributeDescriptor attr) throws InitializeException,
+			ProviderNotRegisteredException;
+
+	 /**
+     * Registers a new cache provider.
+     *
+     * @param name
+     * 			provider's name
+     *
+     * @param description
+     * 			provider's description
+     *
+     * @param clazz
+     * 			a custom FeatureCacheProvider implementation
+     */
+	 public void registerFeatureCacheProvider(FeatureCacheProviderFactory providerFactory);
+		    
+	 /**
+	  * Creates a FeatureCacheProvider from a name and the parameters to configure 
+	  * its data server explorer. The cache provider creates new stores using the
+	  * {@link DataServerExplorerParameters}.
+	  * @param name provider's name.	   	
+	  * @param parameters parameters used to create a explorer.
+	  * @return A cache provider
+	  * @throws DataException
+	  */
+	 public FeatureCacheProvider createFeatureCacheProvider(String name, DynObject parameters) throws DataException;
+
+
+	 /**
+	  *
+	  * Creates a new instance of the provider associated to the passed parameters.
+	  * 
+	  * @param store
+	  * @param parameters
+	  * @return
+	  * @throws InitializeException
+	  * @throws ProviderNotRegisteredException
+	  */
+	 public DataStoreProvider createProvider(DataStoreProviderServices providerServices, DataStoreParameters parameters) throws InitializeException, ProviderNotRegisteredException;	 
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java	(revision 35988)
@@ -0,0 +1,56 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.DataStore;
+
+/**
+ * Base interface of Services for data providers
+ *
+ * @author jmvivo
+ *
+ */
+public interface DataStoreProviderServices {
+
+	public static final String BASE_PARAMETERS_PROVIDER_DEFINITION_NAME = "ProviderParameters";
+	public static final String BASE_PARAMETERS_PROVIDER_DEFINITION_FULLNAME = "DAL:"+BASE_PARAMETERS_PROVIDER_DEFINITION_NAME;
+	
+	public static final String BASE_NEWPARAMETERS_PROVIDER_DEFINITION_NAME = "NewProviderParameters";
+	public static final String BASE_NEWPARAMETERS_PROVIDER_DEFINITION_FULLNAME = "DAL:"+BASE_NEWPARAMETERS_PROVIDER_DEFINITION_NAME;
+	
+	public static final String PROVIDER_PARAMTER_NAME = "ProviderName";
+	public static final String PROVIDER_PARAMTER_FULLNAME = "DAL:"+PROVIDER_PARAMTER_NAME;
+
+
+	/**
+	 * Return the Store instance
+	 * 
+	 * @return
+	 */
+	public DataStore getStore();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java	(revision 35988)
@@ -0,0 +1,39 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.InitializeException;
+
+public interface DataStoreInitializer {
+	void intializePhase1(DataManager dataManager,
+			DataStoreParameters parameters) throws InitializeException;
+
+	void intializePhase2(DataStoreProvider provider) throws InitializeException;
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java	(revision 35988)
@@ -0,0 +1,43 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+
+/**
+ * Base interface for providers of data server explorers
+ *
+ *
+ * @author jmvivo
+ * 
+ */
+public interface DataServerExplorerProvider extends DataServerExplorer {
+
+	public DataServerExplorerProviderServices getServerExplorerProviderServices();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java	(revision 35988)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.resource.Resource;
+
+/**
+ * Base inferface of services for data servers explorers
+ * 
+ * @author jmvivo
+ * 
+ */
+public interface DataServerExplorerProviderServices {
+
+	public EditableFeatureType createNewFeatureType();
+
+	public Resource createResource(String name, Object[] params)
+			throws InitializeException;
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java	(revision 35988)
@@ -0,0 +1,88 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.lang.Cloneable;
+
+/**
+ * Manages a selection of Features.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface FeatureSelection extends FeatureReferenceSelection,
+		FeatureSet, Cloneable {
+
+    /**
+     * Adds a feature to the selection.
+     * 
+     * @param feature
+     *            the selected feature
+     * @return true if the feature was not selected before selecting it
+     */
+    boolean select(Feature feature);
+
+    /**
+     * Removes a feature from the selection.
+     * 
+     * @param feature
+     *            the deselected feature
+     * @return true if the feature was selected before deselecting it
+     */
+    boolean deselect(Feature feature);
+
+    /**
+     * Adds a DataSet of features to the selection.
+     * 
+     * @param features
+     *            the selected features
+     * @return true if any of the feature was not selected before selecting it
+     * @throws DataException
+     *             if there is an error reading the FeatureSet values
+     */
+    boolean select(FeatureSet features) throws DataException;
+
+    /**
+     * Removes a DataSet of features from the selection.
+     * 
+     * @param features
+     *            the deselected features
+     * @return true if any of the features was selected before deselecting it
+     * @throws DataException
+     *             if there is an error reading the FeatureSet values
+     */
+    boolean deselect(FeatureSet features) throws DataException;
+
+    /**
+     * Returns if a feature is selected.
+     * 
+     * @param feature
+     *            to check
+     * @return if it is selected
+     */
+    boolean isSelected(Feature feature);
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:mergeinfo

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java	(revision 35988)
@@ -0,0 +1,114 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.feature;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * A FeatureStoreTransform provides a mechanism for mapping a source FeatureType
+ * to a target FeatureType, allowing to build different views (as in database
+ * view) over different feature types even from different stores.
+ *
+ * @author jmvivo
+ *
+ */
+public interface FeatureStoreTransform extends Persistent {
+
+	/**
+	 * Returns the default {@link FeatureType}.
+	 *
+	 * @return default {@link FeatureType}
+	 *
+	 * @throws DataException
+	 */
+	public FeatureType getDefaultFeatureType() throws DataException;
+
+	/**
+	 * Returns this FeatureStoreTransform's FeatureType(s)
+	 * @return
+	 * @throws DataException
+	 */
+	public List getFeatureTypes() throws DataException;
+
+	/**
+	 * Returns the original store {@link FeatureType} that replaces
+	 * targetFeatureType of this FeatureStoreTransform's
+	 *
+	 * @return source {@link FeatureType}
+	 * @throws DataException
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType);
+
+	/**
+	 * Applies this transform between two features, copying the source data to
+	 * the target feature.
+	 *
+	 * @param source
+	 *            feature whose data will be used as source
+	 *
+	 * @param target
+	 *            feature in which the source data will be copied
+	 *
+	 * @throws DataException
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException;
+
+	/**
+	 * Sets the FeatureStore to which this transform is applied.
+	 *
+	 * @param featureStore
+	 *            FeatureStore to which this transform is applied.
+	 */
+	public void setFeatureStore(FeatureStore featureStore);
+
+	/**
+	 * Returns the FeatureStore to which this transform belongs.
+	 *
+	 * @return FeatureStore to which this transform belongs.
+	 */
+	public FeatureStore getFeatureStore();
+
+	/**
+	 * Retruns true if this make changes of any attributes values or false if
+	 * only {@link FeatureType} definitions is changed.
+	 *
+	 * @see {@link FeatureStoreTransforms#isTransformsOriginalValues()}
+	 * 
+	 * @return
+	 */
+	public boolean isTransformsOriginalValues();
+	
+	public String getName();
+	
+	public String getDescription();
+	
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java	(revision 35988)
@@ -0,0 +1,48 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  { }
+ * 2008 {IVER TI}  { }
+ */
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+public interface FeatureLocksGroup  {
+
+    boolean unlock();
+
+    boolean isLocked(Feature feature);
+
+    boolean isLocked(FeatureReference feature);
+    
+    long getTimeout();
+    
+    long getXXX();
+    
+    Iterator iterator();
+    
+    long getLocksCount();   
+    
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java	(revision 35988)
@@ -0,0 +1,300 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.IndexedVisitable;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * A FeatureSet represents a set of {@link Feature}(s). These sets of features
+ * are typically obtained directly from a {@link FeatureStore}, or through a
+ * {@link FeatureQuery}.
+ * 
+ * A FeatureSet may contain subsets of {@link Feature}(s) of different
+ * {@link FeatureType}(s). It allows iterating and editing the features.
+ * 
+ * FIXME: Actualizar javadoc
+ * 
+ * Si el store en el que esta basado el featureset es modificado, se realiza un
+ * update, insert, delete o se modifican los featuretype de este, el FeatureSet
+ * quedara invalidado, y cualquier acceso a el provocara que se lance una
+ * excepcion de tiempo de ejecucion ConcurrentModificationException.
+ * 
+ * Habria que indicar que invocar al metodo accept del interface visitor
+ * provocara la excepcion ConcurrentModificationException si el store a sido
+ * modificado desde otro punto.
+ * 
+ * Indicar que los metodos insert/delete/update ademas de actuar sobre el set,
+ * actuan sobre el store en el que este esta basado, pero que no invalidan el
+ * set sobre el que se ejecutan. No se si esto deberia hacerse mencion en esos
+ * metodos o en la doc general del featureset.
+ * 
+ */
+public interface FeatureSet extends DataSet, IndexedVisitable {
+
+	/**
+	 * Returns the default {@link FeatureType} of this FeatureSet.
+	 * 
+	 * @return default {@link FeatureType} in this FeatureSet.
+	 */
+	public FeatureType getDefaultFeatureType();
+
+	/**
+	 * Returns a list of the {@link FeatureType}(s) in this FeatureSet.
+	 * 
+	 * @return list of the {@link FeatureType}(s) in this FeatureSet.
+	 */
+	public List getFeatureTypes();
+
+	/**
+	 * Returns the number of {@link Feature}(s) contained in this FeatureSet.
+	 * 
+	 * The value returned by this method won't be accurate when
+	 * the FeatureStore is being edited and this set's features
+	 * are modified, added or deleted.
+	 *  
+	 * @return number of {@link Feature}(s) contained in this FeatureSet.
+	 * 
+	 * @throws DataException
+	 */
+    public long getSize() throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this collection, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * The iterator starts at the specified position in this collection. The
+     * specified index indicates the first element that would be returned by an
+     * initial call to the <tt>next</tt> method. An initial call to the
+     * <tt>previous</tt> method would return the element with the specified
+     * index minus one.
+     * 
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get the iterator, you
+     * must get sure the iterator is disposed (@see
+     * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
+     * while getting the data. It is recommended to use the <code>accept</code>
+     * methods instead, which handle everything for you. 
+     * Take into account the accept methods may use a fast iterator to 
+     * get the features.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, long)
+     * @see #fastIterator()
+     * @see #fastIterator(long)
+     * 
+     * @param index
+     *            index of first element to be returned from the iterator (by a
+     *            call to the <tt>next</tt> method).
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence), starting at the specified position in the collection.
+     * @throws DataException
+     *             if the index is out of range (index &lt; 0 || index &gt;
+     *             size()).
+     * @deprecated use {@link #fastIterator(long)} instead
+     */
+	DisposableIterator iterator(long index) throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this collection, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get the iterator, you
+     * must get sure the iterator is disposed (@see
+     * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
+     * while getting the data. It is recommended to use the <code>accept</code>
+     * methods instead, which handle everything for you. 
+     * Take into account the accept methods may use a fast iterator to 
+     * get the features.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, long)
+     * @see #fastIterator()
+     * @see #fastIterator(long)
+     * 
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws DataException
+     *             if there is an error getting the iterator
+     * 
+     * @deprecated use {@link #fastIterator()} instead
+     */
+	DisposableIterator iterator() throws DataException;
+
+    /**
+     * Returns a fast iterator over this set.
+     * <p>
+     * Fast in this case means that each of the elements returned may be a
+     * reused or pooled object instance, so don't use it to be stored in any
+     * way.
+     * </p>
+     * <p>
+     * If you need to store one of the {@link Feature} of the iterator, use the
+     * {@link Feature#getCopy()} to create a clone of the object.
+     * </p>
+     * 
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get the iterator, you
+     * must get sure the iterator is disposed (@see
+     * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
+     * while getting the data. It is recommended to use the <code>accept</code>
+     * methods instead, which handle everything for you. 
+     * Take into account the accept methods may use a fast iterator to 
+     * get the features.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, long)
+     * 
+     * @return an iterator over this set.
+     * 
+     * @throws DataException
+     */
+	public DisposableIterator fastIterator() throws DataException;
+
+    /**
+     * Returns a fast iterator over this set, starting from the given index.
+     * <p>
+     * Fast in this case means that each of the elements returned may be a
+     * reused or pooled object instance, so don't use it to be stored in any
+     * way.
+     * </p>
+     * <p>
+     * If you need to store one of the {@link Feature} of the iterator, use the
+     * {@link Feature#getCopy()} to create a clone of the object.
+     * </p>
+     * 
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get the iterator, you
+     * must get sure the iterator is disposed (@see
+     * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
+     * while getting the data. It is recommended to use the <code>accept</code>
+     * methods instead, which handle everything for you. 
+     * Take into account the accept methods may use a fast iterator to 
+     * get the features.
+     * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * @see #accept(org.gvsig.tools.visitor.Visitor, long)
+     * 
+     * @param index
+     *            position in which the iterator is initially located.
+     * 
+     * @return an iterator initially located at the position indicated by the
+     *         given index
+     * 
+     * @throws DataException
+     */
+	public DisposableIterator fastIterator(long index) throws DataException;
+
+	/**
+	 * Indicates whether this FeatureSet contains zero features.
+	 * 
+	 * The value returned by this method won't be accurate when
+	 * the FeatureStore is being edited and this set's features
+	 * are modified, added or deleted.
+	 *  
+	 * @return true if this FeatureSet is empty, false otherwise.
+	 * 
+	 * @throws DataException
+	 */
+	boolean isEmpty() throws DataException;
+
+	/**
+	 * Updates a {@link Feature} with the given {@link EditableFeature}.<br>
+	 * 
+	 * Any {@link DisposableIterator} from this store that was still in use can will not
+	 * reflect this change.
+	 * 
+	 * @param feature
+	 *            an instance of {@link EditableFeature} with which to update
+	 *            the associated {@link Feature}.
+	 * 
+	 * @throws DataException
+	 */
+	public void update(EditableFeature feature) throws DataException;
+
+	/**
+	 * Deletes a {@link Feature} from this FeatureSet.<br>
+	 * 
+	 * Any {@link DisposableIterator} from this store that was still in use will be
+	 * <i>unsafe</i>. Use {@link DisposableIterator#remove()} instead.
+	 * 
+	 * @param feature
+	 *            the {@link Feature} to delete.
+	 * 
+	 * @throws DataException
+	 */
+	public void delete(Feature feature) throws DataException;
+
+	/**
+	 * Inserts a new feature in this set. It needs to be an instance of
+	 * {@link EditableFeature} as it has not been stored yet.<br>
+	 * 
+	 * Any {@link DisposableIterator} from this store that was still in use can will not
+	 * reflect this change.
+	 * 
+	 * @param feature
+	 *            the {@link EditableFeature} to insert.
+	 * 
+	 * @throws DataException
+	 */
+	public void insert(EditableFeature feature) throws DataException;
+
+    /**
+     * Returns a {@link DynObjectSet} of the contents of this set.
+     * Defaults to fast iteration.
+     * 
+     * @return a {@link DynObjectSet}
+     */
+    public DynObjectSet getDynObjectSet();
+
+    /**
+     * Returns a {@link DynObjectSet} of the contents of this set.
+     * 
+     * @param fast
+     *            if the set will be able to be iterated in a fast way, by
+     *            reusing the {@link DynObject} instance for each
+     *            {@link Feature} instance.
+     * @return a {@link DynObjectSet}
+     */
+    public DynObjectSet getDynObjectSet(boolean fast);
+
+    /**
+     * Provides each value of this Store to the provided {@link Visitor},
+     * beginning from the provided index position.
+     * The values received through the {@link Visitor#visit(Object)} method
+     * may be transient, reused or externally modifiable, so they can't
+     * be used to be stored in any external form out of the visit method.
+     * 
+     * If you need to store any of the values out of the
+     * {@link Visitor#visit(Object)} method execution, create a copy or clone
+     * the received value in order to be stored.
+     * 
+     * @param visitor
+     *            the visitor to apply to each value.
+     * @param firstValueIndex
+     *            index of first element to be visited by the {@link Visitor}
+     * @exception BaseException
+     *                if there is an error while performing the visit
+     */
+    void accept(Visitor visitor, long firstValueIndex) throws BaseException;
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java	(revision 35988)
@@ -0,0 +1,532 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.resource.ResourceAction;
+import org.gvsig.fmap.dal.resource.ResourceManager;
+import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Abstract implementation of {@link FeatureStoreProvider}
+ *
+ */
+public abstract class AbstractFeatureStoreProvider extends AbstractDisposable
+		implements FeatureStoreProvider {
+
+	private FeatureStoreProviderServices store;
+	private DelegatedDynObject metadata;
+	private DataStoreParameters parameters;
+
+	/**
+	 * Default Constructor.
+	 *
+	 * @param params
+	 * @param storeServices
+	 * @param metadata
+	 */
+	protected AbstractFeatureStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices, DynObject metadata) {
+		this.store = (FeatureStoreProviderServices) storeServices;
+		this.metadata = (DelegatedDynObject) metadata;
+		this.parameters = params;
+	}
+
+	/**
+	 * Constructor when cannot create metada in constrution time. <br>
+	 * <br>
+	 * <strong>Note: </strong> Don't use it if not is necesary. Set metada
+	 * <strong>as soon as posible</strong> by
+	 * {@link AbstractFeatureStoreProvider#setMetadata(DynObject)}
+	 * 
+	 * @param params
+	 * @param storeServices
+	 */
+	protected AbstractFeatureStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices) {
+		this.store = (FeatureStoreProviderServices) storeServices;
+		this.metadata = null;
+		this.parameters = params;
+	}
+
+	public final FeatureProvider getFeatureProviderByReference(
+			final FeatureReferenceProviderServices reference)
+			throws DataException {
+		this.open();
+		FeatureProvider featureProvider = (FeatureProvider) getResource()
+				.execute(new ResourceAction() {
+					public Object run() throws Exception {
+						return internalGetFeatureProviderByReference(reference);
+					}
+				});
+
+		if (featureProvider == null) {
+			throw new FeatureProviderNotFoundException(reference);
+		}
+
+		return featureProvider;
+	}
+
+	public final FeatureProvider getFeatureProviderByReference(
+			final FeatureReferenceProviderServices reference,
+			final FeatureType featureType) throws DataException {
+		this.open();
+		FeatureProvider featureProvider = (FeatureProvider) getResource()
+				.execute(new ResourceAction() {
+			public Object run() throws Exception {
+				return internalGetFeatureProviderByReference(reference,
+						featureType);
+			}
+		});
+
+		if (featureProvider == null) {
+			throw new FeatureProviderNotFoundException(reference);
+		}
+
+		return featureProvider;
+	}
+
+	/**
+	 * Returns a {@link FeatureProvider} by reference, using the default
+	 * {@link FeatureType}. This method may be rewritten by the child classes as
+	 * an implementation of the
+	 * {@link #getFeatureProviderByReference(FeatureReferenceProviderServices)}
+	 * method.
+	 * 
+	 * @param reference
+	 *            the reference to the {@link FeatureProvider}
+	 * @return the {@link FeatureProvider} being referenced
+	 * @throws DataException
+	 *             if there is an error loading the {@link FeatureProvider}
+	 */
+	protected FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference) throws DataException {
+		return internalGetFeatureProviderByReference(reference,
+				getStoreServices().getDefaultFeatureType());
+	}
+
+	/**
+	 * Set metada container if this not set at construction time and only in one
+	 * time. In other case an Exception will be throw
+	 *
+	 * @param metadata
+	 */
+	protected void setMetadata(DynObject metadata) {
+		if (this.metadata != null) {
+			// FIXME Exception
+			throw new IllegalStateException();
+		}
+		this.metadata = (DelegatedDynObject) metadata;
+	}
+
+	/**
+	 * @return the parameters
+	 */
+	public DataStoreParameters getParameters() {
+		return parameters;
+	}
+
+	/**
+	 * Create or get a resource of <code>type</code> for <code>params</code> in
+	 * {@link ResourceManager}
+	 *
+	 * @param type
+	 * @param params
+	 * @return
+	 * @throws InitializeException
+	 */
+	protected ResourceProvider createResource(String type, Object[] params)
+			throws InitializeException {
+		ResourceManagerProviderServices manager = (ResourceManagerProviderServices) DALLocator
+				.getResourceManager();
+		ResourceProvider resource = manager.createAddResource(type, params);
+		return resource;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getStoreServices()
+	 */
+	public FeatureStoreProviderServices getStoreServices() {
+		return this.store;
+	}
+
+	public FeatureStore getFeatureStore() {
+		return this.store.getFeatureStore();
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#allowWrite()
+	 */
+	public boolean allowWrite() {
+		return false;
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#performChanges(Iterator,
+	 *      Iterator, Iterator, Iterator)
+	 */
+
+	public void performChanges(Iterator deleteds, Iterator inserteds,
+			Iterator updateds, Iterator featureTypesChanged)
+			throws DataException {
+		// FIXME exception
+		throw new UnsupportedOperationException();
+
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#isLocksSupported()
+	 */
+	public boolean isLocksSupported() {
+		return false;
+	}
+
+	/**
+	 * Default Factory of {@link FeatureProvider}. Create a new default
+	 * {@link FeatureProvider} instance.<br>
+	 *
+	 * Override this if you need an special implemtation of
+	 * {@link FeatureProvider}.
+	 *
+	 * @return
+	 * @throws DataException
+	 *
+	 * @see {@link org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createFeatureProvider(FeatureType)}
+	 */
+
+	public FeatureProvider createFeatureProvider(FeatureType type)
+			throws DataException {
+		return this.store.createDefaultFeatureProvider(type);
+	}
+
+	/**
+	 * unsupported by default (return <code>null</code>), override this
+	 * otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createFeatureLocks()
+	 */
+	public FeatureLocks createFeatureLocks() throws DataException {
+		return null;
+	}
+
+	/**
+	 * Default Factory of {@link FeatureSelection}. Create a new default
+	 * {@link FeatureSelection} instance.<br>
+	 *
+	 * Override this if you need an special implemtation of
+	 * {@link FeatureSelection}.
+	 *
+	 * @return
+	 * @throws DataException
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createFeatureSelection()
+	 */
+	public FeatureSelection createFeatureSelection() throws DataException {
+		return this.store.createDefaultFeatureSelection();
+	}
+
+	/**
+	 * do nothing by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#refresh()
+	 */
+	public void refresh() throws OpenException {
+		// Do nothing by default
+	}
+
+	/**
+	 * do nothing by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#close()
+	 */
+	public void close() throws CloseException {
+		// Do nothing by default
+	}
+
+	protected void doDispose() throws BaseException {
+		this.metadata = null;
+		this.store = null;
+	}
+
+	/**
+	 * unsupported geometry by default (return <code>null</code>), override this
+	 * otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getEnvelope()
+	 */
+	public Envelope getEnvelope() throws DataException {
+		return null;
+	}
+
+	/**
+	 * unsupported geometry write by default (return <code>false</code>),
+	 * override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#canWriteGeometry(int,
+	 *      int)
+	 */
+	public boolean canWriteGeometry(int geometryType, int geometrySubType)
+			throws DataException {
+		return false;
+	}
+
+	// --- Metadata methods ---
+
+	public void delegate(DynObject dynObject) {
+		if (this.metadata == null) {
+			return;
+		}
+		this.metadata.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		if (this.metadata == null) {
+			return null;
+		}
+		return this.metadata.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		if (this.metadata == null) {
+			return false;
+		}
+		// TODO this.open??
+		return this.metadata.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		if (this.metadata == null) {
+			return;
+		}
+		this.metadata.implement(dynClass);
+
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.invokeDynMethod(this, code, context);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		if (this.metadata == null) {
+			return null;
+		}
+		// TODO this.open??
+		return this.metadata.invokeDynMethod(this, name, context);
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		if (this.metadata == null) {
+			return;
+		}
+		// TODO this.open??
+		this.metadata.setDynValue(name, value);
+	}
+
+	// --- end Metadata methods ---
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#allowAutomaticValues()
+	 */
+	public boolean allowAutomaticValues() {
+		return false;
+
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#append(org.gvsig.
+	 *      fmap.dal.feature.spi.FeatureProvider)
+	 */
+	public void append(FeatureProvider featureProvider) throws DataException {
+		// FIXME exception
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#beginAppend()
+	 */
+	public void beginAppend() throws DataException {
+		// FIXME exception
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#endAppend()
+	 */
+	public void endAppend() throws DataException {
+		// FIXME exception
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * unsupported by default, override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#supportsAppendMode()
+	 */
+	public boolean supportsAppendMode() {
+		return false;
+	}
+
+	/**
+	 * unsupported by default (return null), override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getChilds()
+	 */
+	public Iterator getChilds() {
+		return null;
+	}
+
+	/**
+	 * unsupported by default (return null), override this otherwise
+	 *
+	 * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getExplorer()
+	 */
+	public DataServerExplorer getExplorer() throws ReadException,
+			ValidateDataParametersException {
+		return null;
+	}
+
+	public void clear() {
+		if (metadata != null) {
+			metadata.clear();
+		}
+	}
+
+	/**
+	 * Returns a {@link FeatureProvider} by reference, using the provided
+	 * {@link FeatureType}. This is the child classes implementation of the
+	 * {@link #getFeatureProviderByReference(FeatureReferenceProviderServices)}
+	 * method.
+	 * 
+	 * @param reference
+	 *            the reference to the {@link FeatureProvider}
+	 * @param featureType
+	 *            the type of feature to load
+	 * @return the {@link FeatureProvider} being referenced
+	 * @throws DataException
+	 *             if there is an error loading the {@link FeatureProvider}
+	 */
+	protected abstract FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference, FeatureType featureType)
+			throws DataException;
+
+	public static class FeatureProviderNotFoundException extends DataException {
+
+		private static final long serialVersionUID = 5161749797695723151L;
+
+		public FeatureProviderNotFoundException(FeatureReference reference) {
+			super("Cannot retreive FeatureProvider for reference %(reference)",
+					"_FeatureProviderNotFoundException", serialVersionUID);
+			setValue("reference", reference.toString());
+		}
+	}
+	
+	public boolean isKnownEnvelope(){
+	    return true;
+	}
+    
+    public boolean hasRetrievedFeaturesLimit(){
+        return false;
+    }
+    
+    public int getRetrievedFeaturesLimit(){
+        return -1;
+    }
+
+    public Interval getInterval() {       
+        return null;
+    }    
+
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java	(revision 35988)
@@ -0,0 +1,198 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+
+/**
+ * Interface of Services for feature based data providers
+ *
+ * @author jmvivo
+ *
+ */
+public interface FeatureStoreProviderServices extends
+		DataStoreProviderServices {
+
+	/**
+	 * Call this to send a notification to observers of this store
+	 *
+	 * @param notification
+	 */
+	public void notifyChange(String notification);
+
+	/**
+	 * Call this to send a notification to observers of this store
+	 * 
+	 * @param notification
+	 */
+	public void notifyChange(String notification, FeatureProvider data);
+
+	/**
+	 * Call this to send a notification to observers of this store
+	 * 
+	 * @param notification
+	 */
+	public void notifyChange(FeatureStoreNotification storeNotification);
+
+	/**
+	 * Call this to send a notification to observers of this store relative to
+	 * Resources
+	 * 
+	 * @param notification
+	 */
+	public void notifyChange(String notification, Resource resource);
+
+	/**
+	 * Create a new instance of default implementation of a
+	 * {@link FeatureSelection}
+	 *
+	 * @return new {@link FeatureSelection}
+	 * @throws DataException
+	 */
+	public FeatureSelection createDefaultFeatureSelection()
+			throws DataException;
+
+	/**
+	 * Create a new instance of default implementation of a {@link FeatureProvider}
+	 *
+	 * @return new {@link FeatureProvider}
+	 * @throws DataException
+	 */
+	public FeatureProvider createDefaultFeatureProvider(FeatureType type)
+			throws DataException;
+
+	/**
+	 * Sets {@link FeatureType} available from this store.<br>
+	 *
+	 * <strong>Note:</strong> <code>defaultType</code> must be in
+	 * <code>types</code>
+	 *
+	 * @param list
+	 *            of all {@link FeatureType} available
+	 * @param {@link FeatureType} used in
+	 *        {@link FeatureStore#getDefaultFeatureType()}
+	 */
+	public void setFeatureTypes(List types, FeatureType defaultType);
+
+	/**
+	 * Reaturn {@link DataManager} instance.
+	 *
+	 * @return
+	 */
+	public DataManager getManager();
+
+	/**
+	 * Create a {@link Feature} instance for {@link FeatureProvider}
+	 * <code>data</code>
+	 *
+	 * <br>
+	 * <br>
+	 * <strong>NOTE:</strong> Normaly <strong> Providers must use</strong>
+	 * {@link FeatureProvider} instances instead Feature
+	 *
+	 * @param data
+	 * @return a {@link Feature}
+	 * @throws DataException
+	 */
+	public Feature createFeature(FeatureProvider data)
+	throws DataException;
+
+	/**
+	 * Creates a new instance of EditableFeatureType. Uses 'default' as
+	 * identifier.
+	 *
+	 * @return
+	 */
+	public EditableFeatureType createFeatureType();
+
+	/**
+	 * Creates a new instance of EditableFeatureType. Uses 'id' as identifier.
+	 *
+	 * @return
+	 */
+	public EditableFeatureType createFeatureType(String id);
+
+	/**
+	 * Return the instance of {@link FeatureStoreProvider} for this store.
+	 *
+	 * @return
+	 */
+	public FeatureStoreProvider getProvider();
+
+
+	/**
+	 * Return original {@link FeatureType} of {@link FeatureStoreProvider}.
+	 *
+	 * @param id
+	 *            of the {@link FeatureType}
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureType getProviderFeatureType(String featureTypeId);
+
+	/**
+	 * Extract {@link FeatureProvider} from a {@link Feature} instance.
+	 *
+	 * @param feature
+	 * @return
+	 */
+	public FeatureProvider getFeatureProviderFromFeature(Feature feature);
+
+	/**
+	 * Return current FeatureStore
+	 *
+	 * @return
+	 */
+	public FeatureStore getFeatureStore();
+
+	/**
+	 * Return current FeatureStore name.
+	 *
+	 * @return
+	 */
+	public String getName();
+
+	/**
+	 * Return default {@link FeatureType} of the store
+	 *
+	 * @return
+	 */
+	public FeatureType getDefaultFeatureType() throws DataException;
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java	(revision 35988)
@@ -0,0 +1,77 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+ 
+
+package org.gvsig.fmap.dal.feature.spi.index;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+
+
+public interface FeatureIndexProvider {
+	
+	/** Sets the IndexProviderServices that will provide application services to this index provider */
+	public void setFeatureIndexProviderServices(FeatureIndexProviderServices services);
+	
+	/** Initializes this provider */
+	public void initialize() throws InitializeException;
+
+	/** Inserts a value into the index */
+	public void insert(Object value, FeatureReferenceProviderServices fref);
+
+	/** Deletes a value from the index, given its reference */
+	public void delete(Object value, FeatureReferenceProviderServices fref);
+	
+	/** Performs a search in the index and returns a list with all the values that match the given value 
+	 * @throws FeatureIndexException TODO*/
+	public List match(Object value) throws FeatureIndexException;
+	
+	/** Performs a search in the index and returns a list with the values that intersect with the given interval 
+	 * @throws FeatureIndexException TODO*/
+	public List range(Object value1, Object value2) throws FeatureIndexException;
+	
+	/** Performs a search in the index and returns the list of up to n values which are nearest to the given value. */
+	public List nearest(int count, Object value) throws FeatureIndexException;	
+
+	/** Performs a search in the index and returns the list of up to n values which are nearest to the given value and within the distance specified by tolerance. */
+	public List nearest(int count, Object value, Object tolerance) throws FeatureIndexException;	
+	
+	
+	/** Returns true if the provider supports the match function */
+	public boolean isMatchSupported();
+	/** Returns true if the provider supports the range function */
+	public boolean isRangeSupported();
+	/** Returns true if the provider supports the nearest function */
+	public boolean isNearestSupported();
+	/** Returns true if the provider supports the nearest with tolerance function */
+	public boolean isNearestToleranceSupported();
+
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java	(revision 35988)
@@ -0,0 +1,159 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.feature.spi.index;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+
+
+public abstract class AbstractFeatureIndexProvider implements FeatureIndexProvider {
+
+	private FeatureIndexProviderServices services = null;
+
+	public void initialize() throws InitializeException {
+	}
+
+	public void setFeatureIndexProviderServices(
+			FeatureIndexProviderServices services) {
+		this.services = services;
+	}
+
+	public FeatureIndexProviderServices getFeatureIndexProviderServices() {
+		return services;
+	}
+
+	protected class LongList implements java.util.List{
+		private ArrayList list;
+		public LongList(java.util.List list) {
+			this.list=(ArrayList)list;
+		}
+		public void add(int arg0, Object arg1) {
+			list.add(arg0, arg1);
+		}
+
+		public boolean add(Object arg0) {
+			return list.add(arg0);
+		}
+
+		public Object set(int arg0, Object arg1) {
+			return list.set(arg0, arg1);
+		}
+		public boolean addAll(Collection arg0) {
+			return list.addAll(arg0);
+		}
+		public boolean addAll(int arg0, Collection arg1) {
+			return list.addAll(arg0, arg1);
+		}
+		public void clear() {
+			list.clear();
+		}
+		public boolean contains(Object o) {
+			return list.contains(o);
+		}
+		public boolean containsAll(Collection arg0) {
+			return list.containsAll(arg0);
+		}
+		public Object get(int index) {
+			Object obj=list.get(index);
+			if (obj instanceof Integer){
+				return new Long(((Integer)obj).longValue());
+			}
+			return obj;
+		}
+		public int indexOf(Object o) {
+			return list.indexOf(o);
+		}
+		public boolean isEmpty() {
+			return list.isEmpty();
+		}
+		public Iterator iterator() {
+			return new LongIterator(list.iterator());
+		}
+		public int lastIndexOf(Object o) {
+			return list.lastIndexOf(o);
+		}
+		public ListIterator listIterator() {
+			return list.listIterator();
+		}
+		public ListIterator listIterator(int index) {
+			return list.listIterator(index);
+		}
+		public boolean remove(Object o) {
+			return list.remove(o);
+		}
+		public Object remove(int index) {
+			return list.remove(index);
+		}
+		public boolean removeAll(Collection arg0) {
+			return list.removeAll(arg0);
+		}
+		public boolean retainAll(Collection arg0) {
+			return list.retainAll(arg0);
+		}
+		public int size() {
+			return list.size();
+		}
+		public List subList(int fromIndex, int toIndex) {
+			return list.subList(fromIndex, toIndex);
+		}
+		public Object[] toArray() {
+			return list.toArray();
+		}
+		public Object[] toArray(Object[] arg0) {
+			return list.toArray(arg0);
+		}
+		class LongIterator implements Iterator{
+			private Iterator iterator;
+			public LongIterator(Iterator it) {
+				iterator=it;
+			}
+			public boolean hasNext() {
+				return iterator.hasNext();
+			}
+
+			public Object next() {
+				Object obj=iterator.next();
+				if (obj instanceof Integer){
+					return new Long(((Integer)obj).longValue());
+				}
+				return obj;
+			}
+
+			public void remove() {
+				iterator.remove();
+			}
+		}
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java	(revision 35988)
@@ -0,0 +1,70 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+ 
+
+package org.gvsig.fmap.dal.feature.spi.index;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+
+
+/**
+ * SPI for all index implementations
+ * @author jyarza
+ *
+ */
+public interface FeatureIndexProviderServices extends FeatureIndex {
+	
+	/** Initializes this provider */
+	public void initialize() throws InitializeException;
+	
+	/** Column to which belongs this index */
+	public FeatureAttributeDescriptor getFeatureAttributeDescriptor();
+	
+	/** FeatureType to which belongs this index */
+	public FeatureType getFeatureType();
+	
+	/** FeatureStore to which belongs this index */
+	public FeatureStoreProviderServices getFeatureStoreProviderServices();
+	
+	/** Returns the absolute path (directory + filename) where this index is or will be stored */
+	public String getFileName();
+	
+	/** Returns a temporary absolute path (directory + filename) according to the system environment */
+	public String getTemporaryFileName();
+	
+	/** Calculates and returns a new filename for an index, using the given prefix and suffix */
+	public String getNewFileName(String prefix, String sufix);
+	
+	/** Fills this index with the store's data */
+	public void fill() throws FeatureIndexException;	
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 35988)
@@ -0,0 +1,211 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.feature.spi.memory;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+/**
+ * Envuelve un FeatureProvider en memoria para que muestre un FeautureType
+ * distinto del orginal sin modificarlo
+ *
+ *
+ * Wrap a FeatureProvider stored in memory to display a FeautureType other than
+ * the original one without change it
+ *
+ * @author jmvivo
+ *
+ */
+public class MemoryFeatureProviderAttributeMapper implements FeatureProvider {
+	private DefaultFeatureProvider original;
+	private FeatureType myFeatureType;
+
+	/**
+	 * Default constructor.
+	 * 
+	 * @param original
+	 *            featureProvider
+	 * @param featureType
+	 *            to expose
+	 */
+	public MemoryFeatureProviderAttributeMapper(DefaultFeatureProvider original,
+			FeatureType featureType) {
+		this.original = original;
+		this.myFeatureType = featureType;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#get(int)
+	 */
+	public Object get(int i) {
+		return original.get(myFeatureType.getAttributeDescriptor(i).getName());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#get(java.lang.String)
+	 */
+	public Object get(String name) {
+		return original.get(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getCopy()
+	 */
+	public FeatureProvider getCopy() {
+		DefaultFeatureProvider data = new DefaultFeatureProvider(myFeatureType);
+		data.setOID(this.original.getOID());
+		Iterator iter = myFeatureType.iterator();
+		FeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			data.set(attr.getIndex(), this.original.get(attr.getName()));
+		}
+		data.setNew(this.original.isNew());
+		return data;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getDefaultEnvelope()
+	 */
+	public Envelope getDefaultEnvelope() {
+		return original.getDefaultEnvelope();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getDefaultGeometry()
+	 */
+	public Geometry getDefaultGeometry() {
+		return original.getDefaultGeometry();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getOID()
+	 */
+	public Object getOID() {
+		return original.getOID();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getType()
+	 */
+	public FeatureType getType() {
+		return myFeatureType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNew()
+	 */
+	public boolean isNew() {
+		return original.isNew();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNull(int)
+	 */
+	public boolean isNull(int i) {
+		return original.isNull(myFeatureType.getAttributeDescriptor(i)
+				.getName());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNull(java.lang.String)
+	 */
+	public boolean isNull(String name) {
+		return original.isNull(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#set(int, java.lang.Object)
+	 */
+	public void set(int i, Object value) {
+		original.set(myFeatureType.getAttributeDescriptor(i).getName(),
+				value);
+
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#set(java.lang.String, java.lang.Object)
+	 */
+	public void set(String name, Object value) {
+		original.set(name, value);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#setDefaultEnvelope(org.gvsig.fmap.geom.primitive.Envelope)
+	 */
+	public void setDefaultEnvelope(Envelope extent) {
+		original.setDefaultEnvelope(extent);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#setDefaultGeometry(org.gvsig.fmap.geom.Geometry)
+	 */
+	public void setDefaultGeometry(Geometry geom) {
+		original.setDefaultGeometry(geom);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#setNew(boolean)
+	 */
+	public void setNew(boolean isNew) {
+		original.setNew(isNew);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#setOID(java.lang.Object)
+	 */
+	public void setOID(Object oid) {
+		original.setOID(oid);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java	(revision 35988)
@@ -0,0 +1,170 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.spi.memory;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.IteratorIndexTooBigException;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureProviderIterator;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureSetProvider;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Implementation of {@link FeatureSetProvider} used in
+ * {@link AbstractMemoryStoreProvider}
+ *
+ */
+public class MemoryFeatureSet extends AbstractFeatureSetProvider {
+
+	protected List data;
+
+	public MemoryFeatureSet(AbstractMemoryStoreProvider store,
+			FeatureQuery query, FeatureType featureType, List data) {
+		super(store, query,
+		/*
+		 * Comprobar si los attributos solicitados son distintos a los
+		 * originales.
+		 */
+		featureType.equals(store.getStoreServices()
+				.getProviderFeatureType(featureType.getId())) ? null
+				: featureType);
+		this.data = data;
+		/*
+		 * Nota: Como no sabe filtrar ni ordenar ignora el query.
+		 */
+	}
+
+	public boolean canFilter() {
+		return false;
+	}
+
+	public boolean canOrder() {
+		return false;
+	}
+
+	public boolean canIterateFromIndex() {
+		return true;
+	}
+
+	public long getSize() throws DataException {
+		return data.size();
+	}
+
+	public boolean isEmpty() throws DataException {
+		return data.isEmpty();
+	}
+
+	protected void doDispose() throws BaseException {
+		//data only has to be deleted when the store.dispose method is called
+		//data.clear();
+	}
+
+	protected AbstractFeatureProviderIterator createFastIterator(long index)
+			throws DataException {
+		return createIterator(index);
+	}
+
+	protected AbstractFeatureProviderIterator createIterator(long index)
+			throws DataException {
+		if (index > 0 && index >= data.size()) {
+			throw new IteratorIndexTooBigException(index, data.size());
+		}
+		Iterator iter =
+				index <= 0 ? data.iterator() : data.listIterator((int) index);
+		if (getFeatureType() == null) {
+			return new DelegatedDisposableIterator(getStore(), iter);
+		} else {
+			return new DelegatedDisposableWrappedIterator(getStore(), iter,
+					getFeatureType());
+		}
+	}
+
+	protected class DelegatedDisposableIterator extends
+			AbstractFeatureProviderIterator {
+		private Iterator delegated;
+
+		public DelegatedDisposableIterator(AbstractFeatureStoreProvider store,
+				Iterator it) {
+			super(store);
+			this.delegated = it;
+		}
+
+		protected void internalDispose() {
+			this.delegated = null;
+		}
+
+		protected boolean internalHasNext() {
+			return delegated.hasNext();
+		}
+
+		protected Object internalNext() {
+			return delegated.next();
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		protected void doDispose() throws BaseException {
+			if (delegated instanceof Disposable) {
+				((Disposable) delegated).dispose();
+			}
+		}
+	}
+
+	protected class DelegatedDisposableWrappedIterator extends
+			DelegatedDisposableIterator {
+		private FeatureType fType;
+
+		public DelegatedDisposableWrappedIterator(
+				AbstractFeatureStoreProvider store, Iterator it,
+				FeatureType featureType) {
+			super(store, it);
+			this.fType = featureType;
+		}
+
+		protected Object internalNext() {
+			DefaultFeatureProvider feature =
+					(DefaultFeatureProvider) super.internalNext();
+			if (fType == null) {
+				return feature;
+			} else {
+				return new MemoryFeatureProviderAttributeMapper(feature,
+						this.fType);
+			}
+
+		}
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java	(revision 35988)
@@ -0,0 +1,72 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.feature.spi.memory;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.resource.ResourceParameters;
+import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
+import org.gvsig.fmap.dal.resource.exception.ResourceException;
+import org.gvsig.fmap.dal.resource.spi.AbstractNonBlockingResource;
+
+/**
+ * Resource based on memory. It may be used to represent some data loaded into
+ * memory, so it can be named as the data or the source resource loaded.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class MemoryResource extends AbstractNonBlockingResource {
+
+	public static final String NAME = "memory";
+	public static final String DESCRIPTION = "Memory based resource";
+
+	/**
+	 * Creates a new {@link MemoryResource}.
+	 * 
+	 * @param parameters
+	 *            to create the resource
+	 * @throws InitializeException
+	 *             if there is an error creating the resource
+	 */
+	public MemoryResource(MemoryResourceParameters parameters)
+			throws InitializeException {
+		super(parameters);
+	}
+
+	public Object get() throws AccessResourceException {
+		return getName();
+	}
+
+	public String getName() throws AccessResourceException {
+		return NAME;
+	}
+
+	public boolean isThis(ResourceParameters parameters)
+			throws ResourceException {
+		return false;
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java	(revision 35988)
@@ -0,0 +1,142 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.spi.memory;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Abstract implementation for {@link FeatureStoreProvider} for provider that
+ * are loaded statically in memory
+ * 
+ */
+public abstract class AbstractMemoryStoreProvider extends
+		AbstractFeatureStoreProvider {
+
+	protected List data;
+
+	protected AbstractMemoryStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices, DynObject metadata) {
+		super(params, storeServices, metadata);
+	}
+
+	protected AbstractMemoryStoreProvider(DataStoreParameters params,
+			DataStoreProviderServices storeServices) {
+		super(params, storeServices);
+	}
+
+	public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator originalFeatureTypesUpdated) throws PerformEditingException {
+		throw new UnsupportedOperationException();
+	}
+
+	/**
+	 * Load a {@link FeatureProvider} into memory store.<br>
+	 * Use this when loading data.
+	 * 
+	 * @param data
+	 */
+	public void addFeatureProvider(FeatureProvider data) {
+		data.setOID(this.createNewOID());
+		this.data.add(data);
+	}
+
+	/**
+	 * Return the current size of the memory store.
+	 * 
+	 * @return
+	 * @throws DataException
+	 */
+	public long getDataSize() throws DataException {
+		this.open();
+		return this.data.size();
+	}
+
+	protected FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference) throws DataException {
+		int oid = ((Long) reference.getOID()).intValue();
+		return (FeatureProvider) this.data.get(oid);
+	}
+
+	protected FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference, FeatureType featureType)
+			throws DataException {
+        return new MemoryFeatureProviderAttributeMapper(
+            (DefaultFeatureProvider) internalGetFeatureProviderByReference(reference),
+            featureType);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery, org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureSetProvider createSet(FeatureQuery query, FeatureType featureType)
+			throws DataException {
+		this.open();
+		return new MemoryFeatureSet(this, query, featureType, this.data);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider#createFeatureProvider(org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureProvider createFeatureProvider(FeatureType featureType)throws DataException  {
+		this.open();
+		return new DefaultFeatureProvider(featureType);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureCount()
+	 */
+	public long getFeatureCount() throws DataException {
+		return data.size();
+	}
+
+	protected AbstractMemoryStoreProvider getMemoryProvider() {
+		return this;
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		data = null;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java	(revision 35988)
@@ -0,0 +1,91 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.spi.memory;
+
+import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObjectManager;
+
+/**
+ * Parameters to create a {@link MemoryResource}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class MemoryResourceParameters extends AbstractResourceParameters {
+
+	public static final String DYNCLASS_NAME = "MemoryResourceParameters";
+
+	private static String FIELD_NAME = "name";
+
+	private DelegatedDynObject delegatedDynObject;
+
+	/**
+	 * Creates a new memory resource parameters.
+	 */
+	public MemoryResourceParameters() {
+		delegatedDynObject =
+				(DelegatedDynObject) ToolsLocator.getDynObjectManager()
+						.createDynObject(registerDynClass());
+	}
+
+	/**
+	 * Creates a new memory resource parameters with the given memory resource
+	 * name.
+	 * 
+	 * @param name
+	 *            of the resource
+	 */
+	public MemoryResourceParameters(String name) {
+		this();
+		setDynValue(FIELD_NAME, name);
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return delegatedDynObject;
+	}
+
+	public String getTypeName() {
+		return MemoryResource.NAME;
+	}
+
+	/**
+	 * Registers the DynClass related to this parameters.
+	 */
+    private DynClass registerDynClass() {
+        DynObjectManager dynman = ToolsLocator.getDynObjectManager();
+        DynClass dynClass = dynman.get(DYNCLASS_NAME);
+        if (dynClass == null) {
+            dynClass = dynman.add(DYNCLASS_NAME);
+
+			dynClass.addDynFieldString(FIELD_NAME).setDescription(
+					"The name of the memory resource");
+        }
+        return dynClass;
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java	(revision 35988)
@@ -0,0 +1,91 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureType;
+
+/**
+ * Interface for feature references services for feature based data providers
+ *
+ *
+ * @author jmvivo
+ *
+ */
+public interface FeatureReferenceProviderServices extends FeatureReference {
+
+	/**
+	 * Return the OID (Object IDentifier) object that represents this reference
+	 *
+	 * <strong>Note:</strong> this can be <code>null</code> if provider does not
+	 * support OID
+	 *
+	 * @return <code>Object</code> that identifies a feature
+	 *
+	 * @see FeatureStoreProvider#getOIDType()
+	 * @see FeatureType#hasOID()
+	 */
+	public Object getOID();
+
+	/**
+	 * Return the attribute names that compound the Primary Key of represented
+	 * feature
+	 *
+	 * @return attribute names
+	 *
+	 * @see #getKeyValue(String)
+	 */
+	public String[] getKeyNames();
+
+	/**
+	 * Return the value of an attribute that compound the Primary Key of
+	 * represented feature
+	 *
+	 * @param name
+	 * @return
+	 *
+	 * @see #getKeyNames()
+	 */
+	public Object getKeyValue(String name);
+
+	/**
+	 * Inform that represented feature is not stored in the original data store
+	 *
+	 * @return true if not in the original store
+	 */
+	public boolean isNewFeature();
+
+	/**
+	 * Return the identifier of the {@link FeatureType} of the represented
+	 * feature
+	 *
+	 * @return
+	 */
+	public String getFeatureTypeId();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 35988)
@@ -0,0 +1,251 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+/**
+ * Default implementation for {@link FeatureProvider}
+ *
+ */
+public class DefaultFeatureProvider implements FeatureProvider {
+
+	protected FeatureType featureType;
+	protected boolean[] nulls;
+	protected Object[] values;
+	protected Geometry defaultGeometry;
+	protected Envelope envelope;
+	private Object oid;
+	private boolean isNew=false;
+
+	public DefaultFeatureProvider(FeatureType type) {
+		if (type instanceof EditableFeatureType) {
+			throw new IllegalArgumentException("type can't by editable.");
+		}
+		this.featureType = type;
+		this.values = new Object[featureType.size()];
+		this.nulls = new boolean[featureType.size()];
+
+		this.envelope = null;
+		this.defaultGeometry = null;
+		this.oid = null;
+	}
+
+	public DefaultFeatureProvider(FeatureType type, Object oid) {
+		this(type);
+		this.oid = oid;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#set(int,
+	 * java.lang.Object)
+	 */
+	public void set(int i, Object value) {
+		if (featureType.getDefaultGeometryAttributeIndex() == i) {
+			defaultGeometry = (Geometry) value;
+			envelope = null;
+		}
+		if (value == null) {
+			nulls[i] = true;
+			values[i] = featureType.getAttributeDescriptor(i).getDefaultValue();
+		} else {
+			values[i] = value;
+			nulls[i] = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#set(java.lang.String,
+	 * java.lang.Object)
+	 */
+	public void set(String name, Object value) {
+		set(featureType.getIndex(name), value);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#get(int)
+	 */
+	public Object get(int i) {
+		return values[i];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#get(java.lang.String)
+	 */
+	public Object get(String name) {
+		FeatureAttributeDescriptor featureAttributeDescriptor = featureType.getAttributeDescriptor(name);	
+		return values[featureAttributeDescriptor.getIndex()];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getType()
+	 */
+	public FeatureType getType() {
+		return featureType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getCopy()
+	 */
+	public FeatureProvider getCopy() {
+		DefaultFeatureProvider data = new DefaultFeatureProvider(
+				this.getType());
+		return getCopy(data);
+	}
+
+	/**
+	 * Copy values from current instance to <code>data</code>
+	 */
+	protected FeatureProvider getCopy(DefaultFeatureProvider data) {
+		data.oid = this.oid;
+		System.arraycopy(this.values, 0, data.values, 0, this.values.length);
+		data.defaultGeometry = this.defaultGeometry;
+		data.envelope = this.envelope;
+		data.isNew=this.isNew;
+		return data;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getDefaultEnvelope()
+	 */
+	public Envelope getDefaultEnvelope() {
+		if (envelope == null && defaultGeometry != null) {
+			envelope = defaultGeometry.getEnvelope();
+		}
+		return envelope;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getDefaultGeometry()
+	 */
+	public Geometry getDefaultGeometry() {
+		return this.defaultGeometry;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureProvider#setDefaultEnvelope(org
+	 * .gvsig.fmap.geom.primitive.Envelope)
+	 */
+	public void setDefaultEnvelope(Envelope envelope) {
+		this.envelope = envelope;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureProvider#setDefaultGeometry(org
+	 * .gvsig.fmap.geom.Geometry)
+	 */
+	public void setDefaultGeometry(Geometry geom) {
+		int i = featureType.getDefaultGeometryAttributeIndex();
+		defaultGeometry = geom;
+		envelope = null;
+		values[i] = geom;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNull(int)
+	 */
+	public boolean isNull(int i) {
+		return nulls[i];
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNull(java.lang.String)
+	 */
+	public boolean isNull(String name) {
+		int i = featureType.getIndex(name);
+		return isNull(i);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#getOID()
+	 */
+	public Object getOID() {
+		return this.oid;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.gvsig.fmap.dal.feature.spi.FeatureProvider#setOID(java.lang.Object)
+	 */
+	public void setOID(Object oid) {
+		this.oid = oid;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#isNew()
+	 */
+	public boolean isNew(){
+		return isNew;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureProvider#setNew(boolean)
+	 */
+	public void setNew(boolean isNew){
+		this.isNew=isNew;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java	(revision 35988)
@@ -0,0 +1,47 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.Iterator;
+
+/**
+ * Interface like {@link java.util.List} but with <code>long</code> capacity
+ * 
+ * @author jmvivo
+ *
+ */
+public interface LongList {
+
+	public long getSize();
+	public boolean isEmpty();
+	public Iterator iterator();
+	public Iterator iterator(long index);
+
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java	(revision 35988)
@@ -0,0 +1,86 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Default implementation for {@link LongList}<br>
+ * <br>
+ *
+ * <strong>Note:</strong> This class is based on {@link java.util.List}
+ */
+public class DefaultLongList implements LongList {
+
+	private List list = null;
+
+	public DefaultLongList(List list) {
+		this.list = list;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.LongList#getSize()
+	 */
+	public long getSize() {
+		return list.size();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.LongList#isEmpty()
+	 */
+	public boolean isEmpty() {
+		return list.isEmpty();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.feature.spi.LongList#iterator()
+	 */
+	public Iterator iterator() {
+		return list.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.fmap.dal.feature.spi.LongList#iterator(long)
+	 */
+	public Iterator iterator(long index) {
+		if (index > Integer.MAX_VALUE || index < Integer.MIN_VALUE) {
+			throw new IndexOutOfBoundsException();
+		}
+		return list.listIterator((int) index);
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java	(revision 35988)
@@ -0,0 +1,139 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dispose.DisposableIterator;
+
+/**
+ * Interface for set of feature based data providers
+ *
+ *
+ * @author jmvivo
+ *
+ */
+public interface FeatureSetProvider extends Disposable {
+
+	boolean canFilter();
+
+	boolean canOrder();
+
+	boolean canIterateFromIndex();
+
+	long getSize() throws DataException;
+
+	boolean isEmpty() throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this set, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * <p>
+     * Fast in this case means that each of the elements returned may be a
+     * reused or pooled object instance, so don't use it to be stored in any
+     * way.
+     * </p>
+     * <p>
+     * If you need to store one of the {@link FeatureProvider} of the iterator,
+     * use the {@link FeatureProvider#getCopy()} to create a clone of the
+     * object.
+     * </p>
+     * 
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws DataException
+     *             if there is an error getting the iterator
+     * 
+     * @deprecated use {@link #fastIterator()} instead
+     */
+	DisposableIterator iterator() throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this set, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * <p>
+     * Fast in this case means that each of the elements returned may be a
+     * reused or pooled object instance, so don't use it to be stored in any
+     * way.
+     * </p>
+     * <p>
+     * If you need to store one of the {@link FeatureProvider} of the iterator,
+     * use the {@link FeatureProvider#getCopy()} to create a clone of the
+     * object.
+     * </p>
+     * 
+     * @param index
+     *            index of first element to be returned from the iterator (by a
+     *            call to the <tt>next</tt> method).
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws DataException
+     *             if there is an error getting the iterator
+     * 
+     * @deprecated use {@link #fastIterator()} instead
+     */
+	DisposableIterator iterator(long index) throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this set, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * @see #fastIterator()
+     * @see #fastIterator(long)
+     * 
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws DataException
+     *             if there is an error getting the iterator
+     */
+    DisposableIterator fastIterator() throws DataException;
+
+    /**
+     * Returns an iterator over the elements in this set, in the order
+     * (if any) defined when the collection was obtained.
+     * 
+     * @see #fastIterator()
+     * @see #fastIterator(long)
+     * 
+     * @param index
+     *            index of first element to be returned from the iterator (by a
+     *            call to the <tt>next</tt> method).
+     * @return an iterator of the elements in this collection (in proper
+     *         sequence).
+     * 
+     * @throws DataException
+     *             if there is an error getting the iterator
+     */
+	DisposableIterator fastIterator(long index) throws DataException;
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java	(revision 35988)
@@ -0,0 +1,257 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+/**
+ *
+ * Interface for all feature based data providers.<br>
+ * <br>
+ * 
+ * 
+ * A FeatureStoreProvier must have a contructor like this:<br>
+ * <br>
+ * <code>
+ * FeatureStoreProvider({@link DataStoreParameters}, {@link FeatureStoreProviderServices})
+ * </code>
+ * 
+ */
+public interface FeatureStoreProvider extends DataStoreProvider {
+
+	/**
+	 * Return a new OID valid for a new feature.
+	 *
+	 * @return a new OID
+	 * @see {@link FeatureStoreProvider#getOIDType()}
+	 */
+	public Object createNewOID();
+
+	/**
+	 * Return OID data type (from {@link DataTypes}) of this store.
+	 *
+	 * @return OID data type
+	 * @see {@link FeatureStoreProvider#createNewOID()} {@link DataTypes}
+	 */
+	public int getOIDType();
+
+	/**
+	 * Factory of {@link FeatureProvider}. Create a new {@link FeatureProvider} instance
+	 * valid for this Store.
+	 *
+	 * @param {@link FeatureType} of the {@link FeatureProvider}
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureProvider createFeatureProvider(FeatureType type) throws DataException;
+
+	/**
+	 * Factory of {@link FeatureSelection}. Create a new
+	 * {@link FeatureSelection} instance valid for this Store.
+	 *
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureSelection createFeatureSelection() throws DataException;
+
+	/**
+	 * Factory of {@link FeatureLocks}. Create a new {@link FeatureLocks}
+	 * instance valid for this Store.
+	 *
+	 *
+	 * @return {@link FeatureLocks} or <code>null</code> if not
+	 *         {@link FeatureStoreProvider#isLocksSupported()}
+	 * @throws DataException
+	 */
+	public FeatureLocks createFeatureLocks() throws DataException;
+
+	/**
+	 * Factory of {@link FeatureSetProvider}. Create a new
+	 * {@link FeatureSetProvider} that represents result of {@link FeatureQuery}
+	 * .
+	 *
+	 * @param query
+	 *            (never will be null)
+	 * @param featureType
+	 *            (never will be null)
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureSetProvider createSet(FeatureQuery query,
+			FeatureType featureType) throws DataException;
+
+	/**
+	 * Return {@link FeatureProvider} from a
+	 * {@link FeatureReferenceProviderServices} using
+	 * {@link FeatureStore#getDefaultFeatureType()} as {@link FeatureType}
+	 *
+	 * @param reference
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureProvider getFeatureProviderByReference(FeatureReferenceProviderServices reference)
+			throws DataException;
+
+	/**
+	 * Return {@link FeatureProvider} from a
+	 * {@link FeatureReferenceProviderServices} using <code>featureType</code>
+	 * as {@link FeatureType}
+	 *
+	 * @param reference
+	 * @return
+	 * @throws DataException
+	 */
+	public FeatureProvider getFeatureProviderByReference(
+			FeatureReferenceProviderServices reference, FeatureType featureType)
+			throws DataException;
+	/**
+	 * Informs that store supports write.
+	 *
+	 * @return <true> if write is supported
+	 */
+	public boolean allowWrite();
+
+	/**
+	 *Informs that store supports write a geometry.
+	 *
+	 * @param geometryType
+	 * @param geometrySubType
+	 * @return
+	 * @throws DataException
+	 */
+	public boolean canWriteGeometry(int geometryType, int geometrySubType) throws DataException;
+
+
+	public interface FeatureTypeChanged {
+		FeatureType getSource();
+
+		FeatureType getTarget();
+	}
+
+	/**
+	 * Perform changes on store.
+	 *
+	 * @param deleteds
+	 *            iterator of {@link FeatureReferenceProviderServices}
+	 * @param inserteds
+	 *            iterator of {@link FeatureProvider}
+	 * @param updateds
+	 *            iterator of {@link FeatureProvider}
+	 * @param featureTypesChanged
+	 *            iterator of {@link FeatureTypeChanged}
+	 *
+	 * @throws DataException
+	 */
+	public void performChanges(Iterator deleteds, Iterator inserteds, Iterator updateds, Iterator featureTypesChanged) throws DataException;
+
+	/**
+	 * Returns this store's total envelope (extent).
+	 *
+	 * @return this store's total envelope (extent) or <code>null</code> if
+	 *         store not have geometry information
+	 */
+	public Envelope getEnvelope() throws DataException;
+
+	/**
+	 * Informs if store supports locks
+	 *
+	 * @return
+	 */
+	public boolean isLocksSupported();
+
+	/**
+	 * Return {@link FeatureStoreProviderServices} for this store
+	 *
+	 * @return
+	 */
+	public FeatureStoreProviderServices getStoreServices();
+
+	/**
+	 * Inform if the store provider supports automatic values for attributues
+	 * (autonumeric)
+	 *
+	 * @return <code>true</code> if supported
+	 */
+	public boolean allowAutomaticValues();
+
+	/**
+	 * Returns total feature count of this store.
+	 *
+	 * @return
+	 * @throws DataException
+	 */
+	public long getFeatureCount() throws DataException;
+
+
+	public boolean supportsAppendMode();
+
+	public void beginAppend() throws DataException;
+
+	public void endAppend() throws DataException;
+
+	public void append(FeatureProvider featureProvider) throws DataException;
+
+	/**
+	 * Return if the provider knows the real envelope of a layer. If not,
+	 * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
+	 * the full envelope.
+	 * 
+	 * @return
+	 * <true> if it knows the real envelope.
+	 */
+	public boolean isKnownEnvelope(); 
+	
+	/**
+	 * Return if the maximum number of features provided by the
+	 * provider are limited.
+	 * 
+	 * @return
+	 * <true> if there is a limit of features.
+	 */
+	public boolean hasRetrievedFeaturesLimit();
+	
+	/**
+	 * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns true,
+	 * it returns the limit of features retrieved from the provider.
+	 * @return
+	 * The limit of the retrieved features.
+	 */
+	public int getRetrievedFeaturesLimit();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java	(revision 35988)
@@ -0,0 +1,72 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2010 {Prodevelop}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.feature.spi.cache;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.spi.ProviderFactory;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
+ */
+public interface FeatureCacheProviderFactory extends ProviderFactory{
+
+	  /**
+	   * Returns the name of the providers created by this factory.
+	   * 
+	   * @return the provider name
+	   */
+	  String getName();
+
+	  /**
+	   * Creates a new CacheProvider.
+	   * 
+	   * @param parameters
+	   *            for the CacheProvider
+	   * @return the new CacheProvider
+	   * @throws DataException
+	   *             if the parameters are not valid or there is an error creating
+	   *             the CacheProvider
+	   */
+	  public FeatureCacheProvider createCacheProvider(DynObject parameters) throws DataException;
+
+	  /**
+	   * Creates the parameters for the {@link Provider} created by this factory.
+	   * 
+	   * @return the provider parameters
+	   */
+	  DynObject createParameters();
+
+	  /**
+	   * Initialices the factory.
+	   */
+	  void initialize();
+
+	
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java	(revision 35988)
@@ -0,0 +1,49 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.feature.spi.cache;
+
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public interface FeatureCacheProvider extends FeatureStoreProvider, FeatureCache{
+
+	void initialize(DataServerExplorerParameters parameters) throws DataException;
+	
+	void apply(FeatureStoreProviderServices featureStoreProviderServices,
+			FeatureStoreProvider featureStoreProvider) throws DataException;
+	
+	public FeatureStore createDataStore(double scale) throws DataException;
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java	(revision 35988)
@@ -0,0 +1,57 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.feature.spi;
+
+import org.gvsig.fmap.dal.spi.AbstractDataProviderIterator;
+
+/**
+ * Abstract base implementation for {@link FeatureProvider} iterators.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractFeatureProviderIterator extends
+		AbstractDataProviderIterator {
+
+	/**
+	 * Creates a new iterator instance.
+	 * 
+	 * @param storeProvider
+	 *            to load the {@link FeatureProvider}s from
+	 */
+	public AbstractFeatureProviderIterator(FeatureStoreProvider storeProvider) {
+		super(storeProvider);
+	}
+
+	/**
+	 * Returns the {@link FeatureStoreProvider}.
+	 * 
+	 * @return the {@link FeatureSetProvider}
+	 */
+	protected FeatureStoreProvider getFeatureStoreProvider() {
+		return (FeatureStoreProvider) getDataStoreProvider();
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java	(revision 35988)
@@ -0,0 +1,140 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+
+/**
+ * Base implementation for {@link FeatureSetProvider}s, adding some utility
+ * methods.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public abstract class AbstractFeatureSetProvider extends AbstractDisposable
+		implements FeatureSetProvider {
+
+	private final AbstractFeatureStoreProvider store;
+	private final FeatureQuery query;
+	private final FeatureType featureType;
+
+	/**
+	 * Creates a new {@link FeatureSetProvider}.
+	 * 
+	 * @param store
+	 *            the underlying {@link FeatureStoreProvider} to get the data
+	 *            from
+	 * @param query
+	 *            used to create the {@link FeatureSetProvider}
+	 * @param featureType
+	 *            the type of feature to get
+	 */
+	public AbstractFeatureSetProvider(AbstractFeatureStoreProvider store,
+			FeatureQuery query, FeatureType featureType) {
+		this.store = store;
+		this.query = query;
+		this.featureType = featureType;
+	}
+
+	/**
+	 * Return the {@link AbstractFeatureStoreProvider}.
+	 * 
+	 * @return the store
+	 */
+	protected AbstractFeatureStoreProvider getStore() {
+		return store;
+	}
+
+	/**
+	 * Returns the {@link FeatureQuery} used to create this set.
+	 * 
+	 * @return the query
+	 */
+	protected FeatureQuery getQuery() {
+		return query;
+	}
+
+	/**
+	 * Returns the type of features to load.
+	 * 
+	 * @return the featureType
+	 */
+	protected FeatureType getFeatureType() {
+		return featureType;
+	}
+
+	public final DisposableIterator fastIterator() throws DataException {
+		return fastIterator(0);
+	}
+
+	public final DisposableIterator fastIterator(long index)
+			throws DataException {
+		return createFastIterator(index);
+	}
+
+	public final DisposableIterator iterator() throws DataException {
+		return iterator(0);
+	}
+
+	public final DisposableIterator iterator(long index) throws DataException {
+		return createIterator(index);
+	}
+
+	/**
+	 * Creates a new {@link Iterator}, begginning at the specified data index.
+	 * 
+	 * @param index
+	 *            the first element position to be returned by the
+	 *            {@link Iterator}
+	 * @return a new {@link Iterator}
+	 * @throws DataException
+	 *             if there is an error creating the {@link Iterator}
+	 */
+	protected abstract AbstractFeatureProviderIterator createIterator(long index)
+			throws DataException;
+
+	/**
+	 * Creates a new fast {@link Iterator}, begginning at the specified data
+	 * index. By fast this means the object instances of data (
+	 * {@link FeatureProvider}) may be reused between the
+	 * {@link Iterator#next()} method invocations.
+	 * 
+	 * @param index
+	 *            the first element position to be returned by the
+	 *            {@link Iterator}
+	 * @return a new {@link Iterator}
+	 * @throws DataException
+	 *             if there is an error creating the {@link Iterator}
+	 */
+	protected abstract AbstractFeatureProviderIterator createFastIterator(
+			long index) throws DataException;
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 35988)
@@ -0,0 +1,75 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.spi;
+
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+
+/**
+ * Inteface for feature of feature based data provider
+ *
+ * @author jmvivo
+ *
+ */
+public interface FeatureProvider {
+
+	public void set(int i, Object value);
+
+	public Object get(int i);
+
+	public void set(String name, Object value);
+
+	public Object get(String name);
+
+	public void setOID(Object oid);
+
+	public Object getOID();
+
+	public FeatureType getType();
+
+	public FeatureProvider getCopy();
+
+	public Envelope getDefaultEnvelope();
+
+	public Geometry getDefaultGeometry();
+
+	public void setDefaultEnvelope(Envelope extent);
+
+	public void setDefaultGeometry(Geometry geom);
+
+	public boolean isNull(int i);
+
+	public boolean isNull(String name);
+
+	public boolean isNew();
+
+	public void setNew(boolean isNew);
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java	(revision 35988)
@@ -0,0 +1,76 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.tools.evaluator.Evaluator;
+
+/**
+ * This interface gives access to a store's local indexes
+ * and also provides a delegated method for obtaining a
+ * resulting {@link FeatureSet} using the appropriate
+ * index given an {@link Evaluator}.
+ *
+ *
+ * @author jyarza
+ *
+ */
+public interface FeatureIndexes {
+
+
+	/**
+	 * Returns a FeatureIndex given the name with which it was created.
+	 *
+	 * @param name FeatureIndex name
+	 *
+	 * @return FeatureIndex or null if it is not found.
+	 */
+	public FeatureIndex getFeatureIndex(String name);
+
+	/**
+	 * Using the given evaluator attributes, choose and use an appropriate index
+	 * to obtain a FeatureSet. If no index can be applied, then this method
+	 * returns null
+	 *
+	 * @param evaluator
+	 * @return FeatureSet or null if could not find any appropriate index.
+	 * @throws FeatureIndexException
+	 *
+	 */
+	public FeatureSet getFeatureSet(Evaluator evaluator)
+			throws FeatureIndexException;
+
+	/**
+	 * Returns an iterator over the indexes. Elements are of type FeatureIndex.
+	 *
+	 * @return Iterator over the FeatureIndex(es).
+	 */
+	public Iterator iterator();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java	(revision 35988)
@@ -0,0 +1,146 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureComparator;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class FeatureQueryOrder implements Persistent, Cloneable {
+
+	private List members = new ArrayList();
+
+	public class FeatureQueryOrderMember implements Persistent, Cloneable {
+		String attributeName = null;
+		Evaluator evaluator = null;
+		boolean ascending;
+
+		FeatureQueryOrderMember(String attributeName, boolean ascending) {
+			this.attributeName = attributeName;
+			this.ascending = ascending;
+		}
+		FeatureQueryOrderMember(Evaluator evaluator, boolean ascending) {
+			this.evaluator = evaluator;
+            this.ascending = ascending;
+		}
+		public boolean hasEvaluator() {
+			return this.evaluator != null;
+		}
+		public Evaluator getEvaluator() {
+			return this.evaluator;
+		}
+		public boolean getAscending() {
+			return this.ascending;
+		}
+		public String getAttributeName() {
+			return this.attributeName;
+		}
+		public void loadFromState(PersistentState state)
+				throws PersistenceException {
+			this.attributeName = state.getString("attributeName");
+			this.ascending = state.getBoolean("ascending");
+			this.evaluator = (Evaluator) state.get("evaluator");
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			state.set("attributeName", this.attributeName);
+			state.set("ascending", this.ascending);
+			if (this.evaluator != null) {
+				state.set("evaluator", evaluator);
+			}
+
+		}
+
+		public Object clone() throws CloneNotSupportedException {
+			// Nothing more to clone
+			return super.clone();
+		}
+	}
+
+	public Object add(String attributeName, boolean ascending) {
+        FeatureQueryOrderMember member = new FeatureQueryOrderMember(
+                attributeName, ascending);
+		if( members.add(member) ) {
+			return member;
+		}
+		return null;
+	}
+
+	public Object add(Evaluator evaluator, boolean ascending) {
+		FeatureQueryOrderMember member = new FeatureQueryOrderMember(
+				evaluator,
+				ascending);
+		if (members.add(member)) {
+			return member;
+		}
+		return null;
+	}
+
+	public Iterator iterator() {
+		return members.iterator();
+	}
+
+	public boolean remove(FeatureQueryOrderMember member) {
+		return members.remove(member);
+	}
+
+	public void remove(int index) {
+		members.remove(index);
+	}
+
+	public void clear() {
+		members.clear();
+	}
+
+	public int size() {
+		return this.members.size();
+	}
+
+	public Comparator getFeatureComparator() {
+		return new DefaultFeatureComparator(this);
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		FeatureQueryOrder clone = (FeatureQueryOrder) super.clone();
+
+		if (members != null) {
+			clone.members = new ArrayList(members.size());
+			for (int i = 0; i < members.size(); i++) {
+				clone.members.add(((Cloneable) members.get(i)).clone());
+			}
+		}
+
+		return clone;
+	}
+
+	public FeatureQueryOrder getCopy() {
+		FeatureQueryOrder aCopy = new FeatureQueryOrder();
+		Iterator iter = this.members.iterator();
+		FeatureQueryOrderMember member;
+		while (iter.hasNext()) {
+			member = (FeatureQueryOrderMember) iter.next();
+			if (member.hasEvaluator()) {
+				aCopy.add(member.getEvaluator(), member.getAscending());
+			} else {
+				aCopy.add(member.getAttributeName(), member.getAscending());
+			}
+		}
+		return aCopy;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		this.members = (List) state.get("menbers");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("menbers", members);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java	(revision 35988)
@@ -0,0 +1,52 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+
+/**
+ * @author jiyarza
+ */
+public class FeatureIndexException extends DataException {
+	
+	private static final long serialVersionUID = 932690269454242645L;	
+	
+	private static final String MESSAGE_KEY = "index_exception";
+	private static final String FORMAT_STRING = 
+		"Index Exception.";	
+	
+	/**
+	 * Main constructor that provides a cause Exception
+	 * @param e
+	 */
+	public FeatureIndexException(Exception e) {
+		super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class FinishEditingException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 5568229519842721381L;
+
+	private final static String MESSAGE_FORMAT = "Can't finish edition.";
+	private final static String MESSAGE_KEY = "_FinishEditingException";
+
+	public FinishEditingException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreDeleteEditableFeatureException extends DataException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -996334019316255990L;
+
+	private final static String MESSAGE_FORMAT = "Can't delete an editable feature in store %(store)s.";
+	private final static String MESSAGE_KEY = "_DeleteEditableFeatureException";
+
+	public StoreDeleteEditableFeatureException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java	(revision 35988)
@@ -0,0 +1,62 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+
+/**
+ * Exception thrown when the index value for an iterator of a {@link FeatureSet}
+ * is too big.
+ * 
+ * @see FeatureSet#iterator(long)
+ * @see FeatureSet#fastIterator(long)
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class IteratorIndexTooBigException extends DataException {
+	
+	private static final long serialVersionUID = -2774419869818426273L;
+	
+	private final static String MESSAGE_FORMAT =
+			"The index value %(value) is bigger than the "
+					+ "Iterator maximum value: %(maxValue)";
+	private final static String MESSAGE_KEY = "_IteratorIndexTooBigException";
+
+	/**
+	 * Creates a new {@link IteratorIndexTooBigException}.
+	 * 
+	 * @param value
+	 *            the wanted Iterator index value
+	 * @param maxValue
+	 *            the maximum Iterator index value
+	 */
+	public IteratorIndexTooBigException(long value, long maxValue) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("value", new Long(value));
+		setValue("maxValue", new Long(maxValue));
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java	(revision 35988)
@@ -0,0 +1,55 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+/**
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class SelectionStateException extends DataException {
+
+    private final static String MESSAGE_FORMAT = "Error getting or setting the selection state";
+    private final static String MESSAGE_KEY = "_SelectionStateException";
+
+    private static final long serialVersionUID = -1183610070098605104L;
+
+    /**
+     * Creates a new SelectionStateException.
+     */
+    public SelectionStateException() {
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+    }
+
+    /**
+     * Creates a new SelectionStateException with a cause.
+     */
+    public SelectionStateException(Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+    }
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class IllegalFeatureTypeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3151888912258726109L;
+	private final static String MESSAGE_FORMAT = "Feature type not allowed for the store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_IllegalFeatureTypeException";
+
+	public IllegalFeatureTypeException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java	(revision 35988)
@@ -0,0 +1,25 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class AttributeFeatureTypeNotSuportedException extends DataException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 7317879648245754186L;
+	private final static String MESSAGE_FORMAT = "Attribute type %(typeValue)s ('%(typeName)s') of attribute '%(attrname)s' no supported for '%(storeName)s'.";
+	private final static String MESSAGE_KEY = "_AttributeFeatureTypeNotSuportedException";
+
+	public AttributeFeatureTypeNotSuportedException(String attrname,
+			int typeValue,
+			String typeName, String storeName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("attrname", attrname);
+		setValue("typeValue", "" + typeValue);
+		setValue("typeName", typeName);
+		setValue("storeName", storeName);
+
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class ValidateFeaturesException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6175223093153209836L;
+	private final static String MESSAGE_FORMAT = "Can't validate features of store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_ValidateFeaturesException";
+
+	public ValidateFeaturesException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreDeleteFeatureException extends DataException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 5730673193453142604L;
+	private final static String MESSAGE_FORMAT = "Can't delete feature in store %(store)s.";
+	private final static String MESSAGE_KEY = "_StoreDeleteFeatureException";
+
+	public StoreDeleteFeatureException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java	(revision 35988)
@@ -0,0 +1,24 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class UnknownDataTypeException extends DataException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7481521283837021787L;
+	private final static String MESSAGE_FORMAT = "Unknown data type '%(typeValue)s' of attribute '%(attrname)s' from '%(storeName)s'.";
+	private final static String MESSAGE_KEY = "_UnknownDataTypeException";
+
+	public UnknownDataTypeException(String attrname,
+			String typeValue,
+			String storeName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("attrname", attrname);
+		setValue("typeValue", typeValue);
+		setValue("storeName", storeName);
+
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class GetFeatureTypeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6691256137001562925L;
+	private final static String MESSAGE_FORMAT = "Can't get feature type of store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_GetFeatureTypeException";
+
+	public GetFeatureTypeException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java	(revision 35988)
@@ -0,0 +1,57 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+
+/**
+ * For errors when creating an iterator from a reversed selection.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class ReversedSelectionIteratorException extends DataRuntimeException {
+
+    private final static String MESSAGE_FORMAT = "Error getting the Features of a reversed selection";
+    private final static String MESSAGE_KEY = "_ReversedSelectionIteratorException";
+
+    private static final long serialVersionUID = -1183610070098605104L;
+
+    /**
+     * Creates a new SelectionStateException.
+     */
+    public ReversedSelectionIteratorException() {
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+    }
+
+    /**
+     * Creates a new SelectionStateException with a cause.
+     */
+    public ReversedSelectionIteratorException(Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+    }
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature.exception package documentation</title>
+</head>
+<body>
+
+<p>Provides DAL's feature level exceptions.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+
+public class ConcurrentDataModificationException extends DataRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8352205502388246169L;
+	private final static String MESSAGE_FORMAT = "Concurrent modification in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_ConcurrentDataModificationException";
+
+	public ConcurrentDataModificationException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,22 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+public class PersistenceCantFindFeatureTypeException extends PersistenceException {
+
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1254048284332411193L;
+	private final static String MESSAGE_FORMAT = "Can't find feature type (%(featureTypeName)) in data store (%(storeName)) to restore.";
+	private final static String MESSAGE_KEY = "_PersistenceCantFindFeatureTypeException";
+
+	public PersistenceCantFindFeatureTypeException(String storeName, String featureTypeName){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("storeName", storeName);
+		this.setValue("featureTypeName", featureTypeName);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class DataExportException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2776287871021464378L;
+
+	private final static String MESSAGE_FORMAT = "Can't export to %(target)s.";
+	private final static String MESSAGE_KEY = "_DataExportException";
+
+	public DataExportException(Throwable cause, String target) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		this.setValue("target", target);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+public class PersistenceStoreAlreadyLoadedException extends PersistenceException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 8995540779271989345L;
+	private final static String MESSAGE_FORMAT = "Can't reload store ('%(name)'), provider already initilized.";
+	private final static String MESSAGE_KEY = "_PersistenceStoreAlreadyLoadedException";
+
+	public PersistenceStoreAlreadyLoadedException(String name){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("name", name);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreUpdateFeatureTypeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3117799038163318881L;
+	private final static String MESSAGE_FORMAT = "Can't update feature type in store '%(store)s.";
+	private final static String MESSAGE_KEY = "_StoreUpdateFeatureTypeException";
+
+	public StoreUpdateFeatureTypeException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java	(revision 35988)
@@ -0,0 +1,51 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class SetReadOnlyAttributeException extends DataRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7608679825253499090L;
+	private final static String MESSAGE_FORMAT = "Attribute '%(attribute)'[%(typename)] is read only.";
+	private final static String MESSAGE_KEY = "_SetReadOnlyAttributeException";
+
+	public SetReadOnlyAttributeException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class PerformEditingException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4303159486787919718L;
+	private final static String MESSAGE_FORMAT = "Can't perform editing in '%(resource)s'.";
+	private final static String MESSAGE_KEY = "_PerformEditingException";
+
+	public PerformEditingException(String resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+public class PersistenceCantFindDefaultFeatureTypeException extends PersistenceException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2869975221925191656L;
+	private final static String MESSAGE_FORMAT = "Can't find feature type (%(featureTypeName)) in data store (%(storeName)) to restore.";
+	private final static String MESSAGE_KEY = "_PersistenceCantFindDefaultFeatureTypeException";
+
+	public PersistenceCantFindDefaultFeatureTypeException(String storeName, String featureTypeName){
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("storeName", storeName);
+		this.setValue("featureTypeName", featureTypeName);
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class SelectionNotAllowedException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6572957305406890773L;
+	private final static String MESSAGE_FORMAT = "Selection not allowed in store %(store)s.";
+	private final static String MESSAGE_KEY = "_SelectionNotAllowedException";
+
+	public SelectionNotAllowedException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class CreateFeatureException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7335241420683266251L;
+	private final static String MESSAGE_FORMAT = "Can't create feature in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_CreateFeatureException";
+
+	public CreateFeatureException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreUndoException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -944510163710231013L;
+	private final static String MESSAGE_FORMAT = "Can't undo in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_StoreUndoException";
+
+	public StoreUndoException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class WriteNotAllowedException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 4935538241520381746L;
+	private final static String MESSAGE_FORMAT = "Unsuported writing for the store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_WriteNotAllowedException";
+
+	public WriteNotAllowedException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java	(revision 35988)
@@ -0,0 +1,57 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class UnsupportedDataTypeException extends DataRuntimeException {
+
+	private int dataType;
+	private final static String MESSAGE_FORMAT = "Unsupported data type '%(typeValue)' of attribute '%(attrname)'.";
+	private final static String MESSAGE_KEY = "_UnsupportedTypeException";
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1313736269863651404L;
+
+	public UnsupportedDataTypeException(String attrname, int dataType) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("attrname", attrname);
+		setValue("typeValue", Integer.toString(dataType));
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class NeedEditingModeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 4295472399799040181L;
+
+	private final static String MESSAGE_FORMAT = "Operation not allowed if not in editing mode for store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_NeedEditingModeException";
+
+	public NeedEditingModeException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class IllegalFeatureException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1367845204038351116L;
+	private final static String MESSAGE_FORMAT = "Feature not allowed for the store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_IllegalFeatureException";
+
+	public IllegalFeatureException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java	(revision 35988)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class AlreadyEditingException extends DataException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6589349326410416899L;
+
+	private final static String MESSAGE_FORMAT = "Store '%(store)s' is already in editing mode.";
+	private final static String MESSAGE_KEY = "_AlreadyEditingException";
+
+	public AlreadyEditingException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class NoNewFeatureInsertException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1597158676397711190L;
+	private final static String MESSAGE_FORMAT = "Exception intializing '%(store)s'.";
+	private final static String MESSAGE_KEY = "_InitializeException";
+
+	public NoNewFeatureInsertException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class NullFeatureTypeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8969897372454817704L;
+	private final static String MESSAGE_FORMAT = "Can't allowed a feature type to null in store %(store)s.";
+	private final static String MESSAGE_KEY = "_NullFeatureTypeException";
+
+	public NullFeatureTypeException(String store) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java	(revision 35988)
@@ -0,0 +1,55 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+
+/**
+ * Exception thrown when an error is produced while creating or initializing a
+ * {@link FeatureSet}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class FeatureSetInitializeException extends DataException {
+
+	private static final long serialVersionUID = 3626939908400169082L;
+	private final static String MESSAGE_FORMAT =
+			"Error initializing a FeatureSet";
+	private final static String MESSAGE_KEY = "_FeatureSetInitializeException";
+
+	/**
+	 * Creates a new {@link FeatureSetInitializeException}.
+	 * 
+	 * @param cause
+	 *            the original cause of the exception
+	 */
+	public FeatureSetInitializeException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java	(revision 35988)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataListException;
+
+
+public class FeatureTypeIntegrityException extends DataListException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -1599605985631014641L;
+
+	private final static String MESSAGE_FORMAT = "Feature type (%(typeId)s) incorrect.";
+	private final static String MESSAGE_KEY = "_FeatureTypeIntegrityException";
+
+	public FeatureTypeIntegrityException(String typeId) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("typeId", typeId);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreInsertFeatureException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1309051657301097896L;
+	private final static String MESSAGE_FORMAT = "Can't insert feature in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_StoreInsertFeatureException";
+
+	public StoreInsertFeatureException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreEditException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -5529148262961765052L;
+
+	private final static String MESSAGE_FORMAT = "Can't enter in editing mode for store '%(store)s.";
+	private final static String MESSAGE_KEY = "_StoreEditException";
+
+	public StoreEditException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		this.setValue("store", store);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java	(revision 35988)
@@ -0,0 +1,73 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.type.GeometryType;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class UnsupportedGeometryException extends DataRuntimeException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2381749762973472962L;
+	private final static String MESSAGE_FORMAT = "Unsupported geometry: '%(geomTypeName)'(%(geomType),%(geomSubtype)).";
+	private final static String MESSAGE_KEY = "_UnsupportedGeometryException";
+
+
+	public UnsupportedGeometryException(int geomType, int geomSubtype) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("geomType", Integer.toString(geomType));
+		setValue("geomSubtype", Integer.toString(geomSubtype));
+		setValue("geomTypeName", "{unknow}");
+		try {
+			GeometryType type = GeometryLocator.getGeometryManager()
+					.getGeometryType(geomType, geomSubtype);
+			setValue("geomTypeName", type.getName());
+		} catch (Exception ex) {
+			// Nothing to do
+		}
+	}
+	public UnsupportedGeometryException(GeometryType geomType) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("geomType", Integer.toString(geomType.getType()));
+		setValue("geomSubtype", Integer.toString(geomType.getSubType()));
+		setValue("geomTypeName", geomType.getName());
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreCancelEditingException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4303159486787919718L;
+	private final static String MESSAGE_FORMAT = "Can't cancel editing in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_StoreCancelEditingException";
+
+	public StoreCancelEditingException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java	(revision 35988)
@@ -0,0 +1,72 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataRuntimeException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class IllegalValueException extends DataRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 7398202284121091833L;
+	private final static String MESSAGE_FORMAT = "Value not allowed for the attribute '%(attribute)'[%(typename)]: %(value).";
+	private final static String MESSAGE_KEY = "_IllegalValueException";
+
+	public IllegalValueException(FeatureAttributeDescriptor attribute,
+			Object value) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("attribute", attribute.getName());
+		setValue("typename", attribute.getDataTypeName());
+		if (value == null) {
+			setValue("value", "{null}");
+		} else {
+			setValue("value", value.toString());
+		}
+	}
+	public IllegalValueException(FeatureAttributeDescriptor attribute,
+			Object value, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("attribute", attribute.getName());
+		setValue("typename", attribute.getDataTypeName());
+		if (value == null) {
+			setValue("value", "{null}");
+		} else {
+			setValue("value", value.toString());
+		}
+
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreRedoException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3619737749583530176L;
+	private final static String MESSAGE_FORMAT = "Can't redo in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_StoreRedoException";
+
+	public StoreRedoException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java	(revision 35988)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class StoreUpdateFeatureException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8532519106338060835L;
+	private final static String MESSAGE_FORMAT = "Can't update feature in store '%(store)s'.";
+	private final static String MESSAGE_KEY = "_StoreUpdateFeatureException";
+
+	public StoreUpdateFeatureException(Throwable cause, String store) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+public class AttributeFeatureTypeSizeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2997663523084109588L;
+
+	private final static String MESSAGE_FORMAT = "invalid size '%(size)s'.";
+	private final static String MESSAGE_KEY = "_AttributeFeatureTypeSizeException";
+
+	public AttributeFeatureTypeSizeException(int size) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("size", Integer.toString(size));
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java	(revision 35988)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class CreateGeometryException extends DataException {
+	private static final long serialVersionUID = -3963756418194447731L;
+	private final static String MESSAGE_FORMAT = "Exception creating a geometry with type: '%(type)' and subtype:'%(subtype)'.";
+	private final static String MESSAGE_KEY = "_CreateGeometryException";
+
+	public CreateGeometryException(Throwable cause) {
+		this(TYPES.NULL, SUBTYPES.UNKNOWN, cause);
+	}
+	
+	public CreateGeometryException(int type, int subtype, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("type", new Integer(type));
+		setValue("subtype", new Integer(subtype));
+	}
+
+}
+
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.exception.DataListException;
+
+public class AttributeFeatureTypeIntegrityException extends DataListException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -1599605985631014641L;
+
+	private final static String MESSAGE_FORMAT = "Integrity error in attribute '%(attrname)s'.";
+	private final static String MESSAGE_KEY = "_AttributeFeatureTypeIntegrityException";
+
+	public AttributeFeatureTypeIntegrityException(String attrname) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("attrname", attrname);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java	(revision 35988)
@@ -0,0 +1,109 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataSelection;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.observer.ComplexObservable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Interface to manage selection of objects from an undetermined set. Allows to
+ * add and remove values from the selection, as well as reversing the selection.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public interface FeatureReferenceSelection extends DataSelection, Observer,
+		WeakReferencingObservable, ComplexObservable, Persistent {
+
+    /**
+     * Adds a feature to the selection.
+     *
+     * @param reference
+     *            the selected feature reference
+     * @return true if the feature was not selected before selecting it
+     */
+    boolean select(FeatureReference reference);
+
+    /**
+     * Removes a feature from the selection.
+     *
+     * @param reference
+     *            the deselected feature reference
+     * @return true if the feature was selected before deselecting it
+     */
+    boolean deselect(FeatureReference reference);
+
+    /**
+     * Selects all values.
+     * 
+     * @throws DataException
+     *             if there is an error selecting all values
+     */
+    void selectAll() throws DataException;
+
+    /**
+     * Deselects all values.
+     * 
+     * @throws DataException
+     *             if there is an error deselecting all values
+     */
+    void deselectAll() throws DataException;
+
+    /**
+     * Returns if a feature is selected.
+     *
+     * @param reference
+     *            to check
+     * @return if it is selected
+     */
+    boolean isSelected(FeatureReference reference);
+
+    /**
+     * Reverses the selection. Currently selected objects will become the not
+     * selected ones, so any other object will be a selected one.
+     */
+    void reverse();
+
+    /**
+     * Returns the number of selected values.
+     *
+     * @return the number of selected values
+     */
+    long getSelectedCount();
+
+    /**
+     * Returns an unmodifiable Iterator of selected feature references.
+     *
+     * @return the iterator of selected feature references
+     */
+    Iterator referenceIterator();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java	(revision 35988)
@@ -0,0 +1,55 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureRule;
+import org.gvsig.fmap.dal.feature.FeatureRules;
+
+public class DefaultFeatureRules extends ArrayList implements FeatureRules {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8084546505498274121L;
+
+	public FeatureRule add(FeatureRule rule) {
+		if (super.add(rule)) {
+			return rule;
+		}
+		return null;
+	}
+
+	public FeatureRule getRule(int index) {
+		return (FeatureRule) super.get(index);
+	}
+
+	public boolean remove(FeatureRule rule) {
+		return super.remove(rule);
+	}
+
+	public FeatureRules getCopy() {
+		DefaultFeatureRules copy = new DefaultFeatureRules();
+		copy.addAll(this);
+		return copy;
+	}
+
+	public void validate(Feature feature) {
+		Iterator featureRules=iterator();
+		while (featureRules.hasNext()) {
+			FeatureRule rule = (FeatureRule) featureRules.next();
+			try {
+				rule.validate(feature, ((DefaultFeature)feature).getStore());
+			} catch (DataException e) {
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 35988)
@@ -0,0 +1,1869 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.CloseException;
+import org.gvsig.fmap.dal.exception.CreateException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.exception.AlreadyEditingException;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.fmap.dal.feature.exception.CreateFeatureException;
+import org.gvsig.fmap.dal.feature.exception.DataExportException;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.exception.FinishEditingException;
+import org.gvsig.fmap.dal.feature.exception.GetFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.IllegalFeatureException;
+import org.gvsig.fmap.dal.feature.exception.IllegalFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.dal.feature.exception.NoNewFeatureInsertException;
+import org.gvsig.fmap.dal.feature.exception.NullFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.PersistenceCantFindDefaultFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.PersistenceCantFindFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.PersistenceStoreAlreadyLoadedException;
+import org.gvsig.fmap.dal.feature.exception.SelectionNotAllowedException;
+import org.gvsig.fmap.dal.feature.exception.StoreCancelEditingException;
+import org.gvsig.fmap.dal.feature.exception.StoreDeleteEditableFeatureException;
+import org.gvsig.fmap.dal.feature.exception.StoreDeleteFeatureException;
+import org.gvsig.fmap.dal.feature.exception.StoreEditException;
+import org.gvsig.fmap.dal.feature.exception.StoreInsertFeatureException;
+import org.gvsig.fmap.dal.feature.exception.StoreUpdateFeatureException;
+import org.gvsig.fmap.dal.feature.exception.StoreUpdateFeatureTypeException;
+import org.gvsig.fmap.dal.feature.exception.ValidateFeaturesException;
+import org.gvsig.fmap.dal.feature.exception.WriteNotAllowedException;
+import org.gvsig.fmap.dal.feature.impl.expansionadapter.MemoryExpansionAdapter;
+import org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet;
+import org.gvsig.fmap.dal.feature.impl.undo.DefaultFeatureCommandsStack;
+import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
+import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.cache.FeatureCacheProvider;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.fmap.dal.impl.DefaultDataManager;
+import org.gvsig.fmap.dal.resource.Resource;
+import org.gvsig.fmap.dal.spi.DataStoreInitializer;
+import org.gvsig.fmap.dal.spi.DataStoreProvider;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectManager;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.NotYetImplemented;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.Command;
+import org.gvsig.tools.visitor.Visitor;
+
+public final class DefaultFeatureStore extends AbstractDisposable implements
+    DataStoreInitializer, FeatureStoreProviderServices, FeatureStore,
+    Observer {
+
+    final static private Logger logger =
+        LoggerFactory.getLogger(DefaultFeatureStore.class);
+
+    private static final String PERSISTENCE_DEFINITION_NAME = "FeatureStore";
+
+    private DataStoreParameters parameters = null;
+    private FeatureSelection selection;
+    private FeatureLocks locks;
+
+    private DelegateWeakReferencingObservable delegateObservable =
+        new DelegateWeakReferencingObservable(this);
+
+    private FeatureCommandsStack commands;
+    private FeatureTypeManager featureTypeManager;
+    private FeatureManager featureManager;
+    private SpatialManager spatialManager;
+
+    private FeatureType defaultFeatureType = null;
+    private List featureTypes = new ArrayList();
+
+    private int mode = MODE_QUERY;
+    private long versionOfUpdate = 0;
+    private boolean hasStrongChanges = true;
+    private boolean hasInserts = true;
+
+    private DefaultDataManager dataManager = null;
+
+    private FeatureStoreProvider provider = null;
+
+    private DefaultFeatureIndexes indexes;
+
+    private DefaultFeatureStoreTransforms transforms;
+
+    private DelegatedDynObject metadata;
+    private Set metadataChildren;
+
+    private Long featureCount = null;
+
+    private long temporalOid = 0;
+
+    private FeatureCacheProvider cache;
+
+    /*
+     * TODO:
+     * 
+     * - Comprobar que solo se pueden a�adir reglas de validacion sobre un
+     * EditableFeatureType. - Comprobar que solo se puede hacer un update con un
+     * featureType al que se le han cambiado las reglas de validacion cuando
+     * hasStrongChanges=false.
+     */
+
+    public DefaultFeatureStore() {
+
+    }
+
+    public void intializePhase1(DataManager dataManager,
+        DataStoreParameters parameters) throws InitializeException {
+
+        DynObjectManager dynManager = ToolsLocator.getDynObjectManager();
+
+        this.metadata =
+            (DelegatedDynObject) dynManager.createDynObject(
+                METADATA_DEFINITION_NAME, MetadataManager.METADATA_NAMESPACE);
+
+        this.dataManager = (DefaultDataManager)dataManager;
+
+        this.parameters = parameters;
+        this.transforms = new DefaultFeatureStoreTransforms(this);
+        try {
+            indexes = new DefaultFeatureIndexes(this);
+        } catch (DataException e) {
+            throw new InitializeException(e);
+        }
+
+    }
+
+    public void intializePhase2(DataStoreProvider provider) {
+        this.provider = (FeatureStoreProvider) provider;
+        this.delegate(provider);
+        this.metadataChildren = new HashSet();
+        this.metadataChildren.add(provider);
+    }
+
+    public DataStoreParameters getParameters() {
+        return parameters;
+    }
+
+    public int getMode() {
+        return this.mode;
+    }
+
+    public DataManager getManager() {
+        return this.dataManager;
+    }
+
+    public Iterator getChildren() {
+        return this.provider.getChilds();
+    }
+
+    public FeatureStoreProvider getProvider() {
+        return this.provider;
+    }
+
+    public FeatureManager getFeatureManager() {
+        return this.featureManager;
+    }
+
+    public void setFeatureTypes(List types, FeatureType defaultType) {
+        this.featureTypes = types;
+        this.defaultFeatureType = defaultType;
+    }
+
+    public void open() throws OpenException {
+        // TODO: Se puede hacer un open estando en edicion ?
+        this.notifyChange(DataStoreNotification.BEFORE_OPEN);
+        this.provider.open();
+        this.notifyChange(DataStoreNotification.AFTER_OPEN);
+    }
+
+    public void refresh() throws OpenException, InitializeException {
+        if (this.mode != MODE_QUERY) {
+            throw new IllegalStateException();
+        }
+        this.notifyChange(FeatureStoreNotification.BEFORE_REFRESH);
+        this.featureCount = null;
+        this.provider.refresh();
+        this.notifyChange(FeatureStoreNotification.AFTER_REFRESH);
+    }
+
+    public void close() throws CloseException {
+        // TODO: Se puede hacer un close estando en edicion ?
+        this.notifyChange(DataStoreNotification.BEFORE_CLOSE);
+        this.featureCount = null;
+        this.provider.close();
+        this.notifyChange(DataStoreNotification.AFTER_CLOSE);
+    }
+
+    protected void doDispose() throws BaseException {
+        this.notifyChange(DataStoreNotification.BEFORE_DISPOSE);
+        this.provider.dispose();
+        if (this.selection != null) {
+            this.selection.dispose();
+            this.selection = null;
+        }
+        this.commands = null;
+        this.featureCount = null;
+        if (this.locks != null) {
+            // this.locks.dispose();
+            this.locks = null;
+        }
+
+        if (this.featureTypeManager != null) {
+            this.featureTypeManager.dispose();
+            this.featureTypeManager = null;
+        }
+
+        this.featureManager = null;
+        this.spatialManager = null;
+
+        this.parameters = null;
+        this.notifyChange(DataStoreNotification.AFTER_DISPOSE);
+        if (delegateObservable != null) {
+            this.delegateObservable.deleteObservers();
+            this.delegateObservable = null;
+        }
+    }
+
+    public boolean allowWrite() {
+        return this.provider.allowWrite();
+    }
+
+    public boolean canWriteGeometry(int geometryType) throws DataException {
+        return this.provider.canWriteGeometry(geometryType, 0);
+    }
+
+    public DataServerExplorer getExplorer() throws ReadException,
+        ValidateDataParametersException {
+        return this.provider.getExplorer();
+    }
+
+    /*
+     * public Metadata getMetadata() throws MetadataNotFoundException {
+     * // TODO:
+     * // Si el provider devuelbe null habria que ver de construir aqui
+     * // los metadatos basicos, como el Envelope y el SRS.
+     * 
+     * // TODO: Estando en edicion el Envelope deberia de
+     * // actualizarse usando el spatialManager
+     * return this.provider.getMetadata();
+     * }
+     */
+
+    public Envelope getEnvelope() throws DataException {
+        if (this.mode == MODE_FULLEDIT) {
+            return this.spatialManager.getEnvelope();
+        }
+        return this.provider.getEnvelope();
+    }
+
+    /**
+     * @deprecated use getDefaultFeatureType().getDefaultSRS()
+     */
+    public IProjection getSRSDefaultGeometry() throws DataException {
+        return this.getDefaultFeatureType().getDefaultSRS();
+    }
+
+    public FeatureSelection createDefaultFeatureSelection()
+        throws DataException {
+        return new DefaultFeatureSelection(this);
+    }
+
+    public FeatureProvider createDefaultFeatureProvider(FeatureType type)
+        throws DataException {
+        if (type.hasOID()) {
+            return new DefaultFeatureProvider(type, this.provider
+                .createNewOID());
+        }
+        return new DefaultFeatureProvider(type);
+    }
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+        if (this.mode != FeatureStore.MODE_QUERY) {
+            throw new PersistenceException(new IllegalStateException(this
+                .getName()));
+        }
+        state.set("dataStoreName", this.getName());
+        state.set("parameters", this.parameters);
+        state.set("selection", this.selection);
+        state.set("transforms", this.transforms);
+        // TODO locks persistence
+        // state.set("locks", this.locks);
+        // TODO indexes persistence
+        // state.set("indexes", this.indexes);
+        Map evaluatedAttr = new HashMap(1);
+        Iterator iterType = featureTypes.iterator();
+        Iterator iterAttr;
+        FeatureType type;
+        DefaultFeatureAttributeDescriptor attr;
+        List attrs;
+        while (iterType.hasNext()) {
+            type = (FeatureType) iterType.next();
+            attrs = new ArrayList();
+            iterAttr = type.iterator();
+            while (iterAttr.hasNext()) {
+                attr = (DefaultFeatureAttributeDescriptor) iterAttr.next();
+                if ((attr.getEvaluator() != null)
+                    && (attr.getEvaluator() instanceof Persistent)) {
+                    attrs.add(attr);
+                }
+            }
+            if (!attrs.isEmpty()) {
+                evaluatedAttr.put(type.getId(), attrs);
+            }
+
+        }
+
+        if (evaluatedAttr.isEmpty()) {
+            evaluatedAttr = null;
+        }
+
+        state.set("evaluatedAttributes", evaluatedAttr);
+        state.set("defaultFeatureTypeId", defaultFeatureType.getId());
+
+    }
+
+    public void loadFromState(PersistentState state)
+        throws PersistenceException {
+        if (this.provider != null) {
+            throw new PersistenceStoreAlreadyLoadedException(this.getName());
+        }
+        if (this.getManager() == null) {
+            this.dataManager = (DefaultDataManager) DALLocator.getDataManager();
+        }
+
+        DataStoreParameters params =
+            (DataStoreParameters) state.get("parameters");
+
+        try {
+
+            this.dataManager.intializeDataStore(this, params);
+            this.selection = (FeatureSelection) state.get("selection");
+            this.transforms =
+                (DefaultFeatureStoreTransforms) state.get("transforms");
+            Map evaluatedAttributes = (Map) state.get("evaluatedAttributes");
+            if ((evaluatedAttributes != null) && !evaluatedAttributes.isEmpty()) {
+                List attrs;
+                Iterator iterEntries =
+                    evaluatedAttributes.entrySet().iterator();
+                Entry entry;
+                while (iterEntries.hasNext()) {
+                    entry = (Entry) iterEntries.next();
+                    attrs = (List) entry.getValue();
+                    if (attrs.isEmpty()) {
+                        continue;
+                    }
+                    int fTypePos = -1;
+                    DefaultFeatureType type = null;
+                    for (int i = 0; i < featureTypes.size(); i++) {
+                        type = (DefaultFeatureType) featureTypes.get(i);
+                        if (type.getId().equals(entry.getKey())) {
+                            fTypePos = i;
+                            break;
+                        }
+                    }
+                    if (fTypePos < 0) {
+                        throw new PersistenceCantFindFeatureTypeException(this
+                            .getName(), (String) entry.getKey());
+                    }
+                    DefaultEditableFeatureType eType =
+                        (DefaultEditableFeatureType) type.getEditable();
+                    Iterator iterAttr = attrs.iterator();
+                    FeatureAttributeDescriptor attr;
+                    while (iterAttr.hasNext()) {
+                        attr = (FeatureAttributeDescriptor) iterAttr.next();
+                        eType.addLike(attr);
+                    }
+                    featureTypes.set(fTypePos, eType.getNotEditableCopy());
+
+                }
+
+            }
+
+            String defFTypeid = state.getString("defaultFeatureTypeId");
+            FeatureType ftype = null;
+            if (!this.defaultFeatureType.getId().equals(
+                state.getString("defaultFeatureTypeId"))) {
+
+                ftype = getFeatureType(defFTypeid);
+                if (ftype == null) {
+                    throw new PersistenceCantFindDefaultFeatureTypeException(
+                        this.getName(), defFTypeid);
+                }
+                this.defaultFeatureType = ftype;
+            }
+
+        } catch (InitializeException e) {
+            throw new PersistenceException(e);
+        } catch (DataException e) {
+            throw new PersistenceException(e);
+        }
+
+    }
+
+    public static void registerPersistenceDefinition() {
+        PersistenceManager manager = ToolsLocator.getPersistenceManager();
+        if (manager.getDefinition(PERSISTENCE_DEFINITION_NAME) == null) {
+            DynStruct definition =
+                manager.addDefinition(DefaultFeatureStore.class,
+                    PERSISTENCE_DEFINITION_NAME, PERSISTENCE_DEFINITION_NAME
+                        + " Persistent definition", null, null);
+            definition.addDynFieldString("dataStoreName").setMandatory(true)
+                .setPersistent(true);
+
+            definition.addDynFieldObject("parameters").setClassOfValue(
+                DynObject.class).setMandatory(true).setPersistent(true);
+
+            definition.addDynFieldObject("selection").setClassOfValue(
+                FeatureSelection.class).setMandatory(false).setPersistent(true);
+
+            definition.addDynFieldObject("transforms").setClassOfValue(
+                DefaultFeatureStoreTransforms.class).setMandatory(true)
+                .setPersistent(true);
+
+            definition.addDynFieldMap("evaluatedAttributes").setClassOfItems(
+                List.class) // List<DefaultFeatureAttributeDescriptor>
+                .setMandatory(false).setPersistent(true);
+
+            definition.addDynFieldString("defaultFeatureTypeId").setMandatory(
+                true).setPersistent(true);
+        }
+    }
+
+    public static void registerMetadataDefinition() throws MetadataException {
+        MetadataManager manager = MetadataLocator.getMetadataManager();
+        if (manager.getDefinition(METADATA_DEFINITION_NAME) == null) {
+            DynStruct metadataDefinition =
+                manager.addDefinition(METADATA_DEFINITION_NAME, null);
+            metadataDefinition.extend(manager
+                .getDefinition(DataStore.METADATA_DEFINITION_NAME));
+        }
+    }
+
+    //
+    // ====================================================================
+    // Gestion de la seleccion
+    //
+
+    public void setSelection(DataSet selection) throws DataException {
+        this.setSelection((FeatureSet) selection);
+    }
+
+    public DataSet createSelection() throws DataException {
+        return createFeatureSelection();
+    }
+
+    public DataSet getSelection() throws DataException {
+        return this.getFeatureSelection();
+    }
+
+    public void setSelection(FeatureSet selection) throws DataException {
+        setSelection(selection, true);
+    }
+
+    /**
+     * @see #setSelection(FeatureSet)
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public void setSelection(FeatureSet selection, boolean undoable)
+        throws DataException {
+        if (selection == null) {
+            if (undoable) {
+                throw new SelectionNotAllowedException(getName());
+            }
+
+        } else {
+            if (selection.equals(this.selection)) {
+                return;
+            }
+            if (!selection.isFromStore(this)) {
+                throw new SelectionNotAllowedException(getName());
+            }
+        }
+
+        if (this.selection != null) {
+            this.selection.deleteObserver(this);
+        }
+        if (selection == null) {
+            if (this.selection != null) {
+                this.selection.dispose();
+            }
+            this.selection = null;
+            return;
+        }
+        if (selection instanceof FeatureSelection) {
+            if (undoable && isEditing()) {
+                commands.selectionSet(this, this.selection,
+                    (FeatureSelection) selection);
+            }
+            if (this.selection != null) {
+                this.selection.dispose();
+            }
+            this.selection = (FeatureSelection) selection;
+        } else {
+            if (undoable && isEditing()) {
+                commands.startComplex("_selectionSet");
+            }
+            if (selection instanceof DefaultFeatureSelection) {
+                DefaultFeatureSelection defSelection =
+                    (DefaultFeatureSelection) selection;
+                defSelection.deselectAll(undoable);
+                defSelection.select(selection, undoable);
+            } else {
+                this.selection.deselectAll();
+                this.selection.select(selection);
+            }
+            if (undoable && isEditing()) {
+                commands.endComplex();
+            }
+        }
+        this.selection.addObserver(this);
+
+        this.notifyChange(DataStoreNotification.SELECTION_CHANGE);
+    }
+
+    public FeatureSelection createFeatureSelection() throws DataException {
+        return this.provider.createFeatureSelection();
+    }
+
+    public FeatureSelection getFeatureSelection() throws DataException {
+        if (selection == null) {
+            this.selection = createFeatureSelection();
+            this.selection.addObserver(this);
+        }
+        return selection;
+    }
+
+    //
+    // ====================================================================
+    // Gestion de notificaciones
+    //
+
+    public void notifyChange(String notification) {
+        if (delegateObservable != null) {
+            notifyChange(new DefaultFeatureStoreNotification(this, notification));
+        }
+
+    }
+
+    public void notifyChange(String notification, FeatureProvider data) {
+        try {
+            notifyChange(notification, createFeature(data));
+        } catch (DataException ex) {
+            logger.error("Error notifying about the notification: "
+                + notification + ", with the data: " + data, ex);
+        }
+    }
+
+    public void notifyChange(String notification, Feature feature) {
+        notifyChange(new DefaultFeatureStoreNotification(this, notification,
+            feature));
+    }
+
+    public void notifyChange(String notification, Command command) {
+        notifyChange(new DefaultFeatureStoreNotification(this, notification,
+            command));
+    }
+
+    public void notifyChange(String notification, EditableFeatureType type) {
+        notifyChange(new DefaultFeatureStoreNotification(this, notification,
+            type));
+    }
+
+    public void notifyChange(FeatureStoreNotification storeNotification) {
+        delegateObservable.notifyObservers(storeNotification);
+    }
+
+    public void notifyChange(String notification, Resource resource) {
+        notifyChange(new DefaultFeatureStoreNotification(this,
+            DataStoreNotification.RESOURCE_CHANGED));
+    }
+
+    //
+    // ====================================================================
+    // Gestion de bloqueos
+    //
+
+    public boolean isLocksSupported() {
+        return this.provider.isLocksSupported();
+    }
+
+    public FeatureLocks getLocks() throws DataException {
+        if (!this.provider.isLocksSupported()) {
+            logger.warn("Locks not supporteds");
+            return null;
+        }
+        if (locks == null) {
+            this.locks = this.provider.createFeatureLocks();
+        }
+        return locks;
+    }
+
+    //
+    // ====================================================================
+    // Interface Observable
+    //
+
+    public void disableNotifications() {
+        this.delegateObservable.disableNotifications();
+
+    }
+
+    public void enableNotifications() {
+        this.delegateObservable.enableNotifications();
+    }
+
+    public void beginComplexNotification() {
+        this.delegateObservable.beginComplexNotification();
+
+    }
+
+    public void endComplexNotification() {
+        this.delegateObservable.endComplexNotification();
+
+    }
+
+    public void addObserver(Observer observer) {
+        this.delegateObservable.addObserver(observer);
+
+    }
+
+    public void deleteObserver(Observer observer) {
+        if (delegateObservable != null) {
+            this.delegateObservable.deleteObserver(observer);
+        }
+    }
+
+    public void deleteObservers() {
+        this.delegateObservable.deleteObservers();
+
+    }
+
+    //
+    // ====================================================================
+    // Interface Observer
+    //
+    // Usado para observar:
+    // - su seleccion
+    // - sus bloqueos
+    // - sus recursos
+    //
+
+    public void update(Observable observable, Object notification) {
+        if (observable instanceof FeatureSet) {
+            if (observable == this.selection) {
+                this.notifyChange(DataStoreNotification.SELECTION_CHANGE);
+            } else
+                if (observable == this.locks) {
+                    this.notifyChange(FeatureStoreNotification.LOCKS_CHANGE);
+                }
+
+        } else
+            if (observable instanceof FeatureStoreProvider) {
+                if (observable == this.provider) {
+
+                }
+
+            }
+    }
+
+    //
+    // ====================================================================
+    // Edicion
+    //
+
+    private void newVersionOfUpdate() {
+        this.versionOfUpdate++;
+    }
+
+    private long currentVersionOfUpdate() {
+        return this.versionOfUpdate;
+    }
+
+    private void checkInEditingMode() throws NeedEditingModeException {
+        if (mode != MODE_FULLEDIT) {
+            throw new NeedEditingModeException(this.getName());
+        }
+    }
+
+    private void checkNotInAppendMode() throws IllegalStateException {
+        if (mode == MODE_APPEND) {
+            throw new IllegalStateException(this.getName());
+        }
+    }
+
+    private void checkIsOwnFeature(Feature feature)
+        throws IllegalFeatureException {
+        if (((DefaultFeature) feature).getStore() != this) {
+            throw new IllegalFeatureException(this.getName());
+        }
+        // FIXME: fixFeatureType no vale para el checkIsOwnFeature
+        // fixFeatureType((DefaultFeatureType) feature.getType());
+    }
+
+    private void exitEditingMode() {
+        if (commands != null) {
+            commands.clear();
+            commands = null;
+        }
+
+        if (featureTypeManager != null) {
+            featureTypeManager.dispose();
+            featureTypeManager = null;
+
+        }
+
+        // TODO implementar un dispose para estos dos
+        featureManager = null;
+        spatialManager = null;
+
+        featureCount = null;
+
+        mode = MODE_QUERY;
+        hasStrongChanges = true; // Lo deja a true por si las moscas
+        hasInserts = true;
+    }
+
+    synchronized public void edit() throws DataException {
+        edit(MODE_FULLEDIT);
+    }
+
+    synchronized public void edit(int mode) throws DataException {
+        try {
+            if (this.mode != MODE_QUERY) {
+                throw new AlreadyEditingException(this.getName());
+            }
+            if (!this.provider.supportsAppendMode()) {
+                mode = MODE_FULLEDIT;
+            }
+            switch (mode) {
+            case MODE_QUERY:
+                throw new IllegalStateException(this.getName());
+
+            case MODE_FULLEDIT:
+                if (!this.transforms.isEmpty()) {
+                    throw new IllegalStateException(this.getName());
+                }
+                notifyChange(FeatureStoreNotification.BEFORE_STARTEDITING);
+                featureManager =
+                    new FeatureManager(new MemoryExpansionAdapter());
+                featureTypeManager =
+                    new FeatureTypeManager(this, new MemoryExpansionAdapter());
+                spatialManager =
+                    new SpatialManager(this, provider.getEnvelope());
+
+                commands =
+                    new DefaultFeatureCommandsStack(featureManager,
+                        spatialManager, featureTypeManager);
+                this.mode = MODE_FULLEDIT;
+                hasStrongChanges = false;
+                hasInserts = false;
+                notifyChange(FeatureStoreNotification.AFTER_STARTEDITING);
+                break;
+            case MODE_APPEND:
+                if (!this.transforms.isEmpty()) {
+                    throw new IllegalStateException(this.getName());
+                }
+                notifyChange(FeatureStoreNotification.BEFORE_STARTEDITING);
+                this.provider.beginAppend();
+                this.mode = MODE_APPEND;
+                hasInserts = false;
+                notifyChange(FeatureStoreNotification.AFTER_STARTEDITING);
+                break;
+            }
+        } catch (Exception e) {
+            throw new StoreEditException(e, this.getName());
+        }
+    }
+
+    public boolean isEditing() {
+        return mode == MODE_FULLEDIT;
+    }
+
+    public boolean isAppending() {
+        return mode == MODE_APPEND;
+    }
+
+    synchronized public void update(EditableFeatureType type)
+        throws DataException {
+        try {
+            checkInEditingMode();
+            if (type == null) {
+                throw new NullFeatureTypeException(getName());
+            }
+            // FIXME: Comprobar que es un featureType aceptable.
+            notifyChange(FeatureStoreNotification.BEFORE_UPDATE_TYPE, type);
+            newVersionOfUpdate();
+
+            FeatureType oldt = type.getSource().getCopy();
+            FeatureType newt = type.getNotEditableCopy();
+            commands.update(newt, oldt);
+
+            if (((DefaultEditableFeatureType) type).hasStrongChanges()) {
+                hasStrongChanges = true;
+            }
+            notifyChange(FeatureStoreNotification.AFTER_UPDATE_TYPE, type);
+        } catch (Exception e) {
+            throw new StoreUpdateFeatureTypeException(e, this.getName());
+        }
+    }
+
+    synchronized public void delete(Feature feature) throws DataException {
+        try {
+            checkInEditingMode();
+            checkIsOwnFeature(feature);
+            if (feature instanceof EditableFeature) {
+                throw new StoreDeleteEditableFeatureException(getName());
+            }
+            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);
+            this.commands.delete(feature);
+            newVersionOfUpdate();
+            hasStrongChanges = true;
+            notifyChange(FeatureStoreNotification.AFTER_DELETE, feature);
+        } catch (Exception e) {
+            throw new StoreDeleteFeatureException(e, this.getName());
+        }
+    }
+
+    private static EditableFeature lastChangedFeature = null;
+
+    synchronized public void insert(EditableFeature feature)
+        throws DataException {
+        try {
+            switch (mode) {
+            case MODE_QUERY:
+                throw new NeedEditingModeException(this.getName());
+
+            case MODE_APPEND:
+                checkIsOwnFeature(feature);
+                if (feature.getSource() != null) {
+                    throw new NoNewFeatureInsertException(this.getName());
+                }
+                this.featureCount = null;
+                notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
+                feature.validate(Feature.UPDATE);
+                provider.append(((DefaultEditableFeature) feature).getData());
+                hasStrongChanges = true;
+                hasInserts = true;
+                notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
+                break;
+
+            case MODE_FULLEDIT:
+                checkIsOwnFeature(feature);
+                if (feature.getSource() != null) {
+                    throw new NoNewFeatureInsertException(this.getName());
+                }
+                notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
+                newVersionOfUpdate();
+                if ((lastChangedFeature == null)
+                    || (lastChangedFeature.getSource() != feature.getSource())) {
+                    lastChangedFeature = feature;
+                    feature.validate(Feature.UPDATE);
+                    lastChangedFeature = null;
+                }
+                commands.insert(feature.getNotEditableCopy());
+                hasStrongChanges = true;
+                hasInserts = true;
+                notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
+                break;
+            }
+        } catch (Exception e) {
+            throw new StoreInsertFeatureException(e, this.getName());
+        }
+    }
+
+    synchronized public void update(EditableFeature feature)
+        throws DataException {
+        try {
+            if ((feature).getSource() == null) {
+                insert(feature);
+                return;
+            }
+            checkInEditingMode();
+            checkIsOwnFeature(feature);
+            notifyChange(FeatureStoreNotification.BEFORE_UPDATE, feature);
+            newVersionOfUpdate();
+            if ((lastChangedFeature == null)
+                || (lastChangedFeature.getSource() != feature.getSource())) {
+                lastChangedFeature = feature;
+                feature.validate(Feature.UPDATE);
+                lastChangedFeature = null;
+            }
+
+            Feature oldf = feature.getSource();
+            Feature newf = feature.getNotEditableCopy();
+            commands.update(newf, oldf);
+
+            hasStrongChanges = true;
+            notifyChange(FeatureStoreNotification.AFTER_UPDATE, feature);
+        } catch (Exception e) {
+            throw new StoreUpdateFeatureException(e, this.getName());
+        }
+    }
+
+    synchronized public void redo() throws RedoException {
+        Command redo = commands.getNextRedoCommand();
+        try {
+            checkInEditingMode();
+        } catch (NeedEditingModeException ex) {
+            throw new RedoException(redo, ex);
+        }
+        notifyChange(FeatureStoreNotification.BEFORE_REDO, redo);
+        newVersionOfUpdate();
+        commands.redo();
+        hasStrongChanges = true;
+        notifyChange(FeatureStoreNotification.AFTER_REDO, redo);
+    }
+
+    synchronized public void undo() throws UndoException {
+        Command undo = commands.getNextUndoCommand();
+        try {
+            checkInEditingMode();
+        } catch (NeedEditingModeException ex) {
+            throw new UndoException(undo, ex);
+        }
+        notifyChange(FeatureStoreNotification.BEFORE_UNDO, undo);
+        newVersionOfUpdate();
+        commands.undo();
+        hasStrongChanges = true;
+        notifyChange(FeatureStoreNotification.AFTER_UNDO, undo);
+    }
+
+    public List getRedoInfos() {
+        if (isEditing() && (commands != null)) {
+            return commands.getRedoInfos();
+        } else {
+            return null;
+        }
+    }
+
+    public List getUndoInfos() {
+        if (isEditing() && (commands != null)) {
+            return commands.getUndoInfos();
+        } else {
+            return null;
+        }
+    }
+
+    public synchronized FeatureCommandsStack getCommandsStack()
+        throws DataException {
+        checkInEditingMode();
+        return commands;
+    }
+
+    synchronized public void cancelEditing() throws DataException {
+        spatialManager.cancelModifies();
+        try {
+            checkInEditingMode();
+
+            boolean clearSelection = this.hasStrongChanges;
+            if (this.selection instanceof FeatureReferenceSelection) {
+                clearSelection = this.hasInserts;
+            }
+            notifyChange(FeatureStoreNotification.BEFORE_CANCELEDITING);
+            exitEditingMode();
+            if (clearSelection) {
+                ((FeatureSelection) this.getSelection()).deselectAll();
+            }
+            notifyChange(FeatureStoreNotification.AFTER_CANCELEDITING);
+        } catch (Exception e) {
+            throw new StoreCancelEditingException(e, this.getName());
+        }
+    }
+
+    synchronized public void finishEditing() throws DataException {
+        try {
+            switch (mode) {
+            case MODE_QUERY:
+                throw new NeedEditingModeException(this.getName());
+
+            case MODE_APPEND:
+                notifyChange(FeatureStoreNotification.BEFORE_FINISHEDITING);
+                provider.endAppend();
+                exitEditingMode();
+                notifyChange(FeatureStoreNotification.AFTER_FINISHEDITING);
+                break;
+
+            case MODE_FULLEDIT:
+                if (hasStrongChanges && !this.allowWrite()) {
+                    throw new WriteNotAllowedException(getName());
+                }
+
+                notifyChange(FeatureStoreNotification.BEFORE_FINISHEDITING);
+                if (hasStrongChanges) {
+                    validateFeatures(Feature.FINISH_EDITING);
+                    provider.performChanges(featureManager.getDeleted(),
+                        featureManager.getInserted(), featureManager
+                            .getUpdated(), featureTypeManager
+                            .getFeatureTypesChanged());
+                }
+                exitEditingMode();
+                notifyChange(FeatureStoreNotification.AFTER_FINISHEDITING);
+                break;
+            }
+        } catch (Exception e) {
+            throw new FinishEditingException(e);
+        }
+    }
+
+    public void beginEditingGroup(String description)
+        throws NeedEditingModeException {
+        checkInEditingMode();
+        commands.startComplex(description);
+    }
+
+    public void endEditingGroup() throws NeedEditingModeException {
+        checkInEditingMode();
+        commands.endComplex();
+    }
+
+    public boolean isAppendModeSupported() {
+        return this.provider.supportsAppendMode();
+    }
+
+    public void export(DataServerExplorer explorer, String provider,
+        NewFeatureStoreParameters params) throws DataException {
+
+        if (this.getFeatureTypes().size() != 1) {
+            throw new NotYetImplemented(
+                "export whith more than one type not yet implemented");
+        }
+        FeatureSelection featureSelection = (FeatureSelection) getSelection();
+        FeatureStore target = null;
+        FeatureSet features = null;
+        DisposableIterator iterator = null;
+        try {
+            FeatureType type = this.getDefaultFeatureType();
+            if ((params.getDefaultFeatureType() == null)
+                || (params.getDefaultFeatureType().size() == 0)) {
+                params.setDefaultFeatureType(type.getEditable());
+
+            }
+            explorer.add(provider, params, true);
+
+            DataManager manager = DALLocator.getDataManager();
+            target = (FeatureStore) manager.openStore(provider, params);
+            FeatureType targetType = target.getDefaultFeatureType();
+
+            target.edit(MODE_APPEND);
+            FeatureAttributeDescriptor[] pk = type.getPrimaryKey();
+            if (featureSelection.getSize() > 0) {
+                features = this.getFeatureSelection();
+            } else {
+                if ((pk != null) && (pk.length > 0)) {
+                    FeatureQuery query = createFeatureQuery();
+                    for (int i = 0; i < pk.length; i++) {
+                        query.getOrder().add(pk[i].getName(), true);
+                    }
+                    features = this.getFeatureSet(query);
+                } else {
+                    features = this.getFeatureSet();
+                }
+            }
+            iterator = features.iterator();
+            while (iterator.hasNext()) {
+                DefaultFeature feature = (DefaultFeature) iterator.next();
+                target.insert(target.createNewFeature(targetType, feature));
+            }
+            target.finishEditing();
+            target.dispose();
+        } catch (Exception e) {
+            throw new DataExportException(e, params.toString());
+        } finally {
+            dispose(iterator);
+            dispose(features);
+            dispose(target);
+        }
+    }
+
+    //
+    // ====================================================================
+    // Obtencion de datos
+    // getDataCollection, getFeatureCollection
+    //
+
+    public DataSet getDataSet() throws DataException {
+        checkNotInAppendMode();
+        FeatureQuery query =
+            new DefaultFeatureQuery(this.getDefaultFeatureType());
+        return new DefaultFeatureSet(this, query);
+    }
+
+    public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+        checkNotInAppendMode();
+        return new DefaultFeatureSet(this, (FeatureQuery) dataQuery);
+    }
+
+    public void getDataSet(Observer observer) throws DataException {
+        checkNotInAppendMode();
+        this.getFeatureSet(null, observer);
+    }
+
+    public void getDataSet(DataQuery dataQuery, Observer observer)
+        throws DataException {
+        checkNotInAppendMode();
+        this.getFeatureSet((FeatureQuery) dataQuery, observer);
+    }
+
+    public FeatureSet getFeatureSet() throws DataException {
+        checkNotInAppendMode();
+        FeatureQuery query =
+            new DefaultFeatureQuery(this.getDefaultFeatureType());
+        return new DefaultFeatureSet(this, query);
+    }
+
+    public FeatureSet getFeatureSet(FeatureQuery featureQuery)
+        throws DataException {
+        checkNotInAppendMode();
+        return new DefaultFeatureSet(this, featureQuery);
+    }
+
+    public void accept(Visitor visitor) throws BaseException {
+        FeatureSet set = getFeatureSet();
+        try {
+            set.accept(visitor);
+        } finally {
+            set.dispose();
+        }
+    }
+
+    public void accept(Visitor visitor, DataQuery dataQuery)
+        throws BaseException {
+        FeatureSet set = getFeatureSet((FeatureQuery) dataQuery);
+        try {
+            set.accept(visitor);
+        } finally {
+            set.dispose();
+        }
+    }
+
+    public FeatureType getFeatureType(FeatureQuery featureQuery)
+        throws DataException {
+        DefaultFeatureType fType =
+            (DefaultFeatureType) this.getFeatureType(featureQuery
+                .getFeatureTypeId());
+        if ((featureQuery.getAttributeNames() != null) && (featureQuery.getAttributeNames().length > 0)) {
+            return fType.getSubtype(featureQuery.getAttributeNames());
+        }
+        return fType;
+    }
+
+    public void getFeatureSet(Observer observer) throws DataException {
+        checkNotInAppendMode();
+        this.getFeatureSet(null, observer);
+    }
+
+    public void getFeatureSet(FeatureQuery query, Observer observer)
+        throws DataException {
+        class LoadInBackGround implements Runnable {
+
+            private FeatureStore store;
+            private FeatureQuery query;
+            private Observer observer;
+
+            public LoadInBackGround(FeatureStore store, FeatureQuery query,
+                Observer observer) {
+                this.store = store;
+                this.query = query;
+                this.observer = observer;
+            }
+
+            void notify(FeatureStoreNotification theNotification) {
+                observer.update(store, theNotification);
+                return;
+            }
+
+            public void run() {
+                FeatureSet set = null;
+                try {
+                    set = store.getFeatureSet(query);
+                    notify(new DefaultFeatureStoreNotification(store,
+                        FeatureStoreNotification.LOAD_FINISHED, set));
+                } catch (Exception e) {
+                    notify(new DefaultFeatureStoreNotification(store,
+                        FeatureStoreNotification.LOAD_FINISHED, e));
+                } finally {
+                    dispose(set);
+                }
+            }
+        }
+
+        checkNotInAppendMode();
+        if (query == null) {
+            query = new DefaultFeatureQuery(this.getDefaultFeatureType());
+        }
+        LoadInBackGround task = new LoadInBackGround(this, query, observer);
+        Thread thread = new Thread(task);
+        thread.run();
+    }
+
+    public Feature getFeatureByReference(FeatureReference reference)
+        throws DataException {
+        checkNotInAppendMode();
+        DefaultFeatureReference ref = (DefaultFeatureReference) reference;
+        FeatureType featureType;
+        if (ref.getFeatureTypeId() == null) {
+            featureType = this.getDefaultFeatureType();
+        } else {
+            featureType = this.getFeatureType(ref.getFeatureTypeId());
+        }
+        return this.getFeatureByReference(reference, featureType);
+    }
+
+    public Feature getFeatureByReference(FeatureReference reference,
+        FeatureType featureType) throws DataException {
+        checkNotInAppendMode();
+        featureType = fixFeatureType((DefaultFeatureType) featureType);
+        if (!this.transforms.isEmpty()) {
+
+            featureType = this.transforms.getSourceFeatureTypeFrom(featureType);
+
+        }
+        // TODO comprobar que el id es de este store
+
+        if (this.mode == MODE_FULLEDIT) {
+            Feature f = featureManager.get(reference, this, featureType);
+            if (f != null) {
+                return f;
+            }
+        }
+        DefaultFeature feature =
+            new DefaultFeature(this, this.provider
+                .getFeatureProviderByReference(
+                    (FeatureReferenceProviderServices) reference, featureType));
+
+        if (!this.transforms.isEmpty()) {
+            return this.transforms.applyTransform(feature, featureType);
+        }
+        return feature;
+    }
+
+    //
+    // ====================================================================
+    // Gestion de features
+    //
+
+    private FeatureType fixFeatureType(DefaultFeatureType type)
+        throws DataException {
+        FeatureType original = this.getDefaultFeatureType();
+
+        if ((type == null) || type.equals(original)) {
+            return original;
+        } else {
+            if (!type.isSubtypeOf(original)) {
+                Iterator iter = this.getFeatureTypes().iterator();
+                FeatureType tmpType;
+                boolean found = false;
+                while (iter.hasNext()) {
+                    tmpType = (FeatureType) iter.next();
+                    if (type.equals(tmpType)) {
+                        return type;
+
+                    } else
+                        if (type.isSubtypeOf(tmpType)) {
+                            found = true;
+                            original = tmpType;
+                            break;
+                        }
+
+                }
+                if (!found) {
+                    throw new IllegalFeatureTypeException(getName());
+                }
+            }
+        }
+
+        // Checks that type has all fields of pk
+        // else add the missing attributes at the end.
+        if (!original.hasOID()) {
+            // Gets original pk attributes
+            DefaultEditableFeatureType edOriginal =
+                (DefaultEditableFeatureType) original.getEditable();
+            FeatureAttributeDescriptor orgAttr;
+            Iterator edOriginalIter = edOriginal.iterator();
+            while (edOriginalIter.hasNext()) {
+                orgAttr = (FeatureAttributeDescriptor) edOriginalIter.next();
+                if (!orgAttr.isPrimaryKey()) {
+                    edOriginalIter.remove();
+                }
+            }
+
+            // Checks if all pk attributes are in type
+            Iterator typeIterator;
+            edOriginalIter = edOriginal.iterator();
+            FeatureAttributeDescriptor attr;
+            while (edOriginalIter.hasNext()) {
+                orgAttr = (FeatureAttributeDescriptor) edOriginalIter.next();
+                typeIterator = type.iterator();
+                while (typeIterator.hasNext()) {
+                    attr = (FeatureAttributeDescriptor) typeIterator.next();
+                    if (attr.getName().equals(orgAttr.getName())) {
+                        edOriginalIter.remove();
+                        break;
+                    }
+                }
+            }
+
+            // add missing pk attributes if any
+            if (edOriginal.size() > 0) {
+                boolean isEditable = type instanceof DefaultEditableFeatureType;
+                DefaultEditableFeatureType edType =
+                    (DefaultEditableFeatureType) original.getEditable();
+                edType.clear();
+                edType.addAll(type);
+                edType.addAll(edOriginal);
+                if (!isEditable) {
+                    type = (DefaultFeatureType) edType.getNotEditableCopy();
+                }
+            }
+
+        }
+
+        return type;
+    }
+
+    public void validateFeatures(int mode) throws DataException {
+        FeatureSet collection = null;
+        DisposableIterator iter = null;
+        try {
+            checkNotInAppendMode();
+            collection = this.getFeatureSet();
+            iter = collection.iterator();
+            long previousVersionOfUpdate = currentVersionOfUpdate();
+            while (iter.hasNext()) {
+                ((DefaultFeature) iter.next()).validate(mode);
+                if (previousVersionOfUpdate != currentVersionOfUpdate()) {
+                    throw new ConcurrentDataModificationException(getName());
+                }
+            }
+        } catch (Exception e) {
+            throw new ValidateFeaturesException(e, getName());
+        } finally {
+            dispose(iter);
+            dispose(collection);
+        }
+    }
+
+    public FeatureType getDefaultFeatureType() throws DataException {
+        try {
+            if (isEditing()) {
+                FeatureType auxFeatureType =
+                    featureTypeManager.getType(defaultFeatureType.getId());
+                if (auxFeatureType != null) {
+                    return auxFeatureType;
+                }
+            }
+            FeatureType type = this.transforms.getDefaultFeatureType();
+            if (type != null) {
+                return type;
+            }
+            return defaultFeatureType;
+        } catch (Exception e) {
+            throw new GetFeatureTypeException(e, getName());
+        }
+    }
+
+    public FeatureType getFeatureType(String featureTypeId)
+        throws DataException {
+        if (featureTypeId == null) {
+            return this.getDefaultFeatureType();
+        }
+        try {
+            if (isEditing()) {
+                FeatureType auxFeatureType =
+                    featureTypeManager.getType(featureTypeId);
+                if (auxFeatureType != null) {
+                    return auxFeatureType;
+                }
+            }
+            FeatureType type = this.transforms.getFeatureType(featureTypeId);
+            if (type != null) {
+                return type;
+            }
+            Iterator iter = this.featureTypes.iterator();
+            while (iter.hasNext()) {
+                type = (FeatureType) iter.next();
+                if (type.getId().equals(featureTypeId)) {
+                    return type;
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            throw new GetFeatureTypeException(e, getName());
+        }
+    }
+
+    public FeatureType getProviderDefaultFeatureType() {
+        return defaultFeatureType;
+    }
+
+    public List getFeatureTypes() throws DataException {
+        try {
+            List types;
+            if (isEditing()) {
+                types = new ArrayList();
+                Iterator it = featureTypes.iterator();
+                while (it.hasNext()) {
+                    FeatureType type = (FeatureType) it.next();
+                    FeatureType typeaux =
+                        featureTypeManager.getType(type.getId());
+                    if (typeaux != null) {
+                        types.add(typeaux);
+                    } else {
+                        types.add(type);
+                    }
+                }
+                it = featureTypeManager.newsIterator();
+                while (it.hasNext()) {
+                    FeatureType type = (FeatureType) it.next();
+                    types.add(type);
+                }
+            } else {
+                types = this.transforms.getFeatureTypes();
+                if (types == null) {
+                    types = featureTypes;
+                }
+            }
+            return Collections.unmodifiableList(types);
+        } catch (Exception e) {
+            throw new GetFeatureTypeException(e, getName());
+        }
+    }
+
+    public List getProviderFeatureTypes() throws DataException {
+        return Collections.unmodifiableList(this.featureTypes);
+    }
+
+    public Feature createFeature(FeatureProvider data) throws DataException {
+        DefaultFeature feature = new DefaultFeature(this, data);
+        return feature;
+    }
+
+    public Feature createFeature(FeatureProvider data, FeatureType type)
+        throws DataException {
+        // FIXME: falta por implementar
+        // Comprobar si es un subtipo del feature de data
+        // y construir un feature usando el subtipo.
+        // Probablemente requiera generar una copia del data.
+        throw new NotYetImplemented();
+    }
+
+    public EditableFeature createNewFeature(FeatureType type,
+        Feature defaultValues) throws DataException {
+        try {
+            FeatureProvider data = createNewFeatureProvider(type);
+            DefaultEditableFeature feature =
+                new DefaultEditableFeature(this, data);
+            feature.initializeValues(defaultValues);
+            return feature;
+        } catch (Exception e) {
+            throw new CreateFeatureException(e, getName());
+        }
+    }
+
+    private FeatureProvider createNewFeatureProvider(FeatureType type)
+        throws DataException {
+        type = this.fixFeatureType((DefaultFeatureType) type);
+        FeatureProvider data = this.provider.createFeatureProvider(type);
+        data.setNew(true);
+        if (type.hasOID() && (data.getOID() == null)) {
+            data.setOID(this.provider.createNewOID());
+        } else {
+            data.setOID(this.getTemporalOID());
+        }
+        return data;
+
+    }
+
+    public EditableFeature createNewFeature(FeatureType type,
+        boolean defaultValues) throws DataException {
+        try {
+            FeatureProvider data = createNewFeatureProvider(type);
+            DefaultEditableFeature feature =
+                new DefaultEditableFeature(this, data);
+            if (defaultValues) {
+                feature.initializeValues();
+            }
+            return feature;
+        } catch (Exception e) {
+            throw new CreateFeatureException(e, getName());
+        }
+    }
+
+    public EditableFeature createNewFeature(boolean defaultValues)
+        throws DataException {
+        return this.createNewFeature(this.getDefaultFeatureType(),
+            defaultValues);
+    }
+
+    public EditableFeature createNewFeature() throws DataException {
+        return this.createNewFeature(this.getDefaultFeatureType(), true);
+    }
+
+    public EditableFeatureType createFeatureType() {
+        DefaultEditableFeatureType ftype = new DefaultEditableFeatureType();
+        return ftype;
+    }
+
+    public EditableFeatureType createFeatureType(String id) {
+        DefaultEditableFeatureType ftype = new DefaultEditableFeatureType(id);
+        return ftype;
+    }
+
+    //
+    // ====================================================================
+    // Index related methods
+    //
+
+    public FeatureIndexes getIndexes() {
+        return this.indexes;
+    }
+
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName) throws DataException {
+        return createIndex(null, featureType, attributeName, indexName);
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException {
+        checkNotInAppendMode();
+        FeatureIndexProviderServices index = null;
+        index =
+            dataManager.createFeatureIndexProvider(indexTypeName, this,
+                featureType, indexName, featureType
+                    .getAttributeDescriptor(attributeName));
+        try {
+            index.fill();
+        } catch (FeatureIndexException e) {
+            throw new InitializeException(index.getName(), e);
+        }
+        ((DefaultFeatureIndexes) getIndexes()).addIndex(index);
+        return index;
+    }
+
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName, Observer observer) {
+        return createIndex(null, featureType, attributeName, indexName,
+            observer);
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) {
+        // TODO Implement observer interaction
+        throw new UnsupportedOperationException();
+    }
+
+    //
+    // ====================================================================
+    // Transforms related methods
+    //
+
+    public FeatureStoreTransforms getTransforms() {
+        return this.transforms;
+    }
+
+    public FeatureQuery createFeatureQuery() {
+        return new DefaultFeatureQuery();
+    }
+
+    public DataQuery createQuery() {
+        return createFeatureQuery();
+    }
+
+    //
+    // ====================================================================
+    // UndoRedo related methods
+    //
+
+    public boolean canRedo() {
+        return commands.canRedo();
+    }
+
+    public boolean canUndo() {
+        return commands.canUndo();
+    }
+
+    public void redo(int num) throws RedoException {
+        commands.redo(num);
+    }
+
+    public void undo(int num) throws UndoException {
+        commands.undo(num);
+    }
+
+    //
+    // ====================================================================
+    // Metadata related methods
+    //
+
+    public Object getMetadataID() {
+        return this.provider.getSourceId();
+    }
+
+    public void delegate(DynObject dynObject) {
+        this.metadata.delegate(dynObject);
+    }
+
+    public DynClass getDynClass() {
+        return this.metadata.getDynClass();
+    }
+
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        if (this.metadata.hasDynValue(name)) {
+            return this.metadata.getDynValue(name);
+        }
+        if (METADATA_PROVIDER.equalsIgnoreCase(name)) {
+            return this.provider.getProviderName();
+        } else
+            if (METADATA_CONTAINERNAME.equalsIgnoreCase(name)) {
+                return this.provider.getSourceId();
+            } else
+                if (METADATA_FEATURETYPE.equalsIgnoreCase(name)) {
+                    try {
+                        return this.getDefaultFeatureType();
+                    } catch (DataException e) {
+                        return null;
+                    }
+                }
+        return this.metadata.getDynValue(name);
+    }
+
+    public boolean hasDynValue(String name) {
+        return this.metadata.hasDynValue(name);
+    }
+
+    public void implement(DynClass dynClass) {
+        this.metadata.implement(dynClass);
+    }
+
+    public Object invokeDynMethod(String name, DynObject context)
+        throws DynMethodException {
+        return this.metadata.invokeDynMethod(this, name, context);
+    }
+
+    public Object invokeDynMethod(int code, DynObject context)
+        throws DynMethodException {
+        return this.metadata.invokeDynMethod(this, code, context);
+    }
+
+    public void setDynValue(String name, Object value)
+        throws DynFieldNotFoundException {
+        this.metadata.setDynValue(name, value);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+     */
+    public Set getMetadataChildren() {
+        return this.metadataChildren;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataName()
+     */
+    public String getMetadataName() {
+        return this.provider.getProviderName();
+    }
+
+    public FeatureTypeManager getFeatureTypeManager() {
+        return this.featureTypeManager;
+    }
+
+    public long getFeatureCount() throws DataException {
+        if (featureCount == null) {
+            featureCount = new Long(this.provider.getFeatureCount());
+        }
+        if (this.isEditing() && !this.isAppending()) {
+            return featureCount.longValue()
+                - this.featureManager.getDeltaSize();
+        }
+        return featureCount.longValue();
+    }
+
+    private Long getTemporalOID() {
+        return new Long(this.temporalOid++);
+    }
+
+    public FeatureType getProviderFeatureType(String featureTypeId) {
+        if (featureTypeId == null) {
+            return this.defaultFeatureType;
+        }
+        FeatureType type;
+        Iterator iter = this.featureTypes.iterator();
+        while (iter.hasNext()) {
+            type = (FeatureType) iter.next();
+            if (type.getId().equals(featureTypeId)) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+    public FeatureProvider getFeatureProviderFromFeature(Feature feature) {
+        return ((DefaultFeature) feature).getData();
+    }
+
+    public DataStore getStore() {
+        return this;
+    }
+
+    public FeatureStore getFeatureStore() {
+        return this;
+    }
+
+    public void createCache(String name, DynObject parameters)
+        throws DataException {
+        cache = dataManager.createFeatureCacheProvider(name, parameters);
+        if (cache == null) {
+            throw new CreateException("FeaureCacheProvider", null);
+        }
+        cache.apply(this, provider);
+        provider = cache;
+
+        featureCount = null;
+    }
+
+    public FeatureCache getCache() {
+        return cache;
+    }
+
+    public void clear() {
+        if (metadata != null) {
+            metadata.clear();
+        }
+    }
+
+    public String getName() {
+        return this.provider.getName();
+    }
+
+    public String getFullName() {
+        return this.provider.getFullName();
+    }
+
+    public String getProviderName() {
+        return this.provider.getProviderName();
+    }
+
+    public boolean isKnownEnvelope() {
+        return this.provider.isKnownEnvelope();
+    }
+
+    public boolean hasRetrievedFeaturesLimit() {
+        return this.provider.hasRetrievedFeaturesLimit();
+    }
+
+    public int getRetrievedFeaturesLimit() {
+        return this.provider.getRetrievedFeaturesLimit();
+    }
+
+    public Interval getInterval() {  
+        return this.provider.getInterval();
+    }
+
+    public Collection getTimes() {      
+        return this.provider.getTimes();
+    }
+
+    public Collection getTimes(Interval interval) {       
+        return this.provider.getTimes(interval);
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java	(revision 35988)
@@ -0,0 +1,207 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.HashMap;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeIntegrityException;
+import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeSizeException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.evaluator.Evaluator;
+
+public class DefaultEditableFeatureAttributeDescriptor extends
+		DefaultFeatureAttributeDescriptor implements
+		EditableFeatureAttributeDescriptor {
+
+	private DefaultFeatureAttributeDescriptor source;
+	private boolean hasStrongChanges;
+
+	protected DefaultEditableFeatureAttributeDescriptor(
+			DefaultFeatureAttributeDescriptor other) {
+		super(other);
+		this.source = other;
+		hasStrongChanges=false;
+	}
+
+	protected DefaultEditableFeatureAttributeDescriptor(
+			DefaultEditableFeatureAttributeDescriptor other) {
+		super(other);
+		this.source = other.getSource();
+		hasStrongChanges = false;
+	}
+
+	public DefaultEditableFeatureAttributeDescriptor() {
+		super();
+		this.source = null;
+		hasStrongChanges = false;
+	}
+
+	public DefaultFeatureAttributeDescriptor getSource() {
+		return this.source;
+	}
+
+	public void fixAll() {
+	}
+
+	public void checkIntegrity() throws AttributeFeatureTypeIntegrityException {
+		AttributeFeatureTypeIntegrityException ex = new AttributeFeatureTypeIntegrityException(
+				getName());
+		if (this.size < 0) {
+			ex.add(new AttributeFeatureTypeSizeException(this.size));
+		}
+
+		// TODO: a�adir resto de comprobaciones de integridad.
+
+		if (ex.size() > 0) {
+			throw ex;
+		}
+	}
+
+	public EditableFeatureAttributeDescriptor setAllowNull(boolean allowNull) {
+		this.allowNull = allowNull;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setDataType(int type) {
+		this.dataType  = ToolsLocator.getDataTypesManager().get(type);
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setDefaultValue(
+			Object defaultValue) {
+		this.defaultValue = defaultValue;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setEvaluator(Evaluator evaluator) {
+	    if (this.evaluator !=null && evaluator == null) {
+	        hasStrongChanges=true;
+	    }
+		this.evaluator = evaluator;
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setGeometryType(int geometryType) {
+		this.geometryType= geometryType;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setIsPrimaryKey(
+			boolean isPrimaryKey) {
+		this.primaryKey = isPrimaryKey;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setIsReadOnly(boolean isReadOnly) {
+		this.readOnly = isReadOnly;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setMaximumOccurrences(
+			int maximumOccurrences) {
+		this.maximumOccurrences = maximumOccurrences;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setMinimumOccurrences(
+			int minimumOccurrences) {
+		this.minimumOccurrences = minimumOccurrences;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setName(String name) {
+		this.name = name;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setObjectClass(Class theClass) {
+		this.objectClass = theClass;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setPrecision(int precision) {
+		this.precision = precision;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setSRS(IProjection SRS) {
+		this.SRS = SRS;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setSize(int size) {
+		this.size = size;
+		if( this.evaluator != null ) {
+			hasStrongChanges=true;
+		}
+		return this;
+	}
+
+	public boolean hasStrongChanges() {
+		return hasStrongChanges;
+	}
+
+	public EditableFeatureAttributeDescriptor setAdditionalInfo(String infoName, Object value) {
+		if (this.additionalInfo == null) {
+			this.additionalInfo = new HashMap();
+		}
+		this.additionalInfo.put(infoName, value);
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setIsAutomatic(boolean isAutomatic) {
+		this.isAutomatic = isAutomatic;
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setGeometrySubType(
+			int geometrySubType) {
+		this.geometrySubType = geometrySubType;
+		return this;
+	}
+
+	public EditableFeatureAttributeDescriptor setIsTime(boolean isTime) {
+		this.isTime = isTime;
+		if( this.evaluator != null ) {
+            hasStrongChanges=true;
+        }
+		return this;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 35988)
@@ -0,0 +1,289 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.lang.ref.WeakReference;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class DefaultFeatureReference implements
+		FeatureReferenceProviderServices, Persistent {
+
+	private Object oid;
+	private Integer myHashCode = null;
+	private Object[] pk;
+	private String[] pkNames;
+	private WeakReference storeRef;
+	private boolean isNewFeature;
+	private String featureTypeId;
+	 
+	/**
+     * Constructor used by the persistence manager. Don't use directly.
+     * After to invoke this method, the persistence manager calls 
+     * the the method {@link #loadFromState(PersistentState)} to set 
+     * the values of the internal attributes that this class needs to work.
+     */
+	public DefaultFeatureReference() {
+		super();		
+	}
+	
+	public DefaultFeatureReference(DefaultFeature feature) {
+		this(feature.getStore(), feature.getData());
+	}
+
+	public DefaultFeatureReference(FeatureStore store,
+			FeatureProvider fdata) {
+		this.isNewFeature = fdata.isNew();
+		this.oid = null;
+		this.pk = null;
+		this.storeRef = new WeakReference(store);
+		this.featureTypeId = fdata.getType().getId();
+
+		if (fdata.getType().hasOID() || isNewFeature) {
+			this.oid = fdata.getOID();
+			if (this.oid == null) {
+				// FIXME Exception
+				throw new RuntimeException("Missing OID");
+			}
+		} else {
+			this.calculatePK(fdata);
+			if (this.pk == null) {
+				// FIXME Exception
+				throw new RuntimeException("Missing pk attributes");
+			}
+		}
+
+	}
+
+	/*
+	 * Use only for Persistent.setState
+	 */
+	public DefaultFeatureReference(FeatureStore store) {
+		this.isNewFeature = false;
+		this.oid = null;
+		this.pk = null;
+		this.storeRef = new WeakReference(store);
+	}
+
+	public DefaultFeatureReference(FeatureStore store, Object oid) {
+		// FIXME featureTypeId is needed !!!
+		this.isNewFeature = false;
+		this.oid = oid;
+		this.pk = null;
+		this.storeRef = new WeakReference(store);
+	}
+
+	private DefaultFeatureStore getStore() {
+		return (DefaultFeatureStore) this.storeRef.get();
+	}
+
+	private void calculatePK(FeatureProvider fdata) {
+		ArrayList keys = new ArrayList();
+		ArrayList keyNames = new ArrayList();
+		FeatureType type = fdata.getType();
+		Iterator it = type.iterator();
+		while (it.hasNext()) {
+			FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) it
+					.next();
+			if (attr.isPrimaryKey()) {
+				keys.add(fdata.get(attr.getIndex()));
+				keyNames.add(attr.getName());
+			}
+		}
+		if (keys.size() < 1) {
+			pk = null;
+			pkNames = null;
+		} else {
+			pk = keys.toArray();
+            pkNames = (String[]) keyNames.toArray(new String[keyNames.size()]);
+		}
+	}
+
+	public Feature getFeature() throws DataException {
+		return this.getStore().getFeatureByReference(this);
+	}
+
+	public Feature getFeature(FeatureType featureType) throws DataException {
+		return this.getStore().getFeatureByReference(this, featureType);
+	}
+
+	public Object getOID() {
+		return this.oid;
+	}
+
+	public boolean isNewFeature() {
+		return this.isNewFeature;
+	}
+
+
+	public boolean equals(Object obj) {
+		if (!(obj instanceof DefaultFeatureReference)) {
+			return false;
+		}
+		DefaultFeatureReference other = (DefaultFeatureReference) obj;
+
+		FeatureStore otherStore = (FeatureStore) other.storeRef.get();
+		FeatureStore myrStore = (FeatureStore) this.storeRef.get();
+		if (otherStore == null || myrStore == null) {
+			return false;
+		}
+		if (!myrStore.equals(otherStore)) {
+			return false;
+		}
+		if (myHashCode != null && other.myHashCode != null) {
+			return myHashCode.equals(other.myHashCode);
+		}
+		if (this.oid != null) {
+			return this.oid.equals(other.oid);
+		}
+		for (int i = 0; i < this.pk.length; i++) {
+			if (!this.pk[i].equals(other.pk[i])) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public int hashCode() {
+		if (this.oid != null) {
+			return this.oid.hashCode();
+		}
+		if (myHashCode == null) {
+			StringBuffer buff = new StringBuffer();
+
+			for (int i = 0; i < this.pk.length; i++) {
+				buff.append(this.pk[i].hashCode());
+				buff.append("##");
+			}
+			myHashCode = new Integer(buff.toString().hashCode());
+		}
+		return myHashCode.intValue();
+	}
+
+	public String[] getKeyNames() {
+		return pkNames;
+	}
+
+	public Object getKeyValue(String name) {
+		for (int i = 0; i < pkNames.length; i++) {
+			if (pkNames[i].equalsIgnoreCase(name)) {
+				return pk[i];
+			}
+		}
+		// FIXME exception????
+		return null;
+	}
+
+	public String getFeatureTypeId() {
+		return featureTypeId;
+	}
+
+	// *** Persistence ***
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		this.oid = state.get("oid");
+		this.myHashCode = (Integer) state.get("myHashCode");
+		this.storeRef = new WeakReference(state.get("store"));
+		this.isNewFeature = state.getBoolean("isNewFeature");
+		this.featureTypeId = state.getString("featureTypeId");
+		List pkList = (List) state.get("pk");
+		if (pkList != null) {
+			List pkNamesList = (List) state.get("pkNames");
+			if (pkNamesList == null || pkList.size() != pkNamesList.size()) {
+				throw new PersistenceException("bad pkNames value");
+			}
+			this.pk = pkList.toArray();
+            this.pkNames =
+                (String[]) pkNamesList.toArray(new String[pkList.size()]);
+		} else {
+			this.pk = null;
+			this.pkNames = null;
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("oid", oid);
+		state.set("myHashCode", myHashCode);
+		state.set("isNewFeature", isNewFeature);
+		state.set("store", (Persistent) storeRef.get());
+		state.set("featureTypeId", featureTypeId);
+		if (pk == null) {
+			state.setNull("pk");
+			state.setNull("pkNames");
+		} else {
+			state.set("pk", pk);
+			state.set("pkNames", pkNames);
+		}
+
+	}
+
+	public static void registerPersistent() {
+		DynStruct definition = ToolsLocator.getPersistenceManager().addDefinition(
+				DefaultFeatureReference.class, 
+				"Reference", 
+				"DefaultFeatureReference Persistent definition", 
+				null, 
+				null
+			);
+
+		definition.addDynFieldObject("oid")
+			.setClassOfValue(Object.class)
+			.setMandatory(false)
+			.setPersistent(true);
+			
+		definition.addDynFieldBoolean("isNewFeature")
+			.setMandatory(true)
+			.setPersistent(true);
+	
+		definition.addDynFieldObject("store")
+			.setClassOfValue(FeatureStore.class)
+			.setMandatory(true)
+			.setPersistent(true);
+
+		definition.addDynFieldInt("myHashCode")
+			.setMandatory(false)
+			.setPersistent(true);
+	
+		definition.addDynFieldString("featureTypeId")
+			.setMandatory(true)
+			.setPersistent(true);
+
+		definition.addDynFieldArray("pk")
+			.setClassOfItems(Object.class)
+			.setMandatory(false)
+			.setPersistent(true);
+
+        definition.addDynFieldArray("pkNames")
+			.setClassOfItems(String.class)
+			.setMandatory(false)
+			.setPersistent(true);
+
+	}
+
+	public String toString() {
+		return MessageFormat.format(
+				"FeatureReference: oid = {0}, myHashCode = {1}, "
+				+ "pks = {2}, pkNames = {3}, "
+				+ "isNewFeature = {4}, featureTypeId = {5}", new Object[] {
+				oid, myHashCode, (pk == null ? null : Arrays.asList(pk)),
+				(pkNames == null ? null : Arrays.asList(pkNames)),
+				new Boolean(isNewFeature),
+				featureTypeId });
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java	(revision 35988)
@@ -0,0 +1,224 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {{Company}}   {{Task}}
+ */
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorFieldValue;
+import org.gvsig.tools.evaluator.EvaluatorFieldValueMatch;
+import org.gvsig.tools.evaluator.EvaluatorFieldValueNearest;
+import org.gvsig.tools.evaluator.EvaluatorFieldValueRange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class provides access to a FeatureStore local indexes and also decides
+ * which index to use given an evaluator containing the filter expression.
+ *
+ * @author jyarza
+ */
+public class DefaultFeatureIndexes implements FeatureIndexes {
+	private static final Logger logger = LoggerFactory
+			.getLogger(DefaultFeatureIndexes.class);
+	// Access by index name
+	private Map names;
+	// Store to which this belongs
+	private DefaultFeatureStore store;
+
+	/**
+	 * Creates an empty DataIndexes for the given FeatureStore
+	 *
+	 * @param store
+	 *            FeatureStore to whom this belongs
+	 * @throws DataException
+	 */
+	public DefaultFeatureIndexes(DefaultFeatureStore store)
+			throws DataException {
+		names = new HashMap();
+		this.store = store;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.index.DataIndexes#getDataIndex(java.lang.String)
+	 */
+	public FeatureIndex getFeatureIndex(String name) {
+		return (FeatureIndex) names.get(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see org.gvsig.fmap.dal.index.DataIndexes#addIndex(org.gvsig.fmap.dal.feature.FeatureType,
+	 *      java.lang.String, org.gvsig.fmap.dal.feature.DataIndex)
+	 */
+	public void addIndex(FeatureIndexProviderServices index) {
+		// By name
+		names.put(index.getName(), index);
+	}
+
+	public Iterator iterator() {
+		return names.values().iterator();
+	}
+
+	/**
+	 * Using the given evaluator attributes, choose and use an appropriate index
+	 * to obtain a FeatureSet. If no index can be applied, then this method
+	 * returns null
+	 *
+	 * @param evaluator
+	 * @return FeatureSet or null if could not find any appropriate index.
+	 * @throws FeatureIndexException
+	 *
+	 */
+	public FeatureSet getFeatureSet(Evaluator evaluator)
+			throws FeatureIndexException {
+
+		class ApplyIndex {
+			DefaultFeatureIndex index;
+			EvaluatorFieldValue[] data;
+
+			ApplyIndex(DefaultFeatureIndex index, EvaluatorFieldValue[] data) {
+				this.index = index;
+				this.data = data;
+			}
+
+			/**
+			 * Checks whether the index supports the evaluator request
+			 *
+			 * @return
+			 */
+			boolean isSupported() {
+				switch (data[0].getType()) {
+				case EvaluatorFieldValue.MATCH:
+					return index.getFeatureIndexProvider().isMatchSupported();
+				case EvaluatorFieldValue.NEAREST:
+					return index.getFeatureIndexProvider().isNearestSupported();
+				case EvaluatorFieldValue.RANGE:
+					return index.getFeatureIndexProvider().isRangeSupported();
+				default:
+					return false;
+				}
+			}
+
+			/**
+			 * Applies the index using the evaluator fields
+			 *
+			 * @return FeatureSet with the result
+			 * @throws FeatureIndexException
+			 */
+			IndexFeatureSet apply() throws FeatureIndexException {
+
+				EvaluatorFieldValueRange rangeField;
+				EvaluatorFieldValueNearest nearestField;
+				// Trick: we know DefaultIndexProvider returns an IndexFeatureSet,
+				// which implements both FeatureSetProvider and FeatureSet.
+				switch (data[0].getType()) {
+				case EvaluatorFieldValue.MATCH:
+					return (IndexFeatureSet) index.getMatchFeatureSet(
+							((EvaluatorFieldValueMatch) data[0])
+									.getValue());
+				case EvaluatorFieldValue.RANGE:
+					rangeField = (EvaluatorFieldValueRange) data[0];
+					return (IndexFeatureSet) index.getRangeFeatureSet(
+							rangeField.getValue1(), rangeField.getValue2());
+				case EvaluatorFieldValue.NEAREST:
+					nearestField = (EvaluatorFieldValueNearest) data[0];
+					if ((nearestField.getTolerance() == null)
+							|| (!isSupported())) {
+						return (IndexFeatureSet) index.getNearestFeatureSet(
+								nearestField.getCount(), nearestField
+										.getValue());
+					} else {
+						return (IndexFeatureSet) index.getNearestFeatureSet(
+								nearestField.getCount(), nearestField
+										.getValue(), nearestField
+										.getTolerance());
+					}
+				}
+				return null;
+			}
+		}
+
+		// Select applicable indexes
+		List applyIndexes = new ArrayList();
+		Iterator indexes = this.iterator();
+		while (indexes.hasNext()) {
+			DefaultFeatureIndex index = (DefaultFeatureIndex) indexes.next();
+			String[] attrs = (String[]) index.getAttributeNames().toArray(
+					new String[0]);
+			for (int i = 0; i < attrs.length; i++) {
+				String attrname = attrs[i];
+				EvaluatorFieldValue[] values = null;
+				if (evaluator.getFieldsInfo() != null) {
+					values = evaluator.getFieldsInfo().getFieldValues(attrname);
+				}
+				if (values != null) {
+					applyIndexes.add(new ApplyIndex(index, values));
+					break;
+				}
+			}
+		}
+
+		// If there's not any applicable index, return null
+		if (applyIndexes.size() == 0) {
+			return null;
+		}
+
+		// Lookup an index with support for the requested function
+		Iterator it = applyIndexes.iterator();
+		ApplyIndex index = (ApplyIndex) it.next();
+		while (it.hasNext() && (!index.isSupported())) {
+			index = (ApplyIndex) it.next();
+		}
+
+		// If there is not any any index supporting the function, use the
+		// first one
+		if (!index.isSupported()) {
+			logger
+					.info("No index support for the evaluator values. Using default index.");
+			index = (ApplyIndex) applyIndexes.get(0);
+		}
+
+		// Apply index
+		return index.apply();
+
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java	(revision 35988)
@@ -0,0 +1,563 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.text.DateFormat;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class DefaultFeatureAttributeDescriptor implements
+		FeatureAttributeDescriptor, Persistent, DynField {
+
+	protected boolean allowNull;
+	protected DataType dataType;
+	protected DateFormat dateFormat;
+	protected Object defaultValue;
+	protected int index;
+	protected int maximumOccurrences;
+	protected int minimumOccurrences;
+	protected int size;
+	protected String name;
+	protected Class objectClass;
+	protected int precision;
+	protected Evaluator evaluator;
+	protected boolean primaryKey;
+	protected boolean readOnly;
+	protected IProjection SRS;
+	protected int geometryType;
+	protected int geometrySubType;
+	protected Map additionalInfo;
+	protected boolean isAutomatic;
+	protected boolean isTime = false;
+	protected FeatureAttributeGetter featureAttributeGetter = null;
+
+
+	protected DefaultFeatureAttributeDescriptor() {
+		this.allowNull = true;
+		this.dataType = null;
+		this.dateFormat = null;
+		this.defaultValue = null;
+		this.index = -1;
+		this.maximumOccurrences = 0;
+		this.minimumOccurrences = 0;
+		this.size = 0;
+		this.name = null;
+		this.objectClass = null;
+		this.precision = 0;
+		this.evaluator = null;
+		this.primaryKey = false;
+		this.readOnly = false;
+		this.SRS = null;
+		this.geometryType = Geometry.TYPES.NULL;
+		this.geometrySubType = Geometry.SUBTYPES.UNKNOWN;
+		this.additionalInfo = null;
+		this.isAutomatic = false;
+	}
+
+	protected DefaultFeatureAttributeDescriptor(
+			DefaultFeatureAttributeDescriptor other) {
+		this.allowNull = other.allowNull;
+		this.dataType = other.dataType;
+		this.dateFormat = other.dateFormat;
+		this.defaultValue = other.defaultValue;
+		this.index = other.index;
+		this.maximumOccurrences = other.maximumOccurrences;
+		this.minimumOccurrences = other.minimumOccurrences;
+		this.size = other.size;
+		this.name = other.name;
+		this.objectClass = other.objectClass;
+		this.precision = other.precision;
+		this.evaluator = other.evaluator;
+		this.primaryKey = other.primaryKey;
+		this.readOnly = other.readOnly;
+		this.SRS = other.SRS;
+		this.geometryType = other.geometryType;
+		this.geometrySubType = other.geometrySubType;
+		if (other.additionalInfo != null) {
+			Iterator iter = other.additionalInfo.entrySet().iterator();
+			Map.Entry entry;
+			this.additionalInfo = new HashMap();
+			while (iter.hasNext()) {
+				entry = (Entry) iter.next();
+				this.additionalInfo.put(entry.getKey(), entry.getValue());
+			}
+		} else {
+			this.additionalInfo = null;
+		}
+		this.isAutomatic = other.isAutomatic;
+		this.isTime = other.isTime;
+		this.featureAttributeGetter = other.featureAttributeGetter;
+	}
+
+	public String getDataTypeName() {
+		if( this.getDataType() == null ) {
+			return "(unknow)";
+		}
+		return this.getDataType().getName();
+	}
+
+	public FeatureAttributeDescriptor getCopy() {
+		return new DefaultFeatureAttributeDescriptor(this);
+	}
+
+	public boolean allowNull() {
+		return allowNull;
+	}
+
+	public DataType getDataType() {
+		if (featureAttributeGetter != null){
+		    return featureAttributeGetter.getDataType();
+		}
+	    return this.dataType;
+	}
+
+	public DateFormat getDateFormat() {
+		return this.dateFormat;
+	}
+
+	public Object getDefaultValue() {
+		return this.defaultValue;
+	}
+
+	public Evaluator getEvaluator() {
+		return this.evaluator;
+	}
+
+	public int getGeometryType() {
+		return this.geometryType;
+	}
+
+	public int getGeometrySubType() {
+		return this.geometrySubType;
+	}
+
+	public int getIndex() {
+		return this.index;
+	}
+
+	protected FeatureAttributeDescriptor setIndex(int index) {
+		this.index = index;
+		return this;
+	}
+
+	public int getMaximumOccurrences() {
+		return this.maximumOccurrences;
+	}
+
+	public int getMinimumOccurrences() {
+		return this.minimumOccurrences;
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	public Class getObjectClass() {
+		if (getDataType().getType() == DataTypes.OBJECT) {
+			return objectClass;
+		} 
+		return getDataType().getDefaultClass();
+	}
+
+	public int getPrecision() {
+		return this.precision;
+	}
+
+	public IProjection getSRS() {
+		return this.SRS;
+	}
+
+	public int getSize() {
+		return this.size;
+	}
+
+	public boolean isPrimaryKey() {
+		return this.primaryKey;
+	}
+
+	public boolean isReadOnly() {
+		return this.readOnly;
+	}
+
+	public Object getAdditionalInfo(String infoName) {
+		if (this.additionalInfo == null) {
+			return null;
+		}
+		return this.additionalInfo.get(infoName);
+	}
+
+	public boolean isAutomatic() {
+		return this.isAutomatic;
+	}
+
+
+	private boolean compareObject(Object a, Object b) {
+		if (a != b) {
+			if (a == null) {
+				return false;
+			}
+			return a.equals(b);
+		}
+		return true;
+
+	}
+
+	public boolean equals(Object obj) {
+		if (this == obj) {
+			return true;
+		}
+		if (!(obj instanceof DefaultFeatureAttributeDescriptor)) {
+			return false;
+		}
+		DefaultFeatureAttributeDescriptor other = (DefaultFeatureAttributeDescriptor) obj;
+
+		if (this.allowNull != other.allowNull) {
+			return false;
+		}
+
+		if (this.index != other.index) {
+			return false;
+		}
+
+		if (!compareObject(this.name, other.name)) {
+				return false;
+		}
+
+		if (this.getDataType() != other.getDataType()) {
+			return false;
+		}
+
+		if (this.size != other.size) {
+			return false;
+		}
+
+		if (!compareObject(this.defaultValue, other.defaultValue)) {
+			return false;
+		}
+
+		if (!compareObject(this.defaultValue, other.defaultValue)) {
+			return false;
+		}
+
+		if (this.primaryKey != other.primaryKey) {
+			return false;
+		}
+
+		if (this.isAutomatic != other.isAutomatic) {
+			return false;
+		}
+
+		if (this.readOnly != other.readOnly) {
+			return false;
+		}
+
+		if (this.precision != other.precision) {
+			return false;
+		}
+
+		if (this.maximumOccurrences != other.maximumOccurrences) {
+			return false;
+		}
+
+		if (this.minimumOccurrences != other.minimumOccurrences) {
+			return false;
+		}
+		if (this.geometryType != other.geometryType) {
+			return false;
+		}
+
+		if (this.geometrySubType != other.geometrySubType) {
+			return false;
+		}
+
+		if (!compareObject(this.evaluator, other.evaluator)) {
+			return false;
+		}
+
+		if (!compareObject(this.SRS, other.SRS)) {
+			return false;
+		}
+
+		if (!compareObject(this.dateFormat, other.dateFormat)) {
+			return false;
+		}
+
+		if (!compareObject(this.objectClass, other.objectClass)) {
+			return false;
+		}
+
+		return true;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		allowNull = state.getBoolean("allowNull");
+		dataType = ToolsLocator.getDataTypesManager().get(state.getInt("dataType"));
+		// FIXME how persist dateFormat ???
+		// dateFormat;
+		defaultValue = state.get("defaultValue");
+
+		index = state.getInt("index");
+		maximumOccurrences = state.getInt("maximumOccurrences");
+		minimumOccurrences = state.getInt("minimumOccurrences");
+		size = state.getInt("size");
+		name = state.getString("name");
+		try {
+			objectClass = Class.forName(state.getString("objectClass"));
+		} catch (ClassNotFoundException e) {
+			throw new PersistenceException(e);
+		}
+		precision = state.getInt("precision");
+		evaluator = (Evaluator) state.get("evaluator");
+		primaryKey = state.getBoolean("primaryKey");
+		readOnly = state.getBoolean("readOnly");
+		String srsId = state.getString("srsId");
+		if (srsId != null){
+			SRS = CRSFactory.getCRS(srsId);
+		}
+		geometryType = state.getInt("geometryType");
+		geometrySubType = state.getInt("geometrySubType");
+		additionalInfo = (Map) state.get("aditionalInfo");
+		isAutomatic = state.getBoolean("isAutomatic");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("allowNull", allowNull);
+		state.set("dataType", dataType);
+		// FIXME how persist dateFormat ???
+		// dateFormat;
+
+		defaultValue = state.get("defaultValue");
+
+		index = state.getInt("index");
+		maximumOccurrences = state.getInt("maximumOccurrences");
+		minimumOccurrences = state.getInt("minimumOccurrences");
+		size = state.getInt("size");
+		name = state.getString("name");
+		try {
+			objectClass = Class.forName(state.getString("objectClass"));
+		} catch (ClassNotFoundException e) {
+			throw new PersistenceException(e);
+		}
+		precision = state.getInt("precision");
+		evaluator = (Evaluator) state.get("evaluator");
+		primaryKey = state.getBoolean("primaryKey");
+		readOnly = state.getBoolean("readOnly");
+		String srsId = state.getString("srsId");
+		if (srsId != null) {
+			SRS = CRSFactory.getCRS(srsId);
+		}
+		geometryType = state.getInt("geometryType");
+		geometrySubType = state.getInt("geometrySubType");
+		additionalInfo = (Map) state.get("aditionalInfo");
+		isAutomatic = state.getBoolean("isAutomatic");
+	}
+
+	/**
+	 * Start of DynField interface Implementation
+	 * READONLY
+	 */
+
+
+	public DynObjectValueItem[] getAvailableValues() {
+		return null;
+	}
+
+	public String getDescription() {
+        return getName();
+	}
+
+	public Object getMaxValue() {
+		return null;
+	}
+
+	public Object getMinValue() {
+		return null;
+	}
+
+	public int getTheTypeOfAvailableValues() {
+		return 0;
+	}
+
+	public int getType() {
+	    if (featureAttributeGetter != null){
+            return featureAttributeGetter.getDataType().getType();
+        }
+		return getDataType().getType();
+	}
+
+	public boolean isMandatory() {
+		return false;
+	}
+
+	public boolean isPersistent() {
+		return false;
+	}
+
+	public DynField setAvailableValues(DynObjectValueItem[] values) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setDescription(String description) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setMandatory(boolean mandatory) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setMaxValue(Object maxValue) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setMinValue(Object minValue) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setPersistent(boolean persistent) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setTheTypeOfAvailableValues(int type) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setType(int type) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setDefaultDynValue(Object defaultValue) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addElementsType() throws DynFieldIsNotAContainerException {
+		throw new UnsupportedOperationException();
+	}
+
+	public Class getClassOfValue() {
+		return null;
+	}
+
+	public DynField getElementsType() {
+		return null;
+	}
+	
+	public DynField setClassOfValue(Class theClass)
+			throws DynFieldIsNotAContainerException {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setElementsType(DynStruct type)
+			throws DynFieldIsNotAContainerException {
+		throw new UnsupportedOperationException();
+	}
+	
+	public DynField setElementsType(int type)
+			throws DynFieldIsNotAContainerException {
+		throw new UnsupportedOperationException();
+	}
+	
+	public DynField setSubtype(String subtype) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void validate(Object value) throws DynFieldValidateException {
+		// Do nothing
+	}
+
+	public String getSubtype() {
+	    if (featureAttributeGetter != null){
+            return featureAttributeGetter.getDataType().getSubtype();
+        }       
+		return this.dataType.getSubtype();
+	}
+
+	public Object coerce(Object value) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setAvailableValues(List values) {
+		throw new UnsupportedOperationException();
+	}
+
+	public String getGroup() {
+		return null;
+	}
+
+	public int getOder() {
+		return 0;
+	}
+
+	public DynField setGroup(String groupName) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setOrder(int order) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setHidden(boolean hidden) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean isHidden() {
+		return false;
+	}
+
+	public DynField setReadOnly(boolean arg0) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean isContainer() {
+		return false;
+	}
+
+	public Class getClassOfItems() {
+		return null;
+	}
+
+	public DynField setDefaultFieldValue(Object defaultValue) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setClassOfItems(Class theClass) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField setType(DataType type) {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean isTime() {		
+		return isTime;
+	}
+
+    public FeatureAttributeGetter getFeatureAttributeGetter() {
+       return featureAttributeGetter;        
+    }
+
+    public void setFeatureAttributeGetter(
+        FeatureAttributeGetter featureAttributeTransform) {
+        this.featureAttributeGetter = featureAttributeTransform;              
+    }	
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java	(revision 35988)
@@ -0,0 +1,90 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.tools.undo.command.Command;
+
+public class DefaultFeatureStoreNotification implements
+		FeatureStoreNotification {
+	private Feature feature = null;
+	private DataSet collectionResult = null;
+	private boolean loadCollectionSucefully = false;
+	private Exception exceptionLoading = null;
+	private Command command = null;
+	private EditableFeatureType featureType = null;
+	private String type;
+	private DataStore source;
+
+	protected void init(DataStore source, String type) {
+		this.source = source;
+		this.type = type;
+	}
+
+	public DefaultFeatureStoreNotification(DataStore source, String type) {
+		this.init(source, type);
+	}
+
+	public DefaultFeatureStoreNotification(DataStore source, String type, Feature feature) {
+		this.init(source, type);
+		this.feature = feature;
+	}
+	public DefaultFeatureStoreNotification(DataStore source, String type, Command command) {
+		this.init(source, type);
+		this.command = command;
+	}
+
+	public DefaultFeatureStoreNotification(DataStore source, String type, Exception exception) {
+		this.init(source, type);
+		this.loadCollectionSucefully = false;
+		this.exceptionLoading = exception;
+	}
+
+	public DefaultFeatureStoreNotification(DataStore source, String type, DataSet collection) {
+		this.init(source, type);
+		this.loadCollectionSucefully = true;
+		this.collectionResult = collection;
+	}
+
+
+	public DefaultFeatureStoreNotification(DataStore source, String type,
+			EditableFeatureType featureType) {
+		this.init(source, type);
+		this.featureType = featureType;
+	}
+
+	public Feature getFeature() {
+		return feature;
+	}
+
+	public EditableFeatureType getFeatureType() {
+		return featureType;
+	}
+
+	public DataSet getCollectionResult() {
+		return this.collectionResult;
+	}
+
+	public Exception getExceptionLoading() {
+		return this.exceptionLoading;
+	}
+
+	public boolean loadSucefully() {
+		return this.loadCollectionSucefully;
+	}
+
+	public Command getCommand() {
+		return this.command;
+	}
+
+	public DataStore getSource() {
+		return source;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java	(revision 35988)
@@ -0,0 +1,563 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.lang.ref.Reference;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Default implementation of a FeatureReferenceSelection, based on the usage of
+ * a java.util.Set to store individual selected or not selected
+ * FeatureReferences, depending on the usage of the {@link #reverse()} method.
+ *
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultFeatureReferenceSelection extends AbstractDisposable
+		implements FeatureReferenceSelection {
+
+	public static final String DYNCLASS_PERSISTENT_NAME =
+			"DefaultFeatureReferenceSelection";
+
+    protected SelectionData selectionData = new SelectionData();
+
+    private FeatureStore featureStore;
+
+    private FeatureSelectionHelper helper;
+
+	private DelegateWeakReferencingObservable delegateObservable =
+			new DelegateWeakReferencingObservable(this);
+
+	/**
+	 * Creates a new Selection with the total size of Features from which the
+	 * selection will be performed.
+	 *
+	 * @param featureStore
+	 *            the FeatureStore of the selected FeatureReferences
+	 * @throws DataException
+	 *             if there is an error while getting the total number of
+	 *             Features of the Store.
+	 */
+    public DefaultFeatureReferenceSelection(DefaultFeatureStore featureStore)
+            throws DataException {
+        super();
+        this.featureStore = featureStore;
+        this.helper = new DefaultFeatureSelectionHelper(featureStore);
+        selectionData.setTotalSize(featureStore.getFeatureCount());
+    }
+
+    /**
+     * Creates a new Selection with the total size of Features from which the
+     * selection will be performed.
+     *
+     * @param featureStore
+     *            the FeatureStore of the selected FeatureReferences
+     * @param helper
+     *            to get some information of the Store
+     * @throws DataException
+     *             if there is an error while getting the total number of
+     *             Features of the Store.
+     */
+    public DefaultFeatureReferenceSelection(FeatureStore featureStore,
+            FeatureSelectionHelper helper)
+            throws DataException {
+        super();
+        this.featureStore = featureStore;
+        this.helper = helper;
+        selectionData.setTotalSize(featureStore.getFeatureCount());
+    }
+
+	/**
+	 * Constructor used by the persistence manager. Don't use directly. After to
+	 * invoke this method, the persistence manager calls the the method
+	 * {@link #loadFromState(PersistentState)} to set the values of the internal
+	 * attributes that this class needs to work.
+	 */
+	public DefaultFeatureReferenceSelection() {
+		super();
+	}
+
+    public boolean select(FeatureReference reference) {
+        return select(reference, true);
+    }
+
+    /**
+     * @see #select(FeatureReference)
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public boolean select(FeatureReference reference, boolean undoable) {
+        if (isSelected(reference)) {
+            return false;
+        }
+
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().select(this, reference);
+        }
+        boolean change = false;
+        if (selectionData.isReversed()) {
+            change = selectionData.remove(reference);
+        } else {
+            change = selectionData.add(reference);
+        }
+
+        if (change) {
+            notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+        }
+
+        return change;
+    }
+
+    public boolean deselect(FeatureReference reference) {
+        return deselect(reference, true);
+    }
+
+    /**
+     * @see #deselect(FeatureReference)
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public boolean deselect(FeatureReference reference, boolean undoable) {
+        if (!isSelected(reference)) {
+            return false;
+        }
+
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().deselect(this, reference);
+        }
+        boolean change = false;
+        if (selectionData.isReversed()) {
+            change = selectionData.add(reference);
+        } else {
+            change = selectionData.remove(reference);
+        }
+
+        if (change) {
+            notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+        }
+
+        return change;
+    }
+
+    public void selectAll() throws DataException {
+        selectAll(true);
+    }
+
+    /**
+     * @see #selectAll()
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public void selectAll(boolean undoable) throws DataException {
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().startComplex("_selectionSelectAll");
+            getCommands().selectAll(this);
+        }
+        if (!selectionData.isReversed()) {
+            selectionData.setReversed(true);
+        }
+        clearFeatureReferences();
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().endComplex();
+        }
+        notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+    }
+
+    public void deselectAll() throws DataException {
+        deselectAll(true);
+    }
+
+    /**
+     * @see #deselectAll()
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public void deselectAll(boolean undoable) throws DataException {
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().startComplex("_selectionDeselectAll");
+            getCommands().deselectAll(this);
+        }
+        if (selectionData.isReversed()) {
+            selectionData.setReversed(false);
+        }
+        clearFeatureReferences();
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().endComplex();
+        }
+
+        notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+    }
+
+    public boolean isSelected(FeatureReference reference) {
+        if (selectionData.isReversed()) {
+            return !selectionData.contains(reference);
+        } else {
+            return selectionData.contains(reference);
+        }
+    }
+
+    public void reverse() {
+        reverse(true);
+    }
+
+    /**
+     * @see #reverse()
+     * @param undoable
+     *            if the action must be undoable
+     */
+    public void reverse(boolean undoable) {
+        if (undoable && getFeatureStore().isEditing()) {
+            getCommands().selectionReverse(this);
+        }
+        selectionData.setReversed(!selectionData.isReversed());
+        notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+    }
+
+    public long getSelectedCount() {
+        if (selectionData.isReversed()) {
+                return selectionData.getTotalSize() - selectionData.getSize()
+                        + helper.getFeatureStoreDeltaSize();
+        } else {
+            return selectionData.getSize();
+        }
+    }
+
+    public Iterator referenceIterator() {
+        return Collections.unmodifiableSet(selectionData.getSelected())
+                .iterator();
+    }
+
+	protected void doDispose() throws BaseException {
+		delegateObservable.deleteObservers();
+		deselectAll(false);
+    }
+
+    public boolean isFromStore(DataStore store) {
+        return featureStore.equals(store);
+    }
+
+    public void accept(Visitor visitor) throws BaseException {
+        for (Iterator iter = selectionData.getSelected().iterator(); iter
+                .hasNext();) {
+            visitor.visit(iter.next());
+        }
+    }
+
+    public void update(Observable observable,
+			Object notification) {
+        // If a Feature is deleted, remove it from the selection Set.
+        if (notification instanceof FeatureStoreNotification) {
+            FeatureStoreNotification storeNotif = (FeatureStoreNotification) notification;
+            if (FeatureStoreNotification.AFTER_DELETE
+                    .equalsIgnoreCase(storeNotif.getType())) {
+                selectionData.remove(storeNotif.getFeature().getReference());
+            }
+        }
+    }
+
+    public SelectionData getData() {
+        return selectionData;
+    }
+
+    public void setData(SelectionData selectionData) {
+        this.selectionData = selectionData;
+        notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+    }
+
+    public String toString() {
+        return getClass().getName() + ": " + getSelectedCount()
+                + " features selected, reversed = "
+                + selectionData.isReversed() + ", featureIds contained: "
+                + selectionData.getSelected();
+    }
+
+    protected boolean isReversed() {
+        return selectionData.isReversed();
+    }
+
+    /**
+     * Removes all the stored FeatureRefence objects.
+     */
+    protected void clearFeatureReferences() {
+        selectionData.clear();
+    }
+
+	/**
+	 * Returns the FeatureStore of the selected FeatureReferences.
+	 *
+	 * @return the featureStore
+	 */
+    protected FeatureStore getFeatureStore() {
+        return featureStore;
+    }
+
+	/**
+	 * Returns the reference to the commands record.
+	 *
+	 * @return the reference to the commands record
+	 */
+    protected FeatureCommandsStack getCommands() {
+        return helper.getFeatureStoreCommandsStack();
+    }
+
+	public static class SelectionData implements Cloneable {
+        private Set selected = new HashSet();
+
+        /**
+         * Sets how the Set of selected values has to be dealt.
+         * <p>
+         * If selected is FALSE, then values into the Set are the selected ones,
+         * anything else is not selected.
+         * </p>
+         * <p>
+         * If selected is TRUE, then values into the Set are values not
+         * selected, anything else is selected.
+         * </p>
+         */
+        private boolean reversed = false;
+
+        private long totalSize;
+
+        /**
+         * @return the selected
+         */
+        public Set getSelected() {
+            return selected;
+        }
+
+        /**
+         * @param selected
+         *            the selected to set
+         */
+        public void setSelected(Set selected) {
+            this.selected = selected;
+        }
+
+        /**
+         * @return the reversed
+         */
+        public boolean isReversed() {
+            return reversed;
+        }
+
+        /**
+         * @param reversed
+         *            the reversed to set
+         */
+        public void setReversed(boolean reversed) {
+            this.reversed = reversed;
+        }
+
+        /**
+         * @return the totalSize
+         */
+        public long getTotalSize() {
+            return totalSize;
+        }
+
+        /**
+         * @param totalSize
+         *            the totalSize to set
+         */
+        public void setTotalSize(long totalSize) {
+            this.totalSize = totalSize;
+        }
+
+        public boolean add(FeatureReference reference) {
+            return selected.add(reference);
+        }
+
+        public boolean remove(FeatureReference reference) {
+            return selected.remove(reference);
+        }
+
+        public void clear() {
+            selected.clear();
+        }
+
+        public boolean contains(FeatureReference reference) {
+            return selected.contains(reference);
+        }
+
+        public int getSize() {
+            return selected.size();
+        }
+
+        public Object clone() throws CloneNotSupportedException {
+			SelectionData clone = (SelectionData) super.clone();
+			// reversed and totalSize already cloned by parent.
+			// clone the selected Set
+			clone.selected = new HashSet(selected);
+            return clone;
+        }
+    }
+
+    // *** Persistence ***
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("store", featureStore);
+		state.set("reversed", selectionData.isReversed());
+		state.set("totalSize", selectionData.getTotalSize());
+		state.set("selected", selectionData.getSelected().iterator());
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		featureStore = (FeatureStore)state.get("store");
+		selectionData.setReversed(state.getBoolean("reversed"));
+		selectionData.setTotalSize(state.getLong("totalSize"));
+		Iterator it = state.getIterator("selected");
+		while (it.hasNext()) {
+			DefaultFeatureReference ref = (DefaultFeatureReference) it.next();
+			selectionData.add(ref);
+		}
+	}
+
+	public static void registerPersistent() {
+		DynStruct definition = ToolsLocator.getPersistenceManager().addDefinition(
+				DefaultFeatureReferenceSelection.class, 
+				DYNCLASS_PERSISTENT_NAME, 
+				"DefaultFeatureReferenceSelection Persistent definition",
+				null, 
+				null
+			);
+
+		definition.addDynFieldObject("store").setClassOfValue(FeatureStore.class).setMandatory(true);
+		definition.addDynFieldBoolean("reversed").setMandatory(true);
+		definition.addDynFieldLong("totalSize").setMandatory(true);
+		definition.addDynFieldList("selected").setClassOfItems(DefaultFeatureReference.class).setMandatory(true);
+
+	}
+
+	public void addObserver(Observer observer) {
+		delegateObservable.addObserver(observer);
+	}
+
+	public void addObserver(Reference ref) {
+		delegateObservable.addObserver(ref);
+	}
+
+	public void addObservers(BaseWeakReferencingObservable observable) {
+		delegateObservable.addObservers(observable);
+	}
+
+	public void beginComplexNotification() {
+		delegateObservable.beginComplexNotification();
+	}
+
+	public int countObservers() {
+		return delegateObservable.countObservers();
+	}
+
+	public void deleteObserver(Observer observer) {
+		delegateObservable.deleteObserver(observer);
+	}
+
+	public void deleteObserver(Reference ref) {
+		delegateObservable.deleteObserver(ref);
+	}
+
+	public void deleteObservers() {
+		delegateObservable.deleteObservers();
+	}
+
+	public void disableNotifications() {
+		delegateObservable.disableNotifications();
+	}
+
+	public void enableNotifications() {
+		delegateObservable.enableNotifications();
+	}
+
+	public void endComplexNotification() {
+		// We don't want to notify many times in a complex notification
+		// scenario, so ignore notifications if in complex.
+		// Only one notification will be sent when the complex notification
+		// ends.
+		delegateObservable
+				.notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+		delegateObservable.endComplexNotification();
+	}
+
+	public boolean inComplex() {
+		return delegateObservable.inComplex();
+	}
+
+	public boolean isEnabledNotifications() {
+		return delegateObservable.isEnabledNotifications();
+	}
+
+	public void notifyObservers() {
+		// We don't want to notify many times in a complex notification
+		// scenario, so ignore notifications if in complex.
+		// Only one notification will be sent when the complex notification
+		// ends.
+		if (!delegateObservable.inComplex()) {
+			delegateObservable.notifyObservers();
+		}
+	}
+
+	public void notifyObservers(Object arg) {
+		if (!delegateObservable.inComplex()) {
+			delegateObservable.notifyObservers(arg);
+		}
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		DefaultFeatureReferenceSelection clone = (DefaultFeatureReferenceSelection) super
+				.clone();
+		// Original observers aren't cloned
+		clone.delegateObservable = new DelegateWeakReferencingObservable(clone);
+		// Clone internal data
+		clone.selectionData = (SelectionData) selectionData.clone();
+		// featureStore and helper are already swallow cloned by our parent
+		return clone;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java	(revision 35988)
@@ -0,0 +1,126 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.feature.impl.expansionadapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+
+/**
+ * Implementaci�n en memoria de ExpansionAdapter.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class MemoryExpansionAdapter implements ExpansionAdapter {
+	private ArrayList objects = new ArrayList();
+
+	public MemoryExpansionAdapter(){
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#addFeature(org.gvsig.fmap.dal.feature.Feature)
+	 */
+	public int addObject(Object obj) {
+//		Feature feature=(Feature)obj;
+		int newIndex = objects.size();
+		objects.add(obj);
+		return newIndex;
+	}
+
+//	/* (non-Javadoc)
+//	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#modifyFeature(int, org.gvsig.fmap.dal.feature.Feature)
+//	 */
+//	public int updateObject(Object obj) {
+////		Feature feature=(Feature)obj;
+//		objects.add(obj);
+//		return objects.size() - 1;
+//	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getFeature(int)
+	 */
+	public Object getObject(int index){
+		return objects.get(index);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#compact(java.util.HashMap)
+	 */
+	public void compact(HashMap relations) {
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#deleteLastFeature()
+	 */
+	public void deleteLastObject() {
+		objects.remove(objects.size()-1);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#open()
+	 */
+	public void open() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#close()
+	 */
+	public void close() {
+		objects.clear();
+		System.gc();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.expansionadapter.ExpansionAdapter#getSize()
+	 */
+	public int getSize() {
+		return objects.size();
+	}
+
+	public Iterator iterator() {
+		return objects.iterator();
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java	(revision 35988)
@@ -0,0 +1,80 @@
+package org.gvsig.fmap.dal.feature.impl.expansionadapter;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+
+/**
+ * Maneja el fichero de extensi�n en el que se almacenan las modificacionesy adici�nes
+ * durante la edici�n. Los �ndices que devuelve esta clase en sus m�todos
+ * addFeature y modifyFeature son invariables, es decir, que si se invoca un
+ * m�todo addFeature que retorna un 8, independientemente de las operaciones
+ * que se realicen posteriormente, una llamada a getFeature(8) retornar�
+ * dicha fila. Si esta geometr�a es eliminada posteriormente, se retornar� un
+ * null. Esto �ltimo se cumple mientras no se invoque el m�todo compact, mediante
+ * el que se reorganizan las geometr�as dejando en el fichero s�lo las que tienen
+ * validez en el momento de realizar la invocaci�n.
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public interface ExpansionAdapter {
+	/**
+	 * A�ade una geometria al final del fichero y retorna el �ndice que ocupa
+	 * esta geometria en el mismo
+	 *
+	 * @param feature
+	 * @param status TODO
+	 * @param indexInternalFields fields that where valid when this feature was added.
+	 *
+	 * @return calculated index of the new feature.
+	 */
+	int addObject(Object obj);
+
+	/**
+	 * Modifica la index-�sima geometr�a del fichero devolviendo la posici�n en
+	 * la que se pone la geometria modificada.
+	 *
+	 * @param calculated index of feature to be modified
+	 * @param feature newFeature that replaces the old feature.
+	 *
+	 * @return new calculated index of the modified feature.
+	 */
+//	int updateObject(Object obj);
+
+	/**
+	 * Obtiene la geometria que hay en el �ndice 'index' o null si la geometr�a
+	 * ha sido invalidada.
+	 *
+	 * @param index caculatedIndex of the feature to be read.
+	 * @return feature
+	 */
+	Object getObject(int index);
+
+	/**
+	 * Realiza una compactaci�n del fichero que maneja esta clase
+	 *
+	 * @param relations DOCUMENT ME!
+	 */
+	void compact(HashMap relations);
+
+	/**
+     * Mueve el puntero de escritura de manera que las siguientes escrituras
+     * machacar�n la �ltima fila
+     */
+    void deleteLastObject();
+
+    /**
+     * Abre el fichero de expansi�n para comenzar la edici�n
+     */
+    void open();
+
+    /**
+     * Cierra el fichero de expansi�n al terminar la edici�n
+     */
+    void close();
+
+    int getSize();
+
+    Iterator iterator();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java	(revision 35988)
@@ -0,0 +1,128 @@
+package org.gvsig.fmap.dal.feature.impl.undo;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.*;
+import org.gvsig.fmap.dal.feature.impl.*;
+import org.gvsig.fmap.dal.feature.impl.undo.command.*;
+import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack;
+
+/**
+ * Clase en memoria para registrar y gestionar los comandos que vamos
+ * realizando. La forma en que ha sido implementada esta clase, en vez de una
+ * �nica lista para albergar los comandos de deshacer(undos) y los de
+ * rehacer(redos), se ha optado por dos pilas una para deshacer(undos) y otra
+ * para rehacer(redos), de esta forma : Cuando se a�ade un nuevo comando, se
+ * inserta este a la pila de deshacer(undos) y se borra de la de rehacer(redos).
+ * Si se realiza un deshacer se desapila este comando de la pila deshacer(undos)
+ * y se apila en la de rehacer(redos). Y de la misma forma cuando se realiza un
+ * rehacer se desapila este comando de la pila de rehacer(redos) y pasa a la de
+ * deshacer(undos).
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DefaultFeatureCommandsStack extends DefaultUndoRedoCommandStack
+        implements FeatureCommandsStack {
+    private FeatureManager expansionManager;
+    private SpatialManager spatialManager;
+    private FeatureTypeManager featureTypeManager;
+
+    public DefaultFeatureCommandsStack(FeatureManager expansionManager,
+            SpatialManager spatialManager, FeatureTypeManager featureTypeManager) {
+        this.expansionManager = expansionManager;
+        this.spatialManager = spatialManager;
+        this.featureTypeManager = featureTypeManager;
+    }
+
+    public void clear() {
+        super.clear();
+        expansionManager.clear();
+        featureTypeManager.clear();
+        spatialManager.clear();
+    }
+
+    public void deselect(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference) {
+        SelectionCommandSelect command = new SelectionCommandSelect(selection,
+                reference, false, "_selectionDeselect");
+        add(command);
+    }
+
+    public void deselectAll(DefaultFeatureReferenceSelection selection)
+            throws DataException {
+        SelectionCommandSelectAll command = new SelectionCommandSelectAll(
+                selection, false, "_selectionDeselectAll");
+        add(command);
+    }
+
+    public void select(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference) {
+        SelectionCommandSelect command = new SelectionCommandSelect(selection,
+                reference, true, "_selectionSelect");
+        add(command);
+    }
+
+    public void selectAll(DefaultFeatureReferenceSelection selection)
+            throws DataException {
+        SelectionCommandSelectAll command = new SelectionCommandSelectAll(
+                selection, true, "_selectionSelectAll");
+        add(command);
+    }
+
+    public void selectionReverse(DefaultFeatureReferenceSelection selection) {
+        SelectionCommandReverse command = new SelectionCommandReverse(
+                selection, "_selectionReverse");
+        add(command);
+    }
+
+    public void selectionSet(DefaultFeatureStore store,
+            FeatureSelection oldSelection, FeatureSelection newSelection) {
+        SelectionCommandSet command = new SelectionCommandSet(store,
+                oldSelection, newSelection, "_selectionSet");
+        add(command);
+    }
+
+    public void delete(Feature feature) {
+        FeatureDeleteCommand command = new FeatureDeleteCommand(
+                expansionManager, spatialManager, feature, "_featureDelete");
+        add(command);
+        command.execute();
+    }
+
+//    public void delete(FeatureType featureType) {
+//        FTypeDeleteCommand command = new FTypeDeleteCommand(
+//                featureTypeManager, featureType, "_typeDelete");
+//        add(command);
+//        command.execute();
+//    }
+
+    public void insert(Feature feature) {
+        FeatureInsertCommand command = new FeatureInsertCommand(
+                expansionManager, spatialManager, feature, "_featureInsert");
+        add(command);
+        command.execute();
+    }
+
+//    public void insert(FeatureType featureType) {
+//        FTypeInsertCommand command = new FTypeInsertCommand(
+//                featureTypeManager, featureType, "_typeInsert");
+//        add(command);
+//        command.execute();
+//    }
+
+    public void update(Feature feature, Feature oldFeature) {
+        FeatureUpdateCommand command = new FeatureUpdateCommand(
+                expansionManager, spatialManager, feature, oldFeature,
+                "_featureUpdate");
+        add(command);
+        command.execute();
+    }
+
+    public void update(FeatureType featureType, FeatureType oldFeatureType) {
+        FTypeUpdateCommand command = new FTypeUpdateCommand(
+                featureTypeManager, featureType, oldFeatureType,
+                "_typeUpdate");
+        add(command);
+        command.execute();
+    }
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java	(revision 35988)
@@ -0,0 +1,146 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.FeatureTypeManager;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FTypeUpdateCommand extends AbstractFTypeCommand {
+    private FeatureType oldType;
+    private int position=-1;
+
+    public FTypeUpdateCommand(FeatureTypeManager expansionManager,
+        FeatureType type, FeatureType oldType, String description) {
+        super(expansionManager, type, description);
+        this.oldType = oldType;
+    }
+
+    /* (non-Javadoc)
+    * @see org.gvsig.fmap.dal.commands.Command#undo()
+    */
+    public void undo() throws UndoException {
+//        if (expansionManager.contains(oldFeature.getReference())) {
+//            expansionManager.deleteLastFeature(feature.getReference());
+//        } else {
+//            expansionManager.delete(type.getId());
+//        }
+
+        expansionManager.restore(oldType.getId(),position);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#redo()
+     */
+    public void redo() throws RedoException {
+        execute();
+    }
+
+    public int getType() {
+        return UPDATE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#execute()
+     */
+    public void execute() {
+        //		 Si la geometr�a no ha sido modificada
+//        if (!expansionManager.contains(oldType.getId())) {
+//        if (expansionManager.delete(oldType.getId())!=null){
+//            expansionManager.add(type);
+//        } else {
+          position =  expansionManager.update(type, oldType);
+//        }
+    }
+
+	public FeatureType getOldFeatureType() {
+		return oldType;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java	(revision 35988)
@@ -0,0 +1,74 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.FeatureTypeManager;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+/**
+ * Add the methods and constructors to use FeatureType.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public abstract class AbstractFTypeCommand extends AbstractCommand {
+    protected FeatureType type;
+    protected FeatureTypeManager expansionManager;
+
+    protected AbstractFTypeCommand(FeatureTypeManager expansionManager,
+    		FeatureType type,
+    		String description) {
+        super(description);
+        this.type = type;
+        this.expansionManager = expansionManager;
+    }
+
+    /**
+     * Returns the FeatureType of this command.
+     *
+     * @return FeatureType.
+     */
+    public FeatureType getFeatureType() {
+        return type;
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java	(revision 35988)
@@ -0,0 +1,85 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.impl.SpatialManager;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureDeleteCommand extends AbstractFeatureCommand {
+
+    public FeatureDeleteCommand(FeatureManager expansionManager,
+        SpatialManager spatialManager, Feature feature,
+        String description) {
+        super(expansionManager, spatialManager, feature, description);
+    }
+
+    public void undo() throws UndoException {
+        expansionManager.restore(feature.getReference());
+        spatialManager.insertFeature(feature);
+    }
+
+    public void redo() throws RedoException {
+        execute();
+    }
+
+    public int getType() {
+        return DELETE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#execute()
+     */
+    public void execute() {
+        expansionManager.delete(feature.getReference());
+        spatialManager.deleteFeature(feature);
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java	(revision 35988)
@@ -0,0 +1,150 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.impl.SpatialManager;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureUpdateCommand extends AbstractFeatureCommand {
+    private Feature oldFeature;
+    private int position=-1;
+
+    public FeatureUpdateCommand(FeatureManager expansionManager,
+        SpatialManager spatialManager, Feature feature, Feature oldFeature, String description) {
+        super(expansionManager, spatialManager, feature, description);
+        this.oldFeature = oldFeature;
+    }
+
+    /* (non-Javadoc)
+    * @see org.gvsig.fmap.dal.commands.Command#undo()
+    */
+    public void undo() throws UndoException {
+//        if (expansionManager.contains(oldFeature.getReference())) {
+//            expansionManager.deleteLastFeature(feature.getReference());
+//        } else {
+//            expansionManager.delete(feature.getReference());
+//        }
+
+        expansionManager.restore(oldFeature.getReference(),position);
+        spatialManager.updateFeature(oldFeature, feature);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#redo()
+     */
+    public void redo() throws RedoException {
+        execute();
+    }
+
+    public int getType() {
+        return UPDATE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#execute()
+     */
+    public void execute() {
+        //		 Si la geometr�a no ha sido modificada
+//        if (!expansionManager.contains(oldFeature.getReference())) {
+//        if (expansionManager.delete(oldFeature.getReference())!=null){
+//            expansionManager.add(feature);
+//        } else {
+    	position = expansionManager.update(feature, oldFeature);
+//        }
+
+        spatialManager.updateFeature(feature, oldFeature); //setFullExtentDirty(true);
+    }
+
+	public Feature getOldFeature() {
+		return oldFeature;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java	(revision 35988)
@@ -0,0 +1,87 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.exception.SelectionStateException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection.SelectionData;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+/**
+ * Command to allow undo and redo over a select or deselect ALL operation
+ * performed on a selection.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class SelectionCommandSelectAll extends AbstractCommand {
+
+    private final DefaultFeatureReferenceSelection selection;
+    private final boolean allSelected;
+    private SelectionData selectionData;
+
+    public SelectionCommandSelectAll(
+            DefaultFeatureReferenceSelection selection,
+            boolean allSelected, String description)
+            throws SelectionStateException {
+        super(description);
+        this.selection = selection;
+        this.allSelected = allSelected;
+        try {
+            this.selectionData = (SelectionData) selection.getData().clone();
+        } catch (CloneNotSupportedException ex) {
+            throw new SelectionStateException(ex);
+        }
+    }
+
+    public void execute() {
+        // Nothing to do
+    }
+
+    public int getType() {
+        return allSelected ? INSERT : DELETE;
+    }
+
+    public void undo() throws UndoException {
+        selection.setData(selectionData);
+    }
+
+    public void redo() throws RedoException {
+        try {
+            // Re-Obtain the state
+            selectionData = (SelectionData) selection.getData().clone();
+            if (allSelected) {
+                selection.selectAll(false);
+            } else {
+                selection.deselectAll(false);
+            }
+        } catch (Exception ex) {
+            throw new RedoException(this, ex);
+        }
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java	(revision 35988)
@@ -0,0 +1,78 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.impl.SpatialManager;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+
+/**
+ * Add the methods and constructors to use Features.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public abstract class AbstractFeatureCommand extends AbstractCommand {
+    protected Feature feature;
+    protected FeatureManager expansionManager;
+    protected SpatialManager spatialManager;
+
+    protected AbstractFeatureCommand(FeatureManager expansionManager,
+            SpatialManager spatialManager, Feature feature,
+        String description) {
+        super(description);
+        this.feature = feature;
+        this.expansionManager = expansionManager;
+        this.spatialManager = spatialManager;
+    }
+
+    /**
+     * Returns the Feature of this command.
+     * 
+     * @return Feature.
+     */
+    public Feature getFeature() {
+        return feature;
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java	(revision 35988)
@@ -0,0 +1,85 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.impl.SpatialManager;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureInsertCommand extends AbstractFeatureCommand {
+
+    public FeatureInsertCommand(FeatureManager expansionManager,
+        SpatialManager spatialManager,Feature feature,
+        String description) {
+        super(expansionManager, spatialManager, feature, description);
+    }
+
+    public void undo() throws UndoException {
+        expansionManager.delete(feature.getReference());
+        spatialManager.deleteFeature(feature);
+    }
+
+    public void redo() throws RedoException {
+        execute();
+    }
+
+    public int getType() {
+        return INSERT;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.fmap.dal.commands.Command#execute()
+     */
+    public void execute() {
+        expansionManager.add(feature);
+        spatialManager.insertFeature(feature);
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java	(revision 35988)
@@ -0,0 +1,71 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+/**
+ * Command to allow undo and redo over a reverse operation performed on a
+ * selection.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class SelectionCommandReverse extends AbstractCommand {
+
+    private final DefaultFeatureReferenceSelection selection;
+
+    /**
+     * Creates a new SelectionCommandReverse over a selection.
+     * 
+     * @param selection
+     *            where the reverse has been performed
+     */
+    public SelectionCommandReverse(DefaultFeatureReferenceSelection selection,
+            String description) {
+        super(description);
+        this.selection = selection;
+    }
+
+    public void execute() {
+        // Nothing to do
+    }
+
+    public int getType() {
+        return UPDATE;
+    }
+    
+    public void undo() throws UndoException {
+        selection.reverse(false);
+    }
+
+    public void redo() throws RedoException {
+        selection.reverse(false);
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java	(revision 35988)
@@ -0,0 +1,80 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+/**
+ * Command to allow undo and redo over a set selection operation performed on a
+ * store.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class SelectionCommandSet extends AbstractCommand {
+
+    private final FeatureSelection oldSelection;
+    private final FeatureSelection newSelection;
+    private final DefaultFeatureStore store;
+
+    public SelectionCommandSet(DefaultFeatureStore store,
+            FeatureSelection oldSelection, FeatureSelection newSelection,
+            String description) {
+        super(description);
+        this.store = store;
+        this.oldSelection = oldSelection;
+        this.newSelection = newSelection;
+    }
+
+    public void execute() {
+        // Nothing to do
+    }
+
+    public int getType() {
+        return UPDATE;
+    }
+    
+    public void undo() throws UndoException {
+        try {
+            store.setSelection(oldSelection, false);
+        } catch (DataException ex) {
+            throw new UndoException(this, ex);
+        }
+    }
+
+    public void redo() throws RedoException {
+        try {
+            store.setSelection(newSelection, false);
+        } catch (DataException ex) {
+            throw new RedoException(this, ex);
+        }   
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java	(revision 35988)
@@ -0,0 +1,78 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl.undo.command;
+
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.undo.command.impl.AbstractCommand;
+
+/**
+ * Command to allow undo and redo over a select or deselect operation performed
+ * on a selection.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class SelectionCommandSelect extends AbstractCommand {
+
+	private final DefaultFeatureReferenceSelection selection;
+    private final FeatureReference reference;
+    private final boolean select;
+
+    public SelectionCommandSelect(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference, boolean select, String description) {
+        super(description);
+        this.selection = selection;
+        this.reference = reference;
+        this.select = select;
+	}
+
+	public void execute() {
+	    // Nothing to do
+	}
+
+	public int getType() {
+        return select ? INSERT : DELETE;
+	}
+	
+	public void undo() throws UndoException {
+        performSelection(!select);
+    }
+
+	public void redo() throws RedoException {
+        performSelection(select);
+	}
+
+    private void performSelection(boolean doSelection) {
+        if (doSelection) {
+            selection.select(reference, false);
+        } else {
+            selection.deselect(reference, false);
+        }
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java	(revision 35988)
@@ -0,0 +1,40 @@
+package org.gvsig.fmap.dal.feature.impl.undo;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.*;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.command.UndoRedoCommandStack;
+
+public interface FeatureCommandsStack extends UndoRedoCommandStack {
+
+    public void insert(Feature feature);
+
+    public void update(Feature feature, Feature oldFeature);
+
+    public void delete(Feature feature);
+
+//    public void insert(FeatureType featureType);
+
+    public void update(FeatureType featureType, FeatureType oldFeatureType);
+
+//    public void delete(FeatureType featureType);
+
+    public void select(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference);
+
+    public void deselect(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference);
+
+    public void selectAll(DefaultFeatureReferenceSelection selection)
+            throws DataException;
+
+    public void deselectAll(DefaultFeatureReferenceSelection selection)
+            throws DataException;
+
+    public void selectionReverse(DefaultFeatureReferenceSelection selection);
+
+    public void selectionSet(DefaultFeatureStore store,
+            FeatureSelection oldSelection, FeatureSelection newSelection);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java	(revision 35988)
@@ -0,0 +1,460 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create Parameter object to define FeatureCollections queries}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.evaluator.AndEvaluator;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorFieldsInfo;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Defines the properties of a collection of Features, as a result of a query
+ * through a FeatureStore.
+ * <p>
+ * A FeatureQuery is always defined by a FeatureType, or by the list of
+ * attribute names of the FeatureStore to return.
+ * </p>
+ * <p>
+ * The filter allows to select Features whose properties have values with the
+ * characteristics defined by the filter.
+ * </p>
+ * <p>
+ * The order is used to set the order of the result FeatureCollection, based on
+ * the values of the properties of the Features.
+ * </p>
+ * <p>
+ * The scale parameter can be used by the FeatureStore as a hint about the
+ * quality or resolution of the data needed to view or operate with the data
+ * returned. As an example, the FeatureStore may use the scale to return only a
+ * representative subset of the data, or maybe to return Features with less
+ * detail, like a point or a line instead of a polygon.
+ * </p>
+ * <p>
+ * If an implementation of FeatureStore is able to get other parameters to
+ * customize the behavior of the getDataCollection methods, there is an option
+ * to set more parameters through the setAttribute method.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultFeatureQuery implements FeatureQuery {
+
+    public static final String SCALE_PARAM_NAME = "Scale";
+
+    private Map queryParameters = new HashMap();
+
+    private String featureTypeId = null;
+
+    private List attributeNames = new ArrayList();
+
+    private Evaluator filter;
+
+    /**
+     * This boolean value is used to know if the current filter
+     * has been added using the {@link FeatureQuery#addFilter(Evaluator)}
+     * method or the {@link FeatureQuery#setFilter(Evaluator)} method.
+     */
+    private boolean isAddFilter = true;
+
+    private FeatureQueryOrder order = new FeatureQueryOrder();
+
+    private long limit;
+
+    private long pageSize;
+
+    /**
+     * Creates a FeatureQuery which will load all available Features of a type.
+     * 
+     * @param featureType
+     *            the type of Features of the query
+     */
+    public DefaultFeatureQuery() {
+        super();
+    }
+
+    /**
+     * Creates a FeatureQuery which will load all available Features of a type.
+     * 
+     * @param featureType
+     *            the type of Features of the query
+     */
+    public DefaultFeatureQuery(FeatureType featureType) {
+        super();
+        this.setFeatureType(featureType);
+    }
+
+    /**
+     * Creates a FeatureQuery with the type of features, a filter and the order
+     * for the FeatureCollection.
+     * 
+     * @param featureType
+     *            the type of Features of the query
+     * @param filter
+     *            based on the properties of the Features
+     * @param order
+     *            for the result
+     */
+    public DefaultFeatureQuery(FeatureType featureType, Evaluator filter) {
+        super();
+        this.setFeatureType(featureType);
+        this.filter = filter;
+    }
+
+    /**
+     * Creates a FeatureQuery with the type of features, a filter, the order for
+     * the FeatureCollection and the view scale.
+     * 
+     * @param featureType
+     *            the type of Features of the query
+     * @param filter
+     *            based on the properties of the Features
+     * @param order
+     *            for the result
+     * @param scale
+     *            to view the Features.
+     */
+    public DefaultFeatureQuery(FeatureType featureType, Evaluator filter,
+        double scale) {
+        this.setFeatureType(featureType);
+        this.filter = filter;
+        this.setScale(scale);
+    }
+
+    /**
+     * Creates a FeatureQuery which will load a list of attribute names of all
+     * available Features.
+     * 
+     * @param attributeNames
+     *            the list of attribute names to load
+     */
+    public DefaultFeatureQuery(String[] attributeNames) {
+        super();
+        setAttributeNames(attributeNames);
+    }
+
+    /**
+     * Creates a FeatureQuery with the list of attribute names of feature, a
+     * filter and the order for the FeatureCollection.
+     * 
+     * @param attributeNames
+     *            the list of attribute names to load
+     * @param filter
+     *            based on the properties of the Features
+     * @param order
+     *            for the result
+     */
+    public DefaultFeatureQuery(String[] attributeNames, Evaluator filter) {
+        super();
+        setAttributeNames(attributeNames);
+        this.filter = filter;
+    }
+
+    /**
+     * Creates a FeatureQuery with the list of attribute names of feature, a
+     * filter, the order for the FeatureCollection and the view scale.
+     * 
+     * @param attributeNames
+     *            the list of attribute names to load
+     * @param filter
+     *            based on the properties of the Features
+     * @param order
+     *            for the result
+     * @param scale
+     *            to view the Features.
+     */
+    public DefaultFeatureQuery(String[] attributeNames, Evaluator filter,
+        double scale) {
+        setAttributeNames(attributeNames);
+        this.filter = filter;
+        this.setScale(scale);
+    }
+
+    public double getScale() {
+        Double scale = (Double) this.getQueryParameter(SCALE_PARAM_NAME);
+        if (scale == null) {
+            return 0;
+        }
+        return scale.doubleValue();
+    }
+
+    public void setScale(double scale) {
+        this.setQueryParameter(SCALE_PARAM_NAME, new Double(scale));
+    }
+
+    public Object getQueryParameter(String name) {
+        return queryParameters.get(name);
+    }
+
+    public void setQueryParameter(String name, Object value) {
+        queryParameters.put(name, value);
+    }
+
+    public void setFeatureType(FeatureType featureType) {
+        this.featureTypeId = featureType.getId();
+        Iterator iter = featureType.iterator();
+        String attrs[] = new String[featureType.size()];
+        FeatureAttributeDescriptor attr;
+        int i = 0;
+        while (iter.hasNext()) {
+            attr = (FeatureAttributeDescriptor) iter.next();
+            attrs[i] = attr.getName();
+            i++;
+        }
+        setAttributeNames(attrs);
+    }
+
+    public String[] getAttributeNames() {
+        return (String[])attributeNames.toArray(new String[attributeNames.size()]);
+    }
+
+    public void setAttributeNames(String[] attributeNames) {
+        this.attributeNames.clear();
+        if (attributeNames != null){
+            for (int i=0 ; i<attributeNames.length ; i++){
+                this.attributeNames.add(attributeNames[i]);
+            }   
+        }
+    }
+    
+    public void addAttributeName(String attributeName){
+        //If the attribute exists finish the method
+        for (int i=0 ; i<attributeNames.size() ; i++){
+            if (attributeNames.get(i).equals(attributeName)){
+                return;
+            }            
+        } 
+        this.attributeNames.add(attributeName);
+    }
+
+    public Evaluator getFilter() {
+        return filter;
+    }
+
+    public void setFilter(Evaluator filter) {
+        this.filter = filter;
+        addFilterAttributes(filter);
+        isAddFilter = false;
+    }
+
+    public void addFilter(Evaluator evaluator) {
+        if (isAddFilter){
+            if (this.filter == null){
+                this.filter = evaluator;
+            }else{
+                if (evaluator != null){
+                    if (this.filter instanceof AndEvaluator){
+                        ((AndEvaluator)this.filter).addEvaluator(evaluator);
+                    }else{
+                        this.filter = new AndEvaluator(this.filter);
+                        ((AndEvaluator)this.filter).addEvaluator(evaluator);
+                    }
+                }
+            }
+        }else{
+            this.filter = evaluator;
+        }
+        addFilterAttributes(evaluator);
+        isAddFilter = true;
+    }
+    
+    private void addFilterAttributes(Evaluator evaluator){
+        if (evaluator != null){
+            EvaluatorFieldsInfo fieldsInfo = evaluator.getFieldsInfo();
+            if (fieldsInfo == null){
+                // FieldsInfo is not available in this evaluator
+                return;
+            }
+            String[] fieldNames = fieldsInfo.getFieldNames();
+            if (fieldNames== null){
+                // fieldNames is not available in this evaluator
+                return;
+            }
+            
+            for (int i=0 ; i<fieldNames.length ; i++){
+                addAttributeName(fieldNames[i]);
+            }
+        }
+    }
+
+    public FeatureQueryOrder getOrder() {
+        return order;
+    }
+
+    public void setOrder(FeatureQueryOrder order) {
+        this.order = order;
+    }
+
+    public boolean hasFilter() {
+        return this.filter != null;
+    }
+
+    public boolean hasOrder() {
+        return this.order != null && this.order.size() > 0;
+    }
+
+    public Object clone() throws CloneNotSupportedException {
+        DefaultFeatureQuery clone = (DefaultFeatureQuery) super.clone();
+
+        // Clone attribute names array
+        if (attributeNames != null) {
+            clone.attributeNames = new ArrayList();
+            for (int i=0 ; i<attributeNames.size() ; i++){
+                clone.attributeNames.add(attributeNames.get(i));
+            }       
+        }
+
+        // Clone order
+        if (order != null) {
+            clone.order = (FeatureQueryOrder) order.clone();
+        }
+
+        return clone;
+    }
+
+    public FeatureQuery getCopy() {
+        try {
+            return (FeatureQuery) clone();
+        } catch (CloneNotSupportedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            return null;
+        }
+        // DefaultFeatureQuery aCopy = new DefaultFeatureQuery();
+        //
+        // aCopy.featureTypeId = this.featureTypeId;
+        //
+        // if (this.attributeNames != null) {
+        // aCopy.attributeNames = (String[]) Arrays
+        // .asList(this.attributeNames).toArray(new String[0]);
+        // }
+        //
+        // aCopy.filter = this.filter;
+        //
+        // if (this.order != null) {
+        // aCopy.order = this.order.getCopy();
+        // }
+        //
+        // return aCopy;
+    }
+
+    public String getFeatureTypeId() {
+        return featureTypeId;
+    }
+
+    public void setFeatureTypeId(String featureTypeId) {
+        this.featureTypeId = featureTypeId;
+    }
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+        // FIXME: falta por terminar de implementar
+        state.set("queryParameters", this.queryParameters);
+        state.set("featureTypeId", this.featureTypeId);
+        state.set("attributeNames", this.attributeNames);
+        // state.set("filter", this.filter);
+        state.set("limit", this.limit);
+        state.set("pageSize", this.pageSize);
+
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+        // FIXME: falta por terminar de implementar
+        this.queryParameters = (Map) state.get("queryParameters");
+        this.featureTypeId = state.getString("featureTypeId");
+        this.attributeNames = state.getList("attributeNames");
+        this.filter = (Evaluator) state.get("filter");
+        this.limit = state.getLong("limit");
+        this.pageSize = state.getLong("pageSize");
+
+    }
+
+    /**
+     * Register the class on PersistenceManager
+     * 
+     */
+    public static void registerPersistent() {
+        DynStruct definition =
+            ToolsLocator.getPersistenceManager()
+            .addDefinition(DefaultFeatureQuery.class,
+                "DefaultFeatureQuery",
+                "DefaultFeatureQuery Persistent definition",
+                null,
+                null);
+
+        definition.addDynFieldMap("queryParameters")
+        .setClassOfItems(Object.class)
+        .setMandatory(true);
+
+        definition.addDynFieldString("featureTypeId").setMandatory(false);
+
+        definition.addDynFieldList("attributeNames")
+        .setClassOfItems(String.class)
+        .setMandatory(false);
+
+        definition.addDynFieldObject("filter")
+        .setClassOfValue(Evaluator.class)
+        .setMandatory(false);
+
+        definition.addDynFieldObject("order")
+        .setClassOfValue(FeatureQueryOrder.class)
+        .setMandatory(false);
+
+        definition.addDynFieldLong("limit").setMandatory(false);
+
+        definition.addDynFieldLong("pageSize").setMandatory(false);
+
+    }
+
+    public long getLimit() {
+        return limit;
+    }
+
+    public long getPageSize() {
+        return pageSize;
+    }
+
+    public void setLimit(long limit) {
+        this.limit = limit;
+    }
+
+    public void setPageSize(long pageSize) {
+        this.pageSize = pageSize;
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java	(revision 35988)
@@ -0,0 +1,414 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.expansionadapter.ExpansionAdapter;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureManager {
+    private ExpansionAdapter expansionAdapter;
+    private ArrayList deleted = new ArrayList();//<FeatureID>
+    private int deltaSize=0;
+	private Map added = new LinkedHashMap();
+	private HashMap modifiedFromOriginal=new HashMap();
+    public FeatureManager(ExpansionAdapter expansionAdapter){
+    	this.expansionAdapter=expansionAdapter;
+    }
+
+
+    public Feature delete(FeatureReference id) {
+        deleted.add(id);
+		Integer num = (Integer) added.remove(id);
+        Feature feature=null;
+        if (num == null || num.intValue() == -1) {
+        	feature = (Feature)modifiedFromOriginal.remove(id);
+		}else{
+			feature = (Feature) expansionAdapter.getObject(num.intValue());
+		}
+        deltaSize--;
+        return feature;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     */
+    public void add(Feature feature) {
+        int pos = expansionAdapter.addObject(feature);
+        added.put(feature.getReference(),new Integer(pos));
+        deleted.remove(feature.getReference());
+        deltaSize++;
+    }
+
+    /**
+     * DOCUMENT ME!
+     * @param id DOCUMENT ME!
+     */
+    public Feature deleteLastFeature() {
+        expansionAdapter.deleteLastObject();
+        Feature feature=(Feature)expansionAdapter.getObject(expansionAdapter.getSize()-1);
+        added.remove(feature.getReference());
+        modifiedFromOriginal.remove(feature.getReference());
+        deltaSize--;
+        return feature;
+    }
+
+    /**
+     * Returns a Feature of the default type.
+     *
+     * @param id
+     *            the feature reference
+     * @param store
+     *            the store to get the feature from
+     * @return a Feature with the given reference
+     * @throws DataException
+     *             if there is an error getting the Feature
+     */
+    public Feature get(FeatureReference id, FeatureStore store)
+            throws DataException {
+        return get(id, store, null);
+    }
+
+    /**
+     * Returns a Feature of the given type.
+     *
+     * @param id
+     *            the feature reference
+     * @param store
+     *            the store to get the feature from
+     * @param featureType
+     *            the type of the feature to return
+     * @return a Feature with the given reference
+     * @throws DataException
+     *             if there is an error getting the Feature
+     */
+    public Feature get(FeatureReference id, FeatureStore store,
+			FeatureType featureType) throws DataException {
+    	// FIXME: y si el featuretype que paso esta modificado.
+    	//        Deberia buscarlo en el featuretypemanager ?
+		//
+    	//        Si no existe feature con ese id... � retorna null ?
+    	//        en EditedDefaultIterator se hace uso de ese comportamiento.
+    	//
+    	Integer intNum =((Integer) added.get(id));
+    	if (intNum == null){
+    		intNum =((Integer) modifiedFromOriginal.get(id));
+        	if (intNum == null){
+        		return null;
+        	}
+    	}
+        int num = intNum.intValue();
+        if (num==-1) {
+			return null;
+		}
+        Feature feature=(Feature)expansionAdapter.getObject(num);
+        if (featureType== null){
+        	featureType = store.getDefaultFeatureType();
+        }
+       	return getCorrectFeature(feature, store,featureType);
+    }
+
+    private Feature getCorrectFeature(Feature feature, FeatureStore store,
+			FeatureType featureType) throws DataException {
+    	 Iterator iterator=featureType.iterator();
+         EditableFeature newFeature=feature.getEditable();//store.createNewFeature(featureType, false);
+         FeatureType orgType = feature.getType();
+         int orgIndex;
+         while (iterator.hasNext()) {
+ 			FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) iterator.next();
+ 			orgIndex = orgType.getIndex(fad.getName());
+ 			if (orgIndex<0){
+ 				continue;
+ 			}
+ 			if (fad.isAutomatic() || fad.isReadOnly()
+					|| fad.getEvaluator() != null) {
+				continue;
+			}
+ 			Object value = feature.get(orgIndex);
+			if (value == null && !fad.allowNull()) {
+				continue;
+			}
+			newFeature.set(orgIndex, value);
+ 		}
+        return newFeature.getNotEditableCopy();
+	}
+
+	/**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     * @param oldFeature DOCUMENT ME!
+     */
+    public int update(Feature feature, Feature oldFeature) {
+    	int oldNum=-1;
+        int num = expansionAdapter.addObject(feature);
+        FeatureReference id=feature.getReference();
+        if (added.containsKey(id)){
+        	oldNum=((Integer)added.get(id)).intValue();
+        	added.put(id,new Integer(num));
+        }else{
+        	if (modifiedFromOriginal.get(id)!=null) {
+				oldNum=((Integer)modifiedFromOriginal.get(id)).intValue();
+			}
+        	modifiedFromOriginal.put(id,new Integer(num));
+        }
+        return oldNum;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param id DOCUMENT ME!
+     */
+    public void restore(FeatureReference id) {
+        deleted.remove(id);
+        deltaSize++;
+    }
+    public void restore(FeatureReference id,int num){
+    	if (added.containsKey(id)){
+        	added.put(id,new Integer(num));
+        }else{
+        	modifiedFromOriginal.put(id,new Integer(num));
+        }
+    }
+
+
+    public boolean isDeleted(Feature feature){
+    	return deleted.contains(feature.getReference());
+    }
+
+    public boolean isDeleted(FeatureReference featureID) {
+		return deleted.contains(featureID);
+	}
+
+	public void clear() {
+		added.clear();
+		modifiedFromOriginal.clear();
+	    expansionAdapter.close();
+	    deleted.clear();//<FeatureID>
+	    deltaSize=0;
+	}
+
+
+	public boolean hasChanges() {
+		return added.size()>0 || modifiedFromOriginal.size() > 0 || deleted.size() > 0;
+	}
+
+
+//	public Iterator newsFeaturesIterator(long index) {
+//		if (index==0)
+//			return newsFeaturesIterator();
+//
+//		return Arrays.asList(added.values()).listIterator((int)index);
+//	}
+//
+//	public Iterator newsFeaturesIterator() {
+//		return added.values().iterator();
+//	}
+	public Iterator getDeleted() {
+		return new DeletedIterator();
+
+	}
+
+	class DeletedIterator implements Iterator {
+		private Boolean hasnext = null;
+		private Iterator iter;
+		private DefaultFeatureReference obj;
+
+		public DeletedIterator(){
+			iter = deleted.iterator();
+		}
+
+		public boolean hasNext() {
+			if (hasnext != null) {
+				return hasnext.booleanValue();
+			}
+			hasnext = Boolean.FALSE;
+			while (iter.hasNext()) {
+				obj = (DefaultFeatureReference) iter.next();
+				if (obj.isNewFeature()) {
+					continue;
+				}
+				hasnext = Boolean.TRUE;
+				break;
+			}
+			return hasnext.booleanValue();
+		}
+
+		public Object next() {
+			if (!hasNext()) {
+				throw new NoSuchElementException();
+			}
+
+			hasnext = null;
+			return obj;
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+
+		}
+
+	}
+
+	public Iterator getInserted() {
+		return new InsertedIterator();
+	}
+
+	class InsertedIterator implements Iterator {
+
+		private Iterator addedIter;
+		private DefaultFeature obj;
+		private Boolean hasnext = null;
+
+		public InsertedIterator(){
+			addedIter = added.values().iterator();
+		}
+
+		public boolean hasNext() {
+			if (hasnext != null) {
+				return hasnext.booleanValue();
+			}
+			hasnext = Boolean.FALSE;
+			int pos;
+			while (addedIter.hasNext()) {
+				pos = ((Integer) addedIter.next()).intValue();
+				obj = (DefaultFeature) expansionAdapter.getObject(pos);
+				if (!deleted.contains(obj.getReference())) {
+					hasnext = Boolean.TRUE;
+					break;
+				}
+			}
+			return hasnext.booleanValue();
+		}
+
+		public Object next() {
+			if (!hasNext()) {
+				throw new NoSuchElementException();
+			}
+			hasnext = null;
+			return obj.getData();
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+
+		}
+
+	}
+	public Iterator getUpdated() {
+		return new UpdatedIterator();
+	}
+	class UpdatedIterator implements Iterator{
+		private Boolean hasnext = null;
+		private Iterator iter;
+		private DefaultFeature obj;
+		private int pos;
+
+		public UpdatedIterator() {
+			iter = expansionAdapter.iterator();
+			pos = -1;
+		}
+
+		public boolean hasNext() {
+			if (hasnext != null) {
+				return hasnext.booleanValue();
+			}
+			hasnext = Boolean.FALSE;
+			while (iter.hasNext()) {
+				pos++;
+				obj = (DefaultFeature) iter.next();
+				if (deleted.contains(obj.getReference())){
+					continue;
+				}else if (!modifiedFromOriginal.containsValue(new Integer(pos))){
+					continue;
+				}else {
+					hasnext = Boolean.TRUE;
+					break;
+				}
+			}
+			return hasnext.booleanValue();
+		}
+
+		public Object next() {
+			if (!hasNext()) {
+				throw new NoSuchElementException();
+			}
+			hasnext = null;
+			return obj.getData();
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+
+		}
+	}
+
+	public boolean hasNews() {
+		return !added.isEmpty();
+	}
+
+	public long getDeltaSize() {
+		return deltaSize;
+	}
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java	(revision 35988)
@@ -0,0 +1,100 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+
+/**
+ * {@link DynObject} implementation to facade a iterator of a {@link FeatureSet}
+ * and allow to be used as a {@link DynObjectSet} iterator.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * 
+ */
+public class DynObjectIteratorFeatureIteratorFacade implements
+    DisposableIterator {
+
+    private final DisposableIterator featureIterator;
+    private DynObjectFeatureFacade featureFacade;
+
+    /**
+     * Creates a new DynObjects iterator facade over a feature iterator.
+     * Each {@link Feature} will be returned through a new or reused
+     * {@link DynObjectFeatureFacade} which allows the {@link Feature} to be
+     * used like a DynObject.
+     * 
+     * @param featureIterator
+     *            to facade
+     * @param featureFacade
+     *            if not null this object will be reused as the facade for the
+     *            Feature objects of the feature iterator
+     */
+    public DynObjectIteratorFeatureIteratorFacade(
+        DisposableIterator featureIterator, DynObjectFeatureFacade featureFacade) {
+        this.featureIterator = featureIterator;
+        this.featureFacade = featureFacade;
+    }
+
+    /**
+     * Creates a new DynObjects iterator facade over a feature iterator.
+     * Each {@link Feature} will be returned through a new
+     * {@link DynObjectFeatureFacade} which allows the {@link Feature} to be
+     * used like a DynObject.
+     * 
+     * @param featureIterator
+     *            to facade
+     */
+    public DynObjectIteratorFeatureIteratorFacade(
+        DisposableIterator featureIterator) {
+        this.featureIterator = featureIterator;
+    }
+
+    public void dispose() {
+        featureIterator.dispose();
+    }
+
+    public boolean hasNext() {
+        return featureIterator.hasNext();
+    }
+
+    public Object next() {
+        Feature feature = (Feature) featureIterator.next();
+        DynObjectFeatureFacade facade;
+        if (featureFacade != null) {
+            facade = this.featureFacade;
+        } else {
+            facade = new DynObjectFeatureFacade();
+        }
+        featureFacade.setFeature(feature);
+        return facade;
+    }
+
+    public void remove() {
+        featureIterator.remove();
+    }
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java	(revision 35988)
@@ -0,0 +1,23 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class FastEditedFilteredIterator extends FastEditedIterator {
+
+	public FastEditedFilteredIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet, index);
+	}
+
+
+	public boolean match(DefaultFeature feature) throws DataException {
+		try {
+			return ((Boolean) this.filter.evaluate(feature)).booleanValue();
+		} catch (EvaluatorException e) {
+			throw new DataEvaluatorException(e);
+		}
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java	(revision 35988)
@@ -0,0 +1,82 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class FastEditedIterator extends EditedIterator {
+	DefaultFeature myFeature;
+
+	public FastEditedIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet);
+		this.initializeFeature();
+		if (index > 0) {
+			if (featureSet.provider.canIterateFromIndex()) {
+				try {
+					this.iterator = featureSet.provider.fastIterator(index);
+				} catch (IllegalArgumentException e) {
+					this.iterator = featureSet.provider.fastIterator();
+					this.newsFeatures = null;
+					skypto(index);
+				} catch (UnsupportedOperationException e) {
+					this.iterator = featureSet.provider.fastIterator();
+					this.newsFeatures = null;
+					skypto(index);
+				}
+			} else {
+				this.iterator = featureSet.provider.fastIterator();
+				this.newsFeatures = null;
+				skypto(index);
+			}
+		} else {
+			this.iterator = featureSet.provider.fastIterator();
+			this.newsFeatures = featureSet.store.getFeatureManager()
+					.getInserted();
+		}
+
+	}
+
+	protected void initializeFeature() {
+		myFeature = new DefaultFeature(fset.store);
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider data) {
+
+		DefaultFeature f = null;
+		try {
+			data.setNew(featureIsNew);
+			FeatureReference ref = new DefaultFeatureReference(fset.store,
+					data);
+			f = (DefaultFeature) fset.store.getFeatureManager().get(
+					ref,
+					fset.store, data.getType());
+		} catch (DataException e) {
+			RuntimeException ex = new RuntimeException();
+			e.initCause(e);
+			throw ex;
+		}
+		if (f == null) {
+			this.myFeature.setData(data);
+		} else {
+			// TODO Sacamos una copia del data o no???
+			this.myFeature.setData(f.getData().getCopy());
+		}
+		return this.myFeature;
+
+	}
+
+	public void remove() {
+		super.remove();
+		this.initializeFeature();
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		myFeature = null;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java	(revision 35988)
@@ -0,0 +1,50 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class FastFilteredIterator extends FilteredIterator {
+
+	DefaultFeature myFeature;
+
+	FastFilteredIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet);
+		initializeFeature();
+
+		this.iterator = featureSet.provider.fastIterator();
+		if (index > 0) {
+			this.skypto(index);
+		}
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider fData)
+			throws DataException {
+		fData.setNew(false);
+		this.myFeature.setData(fData);
+
+		if (this.fset.transform.isEmpty()) {
+			return myFeature;
+		} else {
+			return (DefaultFeature) this.fset.transform.applyTransform(
+					myFeature, fset.getDefaultFeatureType());
+		}
+	}
+
+	protected void initializeFeature() {
+		myFeature = new DefaultFeature(fset.store);
+	}
+
+	public void remove() {
+		super.remove();
+		this.initializeFeature();
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		myFeature = null;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java	(revision 35988)
@@ -0,0 +1,24 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+
+public class EditedFilteredIterator extends EditedIterator {
+
+	EditedFilteredIterator(DefaultFeatureSet fset, long index)
+			throws DataException {
+		super(fset, index);
+	}
+
+	public boolean match(DefaultFeature feature) throws DataException {
+		try {
+			return ((Boolean) this.filter.evaluate(feature)).booleanValue();
+		} catch (EvaluatorException e) {
+			throw new DataEvaluatorException(e);
+		}
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java	(revision 35988)
@@ -0,0 +1,108 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class EditedIterator extends FilteredIterator {
+
+	Iterator newsFeatures;
+	boolean featureIsNew;
+
+
+	public EditedIterator(DefaultFeatureSet featureSet) {
+		super(featureSet);
+	}
+
+	public EditedIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet);
+		this.newsFeatures = null;
+		if (index > 0) {
+			if (featureSet.provider.canIterateFromIndex()) {
+				try {
+					this.iterator = featureSet.provider.iterator(index);
+				} catch (IllegalArgumentException e) {
+					this.iterator = featureSet.provider.iterator();
+					skypto(index);
+				} catch (UnsupportedOperationException e) {
+					this.iterator = featureSet.provider.iterator();
+					skypto(index);
+				}
+			} else {
+				this.iterator = featureSet.provider.iterator();
+				skypto(index);
+			}
+		} else {
+			this.iterator = featureSet.provider.iterator();
+		}
+
+	}
+
+	protected Iterator getIterator() {
+		if (this.featureIsNew){
+			return this.newsFeatures;
+		} else if (this.iterator.hasNext()) {
+			featureIsNew=false;
+			return this.iterator;
+		} else{
+			featureIsNew = true;
+			this.newsFeatures = this.fset.store.getFeatureManager()
+					.getInserted();
+			return this.newsFeatures;
+		}
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider data) {
+
+		DefaultFeature f = null;
+		data.setNew(featureIsNew);
+		try {
+			FeatureReference ref = new DefaultFeatureReference(fset.store, data);
+			f = (DefaultFeature) fset.store.getFeatureManager().get(ref,
+					fset.store, data.getType());
+		} catch (DataException e) {
+			RuntimeException ex = new RuntimeException();
+			e.initCause(e);
+			throw ex;
+		}
+		if (f == null) {
+			// La feature no se ha editado.
+			f = new DefaultFeature(fset.store, data);
+		}
+		return f;
+	}
+
+	protected boolean isDeletedOrHasToSkip(FeatureProvider data) {
+
+		// XXX
+		// si recorriendo los originales nos
+		// encontramos uno nuevo, no lo devolvemos
+		// porque se recorrera mas tarde.
+		// Esto es una interaccion con los indices
+		// ya que estos contienen todas las features ya
+		// sea nuevas o no
+
+		if (data.isNew() && !featureIsNew) {
+			return true;
+		}
+		FeatureReference ref = new DefaultFeatureReference(fset.store, data);
+		return fset.store.getFeatureManager().isDeleted(ref);
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		if (newsFeatures instanceof DisposableIterator) {
+			((DisposableIterator) newsFeatures).dispose();
+		}
+		newsFeatures = null;
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java	(revision 35988)
@@ -0,0 +1,126 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorException;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorException;
+import org.gvsig.tools.exception.BaseException;
+
+public class FilteredIterator extends DefaultIterator {
+
+	protected boolean nextChecked;
+	protected DefaultFeature current;
+	protected Evaluator filter;
+
+
+	protected FilteredIterator(DefaultFeatureSet featureSet) {
+		super(featureSet);
+		this.current = null;
+		this.nextChecked = false;
+		this.filter = featureSet.query.getFilter();
+	}
+
+	FilteredIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet);
+		this.iterator = featureSet.provider.iterator();
+		if (index > 0) {
+			this.skypto(index);
+		}
+		this.current = null;
+		this.nextChecked = false;
+		this.filter = featureSet.query.getFilter();
+	}
+
+	protected void skypto(long index) {
+		// TODO: Comprobar si esta bien la condicion de n<=
+		for (long n = 0; n <= index && this.hasNext(); n++, this.next()) {
+			;
+		}
+	}
+
+	protected void doNext() throws DataException {
+		nextChecked = true;
+		DefaultFeature feature;
+		FeatureProvider data;
+		Object obj;
+		while (this.getIterator().hasNext()) {
+			obj =this.getIterator().next();
+			if (obj instanceof FeatureProvider){
+				data = (FeatureProvider)obj;
+				if (isDeletedOrHasToSkip(data)) {
+					continue;
+				}
+				feature = this.createFeature(data);
+			} else {
+				feature = (DefaultFeature)obj;
+				if (isDeletedOrHasToSkip(feature.getData())) {
+					continue;
+				}
+			}
+			if (this.match(feature)) {
+				this.current = feature;
+				return;
+			}
+		}
+		this.current = null;
+	}
+
+	protected Iterator getIterator() {
+		return this.iterator;
+	}
+
+	public boolean hasNext() {
+		fset.checkSourceStoreModified();
+		if (nextChecked) {
+			return this.current != null;
+		}
+		try {
+			doNext();
+		} catch( DataException e) {
+			NullPointerException ex = new NullPointerException();
+			ex.initCause(e);
+			throw ex;
+		}
+		return this.current != null;
+	}
+
+	public boolean match(DefaultFeature feature) throws DataException {
+		try {
+			if (filter==null) {
+				return true;
+			}
+			return ((Boolean) this.filter.evaluate(feature)).booleanValue();
+		} catch (EvaluatorException e) {
+			throw new DataEvaluatorException(e);
+		}
+	}
+
+	public Object next() {
+		fset.checkSourceStoreModified();
+		if (!nextChecked) {
+			hasNext();
+		}
+		if (this.current == null) {
+			throw new NoSuchElementException();
+		}
+		this.lastFeature = null;
+		nextChecked = false;
+		DefaultFeature feature = this.current;
+		this.current = null;
+		this.lastFeature = feature;
+		return feature;
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		current = null;
+		filter = null;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java	(revision 35988)
@@ -0,0 +1,186 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * {@link DynObject} implementation to facade of a {@link FeatureSet} and allow
+ * to be used as a {@link DynObjectSet}.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DynObjectSetFeatureSetFacade extends BaseWeakReferencingObservable
+    implements DynObjectSet, Observer {
+
+    private final FeatureSet featureSet;
+
+    private final FeatureStore store;
+
+    private final DynObjectFeatureFacade featureFacade =
+        new DynObjectFeatureFacade();
+
+    private final boolean fast;
+
+    /**
+     * Creates a new facade over a given feature set, with fast dynobject
+     * iteration.
+     * 
+     * @param featureSet
+     *            to facade
+     */
+    public DynObjectSetFeatureSetFacade(FeatureSet featureSet,
+        FeatureStore store) {
+        this(featureSet, store, true);
+    }
+
+    /**
+     * Creates a new facade over a given feature set, with fast dynobject
+     * iteration.
+     * 
+     * @param featureSet
+     *            to facade
+     * @param fast
+     *            if true try to reuse objects as much as possible to make the
+     *            object iteration faster. If true, DynObjects got through the
+     *            returned set must not be stored unless cloned.
+     */
+    public DynObjectSetFeatureSetFacade(FeatureSet featureSet,
+        FeatureStore store, boolean fast) {
+        this.featureSet = featureSet;
+        this.store = store;
+        store.addObserver(this);
+        this.fast = fast;
+    }
+
+    public void dispose() {
+        store.deleteObserver(this);
+    }
+
+    public void accept(final Visitor visitor, long firstValueIndex)
+        throws BaseException {
+        featureSet.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                DynObjectFeatureFacade feature;
+                if (fast) {
+                    feature = featureFacade;
+                } else {
+                    feature = new DynObjectFeatureFacade();
+                }
+                feature.setFeature((Feature) obj);
+                visitor.visit(feature);
+            }
+        }, firstValueIndex);
+    }
+
+    public void accept(final Visitor visitor) throws BaseException {
+        featureSet.accept(new Visitor() {
+
+            public void visit(Object obj) throws VisitCanceledException,
+                BaseException {
+                featureFacade.setFeature((Feature) obj);
+                visitor.visit(featureFacade);
+            }
+        });
+    }
+
+    public long getSize() throws BaseException {
+        return featureSet.getSize();
+    }
+
+    public DisposableIterator iterator(long index) throws BaseException {
+        if (fast) {
+            return new DynObjectIteratorFeatureIteratorFacade(
+                featureSet.fastIterator(index), featureFacade);
+        } else {
+            return new DynObjectIteratorFeatureIteratorFacade(
+                featureSet.fastIterator(index));
+        }
+    }
+
+    public DisposableIterator iterator() throws BaseException {
+        if (fast) {
+            return new DynObjectIteratorFeatureIteratorFacade(
+                featureSet.fastIterator(), featureFacade);
+        } else {
+            return new DynObjectIteratorFeatureIteratorFacade(
+                featureSet.fastIterator());
+        }
+    }
+
+    public boolean isEmpty() throws BaseException {
+        return featureSet.isEmpty();
+    }
+
+    public boolean isDeleteEnabled() {
+        return store.isEditing();
+    }
+
+    public void delete(DynObject dynObject) throws BaseException {
+        DynObjectFeatureFacade facade = (DynObjectFeatureFacade) dynObject;
+        featureSet.delete(facade.getFeature());
+    }
+
+    public boolean isUpdateEnabled() {
+        return store.isEditing();
+    }
+
+    public void update(DynObject dynObject) throws BaseException {
+        DynObjectFeatureFacade facade = (DynObjectFeatureFacade) dynObject;
+        featureSet.update(facade.getEditable());
+    }
+
+    public void update(Observable observable, Object notification) {
+        if (observable.equals(store)
+            && notification instanceof FeatureStoreNotification) {
+            FeatureStoreNotification event =
+                (FeatureStoreNotification) notification;
+            if (event.getType() == FeatureStoreNotification.AFTER_STARTEDITING
+                || event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING
+                || event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING) {
+                setChanged();
+                notify(this, new Notification() {
+
+                    public String getType() {
+                        return Notification.EDITION_STATUS_CHANGE;
+                    }
+                });
+            }
+        }
+
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java	(revision 35988)
@@ -0,0 +1,528 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder.FeatureQueryOrderMember;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.fmap.dal.feature.exception.FeatureSetInitializeException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+import org.gvsig.tools.visitor.impl.AbstractIndexedVisitable;
+
+public class DefaultFeatureSet extends AbstractIndexedVisitable implements
+		FeatureSet, Observer {
+
+
+	private static final int NO_CHECKED = -1;
+	private static final int DEFAULT = 0;
+	private static final int FILTERED = 1;
+	private static final int ORDERED = 2;
+	private static final int ORDERED_FILTERED = 3;
+	private static final int EDITED = 4;
+	private static final int EDITED_FILTERED = 5;
+	private static final int ORDERD_EDITED = 6;
+	private static final int ORDERED_EDITED_FILTER = 7;
+
+	private boolean sourceStoreModified;
+    private boolean ownFeaturesModified;
+	DefaultFeatureStore store;
+	private List featureTypes;
+	FeatureQuery query;
+	FeatureSetProvider provider;
+	private long size;
+	private int iteratorMode;
+	List orderedData;
+	private Feature featureToIgnoreNotification;
+	DefaultFeatureStoreTransforms transform;
+	private FeatureQuery queryForProvider;
+	private FeatureType defatulFeatureType;
+	private FeatureType defatulFeatureTypeForProvider;
+
+
+	public DefaultFeatureSet(DefaultFeatureStore store, FeatureQuery query)
+	throws DataException {
+		this.featureToIgnoreNotification = null;
+		this.iteratorMode = NO_CHECKED;
+		this.sourceStoreModified = false;
+        this.ownFeaturesModified = false;
+		this.size = -1;
+		this.orderedData = null;
+		this.store = store;
+		if (this.store.isEditing()) {
+			this.transform = this.store.getFeatureTypeManager().getTransforms();
+		} else {
+			this.transform = (DefaultFeatureStoreTransforms) store
+				.getTransforms();
+		}
+		this.query = query;
+		try {
+			this.queryForProvider = (FeatureQuery) query.clone();
+		} catch (CloneNotSupportedException e) {
+			throw new FeatureSetInitializeException(e);
+		}
+
+		this.featureTypes = new ArrayList();
+		if (this.query.getFeatureTypeId() == null
+				&& this.query.getAttributeNames() == null) {
+			this.defatulFeatureType = this.store.getDefaultFeatureType();
+			this.featureTypes.addAll(this.store.getFeatureTypes());
+		} else {
+			this.defatulFeatureType = this.store.getFeatureType(this.query);
+			this.featureTypes.add(this.defatulFeatureType);
+		}
+		if (this.transform != null && !this.transform.isEmpty()) {
+			this.fixQueryForProvider(this.queryForProvider, this.transform);
+		} else {
+			this.defatulFeatureTypeForProvider = this.defatulFeatureType;
+		}
+
+		if (this.queryForProvider.hasFilter() && store.getIndexes() != null) {
+			this.provider = (FeatureSetProvider) store.getIndexes()
+					.getFeatureSet(this.queryForProvider.getFilter());
+		}
+		if (this.provider == null) {
+			this.provider = this.store.getProvider().createSet(
+					this.queryForProvider, this.defatulFeatureTypeForProvider);
+		}
+		this.store.addObserver(this);
+	}
+
+	private void fixQueryForProvider(FeatureQuery theQueryForProvider,
+			DefaultFeatureStoreTransforms transformsToUse) throws DataException {
+		theQueryForProvider.setAttributeNames(null);
+		FeatureType ftype = transformsToUse
+				.getSourceFeatureTypeFrom(this.defatulFeatureType);
+		theQueryForProvider.setFeatureTypeId(ftype.getId());
+		this.defatulFeatureTypeForProvider = ftype;
+
+		if (transformsToUse.isTransformsOriginalValues()) {
+			theQueryForProvider.setFilter(null);
+			theQueryForProvider.getOrder().clear();
+			return;
+
+		}
+
+		// Filter
+		Evaluator filter = theQueryForProvider.getFilter();
+		if (filter != null) {
+			boolean canUseFilter = true;
+			if (filter.getFieldsInfo() == null) {
+				canUseFilter = false;
+			} else {
+				canUseFilter = areEvaluatorFieldsInAttributes(filter, ftype);
+			}
+
+			if (!canUseFilter) {
+				theQueryForProvider.setFilter(null);
+			}
+
+		}
+
+
+		// Order
+		if (theQueryForProvider.hasOrder()){
+		    boolean canUseOrder = true;
+		    Iterator iter = theQueryForProvider.getOrder().iterator();
+		    FeatureQueryOrderMember item;
+		    while (iter.hasNext()) {
+		        item = (FeatureQueryOrderMember) iter.next();
+		        if (item.hasEvaluator()) {
+		            if (!areEvaluatorFieldsInAttributes(item.getEvaluator(), ftype)) {
+		                canUseOrder = false;
+		                break;
+		            }
+		        } else {
+		            if (ftype.get(item.getAttributeName()) == null) {
+		                canUseOrder = false;
+		                break;
+		            }
+		        }
+		    }
+
+		    if (!canUseOrder) {
+		        theQueryForProvider.getOrder().clear();
+		    }
+		}
+
+	}
+
+	private boolean areEvaluatorFieldsInAttributes(Evaluator evaluator,
+			FeatureType fType) {
+		if (evaluator.getFieldsInfo() == null) {
+			return false;
+		}
+		String[] fieldNames = evaluator.getFieldsInfo().getFieldNames();
+		if (fieldNames.length == 0) {
+			return false;
+		} else {
+			for (int i = 0; i < fieldNames.length; i++) {
+				if (fType.get(fieldNames[i]) == null) {
+					return false;
+				}
+
+			}
+		}
+		return true;
+	}
+
+	public FeatureType getDefaultFeatureType() {
+		return this.defatulFeatureType;
+	}
+
+	public List getFeatureTypes() {
+		return Collections.unmodifiableList(this.featureTypes);
+	}
+
+	public long getSize() throws DataException {
+		this.checkSourceStoreModified();
+		if (size < 0) {
+			size = calculateSize();
+		}
+		return size;
+	}
+
+	private long calculateSize() throws DataException {
+		int mode = this.getIteratorMode();
+		if ((mode & EDITED) != EDITED) {
+			if( this.provider.isEmpty() ) {
+				return 0;
+			}
+		}
+		if ((mode & FILTERED) == FILTERED) {
+			long mySize =0;
+			DisposableIterator iter = null;
+			try{
+				iter = this.fastIterator();
+				while (true) {
+					iter.next();
+					mySize++;
+				}
+			} catch (NoSuchElementException e){
+				return mySize;
+			} finally {
+				iter.dispose();
+			}
+		} else if ((mode & EDITED) == EDITED) {
+			return provider.getSize()
+			+ store.getFeatureManager().getDeltaSize();
+		}
+		return provider.getSize();
+	}
+
+	public void dispose() {
+		this.store.deleteObserver(this);
+		this.provider.dispose();
+		this.provider = null;
+
+		this.featureToIgnoreNotification = null;
+		if (orderedData != null) {
+			orderedData.clear();
+		}
+		this.orderedData = null;
+		this.store = null;
+		this.transform = null;
+		this.query = null;
+		this.queryForProvider = null;
+		this.featureTypes = null;
+		this.defatulFeatureType = null;
+		this.defatulFeatureTypeForProvider = null;
+	}
+
+	public boolean isFromStore(DataStore store) {
+		return this.store.equals(store);
+	}
+
+	public void update(Observable obsevable, Object notification) {
+		if (sourceStoreModified) {
+			return;
+		}
+
+		String type = ((FeatureStoreNotification) notification).getType();
+
+		if (
+				type.equalsIgnoreCase(FeatureStoreNotification.AFTER_INSERT)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DELETE)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE)
+		) {
+			if( this.featureToIgnoreNotification == ((FeatureStoreNotification) notification).getFeature() ) {
+				return;
+			}
+			sourceStoreModified = true;
+			return;
+		}
+		if (
+				type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UPDATE_TYPE)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REDO)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_UNDO)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_REFRESH)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.COMPLEX_NOTIFICATION)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CLOSE)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.AFTER_DISPOSE)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.RESOURCE_CHANGED)
+				|| type.equalsIgnoreCase(FeatureStoreNotification.TRANSFORM_CHANGE)
+		) {
+			sourceStoreModified = true;
+			return;
+		}
+        if (type.equalsIgnoreCase(FeatureStoreNotification.AFTER_CANCELEDITING)
+            && ownFeaturesModified) {
+            sourceStoreModified = true;
+            return;
+        }
+	}
+
+	protected void doAccept(Visitor visitor, long firstValueIndex)
+			throws VisitCanceledException, BaseException {
+        DisposableIterator iterator = fastIterator(firstValueIndex);
+
+		try {
+			while (iterator.hasNext()) {
+				Feature feature = (Feature) iterator.next();
+				visitor.visit(feature);
+			}
+		} finally {
+			iterator.dispose();
+		}
+	}
+
+	protected void checkSourceStoreModified() {
+		if (sourceStoreModified) {
+			throw new ConcurrentDataModificationException(store.getName());
+		}
+	}
+
+	public boolean isEmpty() throws DataException {
+		checkSourceStoreModified();
+		return this.getSize()==0 ;
+	}
+
+	public DisposableIterator fastIterator() throws DataException {
+		return this.fastIterator(0);
+	}
+
+	public DisposableIterator fastIterator(long index) throws DataException {
+		if (index < 0) {
+			throw new IndexOutOfBoundsException("The index (" + index
+					+ ") is less than 0");
+		}
+		int mode = this.getIteratorMode();
+
+		switch (mode) {
+		case DEFAULT:
+			return new FastDefaultIterator(this, index);
+
+		case FILTERED:
+			return new FastFilteredIterator(this, index);
+
+
+		case ORDERED:
+			if (this.orderedData != null) {
+				return new FastOrderedIterator(this, index);
+			} else {
+				return new FastOrderedIterator(this, new FastDefaultIterator(
+						this, 0), index);
+			}
+
+		case ORDERED_FILTERED:
+			if (this.orderedData != null) {
+				return new FastOrderedIterator(this, index);
+			} else {
+				return new FastOrderedIterator(this, new FastFilteredIterator(
+						this, 0), index);
+			}
+
+		case EDITED:
+			return new FastEditedIterator(this, index);
+
+		case EDITED_FILTERED:
+			return new FastEditedFilteredIterator(this, index);
+
+		case ORDERD_EDITED:
+			if (this.orderedData != null) {
+				return new FastOrderedIterator(this, index);
+			} else {
+				return new FastOrderedIterator(this, new FastEditedIterator(
+						this, 0), index);
+			}
+
+		case ORDERED_EDITED_FILTER:
+			if (this.orderedData != null) {
+				return new FastOrderedIterator(this, index);
+			} else {
+				return new FastOrderedIterator(this,
+						new FastEditedFilteredIterator(this, 0), index);
+			}
+		default:
+			throw new IllegalArgumentException();
+		}
+	}
+
+	public DisposableIterator iterator() throws DataException {
+		return this.iterator(0);
+	}
+
+	public DisposableIterator iterator(long index) throws DataException {
+		if (index < 0) {
+			throw new IndexOutOfBoundsException("The index (" + index
+					+ ") is less than 0");
+		}
+		int mode = this.getIteratorMode();
+
+		switch (mode) {
+		case DEFAULT:
+			return new DefaultIterator(this, index);
+
+		case FILTERED:
+			return new FilteredIterator(this, index);
+
+		case ORDERED:
+			if (orderedData != null) {
+				return new OrderedIterator(this, index);
+
+			} else {
+				return new OrderedIterator(this, new DefaultIterator(this, 0),
+						index);
+			}
+
+		case ORDERED_FILTERED:
+			return new OrderedIterator(this, new FilteredIterator(this, 0),
+					index);
+
+		case EDITED:
+			return new EditedIterator(this, index);
+
+		case EDITED_FILTERED:
+			return new EditedFilteredIterator(this, index);
+
+		case ORDERD_EDITED:
+			return new OrderedIterator(this,
+					new EditedIterator(this, 0), index);
+
+		case ORDERED_EDITED_FILTER:
+			return new OrderedIterator(this,
+					new EditedFilteredIterator(this, 0), index);
+
+		default:
+			throw new IllegalArgumentException();
+		}
+
+	}
+
+	private boolean providerCanOrder() {
+		return this.provider.canOrder();
+	}
+
+	private boolean providerCanFilter() {
+		return this.provider.canFilter();
+	}
+
+	private int getIteratorMode() {
+
+		if (this.iteratorMode != NO_CHECKED) {
+			return this.iteratorMode;
+		}
+
+		// TODO Tener en cuenta las transformaciones ???
+
+		if (store.isEditing() && store.getFeatureManager().hasChanges()) {
+			if (this.query.hasOrder()) { // En edicion siempre ordeno yo.
+				if (this.query.hasFilter()) {
+					return ORDERED_EDITED_FILTER;
+				} else {
+					return ORDERD_EDITED;
+				}
+			} else {
+				if (this.query.hasFilter()) {
+					return EDITED_FILTERED;
+				} else {
+					return EDITED;
+				}
+			}
+		} else {
+			boolean useMyFilter = this.query.hasFilter();
+			boolean useMyOrder = this.query.hasOrder();
+			if (this.providerCanOrder() && this.transform.isEmpty()) {
+				useMyOrder = false;
+			}
+			if (this.providerCanFilter() && this.transform.isEmpty()) {
+				useMyFilter = false;
+			}
+
+			if (useMyOrder) {
+				if (useMyFilter) {
+					return ORDERED_FILTERED;// ORDERED_FILTERED;
+				} else {
+					return ORDERED;// ORDERED;
+				}
+			} else {
+				if (useMyFilter) {
+					return FILTERED;// FILTERED;
+				} else {
+					return DEFAULT;// DEFAULT;
+				}
+			}
+		}
+
+	}
+
+	public void delete(Feature feature) throws DataException {
+		this.featureToIgnoreNotification = feature;
+        this.store.delete(feature);
+		if (this.size > 0) {
+            this.size--;
+		}
+		this.featureToIgnoreNotification = null;
+        this.ownFeaturesModified = true;
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		this.featureToIgnoreNotification = feature;
+		this.store.insert(feature);
+		if (this.size >= 0) {
+			this.size++;
+		}
+		this.featureToIgnoreNotification = null;
+        this.ownFeaturesModified = true;
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		this.featureToIgnoreNotification = feature;
+		this.store.update(feature);
+		this.featureToIgnoreNotification = null;
+        this.ownFeaturesModified = true;
+	}
+
+    public DynObjectSet getDynObjectSet() {
+        return this.getDynObjectSet(true);
+    }
+
+    public DynObjectSet getDynObjectSet(boolean fast) {
+        return new DynObjectSetFeatureSetFacade(this, store, fast);
+    }
+
+    public FeatureStore getFeatureStore() {
+        return store;
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java	(revision 35988)
@@ -0,0 +1,62 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class FastDefaultIterator extends DefaultIterator {
+
+	DefaultFeature myFeature;
+
+	public FastDefaultIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		super(featureSet);
+		this.initializeFeature();
+		if (index > 0) {
+			if (featureSet.provider.canIterateFromIndex()) {
+				try {
+					this.iterator = featureSet.provider.fastIterator(index);
+				} catch (UnsupportedOperationException e) {
+					this.iterator = featureSet.provider.fastIterator();
+					skypto(index);
+				}
+			} else {
+				this.iterator = featureSet.provider.fastIterator();
+				skypto(index);
+			}
+		} else {
+			this.iterator = featureSet.provider.fastIterator();
+		}
+
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider fData)
+			throws DataException {
+		fData.setNew(false);
+		this.myFeature.setData(fData);
+
+		if (this.fset.transform.isEmpty()) {
+			return myFeature;
+		} else {
+			return (DefaultFeature) this.fset.transform.applyTransform(
+					myFeature, fset
+							.getDefaultFeatureType());
+		}
+	}
+
+	protected void initializeFeature() {
+		myFeature = new DefaultFeature(fset.store);
+	}
+
+	public void remove() {
+		super.remove();
+		this.initializeFeature();
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		myFeature = null;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java	(revision 35988)
@@ -0,0 +1,106 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class FastOrderedIterator extends DefaultIterator {
+	DefaultFeature myFeature;
+	protected Feature lastFeature = null;
+
+	FastOrderedIterator(DefaultFeatureSet featureSet, Iterator iterator, long index) {
+		super(featureSet);
+		try {
+			this.initializeFeature();
+			if (featureSet.orderedData == null) {
+				// FIXME QUE PASA CON SIZE > Integer.MAX_VALUE ?????
+	
+				List data = new ArrayList();
+				Object item;
+				while (iterator.hasNext()) {
+					item = iterator.next();
+					if (item instanceof DefaultFeature){
+						data.add(((DefaultFeature) item).getData().getCopy());
+					} else {
+						data.add(((FeatureProvider)item).getCopy());
+					}
+				}
+				Collections.sort(data, new FeatureProviderComparator(featureSet.store,
+						featureSet.query.getOrder()));
+				featureSet.orderedData = data;
+			}
+	
+			if (index < Integer.MAX_VALUE) {
+				this.iterator = featureSet.orderedData.listIterator((int) index);
+			} else {
+				this.iterator = featureSet.orderedData.iterator();
+				this.skypto(index);
+			}
+		}
+		finally {			
+			if (iterator instanceof DisposableIterator) {
+				((DisposableIterator) iterator).dispose();
+			}
+		}
+	}
+
+	public FastOrderedIterator(DefaultFeatureSet featureSet, long index) {
+		super(featureSet);
+		this.initializeFeature();
+
+		if (index < Integer.MAX_VALUE) {
+			this.iterator = featureSet.orderedData.listIterator((int) index);
+		} else {
+			this.iterator = featureSet.orderedData.iterator();
+			this.skypto(index);
+		}
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider fData) {
+		fData.setNew(false);
+		this.myFeature.setData(fData);
+		return this.myFeature;
+	}
+
+	protected void initializeFeature() {
+		myFeature = new DefaultFeature(fset.store);
+	}
+
+	public Object next() {
+		lastFeature = null;
+		lastFeature = (Feature) super.next();
+		return lastFeature;
+	}
+
+	public void remove() {
+		if (!fset.store.isEditing()) {
+			throw new UnsupportedOperationException();
+		}
+		if (this.lastFeature == null) {
+			throw new IllegalStateException();
+		}
+		try {
+			fset.store.delete(this.lastFeature);
+		} catch (DataException e) {
+			// FIXME Cambiar excepcion a una Runtime de DAL
+			throw new RuntimeException(e);
+		}
+		this.iterator.remove();
+		this.initializeFeature();
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		myFeature = null;
+		lastFeature = null;
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java	(revision 35988)
@@ -0,0 +1,125 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.exception.BaseException;
+
+
+class DefaultIterator extends AbstractDisposable implements DisposableIterator {
+
+	protected Iterator iterator;
+	protected DefaultFeatureSet fset;
+	protected Feature lastFeature = null;
+
+	public DefaultIterator(DefaultFeatureSet featureSet) {
+		this.fset = featureSet;
+	}
+
+	public DefaultIterator(DefaultFeatureSet featureSet, long index)
+			throws DataException {
+		this.fset = featureSet;
+		if (index > 0) {
+			if (featureSet.provider.canIterateFromIndex()) {
+				try {
+					this.iterator = featureSet.provider.iterator(index);
+				} catch (UnsupportedOperationException e) {
+					this.iterator = featureSet.provider.iterator();
+					skypto(index);
+				}
+			} else {
+				this.iterator = featureSet.provider.iterator();
+				skypto(index);
+			}
+		} else {
+			this.iterator = featureSet.provider.iterator();
+		}
+	}
+
+	protected void skypto(long index) {
+		// TODO: Comprobar si esta bien la condicion de n<=
+		for (long n = 0; n <= index && this.getIterator().hasNext(); n++, this
+				.getIterator()
+				.next()) {
+			;
+		}
+	}
+
+	public boolean hasNext() {
+		fset.checkSourceStoreModified();
+		return this.getIterator().hasNext();
+	}
+
+	public Object next() {
+		fset.checkSourceStoreModified();
+		lastFeature = null;
+		if (!this.hasNext()) {
+			throw new NoSuchElementException();
+		}
+		try {
+			lastFeature = this.createFeature((FeatureProvider) this.getIterator()
+					.next());
+			return lastFeature;
+		} catch (DataException e) {
+			RuntimeException ex = new RuntimeException();
+			e.initCause(e);
+			throw ex;
+		}
+	}
+
+	public void remove() {
+		if (!fset.store.isEditing()) {
+			throw new UnsupportedOperationException();
+		}
+		if (lastFeature == null) {
+			throw new IllegalStateException();
+		}
+		try {
+			this.fset.delete(this.lastFeature);
+		} catch (DataException e) {
+			// FIXME Cambiar excepcion a una Runtime de DAL
+			throw new RuntimeException(e);
+		}
+		lastFeature = null;
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider fData)
+			throws DataException {
+		fData.setNew(false);
+		if (this.fset.transform.isEmpty()) {
+			return new DefaultFeature(fset.store, fData);
+		} else {
+			return (DefaultFeature) this.fset.transform.applyTransform(
+					new DefaultFeature(fset.store, fData), fset
+							.getDefaultFeatureType());
+		}
+	}
+
+	protected Iterator getIterator() {
+		return this.iterator;
+	}
+
+	protected boolean isDeletedOrHasToSkip(FeatureProvider data) {
+		return false;
+	}
+
+	protected void doNext() throws DataException {
+
+	}
+
+	protected void doDispose() throws BaseException {
+		if (iterator instanceof DisposableIterator){
+			((DisposableIterator)this.iterator).dispose();
+		}
+		this.iterator = null;
+		this.fset = null;
+		this.lastFeature = null;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java	(revision 35988)
@@ -0,0 +1,123 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.gvsig.compat.CompatLocator;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder.FeatureQueryOrderMember;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+/*
+ *
+ * Compara dos Feature o FeatureProvider.
+ */
+public class FeatureProviderComparator implements Comparator {
+
+	private FeatureQueryOrder order;
+	private DefaultFeature f1;
+	private DefaultFeature f2;
+	private DefaultFeatureStore store;
+	private OrderElement[] elements = null;
+
+	private class OrderElement {
+		FeatureQueryOrderMember order = null;
+		int fieldIndex = -1;
+	}
+
+	public FeatureProviderComparator(DefaultFeatureStore store, FeatureQueryOrder order) {
+		this.order = order;
+		this.store = store;
+		this.f1 = new DefaultFeature(this.store);
+		this.f2 = new DefaultFeature(this.store);
+	}
+
+	private void initElements(FeatureType type) {
+		elements = new OrderElement[this.order.size()];
+		OrderElement cur;
+		Iterator iter = order.iterator();
+		FeatureQueryOrderMember orderItem;
+		int i = 0;
+		while (iter.hasNext()) {
+			cur = new OrderElement();
+			cur.order = (FeatureQueryOrderMember) iter.next();
+			if (!cur.order.hasEvaluator()) {
+				cur.fieldIndex = type.getIndex(cur.order.getAttributeName());
+			}
+			elements[i] = cur;
+			i++;
+		}
+
+	}
+
+	public int compare(Object arg0, Object arg1) {
+		FeatureQueryOrderMember order;
+		Comparable v1;
+		Comparable v2;
+		Object o1;
+		Object o2;
+		int v;
+		int fieldIndex;
+
+		f1.setData((FeatureProvider) arg0);
+		f2.setData((FeatureProvider) arg1);
+
+		if (elements == null){
+			initElements(f1.getType());
+		}
+
+		OrderElement element;
+
+		for (int i = 0; i < elements.length; i++) {
+			element = elements[i];
+
+			if (element.order.hasEvaluator()) {
+				Evaluator evaluator = element.order.getEvaluator();
+				try {
+					o1 = evaluator.evaluate(f1);
+					o2 = evaluator.evaluate(f2);
+				} catch (EvaluatorException e) {
+					throw new DataEvaluatorRuntimeException(e);
+				}
+			} else {
+				o1 = f1.get(element.fieldIndex);
+				o2 = f2.get(element.fieldIndex);
+			}
+			if (o1 == null) {
+				if (o2 == null) {
+					return 0;
+				} else {
+					v = 1;
+				}
+			} else {
+				if (o1 instanceof String && o2 instanceof String) {
+					v = CompatLocator.getStringUtils().compare((String) o1,
+							(String) o2, true);
+				}
+				else if (o1 instanceof Comparable && o2 instanceof Comparable) {
+					v1 = (Comparable) o1;
+					v2 = (Comparable) o2;
+					v = v1.compareTo(v2);
+				} else {
+					v = -1;
+				}
+			}
+
+			if (v != 0) {
+				if (element.order.getAscending()) {
+					return v;
+				} else {
+					return -v;
+				}
+			}
+		}
+		return 0;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java	(revision 35988)
@@ -0,0 +1,77 @@
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.exception.BaseException;
+
+public class OrderedIterator extends DefaultIterator {
+
+	protected Feature lastFeature = null;
+
+	OrderedIterator(DefaultFeatureSet featureSet, Iterator iterator, long index) {
+		super(featureSet);
+		// FIXME QUE PASA CON SIZE > Integer.MAX_VALUE ?????
+		if (featureSet.orderedData == null) {
+			List data = new ArrayList();
+			Object item;
+			while (iterator.hasNext()) {
+				item = iterator.next();
+				if (item instanceof DefaultFeature) {
+					data.add(((DefaultFeature) item).getData());
+				} else {
+					data.add(item);
+				}
+			}
+			Collections.sort(data, new FeatureProviderComparator(featureSet.store,
+					featureSet.query.getOrder()));
+			featureSet.orderedData = data;
+		}
+		if (iterator instanceof DisposableIterator) {
+			((DisposableIterator) iterator).dispose();
+		}
+		iterator = null;
+
+		if (index < Integer.MAX_VALUE) {
+			this.iterator = featureSet.orderedData.listIterator((int) index);
+		} else {
+			this.iterator = featureSet.orderedData.iterator();
+			this.skypto(index);
+		}
+	}
+
+	public OrderedIterator(DefaultFeatureSet featureSet, long index) {
+		super(featureSet);
+		if (index < Integer.MAX_VALUE) {
+			this.iterator = featureSet.orderedData.listIterator((int) index);
+		} else {
+			this.iterator = featureSet.orderedData.iterator();
+			this.skypto(index);
+		}
+	}
+
+	public void remove() {
+		super.remove();
+		this.iterator.remove();
+	}
+
+	protected DefaultFeature createFeature(FeatureProvider fData)
+			throws DataException {
+		fData.setNew(false);
+		return new DefaultFeature(fset.store, fData);
+
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		lastFeature = null;
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java	(revision 35988)
@@ -0,0 +1,122 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.featureset;
+
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+
+/**
+ * {@link DynObject} implementation to facade a Feature and allow to be used
+ * as a {@link DynObject}.
+ * 
+ * This implementation may be reused to be used with many {@link Feature}
+ * objects, but not at the same time.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class DynObjectFeatureFacade implements DynObject {
+
+    private Feature feature;
+    
+    private EditableFeature editable;
+
+    private final Object lock = new Object();
+
+    /**
+     * Empty constructor.
+     */
+    public DynObjectFeatureFacade() {
+        // Nothing to do
+    }
+
+    /**
+     * Creates a facade over a {@link Feature}.
+     */
+    public DynObjectFeatureFacade(Feature feature) {
+        setFeature(feature);
+    }
+
+    public DynClass getDynClass() {
+        return getFeature().getType();
+    }
+
+    public Object getDynValue(String name) throws DynFieldNotFoundException {
+        return getFeature().get(name);
+    }
+
+    public void setDynValue(String name, Object value)
+        throws DynFieldNotFoundException {
+        synchronized (lock) {
+            if (editable == null) {
+                editable = feature.getEditable();
+            }            
+        }
+        editable.set(name, value);
+    }
+
+    public boolean hasDynValue(String name) {
+        return getFeature().get(name) != null;
+    }
+
+    public Object invokeDynMethod(String name, DynObject context)
+        throws DynMethodException {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object invokeDynMethod(int code, DynObject context)
+        throws DynMethodException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void implement(DynClass dynClass) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void delegate(DynObject dynObject) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void clear() {
+        // Nothing to do
+    }
+    
+    public Feature getFeature() {
+        return editable == null ? feature : editable;
+    }
+    
+    public void setFeature(Feature feature) {
+        synchronized (lock) {
+            this.feature = feature.getCopy();
+            this.editable = null;
+        }
+    }
+
+    public EditableFeature getEditable() {
+        return editable;
+    }
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java	(revision 35988)
@@ -0,0 +1,309 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.dispose.DisposableIterator;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SpatialManager {
+    private static final Logger LOG = LoggerFactory.getLogger(SpatialManager.class);
+    
+    protected boolean isFullExtentDirty = true;
+	private FeatureStore featureStore;
+	private FeatureIndex featureIndex = null;
+	private Envelope originalEnvelope = null;
+	private Envelope fullEnvelope = null;
+	private ArrayList feaOperation=new ArrayList();
+	private boolean noSpatialData = false;
+
+	public SpatialManager(FeatureStore featureStore, Envelope originalEnvelope)
+			throws DataException {
+		this.featureStore=featureStore;
+		FeatureIndexes findexes=featureStore.getIndexes();
+		// Comprobamos si hay algun campo espacial a manejar
+
+		FeatureType fType = this.featureStore.getDefaultFeatureType();
+		// TODO Multy FType !!
+		if (fType.getDefaultGeometryAttributeIndex() < 0) {
+			noSpatialData = true;
+			return;
+		}
+		FeatureAttributeDescriptor attr = fType.getAttributeDescriptor(fType
+				.getDefaultGeometryAttributeIndex());
+		this.originalEnvelope = originalEnvelope;
+		if ((originalEnvelope != null) && (!originalEnvelope.isEmpty())) {
+			this.fullEnvelope = originalEnvelope.getGeometry().getEnvelope();
+		} else {
+			FeatureAttributeDescriptor geoAttr = fType.getAttributeDescriptor(fType.getDefaultGeometryAttributeIndex());
+			try {
+				this.fullEnvelope = GeometryLocator.getGeometryManager()
+						.createEnvelope(geoAttr.getGeometrySubType());
+			} catch (Exception e) {
+				// FIXME Excpetion
+				throw new RuntimeException(e);
+			}
+		}
+		if (!fType.hasOID()) {
+			return;
+		}
+
+		Iterator iterator = findexes.iterator();
+		FeatureIndex index;
+		while (iterator.hasNext()) {
+			index = (FeatureIndex) iterator.next();
+			if (index.getAttributeNames().size() == 1
+					&& index.getAttributeNames().contains(attr.getName())) {
+				featureIndex = index;
+				break;
+			}
+		}
+
+		if (featureIndex == null) {
+		    try{
+		        featureIndex = featureStore.createIndex(fType, attr.getName(),
+		        "QuadtreeJts");
+		    }catch (Exception e) {
+		        LOG.info("It can not create an index", e);
+		    }
+		}
+	}
+
+
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     * @param oldFeature DOCUMENT ME!
+     */
+    public void updateFeature(Feature feature, Feature oldFeature) {
+    	if (noSpatialData) {
+			return;
+		}
+    	if (featureIndex != null) {
+			featureIndex.delete(oldFeature);
+			feaOperation.add(new FeatureOperation(((DefaultFeature) oldFeature)
+					.getReference(), FeatureOperation.DELETE));
+			featureIndex.insert(feature);
+			feaOperation.add(new FeatureOperation(((DefaultFeature) feature)
+					.getReference(), FeatureOperation.INSERT));
+			// } else {
+			// fullEnvelope.add(feature.getDefaultEnvelope());
+		}
+        isFullExtentDirty = true;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     */
+    public void insertFeature(Feature feature) {
+    	if (noSpatialData) {
+			return;
+		}
+    	if (featureIndex != null) {
+			featureIndex.insert(feature);
+			feaOperation.add(new FeatureOperation(((DefaultFeature) feature)
+					.getReference(), FeatureOperation.INSERT));
+		} else if (!isFullExtentDirty) {
+			fullEnvelope.add(feature.getDefaultEnvelope());
+		}
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     */
+    public void deleteFeature(Feature feature) {
+    	if (noSpatialData) {
+			return;
+		}
+    	if (featureIndex != null) {
+			featureIndex.delete(feature);
+			feaOperation.add(new FeatureOperation(((DefaultFeature) feature)
+					.getReference(), FeatureOperation.DELETE));
+		}
+    	isFullExtentDirty = true;
+    }
+
+	public void clear() {
+	}
+
+	public Envelope getEnvelope() throws DataException {
+    	if (noSpatialData) {
+			return null;
+		}
+    	if (!isFullExtentDirty){
+    		return this.fullEnvelope;
+    	}
+
+		// FIXME in every changes when anyone ask for envelope it was regenerated.
+		//       if we assume that the envelope may not be the minimum in edit mode
+		//       this call must be very much faster
+
+
+		FeatureAttributeDescriptor attr = featureStore.getDefaultFeatureType()
+				.getAttributeDescriptor(
+						featureStore.getDefaultFeatureType()
+								.getDefaultGeometryAttributeIndex());
+		Envelope fullEnvelope = null;
+
+		FeatureSet set = null;
+		DisposableIterator iterator = null;
+		try {
+			set = featureStore.getFeatureSet();
+			iterator = set.fastIterator();
+			//First while to initialize the feature envelope
+			while (iterator.hasNext()) {
+                Feature feature = (Feature) iterator.next();
+                Envelope envelope = feature.getDefaultEnvelope();
+                if (envelope != null){
+                    fullEnvelope = (Envelope)envelope.clone();
+                    break;
+                }
+			}			
+			//Second while to add new evelopes tho the full envelope
+			while (iterator.hasNext()) {
+				Feature feature = (Feature) iterator.next();
+				Envelope envelope = feature.getDefaultEnvelope();			
+				if(envelope!=null){
+					fullEnvelope.add(envelope);
+				}
+			}
+			//Creating an empty envelope by default
+			if (fullEnvelope == null){
+			    fullEnvelope = GeometryLocator.getGeometryManager().createEnvelope(
+                    attr.getGeometrySubType());
+			}
+		} catch (Exception e) {
+            throw new RuntimeException(e);
+        } finally {
+			if (iterator != null) {
+				iterator.dispose();
+			}
+			if (set != null) {
+				set.dispose();
+			}
+		}
+		this.fullEnvelope = fullEnvelope;
+		this.isFullExtentDirty = false;
+		return fullEnvelope;
+	}
+
+
+
+	public void cancelModifies() {
+    	if (noSpatialData) {
+			return;
+		}
+    	if (featureIndex != null){
+			Iterator iterator=feaOperation.iterator();
+			while (iterator.hasNext()) {
+				try {
+					FeatureOperation fo = (FeatureOperation) iterator.next();
+					if (fo.getOperation()==FeatureOperation.INSERT){
+						featureIndex.delete(fo.getFeatureReference().getFeature());
+					}else if (fo.getOperation()==FeatureOperation.DELETE){
+						featureIndex.insert(fo.getFeatureReference().getFeature());
+					}
+				} catch (DataException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+    	if (originalEnvelope!=null){
+    		fullEnvelope = originalEnvelope.getGeometry().getEnvelope();
+    	} else {
+    		fullEnvelope = null;
+    	}
+		isFullExtentDirty = false;
+	}
+
+	private class FeatureOperation{
+		final static int INSERT=0;
+		final static int DELETE=1;
+		private FeatureReference ref;
+		private int operation;
+		public FeatureOperation(FeatureReference fe,int op){
+			ref=fe;
+			operation=op;
+		}
+		public FeatureReference getFeatureReference() {
+			return ref;
+		}
+		public void setFeatureReference(FeatureReference ref) {
+			this.ref = ref;
+		}
+		public int getOperation() {
+			return operation;
+		}
+		public void setOperation(int operation) {
+			this.operation = operation;
+		}
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java	(revision 35988)
@@ -0,0 +1,444 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.expansionadapter.ExpansionAdapter;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider.FeatureTypeChanged;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureTypeManager {
+	private ExpansionAdapter expansionAdapter;
+	private ArrayList deleted = new ArrayList();// <FeatureID>
+	private int deltaSize = 0;
+	private HashMap added = new HashMap();
+	private HashMap modifiedFromOriginal = new HashMap();
+	private FeatureType originalType = null;
+	private boolean first = true;
+	private FeatureTypeManagerFeatureStoreTransforms transforms;
+	private FeatureStore store;
+
+	public FeatureTypeManager(FeatureStore store,
+			ExpansionAdapter expansionAdapter) {
+		this.expansionAdapter = expansionAdapter;
+		this.store = store;
+		this.transforms = new FeatureTypeManagerFeatureStoreTransforms();
+		this.transforms.setFeatureStore(store);
+	}
+
+	public void dispose() {
+		this.expansionAdapter.close();
+		this.expansionAdapter = null;
+		this.deleted.clear();
+		this.deleted = null;
+		this.transforms.clear();
+	}
+
+	// public FeatureType delete(String id) {
+	// deleted.add(id);
+	// FeatureType type=(FeatureType)added.remove(id);
+	// if (type==null) {
+	// type=(FeatureType)modifiedFromOriginal.remove(id);
+	// }
+	// deltaSize--;
+	// return type;
+	// }
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param feature
+	 *            DOCUMENT ME!
+	 */
+	// public void add(FeatureType type) {
+	// int pos = expansionAdapter.addObject(type);
+	// added.put(type.getId(),new Integer(pos));
+	// deltaSize++;
+	// }
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param id
+	 *            DOCUMENT ME!
+	 */
+	// public void deleteLastFeatureType() {
+	// expansionAdapter.deleteLastObject();
+	// FeatureType
+	// type=(FeatureType)expansionAdapter.getObject(expansionAdapter.getSize()-1);
+	// added.remove(type.getId());
+	// modifiedFromOriginal.remove(type.getId());
+	// deltaSize--;
+	// }
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param id
+	 *            DOCUMENT ME!
+	 *
+	 * @return DOCUMENT ME!
+	 * @throws IsNotFeatureSettingException
+	 */
+	public FeatureType getType(String id) throws DataException {
+		Integer intNum = ((Integer) added.get(id));
+		if (intNum == null) {
+			intNum = ((Integer) modifiedFromOriginal.get(id));
+			if (intNum == null) {
+				return null;
+			}
+		}
+		int num = intNum.intValue();
+
+		FeatureType type = (FeatureType) expansionAdapter.getObject(num);
+		return type;
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param feature
+	 *            DOCUMENT ME!
+	 * @param oldFeature
+	 *            DOCUMENT ME!
+	 * @throws DataException
+	 */
+	public int update(FeatureType type, FeatureType oldType) {
+		// deleted.add(oldType.getId());
+		if (first) {
+			originalType = oldType;
+			first = false;
+		}
+		int oldNum = -1;
+		int num = expansionAdapter.addObject(type);
+		String id = type.getId();
+
+		if (added.containsKey(id)) {
+			oldNum = ((Integer) added.get(id)).intValue();
+			added.put(id, new Integer(num));
+		} else {
+			if (modifiedFromOriginal.get(id) != null) {
+				oldNum = ((Integer) modifiedFromOriginal.get(id)).intValue();
+			}
+			modifiedFromOriginal.put(id, new Integer(num));
+		}
+
+		try {
+			this.transforms.add(new UpdateFeatureTypeTransform(this.store,
+					type, oldType));
+		} catch (DataException e) {
+			throw new RuntimeException(); // FIXME (pero esto no deberia de
+											// pasar nunca)
+		}
+		return oldNum;
+	}
+
+	private class UpdateFeatureTypeTransform implements FeatureStoreTransform {
+		private FeatureType ftSource;
+		private FeatureType ftTarget;
+		private WeakReference wkRefStore;
+		private List ftypes = null;
+		private List attrToUse;
+
+		UpdateFeatureTypeTransform(FeatureStore featureStore,
+				FeatureType ftSource, FeatureType ftTarget) {
+			this.ftSource = ftSource;
+			this.ftTarget = ftTarget;
+			this.wkRefStore = new WeakReference(featureStore);
+			this.initializeAttributesToUse();
+		}
+
+		public String getDescription() {
+		//TODO
+		    return "";
+		}
+		
+		public String getName() {
+		//TODO
+		    return "";
+		}
+		
+		private void initializeAttributesToUse() {
+			attrToUse = new ArrayList(ftTarget.size());
+			Iterator iter = ftTarget.iterator();
+			FeatureAttributeDescriptor tAttr, sAttr;
+			while (iter.hasNext()) {
+				tAttr = (FeatureAttributeDescriptor) iter.next();
+				sAttr = this.ftSource.getAttributeDescriptor(tAttr.getName());
+				if (sAttr == null) {
+					continue;
+				}
+				if (tAttr.getDataType() != sAttr.getDataType()) {
+					continue;
+				}
+				attrToUse.add(tAttr.getName());
+
+			}
+
+		}
+
+		public void applyTransform(Feature source, EditableFeature target)
+				throws DataException {
+			Iterator iter = target.getType().iterator();
+			FeatureAttributeDescriptor tAttr;
+			String name;
+			while (iter.hasNext()) {
+				tAttr = (FeatureAttributeDescriptor) iter.next();
+				name = tAttr.getName();
+				if (this.attrToUse.contains(name)) {
+					target.set(name, source.get(name));
+				} else {
+					target.set(name, tAttr.getDefaultValue());
+				}
+			}
+		}
+
+		public FeatureType getDefaultFeatureType() throws DataException {
+			return this.ftTarget;
+		}
+
+		public FeatureStore getFeatureStore() {
+			return (FeatureStore) this.wkRefStore.get();
+		}
+
+		public List getFeatureTypes() throws DataException {
+			if (this.ftypes == null) {
+				this.ftypes = Arrays
+						.asList(new FeatureType[] { this.ftTarget });
+			}
+			return this.ftypes;
+		}
+
+		public FeatureType getSourceFeatureTypeFrom(
+				FeatureType targetFeatureType) {
+			EditableFeatureType orgType = ftSource.getEditable();
+			Iterator iter = orgType.iterator();
+			FeatureAttributeDescriptor attr;
+
+			while (iter.hasNext()) {
+				attr = (FeatureAttributeDescriptor) iter.next();
+				if (!attrToUse.contains(attr.getName())) {
+					iter.remove();
+				}
+			}
+
+			return orgType.getNotEditableCopy();
+		}
+
+		public void setFeatureStore(FeatureStore featureStore) {
+			this.wkRefStore = new WeakReference(featureStore);
+		}
+
+		public PersistentState getState() throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public void saveToState(PersistentState state)
+				throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public void loadFromState(PersistentState state) throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public boolean isTransformsOriginalValues() {
+			return false;
+		}
+
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param id
+	 *            DOCUMENT ME!
+	 */
+	public void restore(String id) {
+		deleted.remove(id);
+		deltaSize++;
+	}
+
+	public void restore(String id, int num) {
+		if (added.containsKey(id)) {
+			added.put(id, new Integer(num));
+		} else {
+			modifiedFromOriginal.put(id, new Integer(num));
+		}
+	}
+
+	public boolean isDeleted(FeatureType type) {
+		return deleted.contains(type.getId());
+	}
+
+	public boolean isDeleted(String id) {
+		return deleted.contains(id);
+	}
+
+	public void clear() {
+		added.clear();
+		modifiedFromOriginal.clear();
+		expansionAdapter.close();
+		deleted.clear();// <FeatureID>
+		deltaSize = 0;
+	}
+
+	public boolean hasChanges() {
+		return added.size() > 0 || modifiedFromOriginal.size() > 0
+				|| deleted.size() > 0;
+	}
+
+	public Iterator newsIterator() {
+		return added.values().iterator();
+	}
+
+	public boolean hasNews() {
+		return !added.isEmpty();
+	}
+
+	public long getDeltaSize() {
+		return deltaSize;
+	}
+
+	public FeatureType getOriginalFeatureType() {
+		return originalType;
+	}
+
+	public DefaultFeatureStoreTransforms getTransforms() {
+		return this.transforms;
+	}
+
+	public class FeatureTypeManagerFeatureStoreTransforms extends
+			DefaultFeatureStoreTransforms {
+
+		private FeatureTypeManagerFeatureStoreTransforms() {
+
+		}
+
+		protected void checkEditingMode() {
+			return;
+		}
+
+		protected void notifyChangeToStore() {
+			return;
+		}
+
+		public PersistentState getState() throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public void loadState(PersistentState state)
+				throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public void loadFromState(PersistentState state) throws PersistenceException {
+			// FIXME
+			throw new UnsupportedOperationException();
+		}
+
+		public FeatureStoreTransform add(FeatureStoreTransform transform)
+				throws DataException {
+			if (!(transform instanceof UpdateFeatureTypeTransform)) {
+				// FIXME
+				throw new IllegalArgumentException();
+			}
+			return super.add(transform);
+		}
+
+	}
+
+	public class FeatureTypesChangedItem implements FeatureTypeChanged {
+
+		private FeatureType source;
+		private FeatureType target;
+
+		public FeatureTypesChangedItem(FeatureType source, FeatureType target) {
+			this.source = source;
+			this.target = target;
+		}
+
+		public FeatureType getSource() {
+			return source;
+		}
+
+		public FeatureType getTarget() {
+			return target;
+		}
+
+	}
+
+	public Iterator getFeatureTypesChanged() throws DataException {
+		// FIXME this don't work for Store.fType.size() > 1
+		List list = new ArrayList();
+		if (modifiedFromOriginal.size() > 0) {
+			FeatureType src = this.getOriginalFeatureType();
+			list.add(new FeatureTypesChangedItem(src, this.store
+					.getFeatureType(src.getId())));
+		}
+		return list.iterator();
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java	(revision 35988)
@@ -0,0 +1,83 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class DefaultFeatureComparator implements Comparator {
+
+	private FeatureQueryOrder order;
+
+
+	public DefaultFeatureComparator(FeatureQueryOrder order) {
+		this.order = order;
+		// TODO optimizar en un array???
+
+	}
+
+
+	private int myCompare(Object arg0, Object arg1) {
+		if (arg0 == null){
+			if (arg1 == null){
+				return 0;
+			} else{
+				return 1;
+			}
+		} else if (arg1 == null){
+			if (arg0 == null) {
+				return 0;
+			} else {
+				return 1;
+			}
+		}
+		if (arg0 instanceof Comparable) {
+			return ((Comparable) arg0).compareTo(arg1);
+		} else if (arg1 instanceof Comparable) {
+			return ((Comparable) arg1).compareTo(arg0) * -1;
+		}
+
+		if (arg0.equals(arg1)){
+			return 0;
+		} else{
+			return -1;
+		}
+
+	}
+
+	public int compare(Object arg0, Object arg1) {
+		Iterator iter = this.order.iterator();
+		int returnValue = 0;
+		Feature f0 = (Feature) arg0;
+		Feature f1 = (Feature) arg1;
+		Object item;
+		String attrName;
+		Evaluator evaluator;
+		while (returnValue == 0 && iter.hasNext()) {
+			item = iter.next();
+			if (item instanceof String) {
+				attrName = (String) item;
+				returnValue = this
+						.myCompare(f0.get(attrName), f1
+						.get(attrName));
+			} else {
+				evaluator = (Evaluator) item;
+				try {
+					returnValue = this.myCompare(evaluator
+							.evaluate((EvaluatorData) f0), evaluator
+							.evaluate((EvaluatorData) f1));
+				} catch (EvaluatorException e) {
+					throw new DataEvaluatorRuntimeException(e);
+				}
+			}
+		}
+
+		return returnValue;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java	(revision 35988)
@@ -0,0 +1,253 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.spi.DefaultLongList;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProvider;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dispose.DisposeUtils;
+
+/**
+ * Default feature index provider services.
+ *
+ * @author jyarza
+ *
+ */
+public class DefaultFeatureIndex implements FeatureIndexProviderServices {
+
+	private final FeatureStoreProviderServices featureStore;
+	private final FeatureType featureType;
+	private final String attributeName;
+	private final String indexName;
+	private final int dataType;
+	private final FeatureIndexProvider indexProvider;
+	private List attributeNames;
+
+	public DefaultFeatureIndex(FeatureStoreProviderServices featureStore, FeatureType featureType, FeatureIndexProvider indexProvider, String attributeName, String indexName) {
+		if (featureStore == null) {
+			throw new IllegalArgumentException("featureStore cannot be null.");
+		}
+		if (featureType == null) {
+			throw new IllegalArgumentException("featureType cannot be null.");
+		}
+		if (attributeName == null) {
+			throw new IllegalArgumentException("attributeName cannot be null.");
+		}
+		if (indexName == null) {
+			throw new IllegalArgumentException("indexName cannot be null.");
+		}
+
+		// FIXME Esto debe ir al provider
+		if (featureStore.getProvider().getOIDType() != DataTypes.INT &&
+				featureStore.getProvider().getOIDType() != DataTypes.LONG) {
+			throw new IllegalArgumentException();
+		}
+
+		FeatureAttributeDescriptor attr = featureType.getAttributeDescriptor(attributeName);
+		if (attr == null) {
+			throw new IllegalArgumentException("Attribute " + attributeName +" not found in FeatureType " + featureType.toString());
+		}
+
+		this.featureStore = featureStore;
+		this.featureType = featureType;
+		this.attributeName = attributeName;
+		this.indexName = indexName;
+		this.dataType = attr.getType();
+		this.indexProvider = indexProvider;
+
+		attributeNames = new ArrayList();
+		attributeNames.add(attributeName);
+	}
+
+	public final FeatureAttributeDescriptor getFeatureAttributeDescriptor() {
+		return featureType.getAttributeDescriptor(attributeName);
+	}
+
+	public final FeatureStoreProviderServices getFeatureStoreProviderServices() {
+		return featureStore;
+	}
+
+	public final FeatureType getFeatureType() {
+		return featureType;
+	}
+
+	public final String getName() {
+		return indexName;
+	}
+
+	public final String getAttributeName() {
+		return attributeName;
+	}
+
+	public final int getDataType() {
+		return dataType;
+	}
+
+	/**
+	 * Fills this index with all the data in its FeatureStore
+	 */
+	public final void fill() throws FeatureIndexException {
+		FeatureSet set = null;
+		try {
+			set =
+					getFeatureStoreProviderServices().getFeatureStore()
+							.getFeatureSet();
+			insert(set);
+		} catch (DataException e) {
+			throw new FeatureIndexException(e);
+		} finally {
+			DisposeUtils.dispose(set);
+		}
+	}
+
+	public final void insert(FeatureSet data) throws DataException {
+		DisposableIterator it = null;
+
+		try {
+			it = data.iterator();
+			while (it.hasNext()) {
+				Feature feat = (Feature) it.next();
+				insert(feat);
+			}
+		} finally {
+			DisposeUtils.dispose(it);
+		}
+	}
+
+	public void insert(Feature feat) {
+		try {
+			indexProvider.insert(feat.get(attributeName),
+					(FeatureReferenceProviderServices) feat.getReference());
+		} catch (NullPointerException e) {
+			throw new IllegalArgumentException("Feature does not contain a column with name " + attributeName);
+		} catch (ClassCastException e) {
+			throw new IllegalArgumentException("Attribute data type is not valid.");
+		}
+	}
+
+	public FeatureSet getMatchFeatureSet(Object value)
+			throws FeatureIndexException {
+		return new IndexFeatureSet(this, new DefaultLongList(indexProvider
+				.match(value)));
+	}
+
+	public FeatureSet getRangeFeatureSet(Object value1, Object value2)
+			throws FeatureIndexException {
+		return new IndexFeatureSet(this, new DefaultLongList(indexProvider
+				.range(value1, value2)));
+	}
+
+	public FeatureSet getNearestFeatureSet(int count, Object value)
+			throws FeatureIndexException {
+		return new IndexFeatureSet(this, new DefaultLongList(indexProvider
+				.nearest(count, value)));
+	}
+
+	public FeatureSet getNearestFeatureSet(int count, Object value,
+			Object tolerance) throws FeatureIndexException {
+		return new IndexFeatureSet(this, new DefaultLongList(indexProvider
+				.nearest(count, value, tolerance)));
+	}
+
+	public void initialize() throws InitializeException {
+		indexProvider.setFeatureIndexProviderServices(this);
+		indexProvider.initialize();
+	}
+
+	public void delete(Object value, FeatureReference fref) {
+		indexProvider.delete(value, (FeatureReferenceProviderServices) fref);
+	}
+
+	public void delete(Feature feat) {
+		indexProvider.delete(feat.get(this.attributeName),
+				(FeatureReferenceProviderServices) feat.getReference());
+	}
+
+	public void delete(FeatureSet data) throws FeatureIndexException {
+		DisposableIterator it = null;
+		try {
+			it = data.iterator();
+			while (it.hasNext()) {
+				Feature feat = (Feature) it.next();
+				delete(feat);
+			}
+		} catch (DataException e) {
+			throw new FeatureIndexException(e);
+		} finally {
+			DisposeUtils.dispose(it);
+		}
+	}
+
+	public List getAttributeNames() {
+		return attributeNames;
+	}
+
+	public String getNewFileName(String prefix, String sufix) {
+		int n=0;
+		File file = new File(prefix + getName(), sufix);
+		while (file.exists()) {
+			n++;
+			file = new File(prefix + getName() + n, sufix);
+		}
+		return file.getAbsolutePath();
+	}
+
+	public String getFileName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getTemporaryFileName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndexProvider getFeatureIndexProvider() {
+		return this.indexProvider;
+	}
+
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java	(revision 35988)
@@ -0,0 +1,234 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.timesupport.Instant;
+import org.gvsig.timesupport.Interval;
+
+public class DefaultEditableFeature extends DefaultFeature implements
+EditableFeature {
+	private DefaultFeature source;
+
+	protected DefaultEditableFeature(DefaultFeature feature) {
+		super(feature);
+		this.source = feature;
+	}
+
+	protected DefaultEditableFeature(DefaultEditableFeature feature) {
+		super(feature);
+		this.source = (DefaultFeature) feature.getSource();
+	}
+
+	public DefaultEditableFeature(DefaultFeatureStore store, FeatureProvider data) {
+		// Se trata de un editable feature sobre una ya existente
+		super(store, data);
+		this.source = null;
+	}
+
+	public Feature getSource() {
+		return this.source;
+	}
+
+	public EditableFeature getEditable() {
+		return this;
+	}
+
+	public Feature getCopy() {
+		return new DefaultEditableFeature(this);
+	}
+
+
+	public Feature getNotEditableCopy() {
+		return new DefaultFeature(this);
+	}
+
+	public void setDefaultGeometry(Geometry geometry) {
+		FeatureAttributeDescriptor attribute = this.getType()
+				.getAttributeDescriptor(
+						this.getType().getDefaultGeometryAttributeIndex());
+		this.set(attribute, geometry);
+	}
+
+	public void set(String name, Object value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void set(int index, Object value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void setArray(String name, Object[] value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+				.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void setArray(int index, Object[] value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+				.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void setBoolean(String name, boolean value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, Boolean.valueOf(value));
+	}
+
+	public void setBoolean(int index, boolean value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, Boolean.valueOf(value));
+	}
+
+	public void setByte(String name, byte value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, new Byte(value));
+	}
+
+	public void setByte(int index, byte value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, new Byte(value));
+	}
+
+	public void setDate(String name, Date value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void setDate(int index, Date value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void setDouble(String name, double value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, new Double(value));
+	}
+
+	public void setDouble(int index, double value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, new Double(value));
+	}
+
+	public void setFeature(String name, Feature value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void setFeature(int index, Feature value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void setFloat(String name, float value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, new Float(value));
+	}
+
+	public void setFloat(int index, float value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, new Float(value));
+	}
+
+	public void setGeometry(String name, Geometry value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void setGeometry(int index, Geometry value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void setInt(String name, int value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, new Integer(value));
+	}
+
+	public void setInt(int index, int value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, new Integer(value));
+	}
+
+	public void setLong(String name, long value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, new Long(value));
+	}
+
+	public void setLong(int index, long value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, new Long(value));
+	}
+
+	public void setString(String name, String value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);
+	}
+
+	public void setString(int index, String value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);
+	}
+
+	public void copyFrom(Feature source) {
+		// iterate over the attributes and copy one by one
+		Iterator it = this.getType().iterator();
+		while( it.hasNext() ) {
+			FeatureAttributeDescriptor attr = (FeatureAttributeDescriptor) it.next();
+			set(attr.getIndex(), source.get(attr.getIndex()));
+		}
+	}
+
+	public void setInstant(String name, Instant value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);		
+	}
+
+	public void setInstant(int index, Instant value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);			
+	}
+
+	public void setInterval(String name, Interval value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(name);
+		this.set(attribute, value);			
+	}
+
+	public void setInterval(int index, Interval value) {
+		FeatureAttributeDescriptor attribute = this.getType()
+		.getAttributeDescriptor(index);
+		this.set(attribute, value);		
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java	(revision 35988)
@@ -0,0 +1,294 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+public class DefaultFeatureStoreTransforms implements FeatureStoreTransforms,
+		Persistent {
+
+	private DefaultFeatureStore store;
+	private List transforms;
+	private Boolean isTramsformValues;
+	private TransformTemporalList lastTransformStack;
+
+	public DefaultFeatureStoreTransforms() {
+		this.store = null;
+		this.transforms = new ArrayList();
+		this.isTramsformValues = Boolean.FALSE;
+	}
+
+	public DefaultFeatureStoreTransforms(DefaultFeatureStore store) {
+		this.store = store;
+		this.transforms = new ArrayList();
+	}
+
+	protected void checkEditingMode() {
+		if (store == null || store.getMode() != FeatureStore.MODE_QUERY) {
+			throw new IllegalStateException();
+		}
+	}
+
+	protected void notifyChangeToStore() {
+		this.store.notifyChange(FeatureStoreNotification.TRANSFORM_CHANGE);
+	}
+
+	public FeatureStoreTransform add(FeatureStoreTransform transform)
+			throws DataException {
+		checkEditingMode();
+		if( ! transform.getFeatureTypes().contains(transform.getDefaultFeatureType())) {
+			throw new IllegalArgumentException(); // FIXME: A�adir tipo especifico.
+		}
+		this.transforms.add(transform);
+		this.notifyChangeToStore();
+		if (this.isTramsformValues == null
+				|| (!this.isTramsformValues.booleanValue())) {
+			if (transform.isTransformsOriginalValues()) {
+				this.isTramsformValues = Boolean.TRUE;
+			}
+
+		}
+
+		return transform;
+	}
+
+
+	public void clear() {
+		checkEditingMode();
+		this.transforms.clear();
+		this.notifyChangeToStore();
+		this.isTramsformValues = Boolean.FALSE;
+	}
+
+	public FeatureStoreTransform getTransform(int index) {
+		return (FeatureStoreTransform) this.transforms.get(index);
+	}
+
+	public Iterator iterator() {
+		return Collections.unmodifiableList(transforms).iterator();
+	}
+
+	public Object remove(int index) {
+		checkEditingMode();
+		Object trans = this.transforms.remove(index);
+		this.notifyChangeToStore();
+		this.isTramsformValues = null;
+		return trans;
+	}
+
+	public boolean remove(FeatureStoreTransform transform) {
+		checkEditingMode();
+		boolean removed = this.transforms.remove(transform);
+		if (removed) {
+			this.notifyChangeToStore();
+
+		}
+		this.isTramsformValues = null;
+		return removed;
+
+	}
+
+	public int size() {
+		return this.transforms.size();
+	}
+
+	public boolean isEmpty() {
+		return this.transforms.isEmpty();
+	}
+
+	private class TransformTemporalListElement {
+		public FeatureStoreTransform transform = null;
+		public FeatureType targetFeatureType = null;
+	}
+
+	private class TransformTemporalList extends ArrayList {
+		private FeatureType targetFType;
+
+		public boolean add(Object arg0) {
+			if (this.isEmpty()) {
+				targetFType = ((TransformTemporalListElement) arg0).targetFeatureType;
+			}
+			return super.add(arg0);
+		}
+
+	}
+
+	protected TransformTemporalList getTransformTemporalList(
+			FeatureType targetFeatureType) {
+		if (this.lastTransformStack == null
+				|| this.lastTransformStack.size() != this.transforms.size()
+				|| !(this.lastTransformStack.targetFType
+						.equals(targetFeatureType))) {
+			TransformTemporalList result = new TransformTemporalList();
+			TransformTemporalListElement item;
+			FeatureType nextFType = targetFeatureType;
+
+			for (int i = transforms.size() - 1; i > -1; i--) {
+				item = new TransformTemporalListElement();
+				item.transform = (FeatureStoreTransform) transforms.get(i);
+				item.targetFeatureType = nextFType;
+				nextFType = item.transform
+						.getSourceFeatureTypeFrom(item.targetFeatureType);
+				result.add(item);
+			}
+			this.lastTransformStack = result;
+		}
+		return this.lastTransformStack;
+	}
+
+	public Feature applyTransform(DefaultFeature source,
+			FeatureType targetFeatureType)
+			throws DataException {
+		if (this.transforms.isEmpty()) {
+			return source;
+		}
+
+		TransformTemporalList stack = this
+				.getTransformTemporalList(targetFeatureType);
+		TransformTemporalListElement item;
+		FeatureProvider targetData;
+		EditableFeature target;
+		ListIterator iterator = stack.listIterator(stack.size());
+
+
+		while (iterator.hasPrevious()) {
+			item = (TransformTemporalListElement) iterator.previous();
+			targetData = this.store
+					.createDefaultFeatureProvider(item.targetFeatureType);
+			targetData.setOID(source.getData().getOID());
+			targetData.setNew(false);
+			target = (new DefaultEditableFeature(this.store, targetData))
+					.getEditable();
+			item.transform.applyTransform(source, target);
+ 			source = (DefaultFeature) target.getNotEditableCopy();
+		}
+
+		return source;
+
+	}
+
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		FeatureType tmpFType = targetFeatureType;
+
+		for (int i = transforms.size() - 1; i > -1; i--) {
+			FeatureStoreTransform transform = (FeatureStoreTransform) transforms
+					.get(i);
+			tmpFType = transform.getSourceFeatureTypeFrom(tmpFType);
+		}
+		return tmpFType;
+	}
+
+	public FeatureType getDefaultFeatureType() throws DataException {
+		if (this.transforms.isEmpty()) {
+			return null;
+		}
+		FeatureStoreTransform transform = (FeatureStoreTransform) this.transforms
+				.get(this.transforms.size() - 1);
+		return transform.getDefaultFeatureType();
+	}
+
+	public List getFeatureTypes() throws DataException {
+		if (this.transforms.isEmpty()) {
+			return null;
+		}
+		FeatureStoreTransform transform = (FeatureStoreTransform) this.transforms
+				.get(this.transforms.size() - 1);
+		return transform.getFeatureTypes();
+	}
+
+	public FeatureStore getFeatureStore() {
+		return this.store;
+	}
+
+	public void setFeatureStore(FeatureStore featureStore) {
+		if (this.store != null) {
+			throw new IllegalStateException();// FIXME: A�adir tipo especifico.
+		}
+		this.store = (DefaultFeatureStore) featureStore;
+	}
+
+	public boolean isTransformsOriginalValues() {
+		if (this.isTramsformValues == null) {
+			Iterator iter = this.transforms.iterator();
+			FeatureStoreTransform transform;
+			this.isTramsformValues = Boolean.FALSE;
+			while (iter.hasNext()) {
+				transform = (FeatureStoreTransform) iter.next();
+				if (transform.isTransformsOriginalValues()){
+					this.isTramsformValues = Boolean.TRUE;
+					break;
+				}
+			}
+		}
+		return this.isTramsformValues.booleanValue();
+	}
+
+	public FeatureType getFeatureType(String featureTypeId)
+			throws DataException {
+		if (this.transforms.isEmpty()) {
+			return null;
+		}
+		if (featureTypeId == null) {
+			return this.getDefaultFeatureType();
+		}
+		Iterator iter = this.getFeatureTypes().iterator();
+		FeatureType fType;
+		while (iter.hasNext()) {
+			fType = (FeatureType) iter.next();
+			if (fType.getId().equals(featureTypeId)) {
+				return fType;
+			}
+		}
+		return null;
+	}
+
+
+
+	// *** Persistence ***
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("store", store);
+		state.set("isTramsformValues", this.isTramsformValues);
+		state.set("transforms", this.transforms);
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		this.isTramsformValues = (Boolean) state.get("isTramsformValues");
+		this.transforms = (List) state.get("transforms");
+		this.store = (DefaultFeatureStore) state.get("store");
+	}
+
+	public static void registerPersistent() {
+		DynStruct definition = ToolsLocator.getPersistenceManager().addDefinition(
+				DefaultFeatureStoreTransforms.class, 
+				"DefaultFeatureStoreTransforms", 
+				"DefaultFeatureStoreTransforms Persistent definition",
+				null, 
+				null
+			);
+
+		definition.addDynFieldBoolean("isTramsformValues").setMandatory(false);
+		definition.addDynFieldList("transforms").setClassOfItems(FeatureStoreTransform.class).setMandatory(true);
+		definition.addDynFieldObject("store").setClassOfValue(FeatureStore.class).setMandatory(true);
+
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java	(revision 35988)
@@ -0,0 +1,319 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.text.MessageFormat;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataListException;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.FeatureTypeIntegrityException;
+import org.gvsig.fmap.dal.feature.exception.UnsupportedDataTypeException;
+import org.gvsig.tools.evaluator.Evaluator;
+
+public class DefaultEditableFeatureType extends DefaultFeatureType implements
+		EditableFeatureType {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -713976880396024389L;
+
+	private boolean hasStrongChanges;
+	private DefaultFeatureType source;
+
+	public DefaultEditableFeatureType() {
+		super();
+		this.hasStrongChanges = false;
+		this.source = null;
+	}
+
+	public DefaultEditableFeatureType(String id) {
+		super(id);
+		this.hasStrongChanges = false;
+		this.source = null;
+	}
+
+	protected DefaultEditableFeatureType(DefaultEditableFeatureType other) {
+		super(other);
+		this.source = (DefaultFeatureType) other.getSource();
+	}
+
+	protected DefaultEditableFeatureType(DefaultFeatureType other) {
+		super(other);
+		this.source = other;
+	}
+
+	protected void intitalizeAddAttibute(DefaultFeatureAttributeDescriptor attr) {
+		super.add(new DefaultEditableFeatureAttributeDescriptor(attr));
+	}
+
+
+	public boolean hasStrongChanges() {
+		if (hasStrongChanges) {
+			return true;
+		}
+		Iterator iter = this.iterator();
+		DefaultEditableFeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			attr = (DefaultEditableFeatureAttributeDescriptor) iter.next();
+			if (attr.hasStrongChanges()) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public FeatureType getCopy() {
+		return new DefaultEditableFeatureType(this);
+	}
+
+	public EditableFeatureType getEditable() {
+		throw new UnsupportedOperationException();
+	}
+
+	public boolean addAll(DefaultFeatureType other) {
+		Iterator iter = other.iterator();
+		DefaultFeatureAttributeDescriptor attr;
+		DefaultEditableFeatureAttributeDescriptor editableAttr;
+		while (iter.hasNext()) {
+			attr = (DefaultFeatureAttributeDescriptor) iter.next();
+			if (attr instanceof DefaultEditableFeatureAttributeDescriptor) {
+				editableAttr = new DefaultEditableFeatureAttributeDescriptor(
+						attr);
+			} else {
+				editableAttr = new DefaultEditableFeatureAttributeDescriptor(
+						attr);
+			}
+			super.add(editableAttr);
+		}
+		this.pk = null;
+		this.fixAll();
+		return true;
+	}
+
+	public EditableFeatureAttributeDescriptor addLike(
+			FeatureAttributeDescriptor other) {
+		DefaultEditableFeatureAttributeDescriptor editableAttr;
+		if (other instanceof DefaultEditableFeatureAttributeDescriptor) {
+			editableAttr = new DefaultEditableFeatureAttributeDescriptor(
+					(DefaultFeatureAttributeDescriptor) other);
+		} else {
+			editableAttr = new DefaultEditableFeatureAttributeDescriptor(
+					(DefaultFeatureAttributeDescriptor) other);
+		}
+		super.add(editableAttr);
+		this.fixAll();
+		return editableAttr;
+
+	}
+
+	public FeatureType getSource() {
+		return source;
+	}
+
+	public FeatureType getNotEditableCopy() {
+		DefaultFeatureType copy = new DefaultFeatureType(this, false);
+		Iterator iter = this.iterator();
+		DefaultFeatureAttributeDescriptor attr;
+		while (iter.hasNext()) {
+			attr = (DefaultFeatureAttributeDescriptor) iter.next();
+			copy.add(new DefaultFeatureAttributeDescriptor(attr));
+		}
+		return copy;
+	}
+
+	public EditableFeatureAttributeDescriptor add(String name, int type) {
+	    return this.add(name,type,true);
+	}
+	
+    private EditableFeatureAttributeDescriptor add(String name, int type, boolean updateHasStrongChanges) {
+		DefaultEditableFeatureAttributeDescriptor attr = new DefaultEditableFeatureAttributeDescriptor();
+		Iterator iter = this.iterator();
+		while (iter.hasNext()) {
+			EditableFeatureAttributeDescriptor descriptor = (EditableFeatureAttributeDescriptor) iter.next();
+			if(descriptor.getName().equals(name)){
+				throw new RuntimeException(
+						MessageFormat.format("Name descriptor {0} duplicated.",new String[]{name})
+						);
+			}
+			
+		}
+		attr.setName(name);
+		switch (type) {
+		case DataTypes.BOOLEAN:
+		case DataTypes.BYTE:
+		case DataTypes.BYTEARRAY:
+		case DataTypes.CHAR:
+		case DataTypes.DATE:
+		case DataTypes.DOUBLE:
+		case DataTypes.FLOAT:
+		case DataTypes.GEOMETRY:
+		case DataTypes.INT:
+		case DataTypes.LONG:
+		case DataTypes.OBJECT:
+		case DataTypes.STRING:
+		case DataTypes.TIME:
+		case DataTypes.TIMESTAMP:
+			break;
+
+		default:
+			throw new UnsupportedDataTypeException(name, type);
+		}
+		attr.setDataType(type);
+		attr.setIndex(this.size());
+		super.add(attr);
+		if (!hasStrongChanges && updateHasStrongChanges){
+		    hasStrongChanges = true;
+		}
+		this.pk = null;
+		return attr;
+	}
+
+	public EditableFeatureAttributeDescriptor add(String name, int type,
+			int size) {
+		return this.add(name, type,true).setSize(size);
+	}
+
+	public EditableFeatureAttributeDescriptor add(String name, int type,
+			Evaluator evaluator) {
+	    if (evaluator == null){
+	        throw new IllegalArgumentException();
+	    }
+		return this.add(name, type, false).setEvaluator(evaluator);
+	}
+
+	public Object remove(String name) {
+		DefaultFeatureAttributeDescriptor attr = (DefaultFeatureAttributeDescriptor) this
+				.get(name);
+		if (attr == null) {
+			return null;
+		}
+		if (attr.getEvaluator() == null) {
+			hasStrongChanges = true;
+		}
+		super.remove(attr);
+		this.pk = null;
+		this.fixAll();
+		return attr;
+	}
+
+	protected void fixAll() {
+		int i = 0;
+		Iterator iter = super.iterator();
+		DefaultFeatureAttributeDescriptor attr;
+
+		while (iter.hasNext()) {
+			attr = (DefaultFeatureAttributeDescriptor) iter
+					.next();
+			attr.setIndex(i++);
+			if (attr instanceof DefaultEditableFeatureAttributeDescriptor) {
+				((DefaultEditableFeatureAttributeDescriptor) attr).fixAll();
+			}
+		}
+		if (this.defaultGeometryAttributeName == null) {
+			return;
+		}
+		this.defaultGeometryAttributeIndex = this
+				.getIndex(this.defaultGeometryAttributeName);
+	}
+
+	public void checkIntegrity() throws DataListException {
+		Iterator iter = super.iterator();
+		FeatureTypeIntegrityException ex = null;
+
+		while (iter.hasNext()) {
+			DefaultEditableFeatureAttributeDescriptor attr = (DefaultEditableFeatureAttributeDescriptor) iter
+					.next();
+			try {
+				attr.checkIntegrity();
+			} catch (Exception e) {
+				if (ex == null) {
+					ex = new FeatureTypeIntegrityException(this.getId());
+				}
+				ex.add(e);
+			}
+		}
+		if (ex != null) {
+			throw ex;
+		}
+	}
+
+	public boolean remove(EditableFeatureAttributeDescriptor attribute) {
+		if (attribute.getEvaluator() != null) {
+			hasStrongChanges = true;
+		}
+		if (!super.remove(attribute)) {
+			return false;
+		}
+		this.fixAll();
+		return true;
+	}
+
+	public void setDefaultGeometryAttributeName(String name) {
+		if (name == null || name.length() == 0) {
+			this.defaultGeometryAttributeName = null;
+			this.defaultGeometryAttributeIndex = -1;
+			return;
+		}
+		DefaultFeatureAttributeDescriptor attr = (DefaultFeatureAttributeDescriptor) this
+				.get(name);
+		if (attr == null) {
+			throw new IllegalArgumentException("Attribute '" + name
+					+ "' not found.");
+		}
+		if (attr.getType() != DataTypes.GEOMETRY) {
+			throw new IllegalArgumentException("Attribute '" + name
+					+ "' is not a geometry.");
+		}
+		this.defaultGeometryAttributeName = name;
+		this.defaultGeometryAttributeIndex = attr.getIndex();
+	}
+
+	public void setHasOID(boolean hasOID) {
+		this.hasOID = hasOID;
+	}
+
+	protected Iterator getIterator(Iterator iter) {
+		return new EditableDelegatedIterator(iter, this);
+	}
+
+	protected class EditableDelegatedIterator extends DelegatedIterator {
+
+		private DefaultEditableFeatureType fType;
+
+		public EditableDelegatedIterator(Iterator iter,
+				DefaultEditableFeatureType fType) {
+			super(iter);
+			this.fType = fType;
+		}
+
+		public void remove() {
+			this.iterator.remove();
+			this.fType.fixAll();
+		}
+
+	}
+
+	protected void setAllowAutomaticValues(boolean value) {
+		this.allowAtomaticValues = value;
+	}
+
+    public void setDefaultTimeAttributeName(String name) {
+        if (name == null || name.length() == 0) {
+            this.defaultTimeAttributeIndex = -1;
+            return;
+        }
+        DefaultFeatureAttributeDescriptor attr = (DefaultFeatureAttributeDescriptor) this
+                .get(name);
+        if (attr == null) {
+            throw new IllegalArgumentException("Attribute '" + name
+                    + "' not found.");
+        }
+
+        this.defaultTimeAttributeIndex = attr.getIndex();        
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class MilliToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter {
+        
+    public MilliToRelativeInstantFeatureAttributeGetter() {
+        super(1);       
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class MonthToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public MonthToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.MONTH_OF_YEAR);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class MilliToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public MilliToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.MILLIS_OF_SECOND);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class SecondToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter {
+    static final long MILLIS_IN_SECOND = 1000; 
+        
+    public SecondToRelativeInstantFeatureAttributeGetter() {
+        super(MILLIS_IN_SECOND);       
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,47 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.timesupport.TimeSupportLocator;
+import org.gvsig.timesupport.TimeSupportManager;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public abstract class AbstractObjectToTimefeatureAttributeGetter implements FeatureAttributeGetter {
+    protected static final TimeSupportManager TIME_SUPPORT_MANAGER = TimeSupportLocator.getManager();
+    protected static final DataTypesManager DATA_TYPES_MANAGER = ToolsLocator.getDataTypesManager();
+    protected static final Logger LOG = LoggerFactory.getLogger(AbstractObjectToTimefeatureAttributeGetter.class);
+        
+    public AbstractObjectToTimefeatureAttributeGetter() {
+        super();       
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class DayToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter {
+    static final long MILLIS_IN_A_DAY = 1000 * 60 * 60 * 24; 
+   
+   public DayToRelativeInstantFeatureAttributeGetter() {
+       super(MILLIS_IN_A_DAY);       
+   }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class HourToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter {
+    static final long MILLIS_IN_A_HOUR = 1000 * 60 * 60; 
+    
+    public HourToRelativeInstantFeatureAttributeGetter() {
+        super(MILLIS_IN_A_HOUR);       
+    }
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class SecondToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public SecondToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.SECOND_OF_MINUTE);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,59 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.timesupport.RelativeInstant;
+import org.gvsig.tools.dataTypes.DataType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public abstract class AbstractRelativeInstantFeatureAttributeGetter  extends AbstractObjectToTimefeatureAttributeGetter {
+    protected DataType dataType = null;
+    protected long millisInUnit = 1;
+
+    public AbstractRelativeInstantFeatureAttributeGetter(long millisInUnit) {
+        super();
+        this.dataType = DATA_TYPES_MANAGER.get(DataTypes.INSTANT);
+        this.millisInUnit = millisInUnit;
+    }
+
+    public DataType getDataType() {  
+        return dataType;
+    }
+    
+    public Object getter(Object sourceAttributeValue) {
+        if (sourceAttributeValue == null){
+            return TIME_SUPPORT_MANAGER.createRelativeInstant(0);
+        }
+        return TIME_SUPPORT_MANAGER.createRelativeInstant((long)new Double(sourceAttributeValue.toString()).doubleValue() * millisInUnit);
+     }
+
+    public Object setter(Object targetAttributeValue) {
+        return new Long(((RelativeInstant)targetAttributeValue).toMillis() / millisInUnit);
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class DayToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public DayToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.DAY_OF_MONTH);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class HourToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public HourToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.HOUR_OF_DAY);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,38 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class MinuteToRelativeInstantFeatureAttributeGetter extends AbstractRelativeInstantFeatureAttributeGetter {
+    static final long MILLIS_IN_A_MINUTE = 1000 * 60; 
+    
+    public MinuteToRelativeInstantFeatureAttributeGetter() {
+        super(MILLIS_IN_A_MINUTE);       
+    }
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,65 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.timesupport.AbsoluteInstant;
+import org.gvsig.timesupport.AbsoluteInstantTypeNotRegisteredException;
+import org.gvsig.tools.dataTypes.DataType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public abstract class AbstractAbsoluteInstantFeatureAttributeGetter extends AbstractObjectToTimefeatureAttributeGetter {
+    protected int dateTimeFieldtype = -1;
+    protected DataType dataType = null;
+    
+    public AbstractAbsoluteInstantFeatureAttributeGetter(
+        int dateTimeFieldtype) {
+        super();
+        this.dateTimeFieldtype = dateTimeFieldtype;
+        this.dataType = DATA_TYPES_MANAGER.get(DataTypes.INSTANT);
+    }   
+
+    public Object getter(Object sourceAttributeValue) {        
+        try {
+            if (sourceAttributeValue == null){
+                return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, 0);
+            }
+            return TIME_SUPPORT_MANAGER.createAbsoluteInstant(dateTimeFieldtype, ((Integer)sourceAttributeValue).intValue());
+        } catch (AbsoluteInstantTypeNotRegisteredException e) {
+           LOG.error("Impossible to apply the tranformation for this field", e);
+        }
+        return TIME_SUPPORT_MANAGER.createAbsoluteInstant();
+    }
+
+    public Object setter(Object targetAttributeValue) {
+        return new Integer(((AbsoluteInstant)targetAttributeValue).getValue(0));        
+    }
+    
+    public DataType getDataType() {        
+        return dataType;
+    }
+ }

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class YearToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public YearToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.YEAR);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature.impl.attributegetter;
+
+import org.gvsig.timesupport.AbsoluteInstantType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class MinuteToAbsoluteInstantFeatureAttributeGetter extends AbstractAbsoluteInstantFeatureAttributeGetter {
+
+    public MinuteToAbsoluteInstantFeatureAttributeGetter() {
+        super(AbsoluteInstantType.MINUTE_OF_HOUR);      
+    }   
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java	(revision 35988)
@@ -0,0 +1,252 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadRuntimeException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectSetFeatureSetFacade;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.fmap.dal.feature.spi.LongList;
+import org.gvsig.fmap.dal.feature.spi.index.FeatureIndexProviderServices;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitor;
+
+
+public class IndexFeatureSet implements FeatureSet, FeatureSetProvider {
+
+	LongList featureReferences = null;
+	FeatureStoreProvider storeProvider = null;
+	FeatureStoreProviderServices store = null;
+	FeatureIndexProviderServices index = null;
+	List featureTypes = null;
+
+	public class IndexIterator implements DisposableIterator {
+		Iterator it = null;
+
+		public IndexIterator(Iterator it) {
+			this.it = it;
+		}
+
+		public boolean hasNext() {
+			return it.hasNext();
+		}
+
+		public Object next() {
+			Object oid = it.next();
+			FeatureReference ref = new DefaultFeatureReference(store
+					.getFeatureStore(), oid);
+			try {
+				return store.getFeatureStore().getFeatureByReference(ref);
+			} catch (DataException e) {
+				throw new ReadRuntimeException(store.getName(), e);
+			}
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		public void dispose() {
+			this.it = null;
+		}
+	}
+
+	public class FastIndexIterator implements DisposableIterator {
+		Iterator it = null;
+		DefaultFeature feature = null;
+
+		public FastIndexIterator(Iterator it) throws DataException {
+			this.it = it;
+			feature = (DefaultFeature) store.createFeature(storeProvider
+					.createFeatureProvider(index.getFeatureType()));
+		}
+
+		public boolean hasNext() {
+			return it.hasNext();
+		}
+
+		public Object next() {
+			Object oid = it.next();
+			try {
+				//				Long longer=new Long(((Integer)oid).longValue());
+				FeatureReference ref = new DefaultFeatureReference(store
+						.getFeatureStore(), oid);
+				FeatureProvider data = storeProvider
+						.getFeatureProviderByReference((FeatureReferenceProviderServices) ref);
+
+				feature.setData(data);
+
+				return feature;
+			} catch (DataException e) {
+				throw new ReadRuntimeException(store.getName(), e);
+			}
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		public void dispose() {
+			this.it = null;
+			this.feature = null;
+
+		}
+	}
+
+	public IndexFeatureSet(FeatureIndexProviderServices index, LongList featureReferences) {
+		this.featureReferences = featureReferences;
+		this.store = index.getFeatureStoreProviderServices();
+		this.storeProvider = store.getProvider();
+		this.index = index;
+	}
+
+	public boolean canFilter() {
+		return false;
+	}
+
+	public boolean canIterateFromIndex() {
+		return true;
+	}
+
+	public boolean canOrder() {
+		return false;
+	}
+
+	public DisposableIterator fastIterator(long index) throws DataException {
+		if (store.getFeatureStore().isEditing()) {
+			return this.iterator(index);
+		}
+		return new FastIndexIterator(this.featureReferences.iterator(index));
+	}
+
+	public DisposableIterator fastIterator() throws DataException {
+		if (store.getFeatureStore().isEditing()) {
+			return this.iterator();
+		}
+		return new FastIndexIterator(this.featureReferences.iterator());
+	}
+
+	public long getSize() throws DataException {
+		return featureReferences.getSize();
+	}
+
+	public boolean isEmpty() throws DataException {
+		return featureReferences.isEmpty();
+	}
+
+	public DisposableIterator iterator() throws DataException {
+		return new IndexIterator(this.featureReferences.iterator());
+	}
+
+	public DisposableIterator iterator(long index) throws DataException {
+		return new IndexIterator(this.featureReferences.iterator(index));
+	}
+
+	public void delete(Feature feature) throws DataException {
+		index.delete(feature);
+		store.getFeatureStore().delete(feature);
+	}
+
+	public FeatureType getDefaultFeatureType() {
+		return index.getFeatureType();
+	}
+
+	public List getFeatureTypes() {
+		List types = new ArrayList();
+		types.add(index.getFeatureType());
+		return Collections.unmodifiableList(types);
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		index.insert(feature);
+		store.getFeatureStore().insert(feature);
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		store.getFeatureStore().update(feature);
+		// we need to re-index the feature, since its shape might have changed
+		index.delete(feature);
+		index.insert(feature);
+	}
+
+	public void dispose() {
+
+	}
+
+	public boolean isFromStore(DataStore store) {
+		return this.store.equals(store);
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		accept(visitor, 0);
+	}
+
+	public void accept(Visitor visitor, long firstValueIndex)
+			throws BaseException {
+		DisposableIterator iterator = fastIterator(firstValueIndex);
+
+		if (iterator != null) {
+			try {
+				while (iterator.hasNext()) {
+					Feature feature = (Feature) iterator.next();
+					visitor.visit(feature);
+				}
+			} finally {
+				iterator.dispose();
+			}
+		}
+	}
+
+    public DynObjectSet getDynObjectSet() {
+        return new DynObjectSetFeatureSetFacade(this, store.getFeatureStore());
+    }
+
+    public DynObjectSet getDynObjectSet(boolean fast) {
+        return new DynObjectSetFeatureSetFacade(this, store.getFeatureStore(),
+            fast);
+    }
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java	(revision 35988)
@@ -0,0 +1,30 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.Iterator;
+
+/**
+ * 
+ * Envuelve un iterador de Features para que se comporte como
+ * un iterador de FeatireDatas.
+ * 
+ */
+public class FeatureToFeatureProviderIterator implements Iterator {
+	Iterator featuresIterator;
+	
+	public FeatureToFeatureProviderIterator(Iterator it) {
+		featuresIterator=it;
+	}	
+	
+	public boolean hasNext() {
+		return featuresIterator.hasNext();
+	}
+
+	public Object next() {
+		return ((DefaultFeature)featuresIterator.next()).getData();
+	}
+
+	public void remove() {
+		featuresIterator.remove();
+	}
+	
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 35988)
@@ -0,0 +1,548 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.IllegalValueException;
+import org.gvsig.fmap.dal.feature.exception.SetReadOnlyAttributeException;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Instant;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class DefaultFeature implements Feature, EvaluatorData {
+
+    private static DataTypesManager dataTypesManager = null; 
+    protected FeatureProvider data;
+    protected FeatureReference reference;
+    private WeakReference storeRef;
+
+
+    /*
+     * Usar con mucha precaucion o mejor no usar. Lo precisa el
+     * DefaultFeatureSet en la ordenacion.
+     */
+    public DefaultFeature(FeatureStore store) {
+        this.storeRef = new WeakReference(store);
+        this.reference = null;
+    }
+
+    public DefaultFeature(FeatureStore store, FeatureProvider data) {
+        this.data = data;
+        this.storeRef = new WeakReference(store);
+        this.reference = null;
+    }
+
+    DefaultFeature(DefaultFeature feature) {
+        this.data = feature.data.getCopy();
+        this.storeRef = feature.storeRef;
+        this.reference = feature.reference;
+    }
+
+    public void setData(FeatureProvider data) {
+        this.data = data;
+        this.reference = null;
+    }
+
+    public FeatureProvider getData() {
+        return this.data;
+    }
+
+    protected DataTypesManager getDataTypesManager() {
+        if( dataTypesManager==null ) {
+            dataTypesManager = ToolsLocator.getDataTypesManager();
+        }
+        return dataTypesManager;
+    }
+
+    void set(FeatureAttributeDescriptor attribute, Object value) {
+        int i = attribute.getIndex();
+
+        if (attribute.isReadOnly()) {
+            throw new SetReadOnlyAttributeException();
+        }
+
+        if (attribute.getEvaluator() != null) {
+            throw new SetReadOnlyAttributeException();
+        }
+
+        if (value == null) {
+            if (!attribute.allowNull()) {
+                if (!attribute.isAutomatic()) {
+                    throw new IllegalValueException(attribute, value);
+                }
+            }
+            this.data.set(i, null);
+            return;
+
+        }
+
+
+        if (attribute.getFeatureAttributeGetter() != null){
+            value = attribute.getFeatureAttributeGetter().setter(value);
+            
+        }
+        
+        if (attribute.getObjectClass().isInstance(value)) {
+            this.data.set(i, value);
+            return;
+        }
+
+        try {
+            this.getDataTypesManager().coerce(attribute.getType(), value);
+        } catch (CoercionException e) {
+            throw new IllegalArgumentException(
+                "Can't convert to "+this.getDataTypesManager().getTypeName(attribute.getType())+" from '"+value.getClass().getName()+"' with value '"+value.toString()+"'.",
+                e);
+        }
+
+        //		if ((Number.class.isAssignableFrom(attribute.getObjectClass()) && Number.class.isAssignableFrom(value.getClass()))
+        //				|| (attribute.getType()==DataTypes.STRING && Number.class.isAssignableFrom(value.getClass()))) {
+        //			Object number=getNumberByType((Number)value, attribute.getType());
+        //			this.data.set(i, number);
+        //			return;
+        //		}
+        //
+        //		if (!(value instanceof String)) {
+        //			throw new IllegalValueException(attribute, value);
+        //		}
+        //		int dataType = attribute.getType();
+        //
+        //		switch (dataType) {
+        //		case DataTypes.BYTE:
+        //			this.data.set(i, Byte.valueOf((String) value));
+        //			break;
+        //
+        //		case DataTypes.DATE:
+        //			try {
+        //				this.data.set(i, attribute.getDateFormat()
+        //						.parse((String) value));
+        //			} catch (ParseException e) {
+        //				throw new IllegalValueException(attribute, value, e);
+        //			}
+        //			break;
+        //
+        //		case DataTypes.DOUBLE:
+        //			this.data.set(i, Double.valueOf((String) value));
+        //			break;
+        //
+        //		case DataTypes.FLOAT:
+        //			this.data.set(i, Float.valueOf((String) value));
+        //			break;
+        //
+        //		case DataTypes.INT:
+        //			this.data.set(i, Integer.valueOf((String) value));
+        //			break;
+        //
+        //		case DataTypes.LONG:
+        //			this.data.set(i, Long.valueOf((String) value));
+        //			break;
+        //
+        //		default:
+        //			throw new IllegalValueException(attribute, value);
+        //		}
+    }
+
+    private Object get(int index,Class theClass, int type) {
+        Object value = this.get(index);
+        if( theClass.isInstance(value) ) {
+            return value;
+        }
+        try {
+            return this.getDataTypesManager().coerce(type, value);
+        } catch (CoercionException e) {
+            throw new IllegalArgumentException(
+                "Can't convert to "+theClass.getSimpleName()+" from '"+value.getClass().getName()+"' with value '"+value.toString()+"'.",
+                e);
+        }
+    }
+
+    //	private Object getNumberByType(Number value, int type) {
+    //		if (type==DataTypes.DOUBLE){
+    //			return new Double(value.doubleValue());
+    //		}else if (type==DataTypes.FLOAT){
+    //			return new Float(value.floatValue());
+    //		}else if (type==DataTypes.LONG){
+    //			return new Long(value.longValue());
+    //		}else if (type==DataTypes.INT){
+    //			return new Integer(value.intValue());
+    //		}else if (type==DataTypes.STRING){
+    //			return value.toString();
+    //		}
+    //		return value;
+    //	}
+
+    public void initializeValues() {
+        FeatureType type = this.getType();
+        Iterator iterator = type.iterator();
+
+        while (iterator.hasNext()) {
+            FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
+            .next();
+            if (attribute.isAutomatic() || attribute.isReadOnly()
+                || attribute.getEvaluator() != null) {
+                continue;
+            }
+            if (attribute.getDefaultValue() == null && !attribute.allowNull()) {
+                continue;
+            }
+            this.set(attribute, attribute.getDefaultValue());
+        }
+    }
+
+    public void clear() {
+        initializeValues();
+    }
+
+    public void initializeValues(Feature feature) {
+        FeatureType myType=this.getType();
+        FeatureType type =feature.getType();
+        Iterator iterator = type.iterator();
+
+        while (iterator.hasNext()) {
+            FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor) iterator
+            .next();
+            FeatureAttributeDescriptor myAttribute=myType.getAttributeDescriptor(attribute.getName());
+            if (myAttribute != null) {
+                this.set(myAttribute, feature.get(attribute.getIndex()));
+            }
+        }
+    }
+
+    public FeatureStore getStore() {
+        return (FeatureStore) this.storeRef.get();
+    }
+
+    public FeatureType getType() {
+        return this.data.getType();
+    }
+
+    public EditableFeature getEditable() {
+        return new DefaultEditableFeature(this);
+    }
+
+    public Feature getCopy() {
+        return new DefaultFeature(this);
+    }
+
+    public FeatureReference getReference() {
+        if (this.reference == null) {
+            this.reference = new DefaultFeatureReference(this);
+        }
+        return this.reference;
+    }
+
+    public void validate(int mode) {
+        ((DefaultFeatureType) this.data.getType()).validateFeature(this, mode);
+    }
+
+    public List getSRSs() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Envelope getDefaultEnvelope() {
+        return this.data.getDefaultEnvelope();
+    }
+
+    public Geometry getDefaultGeometry() {
+        return this.data.getDefaultGeometry();
+    }
+
+    public IProjection getDefaultSRS() {
+        return this.data.getType().getDefaultSRS();
+    }
+
+    public List getGeometries() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Object get(String name) {
+        int index = this.data.getType().getIndex(name);
+        if( index < 0 ) {
+            throw new IllegalArgumentException("Attribute name '"+name+"' not found in the feature.");
+        }
+        return this.get(index);
+    }
+
+    public Object get(int index) {
+        FeatureType type = this.data.getType();
+        if( index <0 || index >= type.size() ) {
+            throw new IllegalArgumentException("Attribute index '"+index+"' out of range (0 to "+this.data.getType().size()+".");
+        }
+        FeatureAttributeDescriptor attribute = type.getAttributeDescriptor(index);
+        if (!this.data.getType().hasEvaluators()) {
+            return get(attribute, this.data.get(index));		
+        }		
+        Evaluator eval = attribute.getEvaluator();
+        if (eval == null) {
+            return this.data.get(index);
+        } else {
+            Object value = this.data.get(index);
+            if (value != null) { // FIXME: para comprobar si esta calculado usar
+                // un array
+                // especifico.
+                return get(attribute, this.data.get(index));
+            }
+            try {
+                value = eval.evaluate(this);
+            } catch (EvaluatorException e) {
+                throw new DataEvaluatorRuntimeException(e);
+            }
+            this.data.set(index, value);
+            return  get(attribute, value);
+        }		
+    }
+
+    private Object get(FeatureAttributeDescriptor featureAttributeDescriptor, Object value){
+        if (featureAttributeDescriptor.getFeatureAttributeGetter() == null){
+            return value;
+        }else{
+            return featureAttributeDescriptor.getFeatureAttributeGetter().getter(value);
+        }
+    }
+
+    public Object[] getArray(String name) {
+        return this.getArray(this.data.getType().getIndex(name));
+    }
+
+    public Object[] getArray(int index) {
+        return (Object[]) this.get(index);
+    }
+
+    public boolean getBoolean(String name) {
+        return this.getBoolean(this.data.getType().getIndex(name));
+    }
+
+    public boolean getBoolean(int index) {
+        Boolean value = ((Boolean) this.get(index,Boolean.class,DataTypes.BOOLEAN));
+        if (value == null) {
+            return false;
+        }
+        return value.booleanValue();
+    }
+
+    public byte getByte(String name) {
+        return this.getByte(this.data.getType().getIndex(name));
+    }
+
+    public byte getByte(int index) {
+        Byte value = ((Byte) this.get(index,Byte.class,DataTypes.BYTE));
+        if (value == null) {
+            return 0;
+        }
+        return value.byteValue();
+    }
+
+    public Date getDate(String name) {
+        return this.getDate(this.data.getType().getIndex(name));
+    }
+
+    public Date getDate(int index) {
+        Date value = ((Date) this.get(index,Date.class,DataTypes.DATE));
+
+        return value;
+    }
+
+    public double getDouble(String name) {
+        return this.getDouble(this.data.getType().getIndex(name));
+    }
+
+    public double getDouble(int index) {
+
+        Double value = ((Double) this.get(index,Double.class,DataTypes.DOUBLE));
+        if (value == null) {
+            return 0;
+        }
+        return value.doubleValue();
+    }
+
+    public Feature getFeature(String name) {
+        return this.getFeature(this.data.getType().getIndex(name));
+    }
+
+    public Feature getFeature(int index) {
+        return (Feature) this.get(index);
+    }
+
+    public float getFloat(String name) {
+        return this.getFloat(this.data.getType().getIndex(name));
+    }
+
+    public float getFloat(int index) {
+        Float value = ((Float) this.get(index,Float.class,DataTypes.FLOAT));
+        if (value == null) {
+            return 0;
+        }
+        return value.floatValue();
+    }
+
+    public Geometry getGeometry(String name) {
+        return this.getGeometry(this.data.getType().getIndex(name));
+    }
+
+    public Geometry getGeometry(int index) {
+        return (Geometry) this.get(index,Geometry.class,DataTypes.GEOMETRY);
+    }
+
+    public int getInt(String name) {
+        return this.getInt(this.data.getType().getIndex(name));
+    }
+
+    public int getInt(int index) {
+        Integer value = ((Integer) this.get(index,Integer.class,DataTypes.INT));
+        if (value == null) {
+            return 0;
+        }
+        return ((Integer)value).intValue();
+    }
+
+    public long getLong(String name) {
+        return this.getLong(this.data.getType().getIndex(name));
+    }
+
+    public long getLong(int index) {
+        Long value = ((Long) this.get(index,Long.class,DataTypes.LONG));
+        if (value == null) {
+            return 0;
+        }
+        return value.longValue();
+    }
+
+    public String getString(String name) {
+        return this.getString(this.data.getType().getIndex(name));
+    }
+
+    public String getString(int index) {
+        return (String) this.get(index,String.class,DataTypes.STRING);
+    }
+
+    public Object getContextValue(String name) {
+        name = name.toLowerCase();
+        if (name.equals("store")) {
+            return this.getStore();
+        }
+
+        if (name.equals("featuretype")) {
+            return this.data.getType();
+        }
+
+        if (name.equals("feature")) {
+            return this;
+        }
+
+        throw new IllegalArgumentException(name);
+    }
+
+    public Iterator getDataNames() {
+        class DataNamesIterator implements Iterator {
+            Iterator attributeIteraror;
+
+            DataNamesIterator(DefaultFeature feature) {
+                this.attributeIteraror = feature.getType().iterator();
+            }
+
+            public boolean hasNext() {
+                return this.attributeIteraror.hasNext();
+            }
+
+            public Object next() {
+                return ((FeatureAttributeDescriptor) this.attributeIteraror
+                    .next()).getName();
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        }
+        return new DataNamesIterator(this);
+    }
+
+    public Object getDataValue(String name) {
+        name = name.toLowerCase();
+        return get(name);
+    }
+
+    public Iterator getDataValues() {
+        class DataValuesIterator implements Iterator {
+            DefaultFeature feature;
+            int current = 0;
+
+            DataValuesIterator(DefaultFeature feature) {
+                this.feature = feature;
+            }
+
+            public boolean hasNext() {
+                return current < feature.getType().size() - 1;
+            }
+
+            public Object next() {
+                return feature.get(current++);
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        }
+        return new DataValuesIterator(this);
+    }
+
+    public boolean hasContextValue(String name) {
+        name = name.toLowerCase();
+        if (name.equals("store")) {
+            return true;
+        }
+
+        if (name.equals("featuretype")) {
+            return true;
+        }
+
+        if (name.equals("feature")) {
+            return true;
+        }
+        return false;
+    }
+
+    public boolean hasDataValue(String name) {
+        name = name.toLowerCase();
+        return this.data.getType().getIndex(name) >= 0;
+    }
+
+    public Instant getInstant(int index) {
+        return ((Instant) this.get(index,Date.class,DataTypes.INSTANT));
+    }
+
+    public Instant getInstant(String name) {
+        return this.getInstant(this.data.getType().getIndex(name));
+    }
+
+    public Interval getInterval(int index) {
+        return ((Interval) this.get(index,Date.class,DataTypes.INTERVAL));
+    }
+
+    public Interval getInterval(String name) {
+        return this.getInterval(this.data.getType().getIndex(name));
+    }
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java	(revision 35988)
@@ -0,0 +1,57 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.dal.feature.impl;
+
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
+
+/**
+ * Helper methods for the Default Selection implementation classes.
+ * 
+ * @see DefaultFeatureReferenceSelection
+ * @see DefaultFeatureSelection
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface FeatureSelectionHelper {
+    
+    /**
+     * If the store is in editing mode, it will have the count of added or
+     * removed features. This is used to correct the total count of Features.
+     * 
+     * @return the total number of added and deleted features
+     */
+    long getFeatureStoreDeltaSize();
+
+    /**
+     * Returns the {@link FeatureCommandsStack} of the {@link FeatureStore}. If
+     * the store is not in editing mode, this method may return null
+     * 
+     * @return the commands stack of the {@link FeatureStore}
+     */
+    FeatureCommandsStack getFeatureStoreCommandsStack();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java	(revision 35988)
@@ -0,0 +1,679 @@
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureRules;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+
+public class DefaultFeatureType extends ArrayList implements FeatureType,
+		DynClass {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7988721447349282215L;
+
+	private DefaultFeatureRules rules;
+	private boolean hasEvaluators;
+	protected String defaultGeometryAttributeName;
+	protected int defaultGeometryAttributeIndex;
+	protected int defaultTimeAttributeIndex;
+	private String id;
+	protected boolean hasOID;
+	protected boolean allowAtomaticValues;
+	protected FeatureAttributeDescriptor[] pk = null;
+
+	private List srsList = null; 
+
+	protected DefaultFeatureType(String id) {
+		this.id = id;
+		this.rules = new DefaultFeatureRules();
+		this.hasEvaluators = false;
+		this.defaultGeometryAttributeName = null;
+		this.defaultGeometryAttributeIndex = -1;
+		this.defaultTimeAttributeIndex = -1;
+		this.allowAtomaticValues = false;
+	}
+
+	protected DefaultFeatureType() {
+		this("default");
+	}
+
+	protected DefaultFeatureType(DefaultFeatureType other) {
+		initialize(other, true);
+	}
+
+	protected DefaultFeatureType(DefaultFeatureType other,
+			boolean copyAttributes) {
+		initialize(other, copyAttributes);
+	}
+
+	protected void initialize(DefaultFeatureType other, boolean copyAttributes) {
+		this.id = other.getId();
+		if (copyAttributes) {
+			Iterator iter = other.iterator();
+			DefaultFeatureAttributeDescriptor attr;
+			while (iter.hasNext()) {
+				attr = (DefaultFeatureAttributeDescriptor) iter.next();
+				this.intitalizeAddAttibute(attr);
+			}
+		}
+		this.defaultGeometryAttributeName = other.defaultGeometryAttributeName;
+		this.hasEvaluators = other.hasEvaluators;
+		this.rules = (DefaultFeatureRules) other.rules.getCopy();
+		this.defaultGeometryAttributeIndex = other.defaultGeometryAttributeIndex;
+		this.defaultTimeAttributeIndex = other.defaultTimeAttributeIndex;
+		this.hasOID = other.hasOID;
+		this.id = other.id; // XXX ???? copiar o no esto????
+	}
+
+	protected void intitalizeAddAttibute(DefaultFeatureAttributeDescriptor attr) {
+		super.add(attr.getCopy());
+	}
+
+	public String getId() {
+		return this.id;
+	}
+
+	public Object get(String name) {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = this.iterator();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (attr.getName().equalsIgnoreCase(name)) {
+				return attr;
+			}
+		}
+		return null;
+	}
+
+	public FeatureAttributeDescriptor getAttributeDescriptor(String name) {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = this.iterator();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (attr.getName().equalsIgnoreCase(name)) {
+				return attr;
+			}
+		}
+		return null;
+	}
+
+	public FeatureAttributeDescriptor getAttributeDescriptor(int index) {
+		return (FeatureAttributeDescriptor) super.get(index);
+	}
+
+	public FeatureType getCopy() {
+		return new DefaultFeatureType(this);
+	}
+
+	public int getDefaultGeometryAttributeIndex() {
+		return this.defaultGeometryAttributeIndex;
+	}
+
+	public String getDefaultGeometryAttributeName() {
+		return this.defaultGeometryAttributeName;
+	}
+
+	public EditableFeatureType getEditable() {
+		return new DefaultEditableFeatureType(this);
+	}
+
+	public int getIndex(String name) {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = this.iterator();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			if (attr.getName().equalsIgnoreCase(name)) {
+				return attr.getIndex();
+			}
+		}
+		return -1;
+	}
+
+	public FeatureRules getRules() {
+		return this.rules;
+	}
+
+	public boolean hasEvaluators() {
+		return this.hasEvaluators;
+	}
+
+	public List getSRSs() {
+		if (this.srsList == null) {
+			ArrayList tmp = new ArrayList();
+			Iterator iter = iterator();
+			Iterator tmpIter;
+			boolean allreadyHave;
+			IProjection tmpSRS;
+			FeatureAttributeDescriptor attr;
+			while (iter.hasNext()){
+				attr = (FeatureAttributeDescriptor) iter.next();
+				if (attr.getDataType().getType() == DataTypes.GEOMETRY
+						&& attr.getSRS() != null) {
+					allreadyHave = false;
+					tmpIter = tmp.iterator();
+					while (tmpIter.hasNext()) {
+						tmpSRS = (IProjection) tmpIter.next();
+						if (tmpSRS.getAbrev().equals(attr.getSRS().getAbrev())) {
+							allreadyHave = true;
+							break;
+						}
+					}
+					if (!allreadyHave) {
+						tmp.add(attr.getSRS());
+					}
+				}
+			}
+			this.srsList = Collections.unmodifiableList(tmp);
+		}
+		return this.srsList;
+	}
+
+	public IProjection getDefaultSRS() {
+		if (this.getDefaultGeometryAttributeIndex() < 0) {
+			return null;
+		}
+		return this.getAttributeDescriptor(
+				this.getDefaultGeometryAttributeIndex()).getSRS();
+	}
+
+	public void validateFeature(Feature feature, int mode) {
+		if (Feature.UPDATE == mode){
+			((DefaultFeatureRules)getRules()).validate(feature);
+		}
+	}
+
+	public FeatureType getSubtype(String[] names) throws DataException {
+		return new SubtypeFeatureType(this, names);
+	}
+
+	public boolean isSubtypeOf(FeatureType featureType) {
+		return false;
+	}
+
+
+
+	class SubtypeFeatureType extends DefaultFeatureType {
+		/**
+		 *
+		 */
+		private static final long serialVersionUID = 6913732960073922540L;
+		WeakReference parent;
+
+		SubtypeFeatureType(DefaultFeatureType parent, String[] names)
+				throws DataException {
+			super(parent, false);
+			DefaultFeatureAttributeDescriptor attrcopy;
+			DefaultFeatureAttributeDescriptor attr;
+			// Copy attributes
+			for (int i = 0; i < names.length; i++) {
+				attr = (DefaultFeatureAttributeDescriptor) parent
+						.getAttributeDescriptor(names[i]);
+				if (attr == null) {
+					throw new SubtypeFeatureTypeNameException(names[i], parent
+							.getId());
+				}
+				attrcopy = new DefaultFeatureAttributeDescriptor(attr);
+				this.add(attrcopy);
+				attrcopy.index = i;
+			}
+
+			// Add missing pk fiels if any
+			if (!parent.hasOID()) {
+				Iterator iter = parent.iterator();
+				while (iter.hasNext()) {
+					attr = (DefaultFeatureAttributeDescriptor) iter.next();
+					if (attr.isPrimaryKey()
+							&& this.getIndex(attr.getName()) < 0) {
+						attrcopy = new DefaultFeatureAttributeDescriptor(attr);
+						this.add(attrcopy);
+						attrcopy.index = this.size() - 1;
+					}
+				}
+			}
+
+			this.defaultGeometryAttributeIndex = this
+					.getIndex(this.defaultGeometryAttributeName);
+			if (this.defaultGeometryAttributeIndex < 0) {
+				this.defaultGeometryAttributeName = null;
+			}
+			this.parent = new WeakReference(parent);
+		}
+
+		public FeatureType getSubtype(String[] names) throws DataException {
+			return new SubtypeFeatureType((DefaultFeatureType) this.parent
+					.get(), names);
+		}
+
+		public boolean isSubtypeOf(FeatureType featureType) {
+			if (featureType == null) {
+				return false;
+			}
+			FeatureType parent = (FeatureType) this.parent.get();
+			return featureType.equals(parent);
+		}
+
+		public EditableFeatureType getEditable() {
+			throw new UnsupportedOperationException();
+		}
+	}
+
+	public class SubtypeFeatureTypeNameException extends DataException {
+
+		/**
+		 *
+		 */
+		private static final long serialVersionUID = -4414242486723260101L;
+		private final static String MESSAGE_FORMAT = "Attribute name '%(name)s' not found in type (%(type)s).";
+		private final static String MESSAGE_KEY = "_SubtypeFeatureTypeNameException";
+
+		public SubtypeFeatureTypeNameException(String name, String type) {
+			super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+			setValue("name", name);
+			setValue("type", type);
+		}
+	}
+
+	public boolean hasOID() {
+		return hasOID;
+	}
+	public String toString(){
+		StringBuffer s = new StringBuffer();
+		s.append(this.getId());
+		s.append(":[");
+		String attName;
+		for (int i = 0; i < size(); i++) {
+			attName =((FeatureAttributeDescriptor)get(i)).getName().toString();
+			s.append(attName);
+			if (i < size() - 1) {
+				s.append(',');
+			}
+		}
+		s.append(']');
+		return s.toString();
+	}
+
+	public Iterator iterator() {
+		return getIterator(super.iterator());
+	}
+
+	protected Iterator getIterator(Iterator iter) {
+		return new DelegatedIterator(iter);
+	}
+
+	protected class DelegatedIterator implements Iterator {
+
+		protected Iterator iterator;
+
+		public DelegatedIterator(Iterator iter) {
+			this.iterator = iter;
+		}
+
+		public boolean hasNext() {
+			return iterator.hasNext();
+		}
+
+		public Object next() {
+			return iterator.next();
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+	}
+
+	public boolean allowAutomaticValues() {
+		return this.allowAtomaticValues;
+	}
+
+	public FeatureAttributeDescriptor[] getAttributeDescriptors() {
+		return (FeatureAttributeDescriptor[]) super
+				.toArray(new FeatureAttributeDescriptor[super.size()]);
+	}
+
+	public FeatureAttributeDescriptor[] getPrimaryKey() {
+		if (pk == null) {
+			List pkList = new ArrayList();
+			Iterator iter = super.iterator();
+			FeatureAttributeDescriptor attr;
+			while (iter.hasNext()){
+				attr = (FeatureAttributeDescriptor) iter.next();
+				if (attr.isPrimaryKey()){
+					pkList.add(attr);
+				}
+			}
+			pk = (FeatureAttributeDescriptor[]) pkList
+					.toArray(new FeatureAttributeDescriptor[pkList.size()]);
+		}
+		return pk;
+	}
+
+	public FeatureAttributeDescriptor getDefaultGeometryAttribute() {
+		if (this.defaultGeometryAttributeIndex < 0) {
+			return null;
+		}
+		return (FeatureAttributeDescriptor) super
+				.get(this.defaultGeometryAttributeIndex);
+	}
+
+
+
+	public boolean equals(Object other) {
+		if (this == other) {
+			return true;
+		}
+		if (!(other instanceof DefaultFeatureType)) {
+			return false;
+		}
+		DefaultFeatureType otherType = (DefaultFeatureType) other;
+		if (!this.id.equals(otherType.id)) {
+			return false;
+		}
+		if (this.size() != otherType.size()) {
+			return false;
+		}
+		FeatureAttributeDescriptor attr,attrOther;
+		Iterator iter,iterOther;
+		iter = this.iterator();
+		iterOther = otherType.iterator();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor) iter.next();
+			attrOther = (FeatureAttributeDescriptor) iterOther.next();
+			if (!attr.equals(attrOther)) {
+				return false;
+			}
+		}
+
+		if (defaultGeometryAttributeName != otherType.defaultGeometryAttributeName) {
+			if (defaultGeometryAttributeName == null) {
+				return false;
+			}
+			return defaultGeometryAttributeName
+					.equals(otherType.defaultGeometryAttributeName);
+
+		}
+		return true;
+
+	}
+
+	/**
+	 * Start of DynClass interface implementation
+	 * READONLY
+	 */
+
+	public DynField addDynField(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField getDeclaredDynField(String name) {
+		return (DynField) getAttributeDescriptor(name);
+	}
+
+	public DynField[] getDeclaredDynFields() {
+		return (DynField[]) getAttributeDescriptors();
+	}
+
+	public String getDescription() {
+		return null;
+	}
+
+	public DynField getDynField(String name) {
+		return (DynField) getAttributeDescriptor(name);
+	}
+
+	public DynField[] getDynFields() {
+		return (DynField[]) getAttributeDescriptors();
+	}
+
+	public String getName() {
+		return this.id;
+	}
+
+	public void removeDynField(String name) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public void addDynMethod(DynMethod dynMethod) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public void extend(DynClass dynClass) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public void extend(String dynClassName) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public void extend(String namespace, String dynClassName) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public DynMethod getDeclaredDynMethod(String name)
+			throws DynMethodException {
+		return null;
+	}
+
+	public DynMethod[] getDeclaredDynMethods() throws DynMethodException {
+		return null;
+	}
+
+	public DynMethod getDynMethod(String name) throws DynMethodException {
+		return null;
+	}
+
+	public DynMethod getDynMethod(int code) throws DynMethodException {
+		return null;
+	}
+
+	public DynMethod[] getDynMethods() throws DynMethodException {
+		return null;
+	}
+
+	public DynClass[] getSuperDynClasses() {
+		return null;
+	}
+
+	public boolean isInstance(DynObject dynObject) {
+		if (dynObject.getDynClass().getName() == getName()) {
+			return true;
+		}
+		return false;
+	}
+
+	public DynObject newInstance() {
+
+		throw new UnsupportedOperationException();
+	}
+
+	public void removeDynMethod(String name) {
+		throw new UnsupportedOperationException();
+
+	}
+
+	public DynField addDynFieldChoice(String name, int type,
+			Object defaultValue, DynObjectValueItem[] values,
+			boolean mandatory, boolean persistent) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldRange(String name, int type,
+			Object defaultValue, Object min, Object max, boolean mandatory,
+			boolean persistent) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldSingle(String name, int type,
+			Object defaultValue, boolean mandatory, boolean persistent) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void validate(DynObject object) throws DynObjectValidateException {
+		//FIXME: not sure it's the correct code
+		if (object instanceof Feature) {
+			Feature fea = (Feature) object;
+			if (fea.getType().equals(this)) {
+				return;
+			}
+		}
+		throw new DynObjectValidateException(this.id);
+	}
+
+	public DynField addDynFieldLong(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldChoice(String name, int type,
+			Object defaultValue, DynObjectValueItem[] values) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldRange(String name, int type,
+			Object defaultValue, Object min, Object max) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldSingle(String name, int type, Object defaultValue) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldString(String name) {
+		throw new UnsupportedOperationException();
+	}
+	
+	public DynField addDynFieldInt(String name) {
+		throw new UnsupportedOperationException();
+	}
+	
+	public DynField addDynFieldDouble(String name) {
+		throw new UnsupportedOperationException();
+	}
+	
+	public DynField addDynFieldFloat(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldBoolean(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldList(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldMap(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldObject(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldSet(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldArray(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldDate(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void extend(DynStruct struct) {
+		throw new UnsupportedOperationException();
+	}
+
+	public String getFullName() {
+        // TODO: usar el DynClassName
+		return this.id;
+	}
+
+	public String getNamespace() {
+		return "DALFeature";
+	}
+
+	public DynStruct[] getSuperDynStructs() {
+		return null;
+	}
+
+	public void setDescription(String description) {
+		throw new UnsupportedOperationException();
+	}
+
+	public void setNamespace(String namespace) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldFile(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldFolder(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldURL(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+	public DynField addDynFieldURI(String name) {
+		throw new UnsupportedOperationException();
+	}
+
+    public boolean isExtendable(DynStruct dynStruct) {
+        return false;
+    }
+
+
+	public FeatureAttributeDescriptor getDefaultTimeAttribute() {
+		if (this.defaultTimeAttributeIndex < 0) {
+			return null;
+		}
+		return (FeatureAttributeDescriptor) super
+				.get(this.defaultTimeAttributeIndex);
+	}
+
+	public void extend(DynStruct[] structs) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void remove(DynStruct superDynStruct) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void removeAll(DynStruct[] superDynStruct) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java	(revision 35988)
@@ -0,0 +1,599 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.ReversedSelectionIteratorException;
+import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectSetFeatureSetFacade;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Default implementation of the FeatureSelection interface. Internally, only
+ * FeatureReference values are stored.
+ * 
+ * This implementation performs better if used with the selection related
+ * methods: select, deselect and isSelected ones.
+ * 
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultFeatureSelection extends DefaultFeatureReferenceSelection
+		implements FeatureSelection {
+
+	private static final Logger LOG = LoggerFactory
+			.getLogger(DefaultFeatureSelection.class);
+
+	private Map featureTypeCounts = new HashMap(1);
+
+	/**
+	 * Creates a DefaultFeatureSelection, with a FeatureStore.
+	 * 
+	 * @param featureStore
+	 *            the FeatureStore to load Features from
+	 * @throws DataException
+	 *             if there is an error while getting the total number of
+	 *             Features of the Store.
+	 * @see AbstractSetBasedDataSelection#DefaultSelection(int)
+	 */
+	public DefaultFeatureSelection(DefaultFeatureStore featureStore)
+			throws DataException {
+		super(featureStore);
+	}
+
+	/**
+	 * Creates a new Selection with the total size of Features from which the
+	 * selection will be performed.
+	 * 
+	 * @param featureStore
+	 *            the FeatureStore of the selected FeatureReferences
+	 * @param helper
+	 *            to get some information of the Store
+	 * @throws DataException
+	 *             if there is an error while getting the total number of
+	 *             Features of the Store.
+	 */
+	public DefaultFeatureSelection(FeatureStore featureStore,
+			FeatureSelectionHelper helper) throws DataException {
+		super(featureStore, helper);
+	}
+
+	/**
+	 * Constructor used by the persistence manager. Don't use directly. After to
+	 * invoke this method, the persistence manager calls the the method
+	 * {@link #loadFromState(PersistentState)} to set the values of the internal
+	 * attributes that this class needs to work.
+	 */
+	public DefaultFeatureSelection() {
+		super();
+	}
+
+	public boolean select(Feature feature) {
+		return select(feature, true);
+	}
+
+	/**
+	 * @see #select(Feature)
+	 * @param undoable
+	 *            if the action must be undoable
+	 */
+	public boolean select(Feature feature, boolean undoable) {
+		// TODO: should we check if the feature is from the same FeatureStore??
+		if (feature == null) {
+			return false;
+		}
+
+		// LOGGER.debug("Selected feature: {}", feature);
+
+		if (isReversed()) {
+			removeFeatureTypeCount(feature.getType());
+		} else {
+			addFeatureTypeCount(feature.getType());
+		}
+		return select(feature.getReference(), undoable);
+	}
+
+	public boolean select(FeatureSet features) throws DataException {
+		return select(features, true);
+	}
+
+	/**
+	 * @see #select(FeatureSet)
+	 * @param undoable
+	 *            if the action must be undoable
+	 */
+	public boolean select(FeatureSet features, boolean undoable)
+			throws DataException {
+		boolean change = false;
+		boolean inComplex = false;
+		if (undoable && getFeatureStore().isEditing()
+				&& !getCommands().inComplex()) {
+			inComplex = getCommands().inComplex();
+			getCommands().startComplex("_selectionSelectFeatureSet");
+		}
+
+		disableNotifications();
+		DisposableIterator iter = null;
+		try {
+			for (iter = features.fastIterator(); iter.hasNext();) {
+				change |= select((Feature) iter.next(), undoable);
+			}
+		} finally {
+			dispose(iter);
+		}
+		enableNotifications();
+		if (undoable && getFeatureStore().isEditing() && !inComplex) {
+			getCommands().endComplex();
+		}
+		if (change) {
+			notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+		}
+		return change;
+	}
+
+	public boolean deselect(Feature feature) {
+		return deselect(feature, true);
+	}
+
+	/**
+	 * @see #deselect(Feature)
+	 * @param undoable
+	 *            if the action must be undoable
+	 */
+	public boolean deselect(Feature feature, boolean undoable) {
+		if (feature == null) {
+			return false;
+		}
+
+		LOG.debug("Deselected feature: {}", feature);
+
+		if (isReversed()) {
+			addFeatureTypeCount(feature.getType());
+		} else {
+			removeFeatureTypeCount(feature.getType());
+		}
+		return deselect(feature.getReference(), undoable);
+	}
+
+	public boolean deselect(FeatureSet features) throws DataException {
+		return deselect(features, true);
+	}
+
+	/**
+	 * @see #deselect(FeatureSet)
+	 * @param undoable
+	 *            if the action must be undoable
+	 */
+	public boolean deselect(FeatureSet features, boolean undoable)
+			throws DataException {
+		boolean change = false;
+		if (undoable && getFeatureStore().isEditing()) {
+			getCommands().startComplex("_selectionDeselectFeatureSet");
+		}
+		disableNotifications();
+		DisposableIterator iter = null;
+		try {
+			for (iter = features.fastIterator(); iter.hasNext();) {
+				change |= deselect((Feature) iter.next(), undoable);
+			}
+		} finally {
+			dispose(iter);
+		}
+		enableNotifications();
+		if (undoable && getFeatureStore().isEditing()) {
+			getCommands().endComplex();
+		}
+		if (change) {
+			notifyObservers(DataStoreNotification.SELECTION_CHANGE);
+		}
+		return change;
+	}
+
+	public boolean isSelected(Feature feature) {
+		if (feature == null) {
+			return false;
+		}
+
+        // Use the selection data size as a small optimization for the most
+        // common case, when nothing is selected and every feature is checked
+        // while drawing or painting the table document.
+        if (selectionData.isReversed()) {
+            return selectionData.getSize() == 0
+                || !selectionData.contains(feature.getReference());
+        } else {
+            return selectionData.getSize() > 0
+                && selectionData.contains(feature.getReference());
+        }
+	}
+
+	public FeatureType getDefaultFeatureType() {
+		try {
+			return getFeatureStore().getDefaultFeatureType();
+		} catch (DataException ex) {
+			LOG.error("Error getting the default feature type "
+					+ "of the FeatureStore: " + getFeatureStore(), ex);
+		}
+		return null;
+	}
+
+	public List getFeatureTypes() {
+		// Go through the map of FeatureTypes, and return only the ones that
+		// have at least a Feature.
+		List types = new ArrayList();
+		for (java.util.Iterator iterator = featureTypeCounts.entrySet()
+				.iterator(); iterator.hasNext();) {
+			Map.Entry entry = (Entry) iterator.next();
+			FeatureType type = (FeatureType) entry.getKey();
+			Long count = (Long) entry.getValue();
+
+			if (count.longValue() > 0) {
+				types.add(type);
+			}
+		}
+
+		return types;
+	}
+
+	public long getSize() throws DataException {
+		return getSelectedCount();
+	}
+
+	public boolean isEmpty() throws DataException {
+		return getSelectedCount() == 0;
+	}
+
+	/**
+	 * Returns the list of selected values, or the deselected ones if the
+	 * selection has been reversed.
+	 */
+	public DisposableIterator iterator() {
+		return iterator(0);
+	}
+
+	/**
+	 * Returns the list of selected values, or the deselected ones if the
+	 * selection has been reversed.
+	 * 
+	 * WARN: not very good performance implementation.
+	 */
+	public DisposableIterator iterator(long index) {
+		return iterator(index, false);
+	}
+
+	/**
+	 * Returns the list of selected values, or the deselected ones if the
+	 * selection has been reversed.
+	 * 
+	 * WARN: not really a fast implementation.
+	 */
+	public DisposableIterator fastIterator() {
+		return fastIterator(0);
+	}
+
+	/**
+	 * Returns the list of selected values, or the deselected ones if the
+	 * selection has been reversed.
+	 * 
+	 * WARN: not really a fast implementation.
+	 */
+	public DisposableIterator fastIterator(long index) {
+		return iterator(index, true);
+	}
+
+	protected void clearFeatureReferences() {
+		super.clearFeatureReferences();
+		featureTypeCounts.clear();
+	}
+
+	/**
+	 * Creates an iterator for the Selection.
+	 */
+	private DisposableIterator iterator(long index, boolean fastIterator) {
+		if (isReversed()) {
+			DisposableIterator iter = new ReversedFeatureIteratorFacade(
+					getData(), getFeatureStore(), fastIterator);
+			for (long l = 0; l < index && iter.hasNext(); l++) {
+				iter.next();
+			}
+			return iter;
+
+		} else {
+			// TODO: maybe we could add a new referenceIterator(int index)
+			// method that could be implemented in a more performant way
+
+			java.util.Iterator iter = referenceIterator();
+			for (long l = 0; l < index && iter.hasNext(); l++) {
+				iter.next();
+			}
+			return new FeatureIteratorFacade(iter, getFeatureStore());
+		}
+	}
+
+	private Long removeFeatureTypeCount(FeatureType featureType) {
+		Long count = (Long) featureTypeCounts.get(featureType);
+		if (count == null) {
+			count = new Long(-1);
+		} else {
+			count = new Long(count.longValue() - 1);
+		}
+		featureTypeCounts.put(featureType, count);
+		return count;
+	}
+
+	private Long addFeatureTypeCount(FeatureType featureType) {
+		Long count = (Long) featureTypeCounts.get(featureType);
+		if (count == null) {
+			count = new Long(1);
+		} else {
+			count = new Long(count.longValue() + 1);
+		}
+		featureTypeCounts.put(featureType, count);
+		return count;
+	}
+
+	/**
+	 * Facade over a Iterator of FeatureReferences, to return Features instead.
+	 * 
+	 * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+	 */
+	private class FeatureIteratorFacade implements DisposableIterator {
+
+		private final Logger LOGGER = LoggerFactory
+				.getLogger(FeatureIteratorFacade.class);
+
+		private java.util.Iterator refIterator;
+
+		private FeatureStore featureStore;
+
+		public FeatureIteratorFacade(java.util.Iterator iter,
+				FeatureStore featureStore) {
+			this.refIterator = iter;
+			this.featureStore = featureStore;
+		}
+
+		public boolean hasNext() {
+			return refIterator.hasNext();
+		}
+
+		public Object next() {
+			FeatureReference ref = nextFeatureReference();
+			try {
+				return featureStore.getFeatureByReference(ref);
+			} catch (DataException ex) {
+				LOGGER.error(
+						"Error loading the Feature with FeatureReference: "
+								+ ref, ex);
+				return null;
+			}
+		}
+
+		/**
+		 * Returns the next FeatureReference.
+		 * 
+		 * @return the next FeatureReference
+		 */
+		public FeatureReference nextFeatureReference() {
+			return (FeatureReference) refIterator.next();
+		}
+
+		public void remove() {
+			refIterator.remove();
+		}
+
+		public void dispose() {
+			if (refIterator instanceof DisposableIterator) {
+				((DisposableIterator) refIterator).dispose();
+			}
+			refIterator = null;
+			featureStore = null;
+		}
+	}
+
+	/**
+	 * Facade over a Iterator of FeatureReferences, to return Features instead,
+	 * when the Selection is reversed
+	 * 
+	 * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+	 */
+	private class ReversedFeatureIteratorFacade implements DisposableIterator {
+
+		private SelectionData selectionData;
+
+		private DisposableIterator iterator;
+
+		private Feature nextFeature = null;
+
+		private FeatureSet featureSet;
+
+		public ReversedFeatureIteratorFacade(SelectionData selectionData,
+				FeatureStore featureStore, boolean fastIterator) {
+			this.selectionData = selectionData;
+
+			// Load a Set with all the store features
+			try {
+				featureSet = featureStore.getFeatureSet();
+				if (fastIterator) {
+					iterator = featureSet.fastIterator();
+				} else {
+					iterator = featureSet.iterator();
+				}
+			} catch (DataException ex) {
+				throw new ReversedSelectionIteratorException(ex);
+			}
+
+			// Filter the features not selected and position in the next
+			// selected feature
+			positionInNextElement();
+		}
+
+		public boolean hasNext() {
+			return nextFeature != null;
+		}
+
+		public Object next() {
+			Feature tmp = nextFeature.getCopy();
+			positionInNextElement();
+			return tmp;
+		}
+
+		public void remove() {
+			iterator.remove();
+		}
+
+		private void positionInNextElement() {
+			nextFeature = null;
+			while (iterator.hasNext()) {
+				nextFeature = (Feature) iterator.next();
+				if (selectionData.contains(nextFeature.getReference())) {
+					nextFeature = null;
+				} else {
+					break;
+				}
+			}
+		}
+
+		public void dispose() {
+			this.featureSet.dispose();
+			this.iterator.dispose();
+			this.selectionData = null;
+			this.nextFeature = null;
+		}
+	}
+
+	public void delete(Feature feature) throws DataException {
+		throw new UnsupportedOperationException();
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		throw new UnsupportedOperationException();
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		throw new UnsupportedOperationException();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection#
+	 * loadFromState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		super.loadFromState(state);
+
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		accept(visitor, 0);
+	}
+
+	public final void accept(Visitor visitor, long firstValueIndex)
+			throws BaseException {
+		try {
+			doAccept(visitor, firstValueIndex);
+		} catch (VisitCanceledException ex) {
+			// The visit has been cancelled by the visitor, so we finish here.
+			LOG.debug(
+					"The visit, beggining on position {}, has been cancelled "
+							+ "by the visitor: {}", new Long(firstValueIndex),
+					visitor);
+		}
+	}
+
+	private void doAccept(Visitor visitor, long firstValueIndex)
+			throws BaseException {
+		DisposableIterator iterator = fastIterator(firstValueIndex);
+
+		if (iterator != null) {
+			try {
+				while (iterator.hasNext()) {
+					Feature feature = (Feature) iterator.next();
+					visitor.visit(feature);
+				}
+			} finally {
+				iterator.dispose();
+			}
+		}
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		featureTypeCounts.clear();
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				DefaultFeatureSelection.class, "DefaultFeatureSelection",
+				"DefaultFeatureSelection Persistent definition", null, null);
+
+		definition.extend(manager.getDefinition(DefaultFeatureReferenceSelection.DYNCLASS_PERSISTENT_NAME));
+		definition.addDynFieldMap("featureTypeCounts")
+				.setClassOfItems(Long.class).setMandatory(false);
+
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		DefaultFeatureSelection clone = (DefaultFeatureSelection) super.clone();
+		clone.featureTypeCounts = new HashMap(featureTypeCounts);
+		return clone;
+	}
+
+    public DynObjectSet getDynObjectSet() {
+        return new DynObjectSetFeatureSetFacade(this, getFeatureStore());
+    }
+
+    public DynObjectSet getDynObjectSet(boolean fast) {
+        return new DynObjectSetFeatureSetFacade(this, getFeatureStore(), fast);
+    }
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java	(revision 35988)
@@ -0,0 +1,61 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.dal.feature.impl;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
+
+/**
+ * @author <a href="mailto:cordin@disid.com">C�sar Ordi�ana</a>
+ */
+public class DefaultFeatureSelectionHelper implements FeatureSelectionHelper {
+
+    private final DefaultFeatureStore store;
+
+    public DefaultFeatureSelectionHelper(DefaultFeatureStore store) {
+        this.store = store;
+    }
+
+    public FeatureCommandsStack getFeatureStoreCommandsStack() {
+        try {
+            return store.getCommandsStack();
+        } catch (DataException e) {
+            // Ignore
+            return null;
+        }
+    }
+
+    public long getFeatureStoreDeltaSize() {
+        // If the FeatureManager is present, and the store is in editing
+        // mode, the number of current Features may have changed.
+        if (store.isEditing() && store.getFeatureManager() != null) {
+            return store.getFeatureManager().getDeltaSize();
+        } else {
+            return 0;
+        }
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java	(revision 35988)
@@ -0,0 +1,155 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+ 
+
+package org.gvsig.fmap.dal.feature;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+
+
+/**
+ * This interface represents a local index on feature based data.
+ * 
+ * All indexes are stored in local files. Creating server 
+ * side indexes is not supported.
+ * 
+ * 
+ * @author jyarza
+ *
+ */
+public interface FeatureIndex {
+	
+	/** Index name */
+	public String getName();
+	
+	/** Attribute names */
+	public List getAttributeNames();
+	
+	/** Data type */
+	public int getDataType();
+	
+	/**
+	 * Inserts a Feature in the index.
+	 * The Feature must contain a column that matches this index's column (name and data type)
+	 * @param feat
+	 */
+	public void insert(Feature feat);
+
+	/**
+	 * Inserts a FeatureSet into this index
+	 * FeatureType is not checked so it will accept any FeatureType
+	 * as long as exists a column with a valid name
+	 */	
+	public void insert(FeatureSet data) throws DataException;
+	
+	/**
+	 * Deletes a Feature in the index.
+	 * The Feature must contain a column that matches this index's column (name and data type)
+	 * @param feat
+	 */
+	public void delete(Feature feat);
+
+	/**
+	 * Deletes a FeatureSet from this index
+	 * FeatureType is not checked so it will accept any FeatureType
+	 * as long as exists a column with a valid name
+	 */	
+	public void delete(FeatureSet data) throws FeatureIndexException;	
+	
+	/**
+	 * Returns a FeatureSet with the set of values that match the given value. 
+	 * 
+	 * @param value 
+	 * 			is the value to match.
+	 * @return
+	 * 		a FeatureSet containing the values in the index that match the given value.
+	 * 
+	 * @throws FeatureIndexException
+	 */
+	public FeatureSet getMatchFeatureSet(Object value)
+			throws FeatureIndexException;
+
+	/**
+	 * Returns a FeatureSet with the set of values that belong to the range defined by value1 and value2.
+	 * 
+	 * @param value1
+	 * 			range lower limit.
+	 * 
+	 * @param value2
+	 * 			range higher limit.
+	 * 
+	 * @return
+	 * 		a FeatureSet with the set of values that belong to the range defined by value1 and value2.
+	 * 
+	 * @throws FeatureIndexException
+	 */
+	public FeatureSet getRangeFeatureSet(Object value1, Object value2)
+			throws FeatureIndexException;
+
+	/**
+	 * Returns a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
+	 * 
+	 * @param count
+	 * 			maximum number of values that their resulting FeatureSet will return
+	 * 
+	 * @param value
+	 * 			the value around which the nearest <code>count</code> will be looked up.
+	 * 
+	 * @return
+	 * 		a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
+	 * 
+	 * @throws FeatureIndexException
+	 */
+	public FeatureSet getNearestFeatureSet(int count, Object value)
+			throws FeatureIndexException;
+
+	/**
+	 * Returns a FeatureSet with the set of up to <code>count</code> values whose distance to the given value
+	 * is not greater than <code>tolerance</code>
+	 * 
+	 * @param count
+	 * 			maximum number of values that their resulting FeatureSet will return
+	 * 
+	 * @param value
+	 * 			the value around which the nearest <code>count</code> will be looked up.
+	 * 
+	 * @param tolerance
+	 * 			maximum distance from the given value.
+	 * 
+	 * @return
+	 * 		a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
+	 * 
+	 * @throws FeatureIndexException
+	 */
+	public FeatureSet getNearestFeatureSet(int count, Object value, 
+			Object tolerance) throws FeatureIndexException;
+
+	
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java	(revision 35988)
@@ -0,0 +1,55 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+/**
+ * Represents a Feature validation rule. These rules are used to 
+ * check Feature state integrity in editing mode.
+ *
+ */
+public interface FeatureRule {
+	
+	/**
+	 * Returns the rule name
+	 * 
+	 * @return
+	 * 		the rule name
+	 */
+	public String getName();
+	
+	/**
+	 * Returns the rule description
+	 * 
+	 * @return
+	 * 		the rule description
+	 */
+	public String getDescription();
+	
+	/**
+	 * This is the method that applies this rule to the {@link Feature}, given also its associated {@link FeatureStore}.
+	 * @param feature
+	 * 			Feature to which apply the rule
+	 * @param featureStore
+	 * 			FeatureStore to which the Feature belongs
+	 * @throws DataException
+	 * 			if an error occurs during validation
+	 */
+	public void validate(Feature feature, FeatureStore featureStore)
+			throws DataException;
+	
+	/**
+	 * Indicates whether this rule should be checked at update.
+	 * 
+	 * @return
+	 * 		true if this rule should be checked at update, otherwise false.
+	 */
+	public boolean checkAtUpdate();
+	
+	/**
+	 * Returns true if this rule should be applied just when editing is being finished.
+	 *
+	 * @return	
+	 * 		true if this rule should be applied when editing is being finished, otherwise false.
+	 */
+	public boolean checkAtFinishEditing();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature.paging package documentation</title>
+</head>
+<body>
+
+<p>Utilities to perform paged loading of Features from a FeatureSet</p>
+
+</body>
+</html>
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java	(revision 35988)
@@ -0,0 +1,143 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Add pagination to a FeatureCollection}
+ */
+package org.gvsig.fmap.dal.feature.paging;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.tools.dynobject.DynObjectPagingHelper;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Helper interface to access the values of a FeatureCollection by position.
+ * 
+ * @author gvSIG team
+ */
+public interface FeaturePagingHelper extends DynObjectPagingHelper {
+
+    /**
+     * Returns the Feature located at the index position.
+     * 
+     * @param index
+     *            to locate the Feature in the Collection
+     * @return the Feature located at the index position
+     * @throws BaseException
+     *             if there is an error getting the Feature
+     */
+    Feature getFeatureAt(long index) throws BaseException;
+
+    /**
+     * Returns all the values of the current loaded page.
+     *
+     * @return all the values of the current loaded page
+     */
+    Feature[] getCurrentPageFeatures();
+
+    /**
+     * Returns the FeatureSet used to fetch the data.
+     *
+     * @return the FeatureSet
+     */
+    FeatureSet getFeatureSet();
+
+    /**
+     * Returns the FeatureStore used to fetch the data.
+     *
+     * @return the FeatureStore
+     */
+    FeatureStore getFeatureStore();
+
+    /**
+     * Returns the query used to load the Features.
+     *
+     * @return the query used to load the Features
+     */
+    FeatureQuery getFeatureQuery();
+
+	/**
+	 * Returns the FeatureType used of the data.
+	 *
+	 * @return the FeatureType of the data
+	 */
+	FeatureType getFeatureType();
+
+    /**
+     * Updates a {@link Feature} with the given {@link EditableFeature} in the
+     * current {@link FeatureSet}. <br>
+     * 
+     * @param feature
+     *            an instance of {@link EditableFeature} with which to update
+     *            the associated {@link Feature}.
+     * 
+     * @throws BaseException
+     * 
+     * @see {@link FeatureSet#update(EditableFeature)}
+     *      {@link FeaturePagingHelper#getFeatureSet()}
+     */
+	void update(EditableFeature feature) throws BaseException;
+
+    /**
+     * Deletes a {@link Feature} from current {@link FeatureSet}.<br>
+     * 
+     * @param feature
+     *            the {@link Feature} to delete.
+     * 
+     * @throws BaseException
+     * 
+     * @see {@link FeatureSet#delete(Feature)}
+     *      {@link FeaturePagingHelper#getFeatureSet()}
+     */
+	void delete(Feature feature) throws BaseException;
+
+    /**
+     * Inserts a new feature in this {@link FeatureSet}. It needs to be an
+     * instance of {@link EditableFeature} as it has not been stored yet.<br>
+     * 
+     * Any {@link Iterator} from this store that was still in use can will not
+     * reflect this change.
+     * 
+     * @param feature
+     *            the {@link EditableFeature} to insert.
+     * 
+     * @throws BaseException
+     * 
+     * @see {@link FeatureSet#insert(EditableFeature)}
+     *      {@link FeaturePagingHelper#getFeatureSet()}
+     */
+	void insert(EditableFeature feature) throws BaseException;
+
+	/**
+	 * Sets that the selected Features get returned first.
+	 */
+	void setSelectionUp(boolean selectionUp);
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java	(revision 35988)
@@ -0,0 +1,53 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+package org.gvsig.fmap.dal.feature.paging.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.tools.paging.PagingCalculator.Sizeable;
+
+/**
+ * @author 2010- C�sar Ordi�ana - gvSIG team
+ */
+public class FeatureSetSizeableDelegate implements Sizeable {
+
+	private static final Logger LOG =
+			LoggerFactory.getLogger(FeatureSetSizeableDelegate.class);
+
+	private final FeatureSet set;
+
+	public FeatureSetSizeableDelegate(FeatureSet set) {
+		this.set = set;
+	}
+
+	public long getSize() {
+		try {
+			return set.getSize();
+		} catch (DataException e) {
+			LOG.error("Error getting the size of the FeatureSet: " + set, e);
+			return 0l;
+		}
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java	(revision 35988)
@@ -0,0 +1,398 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create a JTable TableModel for a FeatureCollection}
+ */
+package org.gvsig.fmap.dal.feature.paging.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectFeatureFacade;
+import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.impl.DefaultDynObjectPagingHelper;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * Helper class to access the values of a FeatureCollection by position. Handles
+ * pagination automatically to avoid filling the memory in case of big
+ * collections.
+ * 
+ * TODO: evaluate if its more convenient to read values in the background when
+ * the returned value is near the end of the page, instead of loading a page on
+ * demand.
+ * 
+ * @author gvSIG Team
+ */
+public class FeaturePagingHelperImpl extends DefaultDynObjectPagingHelper
+    implements FeaturePagingHelper {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(FeaturePagingHelperImpl.class);
+
+    private FeatureQuery query;
+
+    private FeatureSet featureSet;
+
+    private FeatureStore featureStore;
+
+    /** If the selected Features must be returned as the first ones. **/
+    private boolean selectionUp = false;
+
+    private FeatureSelection initialSelection = null;
+
+    private Feature[] features = null;
+
+    /**
+     * Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
+     * 
+     * @param featureStore
+     *            to extract data from
+     * @throws DataException
+     *             if there is an error initializing the helper
+     */
+    public FeaturePagingHelperImpl(FeatureStore featureStore)
+        throws BaseException {
+        this(featureStore, DEFAULT_PAGE_SIZE);
+    }
+
+    /**
+     * Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
+     * 
+     * @param featureStore
+     *            to extract data from
+     * @param pageSize
+     *            the number of elements per page data
+     * @throws DataException
+     *             if there is an error initializing the helper
+     */
+    public FeaturePagingHelperImpl(FeatureStore featureStore, int pageSize)
+        throws BaseException {
+        this(featureStore, null, pageSize);
+    }
+
+    /**
+     * Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
+     * 
+     * @param featureStore
+     *            to extract data from
+     * @throws DataException
+     *             if there is an error initializing the helper
+     */
+    public FeaturePagingHelperImpl(FeatureStore featureStore,
+        FeatureQuery featureQuery) throws BaseException {
+        this(featureStore, featureQuery, DEFAULT_PAGE_SIZE);
+    }
+
+    /**
+     * Constructs a FeaturePagingHelperImpl from data of a FeatureStore.
+     * 
+     * @param featureSet
+     *            to extract data from
+     * @param pageSize
+     *            the number of elements per page data
+     * @throws DataException
+     *             if there is an error initializing the helper
+     */
+    public FeaturePagingHelperImpl(FeatureStore featureStore,
+        FeatureQuery featureQuery, int pageSize) throws BaseException {
+        super();
+        FeatureQuery query = featureQuery;
+        if (featureQuery == null) {
+            query = featureStore.createFeatureQuery();
+            query.setFeatureType(featureStore.getDefaultFeatureType());
+        }
+
+        this.featureStore = featureStore;
+        this.query = query;
+        this.query.setPageSize(pageSize);
+        loadFeatureSet();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("FeaturePagingHelperImpl created with {} pages, "
+                + "and a page size of {}", new Long(getCalculator()
+                .getNumPages()), new Integer(pageSize));
+        }
+    }
+
+    /**
+     * @return the selectionUp status
+     */
+    protected boolean isSelectionUp() {
+        return selectionUp;
+    }
+
+    public void setSelectionUp(boolean selectionUp) {
+        this.selectionUp = selectionUp;
+        try {
+            if (selectionUp) {
+                initialSelection =
+                    (FeatureSelection) getFeatureStore().getFeatureSelection()
+                        .clone();
+                setCalculator(new OneSubsetOneSetPagingCalculator(
+                    new FeatureSetSizeableDelegate(initialSelection),
+                    new FeatureSetSizeableDelegate(getFeatureSet()),
+                    getMaxPageSize()));
+            } else {
+                if (initialSelection != null) {
+                    initialSelection.dispose();
+                    initialSelection = null;
+                }
+                setDefaultCalculator(new FeatureSetSizeableDelegate(
+                    getFeatureSet()), getMaxPageSize());
+            }
+        } catch (BaseException e) {
+            LOG.error("Error setting the selection up setting to: "
+                + selectionUp, e);
+        } catch (CloneNotSupportedException e) {
+            LOG.error("Error cloning the selection "
+                + "while setting the selection up", e);
+        }
+    }
+
+    public Feature getFeatureAt(long index) throws BaseException {
+        // Check if we have currently loaded the viewed page data,
+        // or we need to load a new one
+        long pageForIndex = (long) Math.floor(index / getMaxPageSize());
+
+        if (pageForIndex != getCurrentPage()) {
+            setCurrentPage(pageForIndex);
+        }
+
+        long positionForIndex = index - (getCurrentPage() * getMaxPageSize());
+
+        return features[(int) positionForIndex];
+    }
+
+    public Feature[] getCurrentPageFeatures() {
+        return features;
+    }
+
+    public FeatureSet getFeatureSet() {
+        return featureSet;
+    }
+
+    public void reloadCurrentPage() throws BaseException {
+        setSelectionUp(false);
+        if (getCalculator().getCurrentPage() > -1) {
+            loadCurrentPageData();
+        }
+    }
+
+    public void reload() throws BaseException {
+        loadFeatureSet();
+        reloadCurrentPage();
+    }
+
+    public FeatureStore getFeatureStore() {
+        return featureStore;
+    }
+
+    public FeatureQuery getFeatureQuery() {
+        return query;
+    }
+
+    /**
+     * Loads all the Features of the current page.
+     */
+    protected void loadCurrentPageData() throws BaseException {
+        final int currentPageSize = getCalculator().getCurrentPageSize();
+        final Feature[] values = new Feature[currentPageSize];
+
+        long t1 = 0;
+        if (LOG.isTraceEnabled()) {
+            t1 = System.currentTimeMillis();
+        }
+
+        if (selectionUp) {
+            loadCurrentPageDataWithSelectionUp(values);
+        } else {
+            loadCurrentPageDataNoSelection(values);
+        }
+
+        if (LOG.isTraceEnabled()) {
+            long t2 = System.currentTimeMillis();
+            LOG.trace("Time to load {} features: {} ms", new Integer(
+                currentPageSize), new Long(t2 - t1));
+        }
+
+        this.features = values;
+    }
+
+    private void loadCurrentPageDataWithSelectionUp(final Feature[] values)
+        throws BaseException {
+        FeatureSelection selection = initialSelection;
+
+        OneSubsetOneSetPagingCalculator twoSetsCalculator = null;
+        if (getCalculator() instanceof OneSubsetOneSetPagingCalculator) {
+            twoSetsCalculator =
+                (OneSubsetOneSetPagingCalculator) getCalculator();
+        } else {
+            twoSetsCalculator =
+                new OneSubsetOneSetPagingCalculator(
+                    new FeatureSetSizeableDelegate(selection),
+                    new FeatureSetSizeableDelegate(getFeatureSet()),
+                    getMaxPageSize(), getCalculator().getCurrentPage());
+            setCalculator(twoSetsCalculator);
+        }
+
+        // First load values from the selection, if the current page has
+        // elements from it
+        if (twoSetsCalculator.hasCurrentPageAnyValuesInFirstSet()) {
+            loadDataFromFeatureSet(values, 0, selection,
+                twoSetsCalculator.getFirstSetInitialIndex(),
+                twoSetsCalculator.getFirstSetHowMany(), null);
+        }
+        // Next, load values from the FeatureSet if the current page has values
+        // from it
+        if (twoSetsCalculator.hasCurrentPageAnyValuesInSecondSet()) {
+            loadDataFromFeatureSet(
+                values,
+                // The cast will work as that size will be <= maxpagesize,
+                // which is an int
+                (int) twoSetsCalculator.getFirstSetHowMany(), getFeatureSet(),
+                twoSetsCalculator.getSecondSetInitialIndex(),
+                twoSetsCalculator.getSecondSetHowMany(), selection);
+        }
+    }
+
+    private void loadCurrentPageDataNoSelection(final Feature[] values)
+        throws DataException {
+
+        long firstPosition = getCalculator().getInitialIndex();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Loading {} Features starting at position {}",
+                new Integer(getCalculator().getCurrentPageSize()), new Long(
+                    firstPosition));
+        }
+
+        loadDataFromFeatureSet(values, 0, getFeatureSet(), firstPosition,
+            getCalculator().getCurrentPageSize(), null);
+    }
+
+    private void loadDataFromFeatureSet(final Feature[] values,
+        final int valuesPosition, FeatureSet set, long initialIndex,
+        final long howMany, final FeatureSelection selectedFeaturesToSkip)
+        throws DataException {
+
+        try {
+            set.accept(new Visitor() {
+
+                private int i = valuesPosition;
+
+                public void visit(Object obj) throws VisitCanceledException,
+                    BaseException {
+                    if (i >= valuesPosition + howMany) {
+                        throw new VisitCanceledException();
+                    }
+                    Feature current = (Feature) obj;
+                    // Add the current Feature only if we don't skip selected
+                    // features or the feature is not selected
+                    if (selectedFeaturesToSkip == null
+                        || !selectedFeaturesToSkip.isSelected(current)) {
+                        values[i] = current.getCopy();
+                        i++;
+                    }
+                }
+            }, initialIndex);
+        } catch (BaseException e) {
+            if (e instanceof DataException) {
+                throw ((DataException) e);
+            } else {
+                LOG.error("Error loading the data starting at position {}",
+                    new Long(initialIndex), e);
+            }
+        }
+    }
+
+    private void loadFeatureSet() throws BaseException {
+        if (featureSet != null) {
+            featureSet.dispose();
+        }
+        featureSet = getFeatureStore().getFeatureSet(getFeatureQuery());
+        setDynObjectSet(featureSet.getDynObjectSet(), getMaxPageSize());
+    }
+
+    public void delete(Feature feature) throws BaseException {
+        if (featureSet == null) {
+            // FIXME change to RuntimeDalException
+            throw new IllegalStateException();
+        }
+        featureSet.delete(feature);
+        reloadCurrentPage();
+    }
+
+    public void insert(EditableFeature feature) throws BaseException {
+        if (featureSet == null) {
+            // FIXME change to RuntimeDalException
+            throw new IllegalStateException();
+        }
+        featureSet.insert(feature);
+        reloadCurrentPage();
+    }
+
+    public void update(EditableFeature feature) throws BaseException {
+        if (featureSet == null) {
+            // FIXME change to RuntimeDalException
+            throw new IllegalStateException();
+        }
+        featureSet.update(feature);
+        reloadCurrentPage();
+    }
+
+    public FeatureType getFeatureType() {
+        return featureSet.getDefaultFeatureType();
+    }
+
+    protected void doDispose() throws BaseException {
+        initialSelection.dispose();
+        featureSet.dispose();
+    }
+
+    public DynObject[] getCurrentPageDynObjects() {
+        Feature[] features = getCurrentPageFeatures();
+        DynObject[] dynobjects = new DynObject[features.length];
+        for (int i = 0; i < dynobjects.length; i++) {
+            dynobjects[i] = new DynObjectFeatureFacade(features[i]);
+        }
+        return dynobjects;
+    }
+
+    public DynObject getDynObjectAt(long index) throws BaseException {
+        return new DynObjectFeatureFacade(getFeatureAt(index));
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java	(revision 35988)
@@ -0,0 +1,179 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+package org.gvsig.fmap.dal.feature.paging.impl;
+
+import org.gvsig.tools.paging.DefaultPagingCalculator;
+
+/**
+ * Performs the calculations needed to be able to do pagination with two Sets of
+ * data which must be viewed as a single set of data. The first set is supposed
+ * to be a subset of the second one, so the size of the first set must be
+ * subtracted from the second one.
+ * 
+ * @author gvSIG team
+ */
+public class OneSubsetOneSetPagingCalculator extends DefaultPagingCalculator {
+
+    private final Sizeable firstSet;
+    private final Sizeable secondSet;
+
+    /**
+     * @see AbstractPagingCalculator#AbstractPagingCalculator(int).
+     * @param firstSet
+     *            the first set of elements to calculate pagination for
+     * @param secondSet
+     *            the second set of elements to calculate pagination for
+     */
+    public OneSubsetOneSetPagingCalculator(Sizeable firstSet,
+        Sizeable secondSet, int maxPageSize) {
+        super(firstSet, maxPageSize);
+        this.firstSet = firstSet;
+        this.secondSet = secondSet;
+    }
+
+    /**
+     * @see AbstractPagingCalculator#AbstractPagingCalculator(int, long).
+     * @param firstSet
+     *            the first set of elements to calculate pagination for
+     * @param secondSet
+     *            the second set of elements to calculate pagination for
+     */
+    public OneSubsetOneSetPagingCalculator(Sizeable firstSet,
+        Sizeable secondSet, int maxPageSize, long currentPage) {
+        super(firstSet, maxPageSize, currentPage);
+        this.firstSet = firstSet;
+        this.secondSet = secondSet;
+    }
+
+    public long getTotalSize() {
+        return secondSet.getSize();
+    }
+
+    /**
+     * Returns the size of the first set.
+     * 
+     * @return the first set size
+     */
+    public long getFirstSetSize() {
+        return firstSet.getSize();
+    }
+
+    /**
+     * Returns the size of the second set.
+     * 
+     * @return the second set size
+     */
+    public long getSecondSetSize() {
+        return secondSet.getSize() - getFirstSetSize();
+    }
+
+    /**
+     * Returns the index of the first element in the page which is available
+     * into the first set, if the current page has elements on it.
+     * 
+     * @return the index of the first element into the first set
+     */
+    public long getFirstSetInitialIndex() {
+        if (hasCurrentPageAnyValuesInFirstSet()) {
+            return calculateFirstSetInitialIndex();
+        } else {
+            return -1;
+        }
+    }
+
+    private long calculateFirstSetInitialIndex() {
+        return getCurrentPage() * getMaxPageSize();
+    }
+
+    /**
+     * Returns the index of the first element in the page which is available
+     * into the second set, if the current page has elements on it.
+     * 
+     * @return the index of the first element into the second set
+     */
+    public long getSecondSetInitialIndex() {
+        if (hasCurrentPageAnyValuesInSecondSet()) {
+            if (hasCurrentPageAnyValuesInFirstSet()) {
+                return 0;
+            } else {
+                return getInitialIndex() - getFirstSetSize();
+            }
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * Returns the number of elements of the current page into the first set.
+     * 
+     * @return the number of elements of the current page into the first set
+     */
+    public long getFirstSetHowMany() {
+        if (hasCurrentPageAnyValuesInFirstSet()) {
+            return (hasCurrentPageAllValuesInFirstSet()) ? getCurrentPageSize()
+                : (getFirstSetSize() - calculateFirstSetInitialIndex());
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns the number of elements of the current page into the second set.
+     * 
+     * @return the number of elements of the current page into the second set
+     */
+    public long getSecondSetHowMany() {
+        if (hasCurrentPageAnyValuesInSecondSet()) {
+            return getLastIndex() - getFirstSetSize()
+                - getSecondSetInitialIndex() + 1;
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns if the current page has all its values into the first set.
+     * 
+     * @return if the current page has all its values into the first set
+     */
+    protected boolean hasCurrentPageAllValuesInFirstSet() {
+        return calculateFirstSetInitialIndex() + getCurrentPageSize() <= getFirstSetSize();
+    }
+
+    /**
+     * Returns if the current page has any of its values into the first set.
+     * 
+     * @return if the current page has any of its values into the first set
+     */
+    public boolean hasCurrentPageAnyValuesInFirstSet() {
+        return calculateFirstSetInitialIndex() < getFirstSetSize();
+    }
+
+    /**
+     * Returns if the current page has any of its values into the second set.
+     * 
+     * @return if the current page has any of its values into the second set
+     */
+    public boolean hasCurrentPageAnyValuesInSecondSet() {
+        return getLastIndex() >= getFirstSetSize();
+    }
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java	(revision 35988)
@@ -0,0 +1,137 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.tools.evaluator.Evaluator;
+
+/**
+ * This interface represents a FeatureType in editable state. 
+ * To edit a FeatureType you have to obtain its instance of 
+ * EditableFeatureType and then perform editing operations on it.
+ * 
+ * Once you have completed the editing you can save the changes to the original 
+ * FeatureType. This is the only way to edit a FeatureType.
+ */
+public interface EditableFeatureType extends FeatureType {
+
+	/**
+	 * Sets the default geometry attribute name
+	 * 
+	 * @param name
+	 * 			string containing the default geometry attribute name
+	 */
+	public void setDefaultGeometryAttributeName(String name);
+
+	/**
+	 * Removes an attribute from this EditableFeatureType, given
+	 * a reference to its descriptor.
+	 * 
+	 * @param attribute
+	 * 				descriptor of the attribute to remove
+	 * 
+	 * @return
+	 * 		true if the attribute was removed successfully, false if not.
+	 */
+	public boolean remove(EditableFeatureAttributeDescriptor attribute);
+
+	/**
+	 * Removes an attribute given its name
+	 * 
+	 * @param name
+	 * 			string containing the name of the attribute to be removed
+	 * @return
+	 * 		
+	 */
+	public Object remove(String name);
+
+	/**
+	 * Removes an attribute given its index
+	 * 
+	 * @param index
+	 * 			position of the attribute to be removed
+	 * 
+	 * @return
+	 * 		
+	 */
+	public Object remove(int index);
+
+	/**
+	 * Adds an attribute to this EditableFeatureType. 
+	 * @param name
+	 * 			string containing the name of the attribute
+	 * @param type
+	 * 			data type of the attribute (one from {@link DataTypes})
+	 * 
+	 * @return a new EditableFeatureAttributeDescriptor
+	 */
+	public EditableFeatureAttributeDescriptor add(String name, int type);
+
+	/**
+	 * Adds an attribute to this EditableFeatureType.
+	 *  
+	 * @param name
+	 * 			string containing the name of the attribute
+	 * 
+	 * @param type
+	 * 			data type of the attribute (one from {@link DataTypes})
+	 * 
+	 * @param size
+	 * 			size of the attribute.
+	 * 
+	 * @return a new EditableFeatureAttributeDescriptor
+	 */
+	public EditableFeatureAttributeDescriptor add(String name, int type,
+			int size);
+
+	/**
+	 * Adds a calculated attribute to this EditableFeatureType.
+	 *  
+	 * @param name
+	 * 			string containing the name of the attribute
+	 * 
+	 * @param type
+	 * 			data type of the attribute (one from {@link DataTypes})
+	 * 
+	 * @param evaluator
+	 * 			an evaluator containing the desired expression
+	 * 
+	 * @return a new EditableFeatureAttributeDescriptor
+	 */	
+	public EditableFeatureAttributeDescriptor add(String name, int type,
+			Evaluator evaluator);
+
+	/**
+	 * Returns the associated FeatureType.
+	 *  
+	 * @return the associated FeatureType
+	 */
+	public FeatureType getSource();
+
+	/**
+	 * Returns a copy of the associated FeatureType.
+	 * 
+	 * @return associated FeatureType
+	 */
+	public FeatureType getNotEditableCopy();
+
+	/**
+	 * Sets whether this EditableFeatureType has an OID.
+	 * An OID is a unique serializable reference to a feature
+	 * (a primary key of sorts that may or may not be defined 
+	 * by the store). If the store does not define this OID then
+	 * it will be generated by the feature reference itself.
+	 * 
+	 * Its main use is to provide a way to persist data associated 
+	 * to a feature by this OID.
+	 * 
+	 * @param hasOID true if it has an OID, or false if not.
+	 */
+	public void setHasOID(boolean hasOID);
+	
+	/**
+	 * Sets the default time attribute name
+     * 
+     * @param name
+     *          string containing the default time attribute name
+	 */
+	public void setDefaultTimeAttributeName(String name);
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java	(revision 35988)
@@ -0,0 +1,110 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Abstract feature store transform intended for giving a partial default implementation 
+ * of the {@link FeatureStoreTransform} interface to other transform implementations. It is recommended
+ * to extend this class when implementing new {@link FeatureStoreTransform}s.
+ * 
+ */
+public abstract class AbstractFeatureStoreTransform implements
+FeatureStoreTransform {
+	public static final String ABSTRACT_FEATURESTORE_DYNCLASS_NAME = "AbstractFeatureStoreTransform";
+
+	private FeatureStore store;
+
+	private FeatureType defaultFeatureType = null;
+	private List featureTypes = new ArrayList();
+
+    protected String name;
+
+    protected String descripcion;
+
+	
+    
+    public AbstractFeatureStoreTransform() {
+        this("", "");
+    }
+
+    public AbstractFeatureStoreTransform(String name, String description) {
+        if( name == null || "".equals(name) ) {
+            this.name = this.getClass().getSimpleName();
+        } else {
+            this.name = name;
+        }
+        this.descripcion = description;
+    }
+    
+	public String getDescription() {
+	    return this.descripcion;
+	}
+	
+	public String getName() {
+	    return this.name;
+	}
+	
+	public FeatureType getDefaultFeatureType() throws DataException {
+		return defaultFeatureType;
+	}
+
+	public List getFeatureTypes() throws DataException {
+		return featureTypes;
+	}
+
+	public void setFeatureStore(FeatureStore store) {
+		this.store = store;
+	}
+
+	public FeatureStore getFeatureStore() {
+		return store;
+	}
+
+	protected void setFeatureTypes(List types, FeatureType defaultType) {
+		this.featureTypes.clear();
+		this.featureTypes.addAll(types);
+		this.defaultFeatureType = defaultType;
+	}
+
+	public static void registerPersistent() {
+		DynStruct definition = ToolsLocator.getPersistenceManager().addDefinition(
+				AbstractFeatureStoreTransform.class, 
+				ABSTRACT_FEATURESTORE_DYNCLASS_NAME, 
+				"AbstractFeatureStoreTransform Persistent definition", 
+				null, 
+				null
+			);
+		
+		definition.addDynFieldObject("store")
+			.setClassOfValue(FeatureStore.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("defaultFeatureType")
+			.setClassOfValue(FeatureType.class)
+			.setMandatory(true);
+		definition.addDynFieldList("featureTypes")
+			.setClassOfItems(FeatureType.class)
+			.setMandatory(true);
+
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		this.store = (FeatureStore) state.get("store");
+		this.defaultFeatureType = (FeatureType) state.get("defaultFeatureType");
+		this.featureTypes = new ArrayList(state.getList("featureTypes"));
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("store", store);
+		state.set("defaultFeatureType", defaultFeatureType);
+		state.set("featureTypes", featureTypes);
+	}
+
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java	(revision 35988)
@@ -0,0 +1,270 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.evaluator.Evaluator;
+
+/**
+ * <p>
+ * This interface provides all the information that describes the structure of
+ * a type of feature, methods for managing it and also offers a variety of utility
+ * methods for simplicity's sake.
+ * </p>
+ *
+ * <p>
+ * The relevant information that compounds a FeatureType includes:
+ * </p>
+ *
+ *  <ul>
+ *  <li> {@link FeatureAttributeDescriptor}(s)
+ *  <li> {@link FeatureRule}(s)
+ *  <li> Its size
+ *  <li> Its SRS(s)
+ *  <li> Its identifier
+ *  <li> Whether features of this type have an OID or not (identifier assigned by the store).
+ * </ul>
+ *
+ * <p>
+ * Methods for management include:
+ * </p>
+ *
+ *  <ul>
+ *  <li>Obtaining its editable instance.
+ *  <li>Obtaining an iterator over its attributes.
+ *  <li>Knowing whether this FeatureType has any associated evaluator for calculated attributes.
+ *  </ul>
+ *
+ * <p>
+ * Utility methods include:
+ * </p>
+ *
+ * <ul>
+ * <li>Getting a copy of the FeatureType.
+ * <li>Getting the default geometry attribute.
+ * <li>Getting the default spatial reference system.
+ * <ul/>
+ */
+public interface FeatureType extends DynClass {
+
+	/**
+	 * Returns a new copy of this FeatureType
+	 *
+	 * @return
+	 * 		a new copy of this FeatureType
+	 */
+	public FeatureType getCopy();
+
+	/**
+	 * Returns a {@link FeatureRules} containing
+	 * all rules applicable to features of this type.
+	 *
+	 * @return
+	 * 		a {@link FeatureRules} containing all rules
+	 * 		applicable to features of this type.
+	 */
+	public FeatureRules getRules();
+
+	/**
+	 * Returns an editable instance of this FeatureType.
+	 * Any modifications on a FeatureType must be done
+	 * through its editable instance.
+	 *
+	 * @return
+	 * 		the editable instance of this FeatureType.
+	 *
+	 * @see EditableFeatureType
+	 */
+	public EditableFeatureType getEditable();
+
+	/**
+	 * Given the name of an attribute, this method returns
+	 * its position in this FeatureType.
+	 *
+	 * @param name
+	 * 			of the attribute
+	 * @return
+	 * 		position of the attribute
+	 */
+	public int getIndex(String name);
+
+	/**
+	 * Returns an attribute descriptor given its name.
+	 *
+	 * @param name
+	 * 			of the attribute
+	 * @return
+	 * 		descriptor of the attribute, a {@link FeatureAttributeDescriptor}.
+	 */
+	public Object get(String name);
+
+	/**
+	 * Returns an attribute descriptor given its index
+	 *
+	 * @param index
+	 * 			of the attribute
+	 *
+	 * @return
+	 * 		descriptor of the attribute, a {@link FeatureAttributeDescriptor}
+	 */
+	public Object get(int index);
+
+	/**
+	 * Returns a {@link FeatureAttributeDescriptor} given the attribute name.
+	 *
+	 * @param name
+	 * 			of the attribute
+	 *
+	 * @return
+	 * 		a {@link FeatureAttributeDescriptor}
+	 */
+	public FeatureAttributeDescriptor getAttributeDescriptor(String name);
+
+	/**
+	 * Returns a {@link FeatureAttributeDescriptor} given the attribute index.
+	 *
+	 * @param index
+	 * 			of the attribute
+	 *
+	 * @return
+	 * 		a {@link FeatureAttributeDescriptor}
+	 */
+	public FeatureAttributeDescriptor getAttributeDescriptor(int index);
+
+	/**
+	 * Returns an iterator over this FeatureType's attributes. Elements
+	 * returned by this iterator are of type {@link FeatureAttributeDescriptor}.
+	 *
+	 * @return
+	 * 		An iterator over this FeatureType's {@link FeatureAttributeDescriptor}s.
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Returns this FeatureType size. The size of a FeatureType is determined
+	 * by its number of attributes.
+	 *
+	 * @return
+	 * 		this FeatureType size, defined as the number of attributes it is composed of.
+	 *
+	 */
+	public int size();
+
+	/**
+	 * Returns this FeatureType identifier. This identifier must always be equal
+	 * to a store.
+	 *
+	 * @return the identifier.
+	 */
+	public String getId();
+
+	/**
+	 * Returns the name of the attribute that will be used as default
+	 * geometry attribute for those processes that require a geometry (for
+	 * instance rendering).
+	 *
+	 * @return
+	 * 		name of the default geometry attribute.
+	 */
+	public String getDefaultGeometryAttributeName();
+
+	/**
+	 * Returns the index of the attribute that will be used as default
+	 * geometry attribute.
+	 *
+	 * @return
+	 * 		index of the default geometry attribute.
+	 */
+	public int getDefaultGeometryAttributeIndex();
+
+	/**
+	 * Returns a list with the SRSs in which this FeatureType geometries are
+	 * expressed. Normally there may be one SRS for each attribute of type
+	 * {@link Geometry}.
+	 *
+	 * @return
+	 * 		a list with the SRS in which this FeatureType geometries are expressed.
+	 */
+	public List getSRSs();
+
+	/**
+	 * Returns the SRS in which the default geometry attribute is expressed.
+	 *
+	 * @return
+	 * 		the SRS in which the default geometry attribute is expressed,
+	 *      null if not has a default geometry attribute.
+	 */
+	public IProjection getDefaultSRS();
+
+	/**
+	 * Indicates whether this FeatureType has any assigned {@link Evaluator}(s).
+	 * Evaluators are used to obtain the values for calculated
+	 * attributes.
+	 *
+	 * @return
+	 * 		true if this FeatureType has any assigned {@link Evaluator}(s).
+	 */
+	public boolean hasEvaluators(); // FIXME: Quitar del interface y dejar en DefaultFeatureType
+
+	/**
+	 * Indicates whether {@link Feature}(s) of this FeatureType have an OID defined.
+	 * An OID is the Feature unique identifier.
+	 *
+	 * Some stores provide their own OIDs which are always unique
+	 * (such as Postgre) while others don't support this concept and
+	 * then it is the library who creates runtime ad-hoc OIDs as
+	 * it see fits, but then integrity of this OIDs among different
+	 * work sessions cannot be guaranteed (this is the case for shape
+	 * files).
+	 *
+	 * @return
+	 * 		true if this FeatureType has an OID defined, false otherwise.
+	 *
+	 */
+	public boolean hasOID();
+
+	/**
+	 * Incicates if attibutes with automatic values are allowed in the source
+	 *
+	 * @return true if source supports this feature, false otherwise
+	 */
+	public boolean allowAutomaticValues();
+
+	/**
+	 * Returns an Array of the FeatureAttributeDescriptor
+	 *
+	 * @return
+	 */
+	public FeatureAttributeDescriptor[] getAttributeDescriptors();
+
+	/**
+	 * Returns an Array of the FeatureAttributeDescriptor that compounds the
+	 * primary key
+	 *
+	 * @return
+	 */
+	public FeatureAttributeDescriptor[] getPrimaryKey();
+
+	/**
+	 * Returns the default geometry FeatureAttributeDescriptor. Return null if
+	 * it's not set
+	 *
+	 * @return
+	 */
+	public FeatureAttributeDescriptor getDefaultGeometryAttribute();
+	
+	/**
+     * Returns the default time FeatureAttributeDescriptor. Return null if
+     * it's not set.
+     *
+     * @return
+     *          the default time attribute
+     */
+	public FeatureAttributeDescriptor getDefaultTimeAttribute();
+
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java	(revision 35988)
@@ -0,0 +1,94 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+/**
+ * This is a container for FeatureRules.
+ * Besides getting a rule by index, this structure allows 
+ * adding a rule, removing a rule, iterating over the rules and copying 
+ * the whole structure.
+ *
+ */
+public interface FeatureRules {
+
+	/**
+	 * Returns an object given its index.
+	 * 
+	 * @param index
+	 * 			a position in this <code>FeatureRules</code>
+	 * @return
+	 * 		the object found in the given index
+	 */
+	public Object get(int index);
+
+	/**
+	 * Returns a {@link FeatureRule} given its index.
+	 * 
+	 * @param index
+	 * 			a position in this <code>FeatureRules</code>
+	 * @return
+	 * 		the {@link FeatureRule} found in the given index
+	 */
+	
+	public FeatureRule getRule(int index);
+
+	/**
+	 * Adds a new rule to this FeatureRules.
+	 * 
+	 * @param rule
+	 * 			the new rule to add.
+	 * @return
+	 * 		the added rule
+	 */
+	public FeatureRule add(FeatureRule rule);
+
+	/**
+	 * Returns the number of rules contained in this FeatureRules.
+	 * 
+	 * @return
+	 * 		number of rules in this FeatureRules
+	 */
+	public int size();
+
+	/**
+	 * Clears this FeatureRules from any rules.
+	 */
+	public void clear();
+
+	/**
+	 * Removes the rule stored in the given index.
+	 * 
+	 * @param index
+	 * 			index of the rule to remove.
+	 * @return
+	 * 		returns the removed rule
+	 */
+	public Object remove(int index);
+
+	/**
+	 * Removes the given rule from this FeatureRules.
+	 * 
+	 * @param rule
+	 * 			FeatureRule to remove
+	 * @return
+	 * 		true indicates success, false indicates that it was not found.
+	 */
+	public boolean remove(FeatureRule rule);
+
+	/**
+	 * Returns an iterator over the available {@link FeatureRule}(s)
+	 * 
+	 * @return
+	 * 		an iterator over the available {@link FeatureRule}(s)
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Returns a new copy of this FeatureRules.
+	 * 
+	 * @return
+	 * 		a new copy of this FeatureRules.
+	 */
+	public FeatureRules getCopy();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java	(revision 35988)
@@ -0,0 +1,10 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.NewDataStoreParameters;
+
+public interface NewFeatureStoreParameters extends NewDataStoreParameters {
+
+	public void setDefaultFeatureType(FeatureType defaultFeatureType);
+
+	public FeatureType getDefaultFeatureType();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java	(revision 35988)
@@ -0,0 +1,92 @@
+
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.dal.feature;
+
+
+/**
+ * Abstract feature rule intended for giving a partial default implementation 
+ * of the {@link FeatureRule} interface to other rule implementations. It is recommended
+ * to extend this class when implementing new {@link FeatureRule}s.
+ * 
+ * @author Vicente Caballero Navarro
+ */
+public abstract class AbstractFeatureRule implements FeatureRule {
+	protected String name;
+	protected String description;
+	protected boolean checkAtUpdate;
+	protected boolean checkAtFinishEdition;
+
+	protected AbstractFeatureRule(String name, String description) {
+		this.init(name,description,true,true);
+	}
+
+	protected AbstractFeatureRule(String name, String description,
+			boolean checkAtUpdate, boolean checkAtFinishEdition) {
+		this.init(name, description, checkAtUpdate, checkAtFinishEdition);
+	}
+
+	protected void init(String name, String description, boolean checkAtUpdate,
+			boolean checkAtFinishEdition) {
+		this.name=name;
+		this.description=description;
+		this.checkAtUpdate = checkAtUpdate;
+		this.checkAtFinishEdition = checkAtFinishEdition;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public boolean checkAtFinishEditing() {
+		return this.checkAtFinishEdition;
+	}
+
+	public boolean checkAtUpdate() {
+		return this.checkAtUpdate;
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 35988)
@@ -0,0 +1,679 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.undo.UndoRedoStack;
+
+/**
+ * <p>
+ * A FeatureStore is a type of store whose data consists on sets of
+ * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
+ * different {@link FeatureType}(s) (as in GML format for instance).
+ * </p>
+ * 
+ * <p>
+ * FeatureStore allows:
+ * </p>
+ * <ul>
+ * <li>Obtaining the default {@link FeatureType}. A FeatureStore always has one
+ * and only one default FeatureType.
+ * <li>Obtaining the list of {@link FeatureType}(s) defined in the FeatureStore.
+ * <li>Obtaining, filtering and sorting subsets of data ({@link FeatureSet})
+ * through {@link FeatureQuery}, as well as background loading.
+ * <li>Obtaining the total {@link Envelope} (AKA bounding box or extent) of the
+ * store.
+ * <li>Support for editing {@link FeatureType}(s).
+ * <li>Obtaining information about contained {@link Geometry} types.
+ * <li>Exporting to another store.
+ * <li>Indexing.
+ * <li>Selection.
+ * <li>Locks management.
+ * </ul>
+ * 
+ */
+public interface FeatureStore extends DataStore, UndoRedoStack {
+
+    public static final String METADATA_DEFINITION_NAME = "FeatureStore";
+
+    /** Indicates that this store is in query mode */
+    final static int MODE_QUERY = 0;
+
+    /** Indicates that this store is in full edit mode */
+    final static int MODE_FULLEDIT = 1;
+
+    /** Indicates that this store is in append mode */
+    final static int MODE_APPEND = 2;
+
+    /*
+     * =============================================================
+     * 
+     * information related services
+     */
+
+    /**
+     * Indicates whether this store allows writing.
+     * 
+     * @return
+     *         true if this store can be written, false if not.
+     */
+    public boolean allowWrite();
+
+    /**
+     * Returns this store's default {@link FeatureType}.
+     * 
+     * @return
+     *         this store's default {@link FeatureType}.
+     * 
+     * @throws DataException
+     */
+    public FeatureType getDefaultFeatureType() throws DataException;
+
+    /**
+     * Returns this store's featureType {@link FeatureType} matches with
+     * featureTypeId.
+     * 
+     * @param featureTypeId
+     * 
+     * @return this store's default {@link FeatureType}.
+     * 
+     * @throws DataException
+     */
+    public FeatureType getFeatureType(String featureTypeId)
+        throws DataException;
+
+    /**
+     * Returns this store's {@link FeatureType}(s).
+     * 
+     * @return a list with this store's {@link FeatureType}(s).
+     * 
+     * @throws DataException
+     */
+    public List getFeatureTypes() throws DataException;
+
+    /**
+     * Returns this store's parameters.
+     * 
+     * @return
+     *         {@link DataStoreParameters} containing this store's parameters
+     */
+    public DataStoreParameters getParameters();
+
+    /**
+     *@throws DataException
+     * @deprecated Mirar de cambiarlo a metadatos
+     */
+    public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
+
+    /**
+     * Returns this store's total envelope (extent).
+     * 
+     * @return this store's total envelope (extent) or <code>null</code> if
+     *         store not have geometry information
+     */
+    public Envelope getEnvelope() throws DataException;
+
+    /**
+     * 
+     * @deprecated use getDefaultFeatureType().getDefaultSRS()
+     * @return
+     * @throws DataException
+     */
+    public IProjection getSRSDefaultGeometry() throws DataException;
+
+    /**
+     * Exports this store to another store.
+     * 
+     * @param explorer
+     *            {@link DataServerExplorer} target
+     * @param params
+     *            New parameters of this store that will be used on the target
+     *            explorer
+     * 
+     * @throws DataException
+     * 
+     * @Deprecated this method is unstable
+     */
+    public void export(DataServerExplorer explorer, String provider,
+        NewFeatureStoreParameters params) throws DataException;
+
+    /*
+     * =============================================================
+     * 
+     * Query related services
+     */
+
+    /**
+     * Returns all available features in the store.
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get a 
+     * {@link FeatureSet}, you  must get sure it is disposed 
+	 * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
+	 * error occurs while getting the data. It is recommended to use the 
+	 * <code>accept</code> methods instead, which handle everything for you. 
+	 * Take into account the accept methods may use a fast iterator to 
+	 * get the features.
+	 * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor)
+     * 
+     * @return a collection of features
+     * @throws ReadException
+     *             if there is any error while reading the features
+     */
+    FeatureSet getFeatureSet() throws DataException;
+
+    /**
+     * Returns a subset of features taking into account the properties and
+     * restrictions of the FeatureQuery.
+     * <p>
+     * <em>
+     * <strong>NOTE:</strong> if you use this method to get a 
+     * {@link FeatureSet}, you  must get sure it is disposed 
+	 * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
+	 * error occurs while getting the data. It is recommended to use the 
+	 * <code>accept</code> methods instead, which handle everything for you. 
+	 * Take into account the accept methods may use a fast iterator to 
+	 * get the features.
+	 * </em>
+     * </p>
+     * 
+     * @see #accept(org.gvsig.tools.visitor.Visitor,
+     *      org.gvsig.fmap.dal.DataQuery)
+     * 
+     * @param featureQuery
+     *            defines the characteristics of the features to return
+     * @return a collection of features
+     * @throws ReadException
+     *             if there is any error while reading the features
+     */
+    FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
+
+    /**
+     * Loads a subset of features taking into account the properties and
+     * restrictions of the FeatureQuery. Feature loading is performed by calling
+     * the Observer, once each loaded Feature.
+     * 
+     * @param featureQuery
+     *            defines the characteristics of the features to return
+     * @param observer
+     *            to be notified of each loaded Feature
+     * @throws DataException
+     *             if there is any error while loading the features
+     */
+    void getFeatureSet(FeatureQuery featureQuery, Observer observer)
+        throws DataException;
+
+    /**
+     * Loads all available feature in the store. The loading of Features is
+     * performed by calling the Observer, once each loaded Feature.
+     * 
+     * @param observer
+     *            to be notified of each loaded Feature
+     * @throws DataException
+     *             if there is any error while loading the features
+     */
+    void getFeatureSet(Observer observer) throws DataException;
+
+    /**
+     * Returns the feature given its reference.
+     * 
+     * @param reference
+     *            a unique FeatureReference
+     * @return
+     *         The Feature
+     * 
+     * @throws DataException
+     * 
+     */
+    public Feature getFeatureByReference(FeatureReference reference)
+        throws DataException;
+
+    /**
+     * Returns the feature given its reference and feature type.
+     * 
+     * @param reference
+     *            a unique FeatureReference
+     * 
+     * @param featureType
+     *            FeatureType to which the requested Feature belongs
+     * 
+     * @return
+     *         The Feature
+     * 
+     * @throws DataException
+     * 
+     */
+    public Feature getFeatureByReference(FeatureReference reference,
+        FeatureType featureType) throws DataException;
+
+    /*
+     * =============================================================
+     * 
+     * Editing related services
+     */
+
+    /**
+     * Enters editing state.
+     */
+    public void edit() throws DataException;
+
+    /**
+     * Enters editing state specifying the editing mode.
+     * 
+     * @param mode
+     * 
+     * @throws DataException
+     */
+    public void edit(int mode) throws DataException;
+
+    /**
+     * Cancels all editing since the last edit().
+     * 
+     * @throws DataException
+     */
+    public void cancelEditing() throws DataException;
+
+    /**
+     * Exits editing state.
+     * 
+     * @throws DataException
+     */
+    public void finishEditing() throws DataException;
+
+    /**
+     * Indicates whether this store is in editing state.
+     * 
+     * @return
+     *         true if this store is in editing state, false if not.
+     */
+    public boolean isEditing();
+
+    /**
+     * Indicates whether this store is in appending state. In this state the new
+     * features are automatically inserted at the end of the {@link FeatureSet}.
+     * 
+     * @return true if this store is in appending state.
+     */
+    public boolean isAppending();
+
+    /**
+     * Updates a {@link FeatureType} in the store with the changes in the
+     * {@link EditableFeatureType}.<br>
+     * 
+     * Any {@link FeatureSet} from this store that are used will be invalidated.
+     * 
+     * @param featureType
+     *            an {@link EditableFeatureType} with the changes.
+     * 
+     * @throws DataException
+     */
+    public void update(EditableFeatureType featureType) throws DataException;
+
+    /**
+     * Updates a {@link Feature} in the store with the changes in the
+     * {@link EditableFeature}.<br>
+     * 
+     * Any {@link FeatureSet} from this store that was still in use will be
+     * invalidated. You can override this using
+     * {@link FeatureSet#update(EditableFeature)}.
+     * 
+     * @param feature
+     *            the feature to be updated
+     * 
+     * @throws DataException
+     */
+    public void update(EditableFeature feature) throws DataException;
+
+    /**
+     * Deletes a {@link Feature} from the store.<br>
+     * 
+     * Any {@link FeatureSet} from this store that was still in use will be
+     * invalidated. You can override this using {@link Iterator#remove()} from
+     * {@link FeatureSet}.
+     * 
+     * @param feature
+     *            The feature to be deleted.
+     * 
+     * @throws DataException
+     */
+    public void delete(Feature feature) throws DataException;
+
+    /**
+     * Inserts a {@link Feature} in the store.<br>
+     * 
+     * Any {@link FeatureSet} from this store that was still in use will be
+     * invalidated. You can override this using
+     * {@link FeatureSet#insert(EditableFeature)}.
+     * 
+     * @param feature
+     *            The feature to be inserted
+     * 
+     * @throws DataException
+     */
+    public void insert(EditableFeature feature) throws DataException;
+
+    /**
+     * Creates a new feature using the default feature type and returns it as an
+     * {@link EditableFeature}
+     * 
+     * @return a new feature in editable state
+     * 
+     * @throws DataException
+     */
+    public EditableFeature createNewFeature() throws DataException;
+
+    /**
+     * Creates a new feature of the given {@link FeatureType} and uses the given
+     * {@link Feature} as default values to initialize it.
+     * 
+     * @param type
+     *            the new feature's feature type
+     * 
+     * @param defaultValues
+     *            a feature whose values are used as default values for the new
+     *            feature.
+     * 
+     * @return the new feature.
+     * 
+     * @throws DataException
+     */
+    public EditableFeature createNewFeature(FeatureType type,
+        Feature defaultValues) throws DataException;
+
+    /**
+     * Creates a new feature of the given {@link FeatureType}. The flag
+     * defaultValues is used to indicate whether the new feature should be
+     * initialized with default values or not.
+     * 
+     * @param type
+     *            the new feature's feature type
+     * 
+     * @param defaultValues
+     *            if true the new feature is initialized with each attribute's
+     *            default value.
+     * 
+     * @return
+     *         the new feature
+     * 
+     * @throws DataException
+     */
+    public EditableFeature createNewFeature(FeatureType type,
+        boolean defaultValues) throws DataException;
+
+    /**
+     * Creates a new feature of default {@link FeatureType}. The flag
+     * defaultValues is used to indicate whether the new feature should be
+     * initialized with default values or not.
+     * 
+     * @param defaultValues
+     *            if true the new feature is initialized with each attribute's
+     *            default value.
+     * 
+     * @return
+     *         the new feature
+     * 
+     * @throws DataException
+     */
+    public EditableFeature createNewFeature(boolean defaultValues)
+        throws DataException;
+
+    /**
+     * Applies the validation rules associated to the given mode to the active
+     * {@link FeatureSet}.
+     * 
+     * @param mode
+     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
+     * 
+     * @throws DataException
+     */
+    public void validateFeatures(int mode) throws DataException;
+
+    /**
+     * Indicates whether this store supports append mode.
+     * 
+     * @return
+     *         true if this store supports append mode.
+     */
+    public boolean isAppendModeSupported();
+
+    /**
+     * Initiates an editing group. This is typically used to group series of
+     * store editing operations.
+     * 
+     * @param description
+     *            Description of the editing group.
+     * 
+     * @throws NeedEditingModeException
+     */
+    public void beginEditingGroup(String description)
+        throws NeedEditingModeException;
+
+    /**
+     * Finishes an editing group.
+     * 
+     * @throws NeedEditingModeException
+     */
+    public void endEditingGroup() throws NeedEditingModeException;
+
+    /*
+     * =============================================================
+     * 
+     * Index related services
+     */
+
+    /**
+     * Creates a FeatureIndex with name indexName, given the attributeName and
+     * its featureType.
+     * 
+     * @param featureType
+     *            The FeatureType to which the indexed attribute belongs.
+     * 
+     * @param attributeName
+     *            The name of the attributed to be indexed
+     * 
+     * @param indexName
+     *            The index name
+     * 
+     * @return the resulting FeatureIndex
+     * 
+     * 
+     * @throws FeatureIndexException
+     */
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName) throws DataException;
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException;
+
+    /**
+     * Creates a FeatureIndex with name indexName, given the attributeName and
+     * its featureType. This method is intended for background indexing. It
+     * receives an observer that will be notified by the process.
+     * 
+     * @param featureType
+     *            The FeatureType to which the indexed attribute belongs.
+     * 
+     * @param attributeName
+     *            The name of the attributed to be indexed
+     * 
+     * @param indexName
+     *            The index name
+     * 
+     * @param observer
+     *            an observer that will be notified of the indexing process
+     *            progress.
+     * 
+     * @return the resulting FeatureIndex
+     * 
+     * 
+     * @throws FeatureIndexException
+     */
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName, Observer observer)
+        throws DataException;
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) throws DataException;
+
+    /**
+     * Returns a FeatureIndexes structure containing all available indexes in
+     * the store.
+     * 
+     * @return
+     */
+    public FeatureIndexes getIndexes();
+
+    /*
+     * =============================================================
+     * 
+     * Selection related services
+     */
+
+    /**
+     * Sets the selection to the passed {@link FeatureSet}
+     * 
+     * @param selection
+     *            A {@link FeatureSet} with the requested selection
+     */
+    public void setSelection(FeatureSet selection) throws DataException;
+
+    /**
+     * Creates a {@link FeatureSelection}
+     * 
+     * @return
+     *         a {@link FeatureSelection}
+     * 
+     * @throws DataException
+     */
+    public FeatureSelection createFeatureSelection() throws DataException;
+
+    /**
+     * Returns the current {@link FeatureSelection}.
+     * 
+     * @return
+     *         current {@link FeatureSelection}.
+     * 
+     * @throws DataException
+     */
+    public FeatureSelection getFeatureSelection() throws DataException;
+
+    /*
+     * =============================================================
+     * 
+     * Lock related services
+     */
+
+    /**
+     * Indicates whether this store supports locks.
+     * 
+     * @return
+     *         true if this store supports locks, false if not.
+     */
+    public boolean isLocksSupported();
+
+    /**
+     * Returns the set of locked features
+     * 
+     * @return
+     *         set of locked features
+     * 
+     * @throws DataException
+     */
+    public FeatureLocks getLocks() throws DataException;
+
+    /*
+     * =============================================================
+     * Transforms related services
+     * =============================================================
+     */
+
+    /**
+     * Returns this store transforms
+     * 
+     * @return
+     *         this store transforms
+     */
+    public FeatureStoreTransforms getTransforms();
+
+    /**
+     * Returns a new {@link FeatureQuery} associated to this store.
+     * 
+     * @return
+     *         a new {@link FeatureQuery} associated to this store.
+     */
+    public FeatureQuery createFeatureQuery();
+
+    /**
+     * Returns featue count of this store.
+     * 
+     * @return
+     * @throws DataException
+     */
+    public long getFeatureCount() throws DataException;
+
+    /**
+     * Creates a vectorial cache that is used to save and retrieve data.
+     * 
+     * @param name
+     *            the cache name.
+     * @param parameters
+     *            parameters to create the stores used to save data.
+     * @throws DataException
+     */
+    public void createCache(String name, DynObject parameters)
+        throws DataException;
+
+    /**
+     * @return the vectorial cache
+     */
+    public FeatureCache getCache();
+
+    /**
+     * Return if the provider knows the real envelope of a layer. If not,
+     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
+     * the full envelope.
+     * 
+     * @return
+     *         <true> if it knows the real envelope.
+     */
+    public boolean isKnownEnvelope();
+
+    /**
+     * Return if the maximum number of features provided by the
+     * provider are limited.
+     * 
+     * @return
+     *         <true> if there is a limit of features.
+     */
+    public boolean hasRetrievedFeaturesLimit();
+
+    /**
+     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
+     * true,
+     * it returns the limit of features retrieved from the provider.
+     * 
+     * @return
+     *         The limit of the retrieved features.
+     */
+    public int getRetrievedFeaturesLimit();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java	(revision 35988)
@@ -0,0 +1,193 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.feature.exception.AttributeFeatureTypeIntegrityException;
+import org.gvsig.tools.evaluator.Evaluator;
+
+/**
+ * This interface represents a FeatureAttributeDescriptor in editable state.
+ * To edit a FeatureAttributeDescriptor you have to obtain its instance of
+ * EditableFeatureAttributeDescriptor and then perform editing operations on it.
+ *
+ * Once you have completed the editing you can save the changes to the original
+ * FeatureAttributeDescriptor. This is the only way to edit a FeatureAttributeDescriptor.
+ */
+public interface EditableFeatureAttributeDescriptor extends
+		FeatureAttributeDescriptor {
+
+	/**
+	 * Checks attribute integrity
+	 */
+	void checkIntegrity() throws AttributeFeatureTypeIntegrityException;
+
+	/**
+	 * Sets the name
+	 * @param
+	 * 		name to set
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setName(String name);
+
+	/**
+	 * Sets the data type
+	 * @param
+	 * 		type one of the constants defined in {@link DataTypes}
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setDataType(int type);
+
+	/**
+	 * Sets the size
+	 * @param size
+	 * 			a size of type int
+	 * @return this
+	 *
+	 */
+	public EditableFeatureAttributeDescriptor setSize(int size);
+
+	/**
+	 * Sets the precision
+	 *
+	 * @param
+	 * 		precision of type int
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setPrecision(int precision);
+
+	/**
+	 * Sets the Class to which the related FeatureAttribute can be cast
+	 *
+	 * @param theClass
+	 * 				Class to which the related FeatureAttribute can be cast
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setObjectClass(Class theClass);
+
+	/**
+	 * Sets the number of minimum occurrences
+	 *
+	 * @param minimumOccurrences
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setMinimumOccurrences(
+			int minimumOccurrences);
+
+	/**
+	 * Sets the maximum number of occurrences
+	 *
+	 * @param maximumOccurrences
+	 *
+	 * @return
+	 */
+	public EditableFeatureAttributeDescriptor setMaximumOccurrences(
+			int maximumOccurrences);
+
+	/**
+	 * Sets whether the related FeatureAttribute is part of the FeatureType's primary key
+	 *
+	 * @param isPrimaryKey
+	 * 				true if is part of the primary key
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setIsPrimaryKey(
+			boolean isPrimaryKey);
+
+	/**
+	 * Sets the expression evaluator that the FeatureAttribute will use
+	 * @param evaluator
+	 * 				an implementation of DAL's Evaluator interface
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setEvaluator(Evaluator evaluator);
+
+	/**
+	 * Sets whether the related FeatureAttribute is read only
+	 *
+	 * @param isReadOnly
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setIsReadOnly(boolean isReadOnly);
+
+	/**
+	 * Sets whether the related FeatureAttribute can have a null value
+	 *
+	 * @param allowNull
+	 * 				a boolean value determining whether the FeatureAttribute can be null
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setAllowNull(boolean allowNull);
+
+	/**
+	 * Sets the SRS.
+	 *
+	 * @param SRS
+	 *
+	 * @return
+	 */
+	public EditableFeatureAttributeDescriptor setSRS(IProjection SRS);
+
+	/**
+	 * Sets the geometry type
+	 *
+	 * @param geometryType
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setGeometryType(int geometryType);
+
+
+	/**
+	 * Sets the geometry subtype
+	 * 
+	 * @param geometrySubType
+	 * 
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setGeometrySubType(
+			int geometrySubType);
+
+	/**
+	 * Sets the default value
+	 *
+	 * @param defaultValue
+	 *
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setDefaultValue(
+			Object defaultValue);
+ 
+	/**
+	 * Sets additional information of the attribute
+	 * @return TODO
+	 *
+	 *
+	 */
+	public EditableFeatureAttributeDescriptor setAdditionalInfo(String infoName, Object value);
+
+	/**
+	 * Sets whether the related FeatureAttribute is part of the FeatureType's
+	 * primary key
+	 *
+	 * @param isPrimaryKey
+	 *            true if is part of the primary key
+	 * @return this
+	 */
+	public EditableFeatureAttributeDescriptor setIsAutomatic(
+			boolean isAutomatic);
+
+	/**
+	 * Sets is the attribute is a temporal attribute.
+     *
+ 	 * @param isTime
+ 	 *        <code>true</code> if the attribute is temporal
+	 * @return
+	 *         this
+	 */
+	public EditableFeatureAttributeDescriptor setIsTime(boolean isTime);
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 35988)
@@ -0,0 +1,35 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+/**
+ * A FeatureReference is a lightweight unique identifier for a
+ * {@link Feature}. It is used to keep references on features
+ * without maintaining the whole feature in memory, thus improving
+ * memory needs.
+ * 
+ */
+public interface FeatureReference {
+
+	/**
+	 * Returns the referenced {@link Feature}
+	 * 
+	 * @return the {@link Feature} identified by this {@link FeatureReference}
+	 * 
+	 * @throws DataException
+	 */
+	public Feature getFeature() throws DataException;
+
+	/**
+	 * Returns the referenced {@link Feature}
+	 * 
+	 * @param featureType
+	 *            The {@link FeatureType} to which the referenced
+	 *            {@link Feature} belongs.
+	 * 
+	 * @return the {@link Feature} identified by this {@link FeatureReference}
+	 * 
+	 * @throws DataException
+	 */
+	public Feature getFeature(FeatureType featureType) throws DataException;
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature package documentation</title>
+</head>
+<body>
+
+<p>Provides API for accessing and managing tabular (Feature based) data.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java	(revision 35988)
@@ -0,0 +1,181 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.text.DateFormat;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.evaluator.Evaluator;
+
+/**
+ * A feature attribute descriptor contains information about
+ * one of the attributes in a feature, such as its name, data type
+ * or precision.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public interface FeatureAttributeDescriptor extends DynField {
+
+	/**
+	 * Returns a clone of this attribute descriptor
+	 *
+	 * @return FeatureAttributeDescriptor
+	 * 						A new copy of this
+	 */
+	public FeatureAttributeDescriptor getCopy();
+
+	/**
+	 * Returns the name of this attribute's data type.
+	 *
+	 * @return
+	 * 		a string containing the name of this attribute's data type.
+	 */
+	public String getDataTypeName();
+
+	/**
+	 * Returns a number that indicates the size of this attribute. See the
+	 * documentation for the various constants of {@link DataTypes}
+	 * for how to interpret this value. As an example, when the data type is
+	 * {@link DataTypes#STRING}, this value indicates the maximum length of the string.
+	 *
+	 * @return
+	 * 		an <code>int</code> indicating the size of the attribute.
+	 */
+	public int getSize();
+
+	/**
+	 * For attributes of type {@link DataTypes#DOUBLE} and {@link DataTypes#FLOAT}
+	 * , this returns the maximum number of places after the decimal point. For
+	 * other types, this must always return zero.
+	 */
+	public int getPrecision();
+
+	/**
+	 * For attributes of type {@link DataTypes#OBJECT},
+	 * this returns the Java {@link Class} object that class or interface that
+	 * all values of this attribute can be cast to.
+	 */
+	public Class getObjectClass();
+
+	/**
+	 * Returns the minimum number of occurrences of this attribute on a given
+	 * feature.  The vast majority of data sources and data consumers will only
+	 * function with this value being zero or one.  If the minimum number of
+	 * occurrences is zero, this is equivalent, in SQL terms, to the attribute
+	 * being nillable.
+	 */
+	public int getMinimumOccurrences();
+
+	/**
+	 * Returns the maximum number of occurrences of this attribute on a given
+	 * feature.  The vast majority of data sources and data consumers will only
+	 * function with this value being one.  A value of {@link Integer#MAX_VALUE}
+	 * indicates that the maximum number of occurrences is unbounded.
+	 */
+	public int getMaximumOccurrences();
+
+	/**
+	 * Returns {@code true} if this attribute forms all or part of the unique identifying
+	 * value for the feature it is contained by.  The primary key attributes uniquely
+	 * identify this feature from other features of the same type.  This is different
+	 * from the {@linkplain Feature#getReference()}, which must uniquely identify
+	 * the {@link Feature} among all feature types.
+	 */
+	public boolean isPrimaryKey();
+
+	/**
+	 * Indicates whether this attribute accepts null values.
+	 *
+	 * @return
+	 * 		true if this attribute can be null, false if not.
+	 */
+	public boolean allowNull();
+
+	/**
+	 * Returns an evaluator that will be used to calculate
+	 * the value of this attribute
+	 */
+	public Evaluator getEvaluator();
+
+	/**
+	 * If this attribute is a {@link Geometry}, this method returns its
+	 * Spatial Reference System.
+	 *
+	 * @return
+	 * 		the SRS if this attribute is a {@link Geometry}, otherwise this method returns null.
+	 */
+	public IProjection getSRS();
+
+	/**
+	 * If this attribute is a {@link Geometry}, this method returns the specific geometry type,
+	 * as defined in {@link Geometry.TYPES}.
+	 *
+	 * @return
+	 * 		One of {@link Geometry.TYPES}
+	 */
+	public int getGeometryType();
+
+	/**
+	 * If this attribute is a {@link Geometry}, this method returns the specific geometry subtype,
+	 * as defined in {@link Geometry.SUBTYPES}.
+	 *
+	 * @return
+	 * 		One of {@link Geometry.SUBTYPES}
+	 */
+	public int getGeometrySubType();
+
+	/**
+	 * If this attribute is of type Date, then this method returns
+	 * the date format set by the data store.
+	 *
+	 * @return
+	 * 		a date format
+	 */
+	public DateFormat getDateFormat();
+
+	/**
+	 * Returns this attribute relative position within the {@link Feature}.
+	 *
+	 * @return
+	 * 		an index
+	 */
+	public int getIndex();
+
+	/**
+	 * Returns additional information of the attribute
+	 *
+	 * @return info
+	 *
+	 */
+	public Object getAdditionalInfo(String infoName);
+
+	/**
+	 * Returns if value is created automatically by the source
+	 */
+	public boolean isAutomatic();
+
+	/**
+	 * Gets if the attribute is a temporal attribute.
+	 * @return
+	 *         <code>true</code> if is a temporal attribute
+	 */
+	public boolean isTime();  
+
+	/**
+	 * Gets if the attribute has a {@link FeatureAttributeGetter}.
+	 * @return
+	 *             a FeatureAttributeGetter or null.
+	 */
+	public FeatureAttributeGetter getFeatureAttributeGetter();
+	
+	/**
+	 * Sets the {@link FeatureAttributeGetter} that is used to update the 
+	 * presentation of a field.
+	 * @param featureAttributeGetter
+	 *             the {@link FeatureAttributeGetter} to set.
+	 */
+	public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java	(revision 35988)
@@ -0,0 +1,58 @@
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStoreNotification;
+import org.gvsig.tools.undo.command.Command;
+
+public interface FeatureStoreNotification extends DataStoreNotification {
+
+
+
+	public static final String BEFORE_UNDO = "before_Undo_DataStore";
+	public static final String BEFORE_REDO = "before_Redo_DataStore";
+
+	public static final String AFTER_UNDO = "after_Undo_DataStore";
+	public static final String AFTER_REDO = "after_Redo_DataStore";
+
+	public static final String BEFORE_REFRESH = "before_refresh";
+	public static final String AFTER_REFRESH = "before_refresh";
+
+	public static final String LOCKS_CHANGE = "after_LockedChange_DataStore";
+
+	public static final String BEFORE_STARTEDITING = "before_StartEditing_DataStore";
+	public static final String AFTER_STARTEDITING = "after_StartEditing_DataStore";
+
+	public static final String BEFORE_CANCELEDITING = "before_CancelEditing_DataStore";
+	public static final String AFTER_CANCELEDITING = "after_CancelEditing_DataStore";
+
+	public static final String BEFORE_FINISHEDITING = "before_FinishEditing_DataStore";
+	public static final String AFTER_FINISHEDITING = "after_FinishEditing_DataStore";
+
+
+	public static final String BEFORE_UPDATE_TYPE = "before_Update_Type";
+	public static final String AFTER_UPDATE_TYPE = "after_Update_Type";
+
+	public static final String BEFORE_UPDATE = "before_Update_Feature";
+	public static final String AFTER_UPDATE = "after_Update_Feature";
+
+	public static final String BEFORE_DELETE = "before_Delete_Feature";
+	public static final String AFTER_DELETE = "after_Delete_Feature";
+
+	public static final String BEFORE_INSERT = "before_Insert_Feature";
+	public static final String AFTER_INSERT = "after_Insert_Feature";
+
+	public static final String LOAD_FINISHED = "Load_Finished";
+	public static final String TRANSFORM_CHANGE = "Transform_Change";
+
+	public Feature getFeature();
+
+	public DataSet getCollectionResult();
+
+	public boolean loadSucefully();
+
+	public Exception getExceptionLoading();
+
+	public Command getCommand();
+
+	public EditableFeatureType getFeatureType();
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java	(revision 35988)
@@ -0,0 +1,82 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider;
+import org.gvsig.fmap.geom.primitive.Envelope;
+
+/**
+ * This class represents a vectorial cache that is used to save and retrieve
+ * {@link FeatureSet}s. First time that a {@link FeatureStore} have to retrieve
+ * data from a {@link FeatureStoreProvider} can save the {@link FeatureSet} in
+ * the cache with its envelope. Next time that the store has to access to a envelope
+ * contained in the previous envelope can retrieve the features directly 
+ * from the cache and it is not necessary to retrieve data from the provider.
+ * 
+ * The cache supports different scales and creates
+ *  
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public interface FeatureCache {
+
+	/**
+	 * Delete all the features for a concrete scale.
+	 * @param scale
+	 * The scale.
+	 * @throws DataException
+	 */
+	public void delete(double scale) throws DataException;
+	
+	/**
+	 * Delete all the features for all the scales in the cache system.
+	 * @throws DataException
+	 */
+	public void deleteAll() throws DataException;
+	
+	/**
+	 * Add a set of features contained in a envelope for a concrete scale.
+	 * @param featureSet
+	 * The feature set retrieved from the server.
+	 * @throws DataException
+	 */
+	public void addFeatures(FeatureSet featureSet, FeatureStore featureStore) throws DataException;
+	
+	/**
+	 * Return a feature set form a concrete envelope and a scale.
+	 * @param envelope
+	 * The envelope.
+	 * @param scale
+	 * The scale.
+	 * @return
+	 * A feature set contained in the evelope.
+	 * @throws DataException
+	 */
+	public FeatureSet getFeatureSet(Envelope envelope, double scale) throws DataException;
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java	(revision 35988)
@@ -0,0 +1,19 @@
+package org.gvsig.fmap.dal.feature.operation;
+
+import java.util.Map;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+
+public interface LegendLabelingManager {
+
+	public void startLoading(Map params);
+
+	public void add(Feature feature, Map params) throws DataException;
+
+	public Object getDefaultLegend();
+
+	public Object getLabeling();
+
+	public void endLoading();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature.operation package documentation</title>
+</head>
+<body>
+
+<p>Provides API for feature operations.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManagerFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManagerFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManagerFactory.java	(revision 35988)
@@ -0,0 +1,6 @@
+package org.gvsig.fmap.dal.feature.operation;
+
+public interface LegendLabelingManagerFactory {
+
+	public LegendLabelingManager newManager();
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManagerFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java	(revision 35988)
@@ -0,0 +1,220 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Create Parameter object to define FeatureCollections queries}
+ */
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.lang.Cloneable;
+
+/**
+ * Defines the properties of a collection of Features, as a result of a query
+ * through a FeatureStore.
+ * <p>
+ * A FeatureQuery is always defined by a FeatureType, or by the list of
+ * attribute names of the FeatureStore to return.
+ * </p>
+ * <p>
+ * The filter allows to select Features whose properties have values with the
+ * characteristics defined by the filter.
+ * </p>
+ * <p>
+ * The order is used to set the order of the result FeatureCollection, based on
+ * the values of the properties of the Features.
+ * </p>
+ * <p>
+ * The scale parameter can be used by the FeatureStore as a hint about the
+ * quality or resolution of the data needed to view or operate with the data
+ * returned. As an example, the FeatureStore may use the scale to return only a
+ * representative subset of the data, or maybe to return Features with less
+ * detail, like a point or a line instead of a polygon.
+ * </p>
+ * <p>
+ * If an implementation of FeatureStore is able to get other parameters to
+ * customize the behavior of the getDataCollection methods, there is an option
+ * to set more parameters through the setAttribute method.
+ * </p>
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface FeatureQuery extends DataQuery, Cloneable {
+
+	/**
+	 * Returns the names of the attributes to load from each {@link Feature}.
+	 * 
+	 * @return the attribute names to load
+	 */
+	String[] getAttributeNames();
+
+	/**
+	 * Sets the names of the attributes to load from each {@link Feature}.
+	 * 
+	 * @param attributeNames
+	 *            the attribute names to load
+	 */
+	void setAttributeNames(String[] attributeNames);
+	
+	/**
+	 * Adds the name of an attribute that has to be used to load each
+	 * {@link Feature}.
+	 * 
+	 * @param attributeName
+	 *             the attribute name to load
+	 */
+	void addAttributeName(String attributeName);
+
+	/**
+	 * Sets the {@link FeatureType} of the {@link Feature}s to load. It may be
+	 * used as an alternative way to set a subset of the list of attribute names
+	 * to load, by creating a sub-FeatureType.
+	 * 
+	 * @param featureType
+	 *            the feature type of the data to load
+	 */
+	void setFeatureType(FeatureType featureType);
+
+	/**
+	 * Returns the {@link FeatureType} id of the {@link Feature}s to load.
+	 * 
+	 * @return the {@link FeatureType} id of the {@link Feature}s to load
+	 */
+	String getFeatureTypeId();
+
+	/**
+	 * Sets the {@link FeatureType} id of the {@link Feature}s to load. This way
+	 * all {@link Feature} attributes will be loaded.
+	 * 
+	 * @param featureTypeId
+	 *            the {@link FeatureType} id of the {@link Feature}s to load
+	 */
+	void setFeatureTypeId(String featureTypeId);
+
+	/**
+	 * Returns the filter to apply to the {@link Feature}s to load.
+	 * 
+	 * @return the filter
+	 */
+	Evaluator getFilter();
+
+	/**
+	 * Sets the filter to apply to the {@link Feature}s to load.
+	 * 
+	 * @param filter
+	 *            the filter to apply to the {@link Feature}s to load
+	 */
+	void setFilter(Evaluator filter);
+	
+	/**
+	 * Adds a filter to apply to the {@link Feature}s to load. A query
+	 * can have more that one filter and all of them are applied when
+	 * the query is applied.
+	 * 
+	 * @param filter
+	 *             a filter to apply to the {@link Feature}s to load
+	 */
+	void addFilter(Evaluator filter);
+
+	/**
+	 * Returns if a filter has been defined for the query.
+	 * 
+	 * @return if a filter has been defined for the query
+	 */
+	boolean hasFilter();
+
+	/**
+	 * Returns the order of the {@link Feature}s to load.
+	 * 
+	 * @return the order of the {@link Feature}s to load
+	 */
+	FeatureQueryOrder getOrder();
+
+	/**
+	 * Sets the order of the {@link Feature}s to load.
+	 * 
+	 * @param order
+	 *            the order of the {@link Feature}s to load
+	 */
+	void setOrder(FeatureQueryOrder order);
+
+	/**
+	 * Returns if an order has been set for the elements returned by the query.
+	 * 
+	 * @return if an order has been set for the elements returned by the query
+	 */
+	boolean hasOrder();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see #clone()
+	 */
+	FeatureQuery getCopy();
+
+	/**
+	 * Returns the maximum number of elements to return with this query.
+	 * <p>
+	 * <strong>NOTE:</strong> this value may be ignored by the underlying data
+	 * source, or only used as a hint, so don't rely on it being used, as you
+	 * may actually get more values than the limit.
+	 * </p>
+	 * 
+	 * @return the maximum number of elements to return with this query
+	 */
+	long getLimit();
+
+	/**
+	 * Sets the maximum number of elements to return with this query.
+	 * <p>
+	 * <strong>NOTE:</strong> this value may be ignored by the underlying data
+	 * source, or only used as a hint, so don't rely on it being used, as you
+	 * may actually get more values than the limit.
+	 * </p>
+	 * 
+	 * @param limit
+	 *            the maximum number of elements to return with this query
+	 */
+	void setLimit(long limit);
+
+	/**
+	 * Returns the load page size, as the number of elements to be retrieved in
+	 * block by the data source. This value is only used as a hint to the
+	 * underlying data source, as a way to tell how many Features may be read in
+	 * a block.
+	 * 
+	 * @return the load page size
+	 */
+	long getPageSize();
+
+	/**
+	 * Sets the load page size, as the number of elements to be retrieved in
+	 * block by the data source. This value is only used as a hint to the
+	 * underlying data source, as a way to tell how many Features may be read in
+	 * a block.
+	 * 
+	 * @param pageSize
+	 *            the load page size
+	 */
+	void setPageSize(long pageSize);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java	(revision 35988)
@@ -0,0 +1,297 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Date;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.timesupport.Instant;
+import org.gvsig.timesupport.Interval;
+
+/**
+ * This interface represents a Feature in editable state. To edit a Feature
+ * you have to obtain its instance of EditableFeature and then perform editing
+ * operations on it. Once you have completed the editing you can save the changes
+ * to the original Feature. This is the only way to edit a Feature.
+ */
+public interface EditableFeature extends Feature {
+
+	/**
+	 * Sets the value of an attribute given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void set(String name, Object value);
+
+	/**
+	 * Sets the value of an attribute given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void set(int index, Object value);
+
+	/**
+	 * Sets the value of an attribute of type integer, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setInt(String name, int value);
+
+	/**
+	 * Sets the value of an attribute of type integer, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setInt(int index, int value);
+
+	/**
+	 * Sets the value of an attribute of type boolean, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setBoolean(String name, boolean value);
+
+	/**
+	 * Sets the value of an attribute of type boolean, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setBoolean(int index, boolean value);
+
+	/**
+	 * Sets the value of an attribute of type long, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setLong(String name, long value);
+
+	/**
+	 * Sets the value of an attribute of type long, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setLong(int index, long value);
+
+	/**
+	 * Sets the value of an attribute of type float, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setFloat(String name, float value);
+
+	/**
+	 * Sets the value of an attribute of type float, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setFloat(int index, float value);
+
+	/**
+	 * Sets the value of an attribute of type double, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setDouble(String name, double value);
+
+	/**
+	 * Sets the value of an attribute of type double, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setDouble(int index, double value);
+
+	/**
+	 * Sets the value of an attribute of type date, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setDate(String name, Date value);
+
+	/**
+	 * Sets the value of an attribute of type date, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setDate(int index, Date value);
+
+	/**
+	 * Sets the value of an attribute of type string, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setString(String name, String value);
+
+	/**
+	 * Sets the value of an attribute of type string, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setString(int index, String value);
+
+	/**
+	 * Sets the value of an attribute of type byte, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setByte(String name, byte value);
+
+	/**
+	 * Sets the value of an attribute of type byte, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setByte(int index, byte value);
+
+	/**
+	 * Sets the value of an attribute of type geometry, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setGeometry(String name, Geometry value);
+
+	/**
+	 * Sets the value of an attribute of type geometry, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setGeometry(int index, Geometry value);
+
+	/**
+	 * Sets the value of an attribute of type array, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setArray(String name, Object[] value);
+
+	/**
+	 * Sets the value of an attribute of type array, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setArray(int index, Object[] value);
+
+	/**
+	 * Sets the value of an attribute of type feature, given its name
+	 * @param name
+	 * 			attribute's name
+	 * @param value
+	 *  		value to set
+	 */
+	public void setFeature(String name, Feature value);
+
+	/**
+	 * Sets the value of an attribute of type feature, given its index
+	 * @param index
+	 * 			attribute's index
+	 * @param value
+	 *  		value to set
+	 */
+	public void setFeature(int index, Feature value);
+
+	/**
+	 * Returns the Feature from which this EditableFeature was created
+	 *
+	 * @return Feature from which this EditableFeature was created
+	 */
+	public Feature getSource();
+
+	/**
+	 * Returns a non editable copy of the Feature.
+	 *
+	 * @return non editable copy of the Feature.
+	 */
+	public Feature getNotEditableCopy();
+
+	/**
+	 * Sets de value of the default geometry attribute.
+	 *
+	 * @param value geometry to set.
+	 */
+	public void setDefaultGeometry(Geometry value);
+	
+	/**
+	 * Copies the values of all attributes from the source feature to this feature
+	 * 
+	 * @param source
+	 * 			source feature from which the values will be copied.
+	 */
+	public void copyFrom(Feature source);	
+	
+	/**
+     * Sets the value of an attribute of type instant, given its name
+     * @param name
+     *          attribute's name
+     * @param value
+     *          value to set
+     */
+	public void setInstant(String name, Instant value);
+
+	/**
+     * Sets the value of an attribute of type instant, given its index
+     * @param index
+     *          attribute's index
+     * @param value
+     *          value to set
+     */
+	public void setInstant(int index, Instant value);  
+
+	/**
+     * Sets the value of an attribute of type interval, given its name
+     * @param name
+     *          attribute's name
+     * @param value
+     *          value to set
+     */
+	public void setInterval(String name, Interval value);
+
+	/**
+     * Sets the value of an attribute of type interval, given its index
+     * @param index
+     *          attribute's index
+     * @param value
+     *          value to set
+     */
+	public void setInterval(int index, Interval value); 
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java	(revision 35988)
@@ -0,0 +1,102 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+
+/**
+ * This interface represents a container for store transforms.
+ *
+ * Provides access to transforms by index and by iterator, and also allows
+ * adding and removing transforms.
+ *
+ */
+public interface FeatureStoreTransforms {
+
+	/**
+	 * Returns the FeatureStoreTransform given its index.
+	 *
+	 * @param index
+	 * 			a position in this FeatureStoreTransforms
+	 *
+	 * @return
+	 * 		the FeatureStoreTransform that is stored in the given index.
+	 */
+	public FeatureStoreTransform getTransform(int index);
+
+	/**
+	 * Adds a FeatureStoreTransform to this container.
+	 *
+	 * @param transform
+	 * 			the FeatureStoreTransform to add
+	 *
+	 * @return
+	 * 		the added FeatureStoreTransform
+	 *
+	 * @throws DataException
+	 */
+	public FeatureStoreTransform add(FeatureStoreTransform transform)
+			throws DataException;
+
+	/**
+	 * Returns the number of FeatureStoreTransforms stored in this container
+	 *
+	 * @return
+	 * 		number of FeatureStoreTransforms stored in this container
+	 */
+	public int size();
+
+	/**
+	 * Indicates whether this container is empty.
+	 *
+	 * @return
+	 * 		true if this container is empty, false if not
+	 */
+	public boolean isEmpty();
+
+	/**
+	 * Returns an iterator over this container elements.
+	 *
+	 * @return
+	 * 		an iterator over this container elements.
+	 */
+	public Iterator iterator();
+
+	/**
+	 * Empties this container.
+	 *
+	 */
+	public void clear();
+
+	/**
+	 * Removes the {@link FeatureStoreTransform} given its index.
+	 *
+	 * @param index
+	 * 			the position of the {@link FeatureStoreTransform} to remove.
+	 * @return
+	 * 		the removed object
+	 */
+	public Object remove(int index);
+
+	/**
+	 * Removes the given {@link FeatureStoreTransform}.
+	 *
+	 * @param transform
+	 * 				{@link FeatureStoreTransform} to remove
+	 * @return
+	 * 		true if the transform was successfully removed, false if not.
+	 */
+	public boolean remove(FeatureStoreTransform transform);
+
+	/**
+	 * Retruns true if any {@link FeatureStoreTransform} make changes of any
+	 * previous attributes values.<br>
+	 *
+	 * If all {@link FeatureStoreTransform} affects only to attributes defition,
+	 * the {@link FeatureSet} performance can be better.
+	 *
+	 * @return
+	 */
+	public boolean isTransformsOriginalValues();
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java	(revision 35988)
@@ -0,0 +1,84 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  { }
+ * 2008 {IVER TI}  { }
+ */
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Manages locks of Features.
+ *
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin del Cerro</a>
+ */
+
+public interface FeatureLocks extends WeakReferencingObservable, Persistent {
+
+	public void apply();
+
+	public Iterator getGroups();
+
+	public int getGroupsCount();
+
+	public boolean isLocked(FeatureReference reference);
+
+	public boolean isLocked(Feature feature);
+
+	public long getLocksCount();
+
+	public Iterator getLocks();
+
+    void setDefaultTimeout(long milisecs);
+
+    long getDefaultTimeout();
+
+
+
+    boolean lock(FeatureReference reference);
+
+    boolean lock(Feature feature);
+
+    boolean lock(FeatureSet features) throws DataException;
+
+    void lockAll() throws DataException;
+
+    boolean unlock(FeatureReference reference);
+
+    boolean unlock(Feature feature);
+
+    boolean unlock(FeatureSet features) throws DataException;
+
+    void unlockAll() throws DataException;
+
+	public long getUnappliedLocksCount();
+
+    Iterator getUnappliedLocks();
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java	(revision 35988)
@@ -0,0 +1,64 @@
+package org.gvsig.fmap.dal.feature.rule;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureRule;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+import org.gvsig.fmap.geom.primitive.Surface;
+import org.gvsig.fmap.geom.util.Converter;
+
+public class FeatureRulePolygon extends AbstractFeatureRule {
+	private static GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	
+	public FeatureRulePolygon() {
+		super("RulePolygon", "Ensure orientation of geometry");
+	}
+
+	public void validate(Feature feature, FeatureStore store)
+			throws DataException {
+
+        try {
+			Geometry geom = feature.getDefaultGeometry();
+			GeneralPathX gp = new GeneralPathX();
+			gp.append(geom.getPathIterator(null, geomManager.getFlatness()), true);
+
+			if (gp.isClosed()) {
+				if (gp.isCCW()) {
+					gp.flip();
+					GeometryManager geomManager = GeometryLocator.getGeometryManager();
+					Surface surface = (Surface)geomManager.create(TYPES.SURFACE, SUBTYPES.GEOM2D);
+					surface.setGeneralPath(gp);
+					geom = surface;
+	        		EditableFeature editable = feature.getEditable();
+					editable.setDefaultGeometry(geom);
+					store.update(editable);
+				}
+	        }
+		} catch (Exception e) {
+			throw new FeatureRulePolygonException(e, store.getName());
+		}
+	}
+
+	public class FeatureRulePolygonException extends DataException {
+
+		/**
+		 *
+		 */
+		private static final long serialVersionUID = -3014970171661713021L;
+		private final static String MESSAGE_FORMAT = "Can't apply rule  in store %(store)s.";
+		private final static String MESSAGE_KEY = "_FeatureRulePolygonException";
+
+		public FeatureRulePolygonException(Throwable cause, String store) {
+			super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+			this.setValue("store", store);
+		}
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.feature.rule package documentation</title>
+</head>
+<body>
+
+<p>Provides API for feature rules.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java	(revision 35988)
@@ -0,0 +1,40 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+package org.gvsig.fmap.dal.feature;
+
+import org.gvsig.tools.dataTypes.DataType;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public interface FeatureAttributeGetter {
+    
+    public Object getter(Object sourceAttributeValue);
+    
+    public Object setter(Object targetAttributeValue);
+    
+    public DataType getDataType();    
+    
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java	(revision 35988)
@@ -0,0 +1,425 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.Date;
+import java.util.List;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Instant;
+import org.gvsig.timesupport.Interval;
+
+/**
+ * <p>Represents the basic data unit of a tabular structure, equivalent
+ * to a record in a data base table. In SIG domain, a Feature is a compound
+ * data structure that may contain a geographic component. The conventional term
+ * Feature comes from the term cartographic feature and both represent the same
+ * concept.
+ * </p>
+ * <p>
+ * A Feature may contain more than one geometry attribute. In the case there is not any geometry data,
+ * the <code>getDefaultGeometry()</code> will return <code>null</code>.
+ * </p>
+ * <p>
+ * Features are not editable as such. To edit a Feature you have to obtain an
+ * editable instance <code>EditableFeature</code> using the method <code>getEditable()</code>.
+ * Modify that editable instance and then apply the changes to the Feature. This
+ * mechanism is to avoid ambiguity and loosing track on the Feature internal state.
+ * </p>
+ * <br>
+ * <p>The Feature:
+ *   <ul>
+ *     <li>Has an unique identifier <code>FeatureReference</code>
+ *     to recognize our Feature from each other from the same data store</li>
+ *     <li>Has a <code>FeatureType</code> that describes the Feature characteristics (attributes,
+ *     data types, default geometry, validation rules).</li>
+ *     <li>Can obtain a copy of itself.</li>
+ *     <li>Can obtain its default geometry attribute and also a list with all the geometry attributes.</li>
+ *     <li>Can obtain its default Spatial Reference System and also a list with all the SRSs used in the geometry attributes.</li>
+ *     <li>Can obtain the envelope (extent) of the default geometry attribute.
+ *     <li>Can obtain the editable instance of the Feature.</li>
+ *     <li>Has a set of utility methods to read attributes when their type is known, by both index and name.</li>
+ *   </ul>
+ * </p>
+ *
+ */
+public interface Feature {
+
+	/**
+	 * Returns a unique identifier for this Feature in the associated store.
+	 *
+	 * @return
+	 * 		a unique FeatureReference in the associated store
+	 */
+	public FeatureReference getReference();
+
+	/**
+	 * Returns the FeatureType that describes the structure of this Feature.
+	 *
+	 * @return
+	 * 		a FeatureType describing this Feature structure.
+	 */
+	public FeatureType getType();
+
+	/**
+	 * Creates and returns a copy of this
+	 *
+	 * @return
+	 * 		a new instance of Feature which is equal to this
+	 */
+	public Feature getCopy();
+
+	/** Mode that indicates the validation of all FeatureRules */
+	static final int ALL = 0;
+
+	/** Mode that indicates the validation of the update FeatureRules */
+	static final int UPDATE = 1;
+
+	/** Mode that indicates the validation of the finish editing FeatureRules */
+	static final int FINISH_EDITING = 2;
+
+	/**
+	 * Validates this Feature by applying the <code>FeatureRules</code>
+	 * corresponding to the given mode.
+	 *
+	 * @param mode
+	 * 			one of the constants {ALL, UPDATE, FINISH_EDITING}
+	 */
+	public void validate(int mode);
+
+	/**
+	 * Returns the editable instance of this Feature.
+	 * EditableFeature offers methods for Feature editing.
+	 *
+	 * @return
+	 * 		EditableFeature of this
+	 */
+	public EditableFeature getEditable();
+
+	/**
+	 * Returns the value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			a string containing the name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Object   get(String name);
+
+	/**
+	 * Returns the value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Object   get(int index);
+
+	/**
+	 * Returns the int value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			a string containing the name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public int      getInt(String name);
+
+	/**
+	 * Returns the int value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public int      getInt(int index);
+
+	/**
+	 * Returns the Boolean value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public boolean  getBoolean(String name);
+
+	/**
+	 * Returns the Boolean value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public boolean  getBoolean(int index);
+
+	/**
+	 * Returns the long value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public long     getLong(String name);
+
+	/**
+	 * Returns the long value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public long     getLong(int index);
+
+	/**
+	 * Returns the float value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public float   getFloat(String name);
+
+	/**
+	 * Returns the float value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public float    getFloat(int index);
+
+	/**
+	 * Returns the double value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public double  getDouble(String name);
+
+	/**
+	 * Returns the double value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public double   getDouble(int index);
+
+	/**
+	 * Returns the Date value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Date    getDate(String name);
+
+	/**
+	 * Returns the Date value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Date     getDate(int index);
+
+	/**
+	 * Returns the String value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public String  getString(String name);
+
+	/**
+	 * Returns the String value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public String   getString(int index);
+
+	/**
+	 * Returns the byte value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public byte    getByte(String name);
+
+	/**
+	 * Returns the byte value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public byte     getByte(int index);
+
+	/**
+	 * Returns the Geometry value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Geometry getGeometry(String name);
+
+	/**
+	 * Returns the Geometry value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Geometry getGeometry(int index);
+
+	/**
+	 * Returns the array value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Object[] getArray(String name);
+
+	/**
+	 * Returns the array value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Object[] getArray(int index);
+
+	/**
+	 * Returns the Feature value of an attribute given its name.
+	 *
+	 * @param name
+	 * 			name of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Feature  getFeature(String name);
+
+	/**
+	 * Returns the Feature value of an attribute given its position.
+	 *
+	 * @param index
+	 * 			position of the attribute
+	 * @return
+	 * 		value of the specified attribute
+	 */
+	public Feature  getFeature(int index);
+
+
+	/**
+	 * Envelope (AKA extent or bounding box) of the default
+	 * geometry attribute.
+	 *
+	 * @return Envelope
+	 * 				of the default geometry attribute
+	 */
+	public Envelope getDefaultEnvelope();
+
+	/**
+	 * Returns the value of the default geometry attribute,
+	 * which is a {@link Geometry}.
+	 *
+	 * @return
+	 * 		value of the default geometry attribute
+	 */
+	public Geometry getDefaultGeometry();
+
+	/**
+	 * Returns a list with the values of this Feature's
+	 * geometry attributes.
+	 *
+	 * @return
+	 * 		a list with the values of this Feature's geometry attributes
+	 */
+	public List getGeometries();
+
+	/**
+	 * Returns the Spatial Reference System in which is
+	 * expressed the default geometry attribute.
+	 *
+	 * @return
+	 * 		A string containing the default geometry attribute SRS.
+	 */
+	public IProjection getDefaultSRS();
+
+	/**
+	 * Returns a list with the Spatial Reference Systems in which
+	 * are expressed this Feature's geometry attributes.
+	 *
+	 * @return
+	 * 		a list with the Spatial Reference Systems.
+	 */
+	public List getSRSs();
+	
+	/**
+     * Returns the instant value of an attribute given its position.
+     *
+     * @param index
+     *          position of the attribute
+     * @return
+     *      value of the specified attribute
+     */
+	public Instant getInstant(int index);
+
+	/**
+     * Returns the instant value of an attribute given its name.
+     *
+     * @param name
+     *          a string containing the name of the attribute
+     * @return
+     *      value of the specified attribute
+     */
+	public Instant getInstant(String name);
+
+    /**
+     * Returns the interval value of an attribute given its position.
+     *
+     * @param index
+     *          position of the attribute
+     * @return
+     *      value of the specified attribute
+     */
+	public Interval getInterval(int index);
+
+	/**
+     * Returns the interval value of an attribute given its name.
+     *
+     * @param name
+     *          a string containing the name of the attribute
+     * @return
+     *      value of the specified attribute
+     */
+	public Interval getInterval(String name);
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java	(revision 35988)
@@ -0,0 +1,111 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.store.memory;
+
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.spi.AbstractDataParameters;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DelegatedDynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class MemoryStoreParameters extends AbstractDataParameters implements
+DataStoreParameters{
+	  
+	private static final String PARAMETERS_DEFINITION_NAME = "MemoryStoreParameters";
+
+	private static final String NAME_PARAMETER_NAME = "name";
+	private static final String NAME_PARAMETER_DESCRIPTION = "Memory data name";
+	public static final String ORDER_PARAMETER_NAME = "autoOrderAttributeName";
+	private static final String ORDER_PARAMETER_DESCRIPTION = "Atribute name to order by, by default";
+
+	private DelegatedDynObject parameters;
+
+	public MemoryStoreParameters() {
+		this(MemoryStoreProvider.NAME);
+	}
+
+	public MemoryStoreParameters(String name) {
+		super();
+		initialize(name);
+	}
+
+	protected void initialize(String name) {
+		this.parameters = (DelegatedDynObject) ToolsLocator.getDynObjectManager()
+			.createDynObject(
+					ToolsLocator.getPersistenceManager().getDefinition(PARAMETERS_DEFINITION_NAME)
+		);
+		setDynValue(NAME_PARAMETER_NAME, name);
+	}
+
+	protected DelegatedDynObject getDelegatedDynObject() {
+		return parameters;
+	}
+	
+	   protected static void registerParametersDefinition() {
+	    	PersistenceManager manager = ToolsLocator.getPersistenceManager();
+	    	if( manager.getDefinition(PARAMETERS_DEFINITION_NAME) == null ) {
+				DynStruct parametersDefinition = manager.addDefinition(
+						MemoryStoreParameters.class, 
+						PARAMETERS_DEFINITION_NAME,
+						(String)null,
+						null, 
+						null
+				);
+				parametersDefinition.addDynFieldString(NAME_PARAMETER_NAME)
+					.setDescription(NAME_PARAMETER_DESCRIPTION)
+					.setMandatory(true);
+				parametersDefinition.addDynFieldString(ORDER_PARAMETER_NAME)
+					.setDescription(ORDER_PARAMETER_DESCRIPTION);
+				
+	    	}
+	    }
+	
+	public String getDataStoreName() {
+		return MemoryStoreProvider.NAME;
+	}
+
+	public String getDescription() {
+		return MemoryStoreProvider.DESCRIPTION;		
+	}
+
+	public boolean isValid() {
+		return true;
+	}
+
+	public String getName() {
+		return (String) parameters.getDynValue(NAME_PARAMETER_NAME);
+	}
+
+	public String getOrderByAttributeName() {
+		return (String) parameters.getDynValue(ORDER_PARAMETER_NAME);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java	(revision 35988)
@@ -0,0 +1,79 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+* 
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+* 
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+* MA  02110-1301, USA.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+ 
+package org.gvsig.fmap.dal.store.memory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class MemoryStoreLibrary extends AbstractLibrary{
+
+    public void doRegistration() {
+        registerAsServiceOf(DALLibrary.class);
+    }
+
+	public void doInitialize()  {
+		
+	}
+
+	public void doPostInitialize()  {
+		List exs = new ArrayList();
+		
+		MemoryStoreParameters.registerParametersDefinition();
+		try {
+			MemoryStoreProvider.registerMetadataDefinition();
+		} catch (MetadataException e) {
+			exs.add(e);
+		}
+		
+        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
+		.getDataManager();
+        
+		if (!dataman.getStoreProviders().contains(MemoryStoreProvider.NAME)) {
+			dataman.registerStoreProvider(MemoryStoreProvider.NAME,
+					MemoryStoreProvider.class, MemoryStoreParameters.class);
+		}
+
+		if( exs.size()>0 ) {
+			throw new LibraryException(this.getClass(), exs);
+		}
+	}
+}
+
+
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java	(revision 35988)
@@ -0,0 +1,230 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {Iver T.I.}   {Task}
+ */
+
+package org.gvsig.fmap.dal.store.memory;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.OpenException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.feature.spi.memory.AbstractMemoryStoreProvider;
+import org.gvsig.fmap.dal.feature.spi.memory.MemoryResource;
+import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ * 
+ *         TODO: take into account the parameter "autoOrderAttributeName" to
+ *         order the {@link Feature}s by default by that attribute, in ascending
+ *         order.
+ */
+public class MemoryStoreProvider extends AbstractMemoryStoreProvider{
+	private static final Logger logger = LoggerFactory.getLogger(MemoryStoreProvider.class);
+
+	private static GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	public static final String NAME = "Memory";
+	public static final String DESCRIPTION = "Memory provider";
+	
+	public static final String METADATA_DEFINITION_NAME = "MemoryProvider";
+	
+	private long counterNewsOIDs = 0;
+	private Envelope envelope = null;
+	private Map oids = null;
+	
+	private Double sourceID = null;
+
+	private ResourceProvider memoryResource;
+
+	public static DynObject newMetadataContainer(String name) {
+    	return ToolsLocator.getDynObjectManager()
+			.createDynObject(
+				MetadataLocator.getMetadataManager().getDefinition(name)
+			);
+	}
+	
+	public MemoryStoreProvider(MemoryStoreParameters memoryStoreParameters, 
+			DataStoreProviderServices storeServices) throws InitializeException {
+		super(
+				memoryStoreParameters, 
+				storeServices,
+				newMetadataContainer(METADATA_DEFINITION_NAME)
+		);
+		sourceID = new Double(Math.random());
+		data = new ArrayList();
+		oids = new Hashtable();
+		initialize();
+		memoryResource =
+				createResource(MemoryResource.NAME,
+						new Object[] { memoryStoreParameters.getName() });
+	}	
+
+	public String getName() {
+		return this.sourceID.toString();
+	}
+
+	public String getFullName() {
+		return "memory:"+this.sourceID.toString();
+	}
+
+
+	private void initialize() {
+		FeatureType featureType = getStoreServices().createFeatureType().getNotEditableCopy();		
+		List types = new ArrayList(1);
+		types.add(featureType);
+		getStoreServices().setFeatureTypes(types, featureType);
+	}
+
+	/*
+	 * 	(non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createNewOID()
+	 */
+	public Object createNewOID() {
+		return new Long(counterNewsOIDs++);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getName()
+	 */
+	public String getProviderName() {
+		return NAME;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getOIDType()
+	 */
+	public int getOIDType() {
+		return DataTypes.LONG;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getSourceId()
+	 */
+	public Object getSourceId() {
+		return sourceID;
+	}
+
+	public void open() throws OpenException {
+	}
+
+	public static void registerMetadataDefinition() throws MetadataException {
+		MetadataManager manager = MetadataLocator.getMetadataManager();
+		if( manager.getDefinition(METADATA_DEFINITION_NAME)==null ) {
+			DynStruct metadataDefinition = manager.addDefinition(METADATA_DEFINITION_NAME, "Memory Store");
+			metadataDefinition.extend(manager
+					.getDefinition(DataStore.SPATIAL_METADATA_DEFINITION_NAME));
+		}
+	}
+
+	public boolean allowWrite() {
+		return true;
+	}
+
+	public void performChanges(Iterator deleteds, Iterator inserteds,
+			Iterator updateds, Iterator originalFeatureTypesUpdated)
+	throws PerformEditingException {
+		FeatureSet set = null;
+		DisposableIterator iter = null;
+		try {		
+			FeatureType featureType = this.getStoreServices().getDefaultFeatureType();
+			List types = new ArrayList(1);
+			types.add(featureType);			
+			getStoreServices().setFeatureTypes(types, featureType);	
+			
+			//Sets the envelope			
+			envelope = 
+				geomManager.createEnvelope(featureType.getDefaultGeometryAttribute().getGeometrySubType());
+					
+			set = this.getFeatureStore().getFeatureSet();
+			iter = set.fastIterator();
+
+			ArrayList newData = new ArrayList();
+			Hashtable newOids = new Hashtable();
+			
+			while (iter.hasNext()) {
+				Feature feature=(Feature) iter.next();
+				FeatureProvider featureProvider = this.getStoreServices().getFeatureProviderFromFeature(feature);
+				featureProvider.setNew(false);
+				newData.add(featureProvider);
+				newOids.put(featureProvider.getOID(), featureProvider);
+				envelope.add(feature.getDefaultEnvelope());
+			}
+			data = newData;
+			oids = newOids;
+			
+		} catch (DataException e) {
+			logger.error("Error adding features", e);
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error creating the envelope", e);
+		} finally {
+			dispose(iter);
+			dispose(set);
+		}
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		return envelope;
+	}
+	
+	protected FeatureProvider internalGetFeatureProviderByReference(
+			FeatureReferenceProviderServices reference) throws DataException {
+		return (FeatureProvider) oids.get(reference.getOID());
+	}
+
+	public ResourceProvider getResource() {
+		return memoryResource;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal package documentation</title>
+</head>
+<body>
+
+<p>Provides DAL's top level abstraction API.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java	(revision 35988)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.dal.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+
+public abstract class DataException extends BaseException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -1951723534438433226L;
+
+	protected Map values = new HashMap();
+
+	public DataException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public DataException(String messageFormat, String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+	protected void setValue(String name, String value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+public class CopyException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 6998431565823817880L;
+	private final static String MESSAGE_FORMAT = "Exception in copy '%(name)s'.";
+	private final static String MESSAGE_KEY = "_CopyException";
+
+	public CopyException(String name, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java	(revision 35988)
@@ -0,0 +1,50 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.exception;
+
+
+/**
+ * @author jmvivo
+ *
+ */
+public class ParameterMissingException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 2572750697666854452L;
+	private final static String MESSAGE_FORMAT = "Missing parameter '%(parameterName)'.";
+	private final static String MESSAGE_KEY = "_ParameterMissingException";
+
+	public ParameterMissingException(String parameterName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("parameterName", parameterName);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java	(revision 35988)
@@ -0,0 +1,24 @@
+package org.gvsig.fmap.dal.exception;
+
+
+/**
+ * FIXME
+ *
+ *
+ */
+
+public class ReadException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8512708060535066804L;
+	private final static String MESSAGE_FORMAT = "Exception reading '%(store)'.";
+	private final static String MESSAGE_KEY = "_ReadException";
+
+	public ReadException(String store, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java	(revision 35988)
@@ -0,0 +1,32 @@
+package org.gvsig.fmap.dal.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+public abstract class DataRuntimeException extends BaseRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -5882808169007262182L;
+	protected Map values = new HashMap();
+
+	public DataRuntimeException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public DataRuntimeException(String messageFormat, String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+	protected void setValue(String name, String value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java	(revision 35988)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ */
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.exception;
+
+
+public class ReadRuntimeException extends DataRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -7756645643644789613L;
+	private final static String MESSAGE_FORMAT = "Exception reading from a store of type '%(store)'.";
+	private final static String MESSAGE_KEY = "_ReadRuntimeException";
+
+	public ReadRuntimeException(String store, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+}
+
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+public class LoadException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 1L;
+	private final static String MESSAGE_FORMAT = "Can't load '%(resource)'.";
+	private final static String MESSAGE_KEY = "_OpenException";
+
+	public LoadException(Throwable cause, String resource) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java	(revision 35988)
@@ -0,0 +1,15 @@
+package org.gvsig.fmap.dal.exception;
+
+public class ProviderNotRegisteredException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 4873697202452898968L;
+	private final static String MESSAGE_FORMAT = "'%(providerName) not registered'.";
+	private final static String MESSAGE_KEY = "_ProviderNotRegisteredException";
+
+	public ProviderNotRegisteredException(String providerName) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("providerName", providerName);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java	(revision 35988)
@@ -0,0 +1,23 @@
+package org.gvsig.fmap.dal.exception;
+
+/**
+ * FIXME
+ *
+ *
+ */
+
+public class WriteException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 3656543768356545436L;
+	private final static String MESSAGE_FORMAT = "Exception writing '%(resource)'.";
+	private final static String MESSAGE_KEY = "_WriteException";
+
+	public WriteException(String resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+
+public class DataEvaluatorException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 4694862217382272837L;
+	private final static String MESSAGE_FORMAT = "Evaluator exception";
+	private final static String MESSAGE_KEY = "_DataEvaluatorException";
+
+	public DataEvaluatorException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java	(revision 35988)
@@ -0,0 +1,23 @@
+package org.gvsig.fmap.dal.exception;
+
+import java.io.File;
+
+public class FileNotFoundException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 8748874874719052534L;
+	private final static String MESSAGE_FORMAT = "File '%(file)' not found.";
+	private final static String MESSAGE_KEY = "_OpenException";
+
+	public FileNotFoundException(String filePath) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("file", filePath);
+	}
+
+	public FileNotFoundException(File file) {
+		this(file.getAbsolutePath());
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+public class RemoveException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -4463253141583983345L;
+	private final static String MESSAGE_FORMAT = "Exception removing '%(resource)'.";
+	private final static String MESSAGE_KEY = "_RemoveException";
+
+	public RemoveException(String resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+public class CopyParametersException extends DataRuntimeException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -401333851837941591L;
+	private final static String MESSAGE_FORMAT = "Exception in copy '%(name)'.";
+	private final static String MESSAGE_KEY = "_CopyParametersException";
+
+	public CopyParametersException(String name, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("name", name);
+	}
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java	(revision 35988)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+
+public class UnsupportedVersionException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 4614439562201218739L;
+	private final static String MESSAGE_FORMAT = "Version '%(formatVersion) of '%(storeName)' not supported'.";
+	private final static String MESSAGE_KEY = "_UnsupportedVersionException";
+
+	public UnsupportedVersionException(String storeName, String formatVersion) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+		setValue("storeName", storeName);
+		setValue("formatVersion", formatVersion);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java	(revision 35988)
@@ -0,0 +1,16 @@
+package org.gvsig.fmap.dal.exception;
+
+
+public class UnsupportedEncodingException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 7149758900102271415L;
+	private final static String MESSAGE_FORMAT = "Unsupported encoding Exception.";
+	private final static String MESSAGE_KEY = "_UnsupportedEncodingException";
+
+	public UnsupportedEncodingException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html	(revision 35988)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>org.gvsig.fmap.dal.exception package documentation</title>
+</head>
+<body>
+
+<p>Provides DAL's top level exceptions.</p>
+
+</body>
+</html>
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java	(revision 35988)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 {{Company}}   {{Task}}
+*/
+
+
+package org.gvsig.fmap.dal.exception;
+
+
+public class DataEvaluatorRuntimeException extends DataRuntimeException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 957625345447753115L;
+	private final static String MESSAGE_FORMAT = "Evaluator exception.";
+	private final static String MESSAGE_KEY = "_DataEvaluatorRuntimeException";
+
+	public DataEvaluatorRuntimeException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+	}
+}
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java	(revision 35988)
@@ -0,0 +1,16 @@
+package org.gvsig.fmap.dal.exception;
+
+public class OpenException extends DataException {
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -8318431541669401823L;
+	private final static String MESSAGE_FORMAT = "Exception opening '%(store)'.";
+	private final static String MESSAGE_KEY = "_OpenException";
+
+	public OpenException(String store, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java	(revision 35988)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.dal.exception;
+
+
+public class InitializeException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -3054877505579218816L;
+	private final static String MESSAGE_FORMAT = "Exception intializing '%(resource)'.";
+	private final static String MESSAGE_KEY = "_InitializeException";
+
+	public InitializeException(String resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+	public InitializeException(Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", "{unknow}");
+	}
+
+	protected InitializeException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	protected InitializeException(String messageFormat, String messageKey,
+			long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java	(revision 35988)
@@ -0,0 +1,23 @@
+package org.gvsig.fmap.dal.exception;
+
+public class CreateException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 9186224366705822305L;
+	private final static String MESSAGE_FORMAT = "Exception creating '%(resource)'.";
+	private final static String MESSAGE_KEY = "_CreateException";
+
+	public CreateException(String resource, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("resource", resource);
+	}
+
+	protected CreateException(String messageFormat, String messageKey,
+			long serialversionuid2) {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+
+	
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java	(revision 35988)
@@ -0,0 +1,22 @@
+package org.gvsig.fmap.dal.exception;
+
+/**
+ * FIXME
+ *
+ */
+
+public class CloseException extends DataException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 9186224366705822305L;
+	private final static String MESSAGE_FORMAT = "Exception closing '%(store)s'.";
+	private final static String MESSAGE_KEY = "_CloseException";
+
+	public CloseException(String store, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+
+}
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java	(revision 35988)
@@ -0,0 +1,34 @@
+package org.gvsig.fmap.dal.exception;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.tools.exception.ListBaseException;
+
+public abstract class DataListException extends ListBaseException {
+
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = -131815899234291797L;
+
+	protected Map values = new HashMap();
+
+	public DataListException(String messageFormat, Throwable cause,
+			String messageKey, long code) {
+		super(messageFormat, cause, messageKey, code);
+	}
+
+	public DataListException(String messageFormat, String messageKey, long code) {
+		super(messageFormat, messageKey, code);
+	}
+
+	protected void setValue(String name, String value) {
+		this.values.put(name, value);
+	}
+
+	protected Map values() {
+		return this.values;
+	}
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java	(revision 35988)
@@ -0,0 +1,56 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+* MA  02110-1301, USA.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.dal.exception;
+
+
+/**
+ * @author jmvivo
+ *
+ */
+public class ValidateDataParametersException extends DataListException {
+
+	/**
+	 *
+	 */
+	private static final long serialVersionUID = 3286674610036657162L;
+
+	private final static String MESSAGE_FORMAT = "Checks parameters";
+	private final static String MESSAGE_KEY = "_ValidateDataParametersException";
+
+	public ValidateDataParametersException() {
+		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+	}
+
+	public ValidateDataParametersException(Throwable cause) {
+        super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+    }
+
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java	(revision 35988)
@@ -0,0 +1,25 @@
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+
+/**
+ * Interface for all DataStore factories. Each type or set of types of stores
+ * register a factory. A factory is capable of building one or more types of
+ * stores throught its parameters.
+ * 
+ * @author Nacho Brodin (nachobrodin@gmail.com)
+ */
+public interface DataStoreFactory {
+
+	/**
+	 * Sets DataParameters object
+	 * @param parameters
+	 */
+	public void setParameters(DataParameters parameters);
+	
+	/**
+	 * Builds a specific kind of store
+	 * @return
+	 */
+	public DataStore createStore() throws InitializeException;
+}

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java	(revision 35988)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 {DiSiD Technologies}  {Implement data selection}
+ */
+package org.gvsig.fmap.dal;
+
+/**
+ * Interface to manage selection of objects from an undetermined set.
+ * 
+ * @author <a href="mailto:cordin@disid.com">César Ordiñana</a>
+ */
+public interface DataSelection extends DataSet {
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_el_uso.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_el_uso.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_driver.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_driver.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_dataStore.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_dataStore.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/pom.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/pom.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/pom.xml	(revision 35988)
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<parent>
+		<artifactId>gvsig-base-library-pom</artifactId>
+		<groupId>org.gvsig</groupId>
+		<version>2.0-SNAPSHOT</version>
+	</parent>	
+	<distributionManagement>
+		<site>
+			<id>gvsig-repository</id>
+			<url>${site-repository}/</url>
+		</site>
+	</distributionManagement>
+
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.gvsig</groupId>
+	<artifactId>org.gvsig.fmap.dal</artifactId>
+	<name>libFMap_dal</name>
+	<version>2.0-SNAPSHOT</version>
+	<url>http://gvsig.org</url>
+	<dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+		</dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.projection</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+            <scope>compile</scope>
+		</dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.timesupport.lib.api</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>easymock</groupId>
+			<artifactId>easymock</artifactId>
+			<version>1.2_Java1.3</version>
+			<scope>test</scope>
+		</dependency>
+        <dependency>
+            <groupId>easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <version>1.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>xmlpull</groupId>
+            <artifactId>xmlpull</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<!-- Implementation dependencies for TESTS -->
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<type>test-jar</type>
+		</dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.compat</artifactId>
+            <classifier>se</classifier>
+            <scope>test</scope>
+        </dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+			<classifier>impl</classifier>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<properties>
+		<build-dir>${basedir}/../build</build-dir>
+        <eclipse.project.name>libFMap_dal</eclipse.project.name>
+	</properties>
+	
+	<profiles>
+		<profile>
+			<id>se</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<dependencies>
+				<!-- TESTS -->
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.geometry</artifactId>
+					<classifier>operation</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.projection</artifactId>
+					<classifier>cresques-impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-legacy</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-main</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.opengis</groupId>
+				    <artifactId>geoapi</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>javax.media</groupId>
+					<artifactId>jai_core</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>javax.media</groupId>
+					<artifactId>jai_codec</artifactId>
+					<scope>test</scope>
+				</dependency>
+			</dependencies>
+		</profile>
+		<profile>
+			<id>cdc</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+			
+			<dependencies>
+				<!-- TESTS -->
+				<dependency>
+					<groupId>org.gvsig.mobile</groupId>
+					<artifactId>org.gvsig.mobile.libProjection</artifactId>
+					<version>0.0.1-SNAPSHOT</version>
+				</dependency>
+			</dependencies>			
+		</profile>
+		<profile>
+			<id>eclipse-project</id>
+			<build>
+				<defaultGoal>antrun:run</defaultGoal>
+				<plugins>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<configuration>
+							<tasks>
+								<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
+									target="eclipse.all"/>
+							</tasks>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>				
+		</profile>		
+	</profiles>
+			
+	<build>
+		<sourceDirectory>src</sourceDirectory>
+		<testSourceDirectory>src-test</testSourceDirectory>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.4</source>
+					<target>1.4</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<configuration>
+					<excludes>
+						<exclude>**/impl/**</exclude>
+						<exclude>**/spi/**</exclude>
+					</excludes>
+				</configuration>
+				<executions>
+					<!--
+						Generates a jar file only with the DAL default implementation
+					-->
+					<execution>
+						<id>impl</id>
+						<phase>package</phase>
+						<goals>
+							<goal>jar</goal>
+						</goals>
+						<configuration>
+							<classifier>impl</classifier>
+							<includes>
+								<include>**/impl/**</include>
+							</includes>
+							<excludes>
+								<exclude>**/spi/**</exclude>
+							</excludes>
+						</configuration>
+					</execution>
+					<!--
+						Generates a jar file only with the DAL SPI
+					-->
+					<execution>
+						<id>spi</id>
+						<phase>package</phase>
+						<goals>
+							<goal>jar</goal>
+						</goals>
+						<configuration>
+							<classifier>spi</classifier>
+							<includes>
+								<include>**/spi/**</include>
+							</includes>
+							<excludes>
+								<exclude>**/impl/**</exclude>
+							</excludes>
+						</configuration>
+					</execution>
+					<!--
+						Generates a jar file only with the test classes
+					-->
+					<execution>
+						<goals>
+							<goal>test-jar</goal>
+						</goals>
+						<configuration>
+							<includes>
+								<include>**/**</include>
+							</includes>
+							<excludes>
+								<exclude>NONE</exclude>
+							</excludes>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>services</id>
+						<phase>package</phase>
+						<goals>
+							<goal>run</goal>
+						</goals>
+						<configuration>
+							<tasks>
+								<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
+									update="true">
+									<fileset dir="${basedir}/resources/api" />
+								</jar>
+								<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar"
+									update="true">
+									<fileset dir="${basedir}/resources/impl" />
+								</jar>
+							</tasks>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<excludes>
+						<exclude>**/BlockTest.java</exclude>
+					</excludes>
+					<additionalClasspathElements>
+						<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+						<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement>
+					</additionalClasspathElements>
+                    <skipTests>true</skipTests>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<reporting>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-javadoc-plugin</artifactId>
+				<reportSets>
+					<reportSet>
+						<id>api</id>
+						<configuration>
+							<excludePackageNames>*.spi:*.impl</excludePackageNames>
+							<name>Javadoc: API</name>
+							<destDir>apidoc</destDir>
+							<windowtitle>API Documentation</windowtitle>
+						</configuration>
+						<reports>
+							<report>javadoc</report>
+						</reports>
+					</reportSet>
+					<reportSet>
+						<id>spi</id>
+						<configuration>
+							<doctitle>${project.name} ${project.version} SPI</doctitle>
+							<subpackages>org.gvsig.fmap.dal.spi:org.gvsig.fmap.dal.feature.spi:org.gvsig.fmap.dal.raster.spi:org.gvsig.fmap.dal.resource.spi</subpackages>
+							<name>Javadoc: SPI</name>
+							<destDir>spidoc</destDir>
+							<windowtitle>SPI Documentation</windowtitle>
+							<links>
+								<link>../apidoc/</link>
+							</links>
+						</configuration>
+						<reports>
+							<report>javadoc</report>
+						</reports>
+					</reportSet>
+					<reportSet>
+						<id>impl</id>
+						<configuration>
+							<doctitle>${project.name} ${project.version} Default implementation</doctitle>
+							<subpackages>org.gvsig.fmap.dal.impl:org.gvsig.fmap.dal.feature.impl:org.gvsig.fmap.dal.raster.impl:org.gvsig.fmap.dal.resource.impl</subpackages>
+							<name>Javadoc: Impl</name>
+							<destDir>impldoc</destDir>
+							<windowtitle>Default implementation Documentation</windowtitle>
+							<links>
+								<link>../apidoc/</link>
+								<link>../spidoc/</link>
+							</links>
+						</configuration>
+						<reports>
+							<report>javadoc</report>
+						</reports>
+					</reportSet>
+				</reportSets>
+			</plugin>
+		</plugins>
+	</reporting>
+</project>
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library	(revision 35988)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.impl.DALDefaultImplLibrary
\ No newline at end of file
Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml	(revision 35988)
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class name="DataProvider" namespace="Metadata">
+      <description>Metadata of a feature store</description>
+      <fields>
+        <field name="ProviderName" type="string" mandatory="true">
+          <description>The name of the provider of data</description>
+        </field>
+        <field name="ContainerName" type="string" mandatory="false">
+          <description>Name of the container of the data, by example, in a dbf, the file name of the dbf</description>
+        </field>
+      </fields>
+    </class>
+
+    <class name="FeatureProvider" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="DataProvider"/>
+      </extends>
+      <description>Metadata of a feature store</description>
+      <fields>
+        <field name="FeatureType" type="dynobject" mandatory="false">
+          <description>The definition of the structure of the store</description>
+        </field>    
+      </fields>
+    </class>
+
+    <class name="SpatialProvider" namespace="Metadata">
+      <extends>
+      	<class namespace="Metadata" name="FeatureProvider"/>
+      </extends>
+      <description>Metadata of a feature store with spatial support</description>
+      <fields>
+        <field name="CRS" type="crs" mandatory="false">
+          <description></description>
+        </field>    
+        <field name="Envelope" type="envelope" mandatory="false">
+          <description></description>
+        </field>    
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml	(revision 35988)
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<definitions>
+  <version>1.0.0</version>
+  <classes>
+    <class namespace="dal" name="ProviderParameters">
+      <description>Parameters used for open a store</description>
+      <fields>
+        <field name="ProviderName" type="string" mandatory="true" group="Other">
+          <description>Name of the provider</description>
+        </field>
+      </fields>
+    </class>
+
+    <class namespace="dal" name="NewProviderParameters">
+      <extends>
+      	<class namespace="dal" name="ProviderParameters"/>
+      </extends>
+      <description>Parameters used for create a new store in the server</description>
+      <fields>
+        <field name="FeatureType" type="object" mandatory="true" classOfValue="org.gvsig.fmap.dal.feature.FeatureType">
+          <description>Define the structure of the new store</description>
+        </field>
+      </fields>
+    </class>
+
+  </classes>
+</definitions>  

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_0/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 35988)
@@ -0,0 +1,3 @@
+org.gvsig.fmap.dal.DALLibrary
+org.gvsig.fmap.dal.store.memory.MemoryStoreLibrary
+

Property changes on: tags/dal_time_support_Build_0/libraries/libFMap_dal
___________________________________________________________________
Added: svn:ignore
   + .classpath 
.project 
.settings 
maven-eclipse.xml
target
bin
hs_err_pid*
.externalToolBuilders
.settings
.classpath
.project


