Index: tags/v2_0_0_Build_2047/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/v2_0_0_Build_2047/libraries/libFMap_dal/imagenes/Diagrama_para_el_uso.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2047/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/v2_0_0_Build_2047/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_driver.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2047/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/v2_0_0_Build_2047/libraries/libFMap_dal/imagenes/Diagrama_para_implementar_dataStore.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/pom.xml
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/pom.xml	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/pom.xml	(revision 38284)
@@ -0,0 +1,357 @@
+<?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">
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.gvsig.fmap.dal</artifactId>
+	<name>libFMap_dal</name>
+	<version>2.0-SNAPSHOT</version>
+    <parent>
+        <artifactId>gvsig-base-library-pom</artifactId>
+        <groupId>org.gvsig</groupId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>   
+	<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.i18n</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.gvsig</groupId>
+            <artifactId>org.gvsig.timesupport.lib.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </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/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml	(revision 38284)
@@ -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" subType="org.gvsig.fmap.dal.feature.FeatureType" 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/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/MetadataDefinitions.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml	(revision 38284)
@@ -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="Advanced">
+          <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" hidden="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/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 38284)
@@ -0,0 +1,3 @@
+org.gvsig.fmap.dal.DALLibrary
+org.gvsig.fmap.dal.store.memory.MemoryStoreLibrary
+
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/META-INF/services/org.gvsig.tools.library.Library	(revision 38284)
@@ -0,0 +1 @@
+org.gvsig.fmap.dal.impl.DALDefaultImplLibrary
\ No newline at end of file
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text.properties
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text.properties	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text.properties	(revision 38284)
@@ -0,0 +1,2 @@
+filling_index=Llenando �ndice
+updating_index=Actualizando �ndice
\ No newline at end of file
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text_en.properties
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text_en.properties	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources/impl/org/gvsig/fmap/dal/i18n/text_en.properties	(revision 38284)
@@ -0,0 +1,2 @@
+filling_index=Filling index
+updating_index=Updating index
\ No newline at end of file
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/commands/CommandTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/DataStoreTest.java	(revision 38284)
@@ -0,0 +1,10 @@
+package org.gvsig.fmap.dal;
+
+import junit.framework.TestCase;
+
+public class DataStoreTest extends TestCase {
+    
+    public void testVoid() {
+
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/AbstractResourceTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestNonBlockingResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestAbstractResourcePerformance.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/resource/spi/TestResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/AllTests.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculatorTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureTest.java	(revision 38284)
@@ -0,0 +1,11 @@
+package org.gvsig.fmap.dal.feature;
+
+import junit.framework.TestCase;
+
+public class FeatureTest extends TestCase {
+
+    public void testVoid() {
+
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestEditableFeatureStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteFirstAndLastFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/UpdateFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/StoreTask.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/InsertFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/testmulithread/DeleteLastFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java	(revision 38284)
@@ -0,0 +1,136 @@
+/* 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.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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/FeatureSetTestParent.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/MyTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelectionTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/impl/JoinTransform.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java	(revision 38284)
@@ -0,0 +1,2088 @@
+/* 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.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();
+						}
+
+					}
+					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 extends AbstractFeatureStoreTransform {
+		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 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 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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/feature/BaseTestFeatureStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src-test/org/gvsig/fmap/dal/store/memory/MemoryStoreProviderTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources-test/log4j.xml
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources-test/log4j.xml	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/resources-test/log4j.xml	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/resources-test/log4j.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/store/memory/MemoryStoreProvider.java	(revision 38284)
@@ -0,0 +1,328 @@
+/* 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.FeatureStoreProviderServices;
+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.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.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.VisitCanceledException;
+import org.gvsig.tools.visitor.Visitor;
+
+/**
+ * @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);
+
+    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);
+
+            set = this.getFeatureStore().getFeatureSet();
+
+            // Create a visitor to generate new data
+            EditionVisitor visitor = new EditionVisitor(set.getSize());
+
+            // collect new data
+            set.accept(visitor);
+
+            // update data objects
+            data = visitor.getData();
+            oids = visitor.getOids();
+            envelope = visitor.getEnvelope();
+
+        } catch (DataException e) {
+            logger.error("Error adding features", e);
+        } catch (BaseException e) {
+            logger.error("Error performing edition", 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;
+    }
+
+    public boolean supportsAppendMode() {
+        return true;
+    }
+
+    public void append(FeatureProvider featureProvider) throws DataException {
+        FeatureProvider newFeatureProvider = featureProvider.getCopy();
+        if (data.isEmpty()) {
+            try {
+                envelope =
+                    (Envelope) newFeatureProvider.getDefaultEnvelope().clone();
+            } catch (CloneNotSupportedException e) {
+                envelope = newFeatureProvider.getDefaultEnvelope();
+            }
+        } else {
+            envelope.add(newFeatureProvider.getDefaultEnvelope());
+        }
+
+        newFeatureProvider.setNew(false);
+        data.add(newFeatureProvider);
+        oids.put(newFeatureProvider.getOID(), newFeatureProvider);
+        logger.debug("Envelope after adding feature: ", envelope.toString());
+    }
+
+    public void beginAppend() throws DataException {
+        // Nothing to do
+    }
+
+    public void endAppend() throws DataException {
+        // Nothing to do
+    }
+
+    /**
+     * Visitor to create new data objects from finish edition operation
+     * 
+     * @author jmvivo ( jmvivo at disid dot com)
+     * 
+     */
+    private class EditionVisitor implements Visitor {
+
+        private List data;
+        private Map oids;
+        private Envelope envelope;
+        private FeatureStoreProviderServices services;
+
+        /**
+         * @param size
+         *            to use to initialize data structures
+         * @throws CreateEnvelopeException
+         */
+        public EditionVisitor(long size) {
+            data = new ArrayList((int) size);
+            oids = new Hashtable((int) size);
+            envelope = null;
+            services = MemoryStoreProvider.this.getStoreServices();
+        }
+
+        public void visit(Object obj) throws VisitCanceledException,
+            BaseException {
+            Feature feature = (Feature) obj;
+            FeatureProvider featureProvider =
+                services.getFeatureProviderFromFeature(feature);
+            featureProvider.setNew(false);
+            data.add(featureProvider);
+            oids.put(featureProvider.getOID(), featureProvider);
+            if (envelope == null) {
+                try {
+                    envelope = (Envelope) feature.getDefaultEnvelope().clone();
+                } catch (CloneNotSupportedException e) {
+                    envelope = feature.getDefaultEnvelope();
+                }
+            } else {
+                envelope.add(feature.getDefaultEnvelope());
+            }
+            Envelope aux = feature.getDefaultEnvelope();
+            if (aux != null) { //There are geometries
+            	if (envelope == null) {
+            		try {
+            			envelope = (Envelope) aux.clone();
+            		} catch (CloneNotSupportedException e) {
+            			envelope = feature.getDefaultEnvelope();
+            		}
+            	} else {
+            		envelope.add(feature.getDefaultEnvelope());
+            	}
+            }
+        }
+
+        public List getData() {
+            return data;
+        }
+
+        public Map getOids() {
+            return oids;
+        }
+
+        public Envelope getEnvelope() {
+            return envelope;
+        }
+    }
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ParameterMissingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ReadRuntimeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/LoadException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ProviderNotRegisteredException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/WriteException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/FileNotFoundException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/RemoveException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedVersionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CopyParametersException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/UnsupportedEncodingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataEvaluatorRuntimeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ServerExplorerAddException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ServerExplorerAddException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ServerExplorerAddException.java	(revision 38284)
@@ -0,0 +1,17 @@
+package org.gvsig.fmap.dal.exception;
+
+public class ServerExplorerAddException extends DataException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -6146358748129171538L;
+	private final static String MESSAGE_FORMAT = "Exception creating '%(store)'.";
+	private final static String MESSAGE_KEY = "_ServerExplorerAddException";
+
+	public ServerExplorerAddException(String store, Throwable cause) {
+		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
+		setValue("store", store);
+	}
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/OpenException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/InitializeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CreateException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataListException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/CloseException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/ValidateDataParametersException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/exception/DataException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSelection.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoveragerStoreParameters.java	(revision 38284)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.dal.raster;
+
+
+public interface CoveragerStoreParameters {
+
+	public String getDataStoreName();
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStore.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/impl/DefaultCoverageStoreNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/DefaultCoverageStoreFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/CoverageStore.java	(revision 38284)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.dal.raster;
+
+import org.gvsig.fmap.dal.DataStore;
+
+public interface CoverageStore extends DataStore {
+	
+}
+
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/AbstractCoverageStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/raster/spi/CoverageStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorer.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java	(revision 38284)
@@ -0,0 +1,160 @@
+/* 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.i18n.Messages;
+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();
+
+        Messages.addResourceFamily("org.gvsig.fmap.dal.i18n.text",
+            DALDefaultImplLibrary.class.getClassLoader(),
+            DALDefaultImplLibrary.class.getClass().getName());
+
+        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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DALDefaultImplLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DataStoreImplementation.java
===================================================================

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/coerce
===================================================================
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataServerExplorerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/impl/DefaultDataManager.java	(revision 38284)
@@ -0,0 +1,912 @@
+/* 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.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.DataStoreProviderFactory;
+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.EditableFeatureType;
+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.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType;
+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.DataStoreProviderToFeatureStoreProviderFactoryWrapper;
+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.fmap.geom.DataTypes;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypesManager;
+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.extensionpoint.ExtensionPointManager;
+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_STORE_PROVIDER_FACTORY =
+        "Data.manager.providers.factory";
+    final static private String DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION =
+        "DAL store provider 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;
+
+    private ArrayList dataTypes;
+
+    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);
+
+        ToolsLocator.getExtensionPointManager().add(
+            DATA_MANAGER_STORE_PROVIDER_FACTORY,
+            DATA_MANAGER_STORE_PROVIDER_FACTORY_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)) {
+            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);
+            return;
+        }
+
+        if (FeatureStoreProvider.class.isAssignableFrom(storeProviderClass)) {
+            // Envuelve al proveedor en una factoria por defecto.
+            this.registerStoreProviderFactory(new DataStoreProviderToFeatureStoreProviderFactoryWrapper(
+                name, "", storeProviderClass, parametersClass));
+            return;
+        }
+
+        throw new IllegalArgumentException("Not supported implemtation: name="
+            + name + " provider class=" + storeProviderClass.getName());
+
+    }
+
+    public void registerStoreProviderFactory(DataStoreProviderFactory factory) {
+        ExtensionPoint factories =
+            ToolsLocator.getExtensionPointManager().add(
+                DATA_MANAGER_STORE_PROVIDER_FACTORY,
+                DATA_MANAGER_STORE_PROVIDER_FACTORY_DESCRIPTION);
+        factories.append(factory.getName(), factory.getDescription(), factory);
+
+    }
+
+    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 {
+
+            // Si hay una factoria para ese proveedor se los pedimos a la
+            // factoria
+            DataStoreProviderFactory providerFactory =
+                (DataStoreProviderFactory) ToolsLocator
+                    .getExtensionPointManager()
+                    .get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name);
+            if (providerFactory != null) {
+                return (DataStoreParameters) providerFactory.createParameters();
+            }
+
+            // Si no hay factoria lo hacemos como se hacia antes por mantener
+            // compatibilidad.
+            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);
+        }
+    }
+
+    private DataStore localOpenStore(String provider,
+        DataStoreParameters parameters) throws InitializeException,
+        ProviderNotRegisteredException, ValidateDataParametersException {
+        String name = provider; // parameters.getDataStoreName();
+
+        parameters.validate();
+
+        DataStore store;
+        try {
+            DataStoreProviderFactory providerFactory;
+            providerFactory =
+                (DataStoreProviderFactory) ToolsLocator
+                    .getExtensionPointManager()
+                    .get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name);
+            if (providerFactory != null) {
+                if (FeatureStoreProviderFactory.class
+                    .isAssignableFrom(providerFactory.getClass())) {
+                    store = new DefaultFeatureStore();
+                    this.intializeDataStore(store, parameters);
+                    return store;
+                }
+            }
+        } catch (InstantiationException e1) {
+            // ignore
+        } catch (IllegalAccessException e1) {
+            // ignore
+        }
+
+        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 {
+
+        return localOpenStore(provider, parameters);
+    }
+
+    /**
+     * @deprecated see openStore
+     */
+    public DataStore createStore(DataStoreParameters parameters)
+        throws InitializeException, ProviderNotRegisteredException,
+        ValidateDataParametersException {
+        return openStore(parameters.getDataStoreName(), parameters);
+    }
+
+    public List getStoreProviders() {
+        ExtensionPointManager epmanager =
+            ToolsLocator.getExtensionPointManager();
+        List names1 = epmanager.get(DATA_MANAGER_STORE).getNames();
+        List names2 =
+            epmanager.get(DATA_MANAGER_STORE_PROVIDER_FACTORY).getNames();
+        List names3 = new ArrayList();
+        names3.addAll(names1);
+        names3.addAll(names2);
+        return names3;
+    }
+
+    public DataStoreProviderFactory getStoreProviderFactory(String name) {
+        try {
+            return (DataStoreProviderFactory) ToolsLocator
+                .getExtensionPointManager()
+                .get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name);
+        } catch (InstantiationException e) {
+            return null;
+        } catch (IllegalAccessException e) {
+            return null;
+        }
+    }
+
+    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 {
+                DataStoreProviderFactory providerFactory =
+                    (DataStoreProviderFactory) ToolsLocator
+                        .getExtensionPointManager()
+                        .get(DATA_MANAGER_STORE_PROVIDER_FACTORY).create(name);
+                if (providerFactory != null) {
+                    provider =
+                        (DataStoreProvider) providerFactory.createProvider(
+                            parameters, providerServices);
+                } else {
+                    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 setOpenErrorHandler(OpenErrorHandler handler) {
+        openErrorHandler = handler;
+
+    }
+
+    public EditableFeatureType createFeatureType() {
+        return new DefaultEditableFeatureType();
+    }
+
+    public List getDataTypes() {
+        if (dataTypes == null) {
+            DataTypesManager manager = ToolsLocator.getDataTypesManager();
+            dataTypes = new ArrayList();
+            dataTypes.add(manager.get(DataTypes.STRING));
+            dataTypes.add(manager.get(DataTypes.BOOLEAN));
+            dataTypes.add(manager.get(DataTypes.INT));
+            dataTypes.add(manager.get(DataTypes.DOUBLE));
+            dataTypes.add(manager.get(DataTypes.DATE));
+            dataTypes.add(manager.get(DataTypes.GEOMETRY));
+        }
+        return dataTypes;
+    }
+    
+    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());
+        }
+    }
+    
+    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);
+        }
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLocator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/NewDataStoreParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java	(revision 38284)
@@ -0,0 +1,158 @@
+/* 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.cresques.ProjectionLibrary;
+
+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.TimeSupportLibrary;
+import org.gvsig.tools.ToolsLibrary;
+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(ToolsLibrary.class);
+        require(MetadataLibrary.class);
+        require(ProjectionLibrary.class);
+        require(GeometryLibrary.class);
+        require(TimeSupportLibrary.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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DALLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStore.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProviderFactory.java	(revision 38284)
@@ -0,0 +1,77 @@
+package org.gvsig.fmap.dal;
+
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.service.spi.ProviderFactory;
+
+public interface DataStoreProviderFactory extends ProviderFactory {
+	
+	public static final int UNKNOWN = 0;
+	public static final int YES = 1;
+	public static final int NO = 2;
+	
+	/**
+	 * Returns the name of the provider
+	 * 
+	 * @return name of the provider
+	 */
+	public String getName();
+	
+	/**
+	 * Return a short descripion about the provider
+	 * 
+	 * @return description about the provider
+	 */
+	public String getDescription();
+	
+	/**
+	 * The provider has read support
+	 * 
+	 * @return YES if has read support
+	 */
+	public int allowRead();
+	
+	/**
+	 * The provider has write support
+	 * 
+	 * @return YES if has write support
+	 */
+	public int allowWrite();
+
+	/**
+	 * The provider can create new stores.
+	 * 
+	 * @return YES if has creation support
+	 */
+	public int allowCreate();
+
+	/**
+	 * The provider has tabular support.
+	 * This support is the minimum requisite for a FeatureStore.
+	 * 
+	 * @return YES if has write support
+	 */
+	public int hasTabularSupport();
+
+	/**
+	 * The provider has vectorial support.
+	 * 
+	 * @return YES if has vectorial support
+	 */
+	public int hasVectorialSupport();
+	
+	/**
+	 * The provider has raster support.
+	 * 
+	 * @return YES if has raster support
+	 */
+	public int hasRasterSupport();
+		
+	/**
+	 * Builds a specific provider
+	 * 
+	 * @return the provider
+	 */
+	public DataStoreProvider createProvider(DataParameters parameters, DataStoreProviderServices providerServices) throws InitializeException;
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreNotification.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java	(revision 38284)
@@ -0,0 +1,35 @@
+/* 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataTypes.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataQuery.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreProvider.java	(revision 38284)
@@ -0,0 +1,5 @@
+package org.gvsig.fmap.dal;
+
+public interface DataStoreProvider {
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataManager.java	(revision 38284)
@@ -0,0 +1,409 @@
+/* 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.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.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;
+	
+	public void setOpenErrorHandler(OpenErrorHandler handler);
+	
+	public DataStoreProviderFactory getStoreProviderFactory(String name);
+
+	public EditableFeatureType createFeatureType();
+	
+	public List getDataTypes();
+	
+	/**
+	 * 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;
+}
\ No newline at end of file

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataServerExplorerParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotClosedOnDisposeManagerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyOpenException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/DisposeResorceManagerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/PrepareResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotRegisteredException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyCloseException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyDisposeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceNotifyChangesException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceManager.java	(revision 38284)
@@ -0,0 +1,364 @@
+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.Map.Entry;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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;
+
+
+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 synchronized Resource getResource(String key) {
+		return (Resource)this.resources.get(key);
+	}
+
+    public synchronized 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 synchronized 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 synchronized 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 synchronized void closeResources() throws DataException {
+		this.collectResources();
+		Resource res;
+		Iterator iter = this.resources.values().iterator();
+		while (iter.hasNext()) {
+			res = (Resource) iter.next();
+			res.closeRequest();
+		}
+	}
+
+    public synchronized 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/impl/DefaultResourceNotification.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceAction.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/Resource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/ResourceParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceConsumer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResourceParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractNonBlockingResource.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/AbstractResourceParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceManagerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/MultiResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/resource/spi/ResourceProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/OpenErrorHandler.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataParameterDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/DataStoreParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreInitializer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataStoreProviderFactory.java	(revision 38284)
@@ -0,0 +1,61 @@
+package org.gvsig.fmap.dal.spi;
+
+import org.gvsig.fmap.dal.DataStoreProviderFactory;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.Provider;
+import org.gvsig.tools.service.spi.ProviderServices;
+
+public abstract class AbstractDataStoreProviderFactory implements
+		DataStoreProviderFactory {
+
+	private String name = null;
+	private String description = "";
+
+
+	protected AbstractDataStoreProviderFactory(String name, String description) {
+		this.name = name;
+		this.description = description;
+	}
+	
+	public final Provider create(DynObject parameters, ProviderServices services)
+			throws ServiceException {
+		throw new UnsupportedOperationException();
+	}
+
+	public final void initialize() {
+		throw new UnsupportedOperationException();
+	}
+
+	public final String getName() {
+		return this.name;
+	}
+
+	public final String getDescription() {
+		return this.description;
+	}
+
+	public int allowRead() {
+		return UNKNOWN;
+	}
+
+	public int allowWrite() {
+		return UNKNOWN;
+	}
+
+	public int allowCreate() {
+		return UNKNOWN;
+	}
+
+	public int hasTabularSupport() {
+		return UNKNOWN;
+	}
+
+	public int hasVectorialSupport() {
+		return UNKNOWN;
+	}
+
+	public int hasRasterSupport() {
+		return UNKNOWN;
+	}
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataServerExplorerProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java	(revision 38284)
@@ -0,0 +1,167 @@
+/* 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 String toString() {
+		return getDelegatedDynObject().toString();
+	}
+	
+	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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java	(revision 38284)
@@ -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 org.gvsig.fmap.dal.DataStoreProvider, 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/AbstractDataProviderIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataManagerProviderServices.java	(revision 38284)
@@ -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.spi;
+
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataServerExplorerParameters;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.DataStoreProviderFactory;
+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;	 
+
+	 public void registerStoreProviderFactory(DataStoreProviderFactory factory);
+
+}
\ No newline at end of file

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/spi/DataStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/FeaturePagingHelper.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java
___________________________________________________________________
Added: svn:mergeinfo

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/OneSubsetOneSetPagingCalculator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/paging/impl/FeatureSetSizeableDelegate.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransforms.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocks.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java	(revision 38284)
@@ -0,0 +1,161 @@
+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.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.persistence.PersistenceManager;
+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.
+ * 
+ * The {@link FeatureType} of this class is not persistent: it has to be generated
+ * by the child implementations of this abstract class when they are created
+ * using the persistence mechanism.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public abstract class AbstractFeatureStoreTransform implements
+FeatureStoreTransform {
+    public static final String METADATA_DEFINITION_NAME = "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;
+
+    private DynObject originalMetadata = null;
+
+    
+    public AbstractFeatureStoreTransform() {
+        this(null, "");
+    }
+
+    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() {
+	    PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
+	    DynStruct definition = persistenceManager.getDefinition(ABSTRACT_FEATURESTORE_DYNCLASS_NAME);
+
+	    if (definition == null){
+	        definition = persistenceManager.addDefinition(
+	            AbstractFeatureStoreTransform.class, 
+	            ABSTRACT_FEATURESTORE_DYNCLASS_NAME, 
+	            "AbstractFeatureStoreTransform Persistent definition", 
+	            null, 
+	            null
+	        );
+
+	        definition.addDynFieldObject("store")
+	            .setClassOfValue(FeatureStore.class)
+	            .setMandatory(true);
+	    }
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		this.store = (FeatureStore) state.get("store");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("store", store);	
+	}
+
+	
+	public final void setSourceMetadata(DynObject metadata) {
+		this.originalMetadata = metadata;
+	}
+	
+	protected DynObject getSourceMetadata() {
+		return this.originalMetadata;
+	}
+	
+	/**
+	 * Get the metadata value for the name <code>name</code>.
+	 * 
+	 * Overwrite this method to support that this transform overwrite the values
+	 * of the statore's metadata.
+	 * 
+	 * @see {#Metadata.getDynValue}
+	 */
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		throw new DynFieldNotFoundException(name, "transform");
+	}
+
+	/**
+	 * Return true is the value <code>name</name> has a value in the metadata
+	 * 
+	 * Overwrite this method to support that this transform overwrite the values
+	 * of the statore's metadata.
+	 * 
+	 * @see {#Metadata.hasDynValue}
+	 */
+	public boolean hasDynValue(String name) {
+		return false;
+	}
+
+	/**
+	 * Set the value of a metadata.
+	 * 
+	 * Overwrite this method to support that this transform overwrite the values
+	 * of the statore's metadata.
+	 * 
+	 * @see {#Metadata.getDynValue}
+	 */
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		throw new DynFieldNotFoundException(name, "transform");
+	}
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureType.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSelection.java
___________________________________________________________________
Added: svn:mergeinfo
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/NewFeatureStoreParameters.java	(revision 38284)
@@ -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 EditableFeatureType getDefaultFeatureType();
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureRule.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreProviderFactory.java	(revision 38284)
@@ -0,0 +1,22 @@
+package org.gvsig.fmap.dal.feature;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.DataStoreProviderFactory;
+
+public interface FeatureStoreProviderFactory extends DataStoreProviderFactory {
+
+	/**
+	 * Return a list of geometry types (Geometry.TYPES) supported
+	 * by this provider. If the provider has not vectorial support
+	 * or has not restrictions over geometry types return null.
+	 * 
+	 * @return List of Geometry.TYPES or null
+	 */
+	public List getSupportedGeometries();
+	
+	public int allowMultipleGeometryTypes();
+	
+	public int allowEditableFeatureType();
+	
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndexes.java	(revision 38284)
@@ -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 {{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();
+
+    /**
+     * Returns if all the indexes are valid and might be used to get Features.
+     * 
+     * @return if the indexes are valid
+     */
+    public boolean areValid();
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureSetProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/cache/FeatureCacheProviderFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProvider.java	(revision 38284)
@@ -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.index;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.exception.DataException;
+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();
+
+    /**
+     * Removes all indexed data.
+     * 
+     * @throws DataException
+     *             if there is an error clearing the index
+     */
+    public void clear() throws DataException;
+
+}
+
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/AbstractFeatureIndexProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/index/FeatureIndexProviderServices.java	(revision 38284)
@@ -0,0 +1,133 @@
+/* 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.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+
+/**
+ * SPI for all index implementations.
+ * 
+ * This observable object provides notificationswhen the index has finished
+ * filling with data and is available to be used. The observer will
+ * receive then a {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
+ * notification, with the index object if it has finished
+ * successfully, or a {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
+ * notification with the exception object if there has been
+ * any error in the process.
+ * 
+ * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
+ * @see FeatureStoreNotification#INDEX_FILLING_ERROR
+ * 
+ * @author gvSIG team
+ */
+public interface FeatureIndexProviderServices extends FeatureIndex, Observable,
+    Disposable {
+
+    /** 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. This operation will not return
+     * until the index has filled with all the store's data.
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error while filling the index
+     */
+    public void fill() throws FeatureIndexException;
+
+    /**
+     * Fills this index with the store's data.
+     * 
+     * @param background
+     *            if the filling must be performed in background
+     * @param observer
+     *            optional observer to be notified when the
+     *            fill index operation finishes
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error while filling the index
+     * 
+     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
+     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
+     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
+     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
+     */
+    public void fill(boolean background, Observer observer)
+        throws FeatureIndexException;
+
+    /**
+     * Sets the index as valid or invalid, so it may be used or not.
+     * 
+     * @param valid
+     *            status to set the index to
+     */
+    public void setValid(boolean valid);
+
+    /**
+     * If the index is in the process of being filled by a background task,
+     * synchronize this method or add some mechanism for external callers to
+     * block on it.
+     */
+    public void waitForIndex();
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResource.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryResourceParameters.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/MemoryFeatureProviderAttributeMapper.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureReferenceProviderServices.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/LongList.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProviderFactory.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProviderFactory.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProviderFactory.java	(revision 38284)
@@ -0,0 +1,28 @@
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.util.List;
+
+import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.spi.AbstractDataStoreProviderFactory;
+
+public abstract class AbstractFeatureStoreProviderFactory extends
+		AbstractDataStoreProviderFactory implements FeatureStoreProviderFactory {
+
+
+	public AbstractFeatureStoreProviderFactory(String name, String description) {
+		super(name, description);
+	}
+
+	public List getSupportedGeometries() {
+		return null;
+	}
+
+	public int allowMultipleGeometryTypes() {
+		return UNKNOWN;
+	}
+	
+	public int allowEditableFeatureType() {
+		return UNKNOWN;
+	}
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultLongList.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DataStoreProviderToFeatureStoreProviderFactoryWrapper.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DataStoreProviderToFeatureStoreProviderFactoryWrapper.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DataStoreProviderToFeatureStoreProviderFactoryWrapper.java	(revision 38284)
@@ -0,0 +1,97 @@
+package org.gvsig.fmap.dal.feature.spi;
+
+import java.lang.reflect.Constructor;
+
+import org.gvsig.fmap.dal.DataParameters;
+import org.gvsig.fmap.dal.DataStoreProvider;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
+import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
+import org.gvsig.tools.dynobject.DynObject;
+
+public class DataStoreProviderToFeatureStoreProviderFactoryWrapper extends
+		AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory {
+
+	private Class providerClass = null;
+	private Class parametersClass = null;
+
+	public DataStoreProviderToFeatureStoreProviderFactoryWrapper(String name, String description,
+			Class provider, Class parametersClass) {
+		super(name, description);
+		this.providerClass = provider;
+		this.parametersClass = parametersClass;
+	}
+
+	public DataStoreProvider createProvider(DataParameters parameters,
+			DataStoreProviderServices providerServices)
+			throws InitializeException {
+		try {
+			Class[] argsTypes = new Class[] { DataParameters.class,
+					DataStoreProviderServices.class };
+			Object[] args = new Object[] { parameters, providerServices };
+
+			Constructor contructor;
+			contructor = findConstructor(providerClass, argsTypes);
+			return (DataStoreProvider) contructor.newInstance(args);
+		} catch (Throwable e) {
+			throw new InitializeException(e);
+		}
+	}
+
+	public final DynObject createParameters() {
+		try {
+			return (DynObject) parametersClass.newInstance();
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	protected Constructor findConstructor(Class clazz, Class[] types)
+			throws SecurityException, NoSuchMethodException {
+		try {
+			return clazz.getConstructor(types);
+		} catch (NoSuchMethodException e) {
+			// Nothing to do
+		}
+
+		// search for the required constructor
+		Constructor[] constrs = clazz.getConstructors();
+		boolean allMatch;
+		for (int i = 0; i < constrs.length; i++) {
+			Class[] paramTypes = constrs[i].getParameterTypes();
+			if (paramTypes.length == types.length) { // a general candidate
+				allMatch = true;
+				for (int j = 0; j < paramTypes.length; j++) {
+					if (!isParameterCompatible(types[j], paramTypes[j])) {
+						allMatch = false;
+						break;
+					}
+				}
+				if (allMatch) {
+					return constrs[i];
+				}
+
+			}
+		}
+		StringBuffer strb = new StringBuffer();
+		strb.append(clazz.getName());
+		strb.append('(');
+		if (types.length > 0) {
+			for (int i = 0; i < types.length - 1; i++) {
+				strb.append(types[i].getName());
+				strb.append(',');
+			}
+			strb.append(types[types.length - 1].getName());
+		}
+		strb.append(')');
+		throw new NoSuchMethodException(strb.toString());
+	}
+
+	private boolean isParameterCompatible(Class current, Class defined) {
+		if (current == null) {
+			return !defined.isPrimitive();
+		} else {
+			return current.isAssignableFrom(defined);
+		}
+	}
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureProviderIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureSetProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/DefaultFeatureProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ConcurrentDataModificationException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/DataExportException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceStoreAlreadyLoadedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SetReadOnlyAttributeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionNotAllowedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PersistenceCantFindDefaultFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUndoException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/WriteNotAllowedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NeedEditingModeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedDataTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AlreadyEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NoNewFeatureInsertException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/NullFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureSetInitializeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/InvalidFeatureIndexException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/InvalidFeatureIndexException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/InvalidFeatureIndexException.java	(revision 38284)
@@ -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.exception;
+
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+
+/**
+ * Exception thrown when a {@link FeatureIndex} is used but its state is not
+ * valid.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class InvalidFeatureIndexException extends FeatureIndexException {
+    
+    private static final long serialVersionUID = 3857591701014208141L;
+    private static final String MESSAGE_KEY = "_InvalidFeatureIndexException";
+    private static final String FORMAT_STRING = 
+        "The feature index is not valid in its current state and can't be used";
+    
+    /**
+     * Creates a new {@link InvalidFeatureIndexException}.
+     */
+    public InvalidFeatureIndexException() {
+        super(FORMAT_STRING, MESSAGE_KEY, serialVersionUID);
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureTypeIntegrityException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreInsertFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreEditException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnsupportedGeometryException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexOperationException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexOperationException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexOperationException.java	(revision 38284)
@@ -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.
+ *
+ */
+package org.gvsig.fmap.dal.feature.exception;
+
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+
+/**
+ * Exception thrown when a {@link FeatureIndex} operation has failed.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+public class FeatureIndexOperationException extends FeatureIndexException {
+
+    private static final long serialVersionUID = 3857591701014208141L;
+    private static final String MESSAGE_KEY = "_FeatureIndexOperationException";
+    private static final String FORMAT_STRING =
+        "Error performing operation: %(operation), on feature index: %(index)";
+
+    /**
+     * Creates a new {@link FeatureIndexOperationException}.
+     */
+    public FeatureIndexOperationException(FeatureIndex index, String operation,
+        Throwable source) {
+        super(FORMAT_STRING, source, MESSAGE_KEY, serialVersionUID);
+        setValue("index", index.toString());
+        setValue("operation", operation);
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreRedoException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalValueException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreCancelEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreUpdateFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeSizeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/CreateGeometryException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeIntegrityException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FeatureIndexException.java	(revision 38284)
@@ -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.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) {
+        this(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
+	}
+
+    /**
+     * @see DataException#DataException(String, String, long)
+     */
+    public FeatureIndexException(String messageFormat, String messageKey,
+        long code) {
+        super(messageFormat, messageKey, code);
+    }
+
+    /**
+     * @see DataException#DataException(String, Throwable, String, long)
+     */
+    public FeatureIndexException(String messageFormat, Throwable cause,
+        String messageKey, long code) {
+        super(messageFormat, cause, messageKey, code);
+    }
+
+}
+
+
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/FinishEditingException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteEditableFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IteratorIndexTooBigException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/SelectionStateException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/IllegalFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/AttributeFeatureTypeNotSuportedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ValidateFeaturesException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/StoreDeleteFeatureException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/UnknownDataTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/GetFeatureTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/ReversedSelectionIteratorException.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/exception/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureIndex.java	(revision 38284)
@@ -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.
+* 
+*/
+
+/*
+* 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) throws DataException;
+
+	/**
+	 * 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) throws DataException;
+
+	/**
+	 * 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;
+
+	
+    /**
+     * Returns if the index is valid and might be used to get Features.
+     * 
+     * @return if the index is valid
+     */
+    public boolean isValid();
+
+    /**
+     * Returns if the index is in the process of being filled with the Features
+     * of a store.
+     * 
+     * @return if the index is filling with data
+     */
+    public boolean isFilling();
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/rule/FeatureRulePolygon.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/Feature.java	(revision 38284)
@@ -0,0 +1,429 @@
+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;
+import org.gvsig.tools.dynobject.DynObject;
+
+
+/**
+ * <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);
+
+	public DynObject getAsDynObject();
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureLocksGroup.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreTransform.java	(revision 38284)
@@ -0,0 +1,130 @@
+/* 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.dynobject.DynObject;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+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();
+
+	/**
+	 * Sets the original metadata for this transform
+	 * 
+	 * @param metadata
+	 */
+	public void setSourceMetadata(DynObject metadata);
+	
+    public void setDynValue(String name, Object value)
+            throws DynFieldNotFoundException;
+    
+    public boolean hasDynValue(String name);
+    
+    public Object getDynValue(String name) throws DynFieldNotFoundException;
+	
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRules.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java	(revision 38284)
@@ -0,0 +1,206 @@
+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.fmap.geom.type.GeometryType;
+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
+     * @deprecated use {@link #setGeometryType(GeometryType)} instead
+     */
+	public EditableFeatureAttributeDescriptor setGeometryType(int geometryType);
+
+
+	    /**
+     * Sets the geometry subtype
+     * 
+     * @param geometrySubType
+     * 
+     * @return this
+     * @deprecated use {@link #setGeometryType(GeometryType)} instead
+     */
+	public EditableFeatureAttributeDescriptor setGeometrySubType(
+			int geometrySubType);
+
+    /**
+     * Sets the geometry type
+     * 
+     * @param geometryType
+     * 
+     * @return this
+     */
+    public EditableFeatureAttributeDescriptor setGeometryType(
+        GeometryType geometryType);
+
+    /**
+     * 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/EditableFeatureAttributeDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStore.java	(revision 38284)
@@ -0,0 +1,760 @@
+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 an index which will be applied to the features of the given type,
+     * by using the data of the given attribute.
+     * 
+     * @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 {@link FeatureIndex}
+     * 
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error creating the index
+     */
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName) throws DataException;
+
+    /**
+     * Creates an index which will be applied to the features of the given type,
+     * by using the data of the given attribute.
+     * 
+     * @param indexTypeName
+     *            the type of the index to be created. That name is
+     *            related to one of the registered index providers
+     * @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 {@link FeatureIndex}
+     * 
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error creating the index
+     */
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException;
+
+    /**
+     * Creates an index which will be applied to the features of the given type,
+     * by using the data of the given attribute. This method will return without
+     * waiting for the index to be filled, as that will be performed in
+     * background. An optional {@link Observer} parameter is provided to be
+     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
+     * when the index has finished filling with data and is available to be
+     * used.
+     * 
+     * @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
+     *            to notify to when the created index has finished filling
+     *            with data and is available to be used. The observer will
+     *            receive then a
+     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
+     *            notification, with the index object if it has finished
+     *            successfully, or a
+     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
+     *            notification with the exception object if there has been
+     *            any error in the process. Optional.
+     * 
+     * @return the resulting {@link FeatureIndex}
+     * 
+     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
+     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
+     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
+     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error creating the index
+     */
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName, Observer observer)
+        throws DataException;
+
+    /**
+     * Creates an index which will be applied to the features of the given type,
+     * by using the data of the given attribute. This method will return without
+     * waiting for the index to be filled, as that will be performed in
+     * background. An optional {@link Observer} parameter is provided to be
+     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
+     * when the index has finished filling with data and is available to be
+     * used.
+     * 
+     * @param indexTypeName
+     *            the type of the index to be created. That name is
+     *            related to one of the registered index providers
+     * @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
+     *            to notify to when the created index has finished filling
+     *            with data and is available to be used. The observer will
+     *            receive then a
+     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
+     *            notification, with the index object if it has finished
+     *            successfully, or a
+     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
+     *            notification with the exception object if there has been
+     *            any error in the process. Optional.
+     * 
+     * @return the resulting {@link FeatureIndex}
+     * 
+     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
+     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
+     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
+     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
+     * 
+     * @throws FeatureIndexException
+     *             if there is an error creating the index
+     */
+    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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReference.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQueryOrder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureAttributeDescriptor.java	(revision 38284)
@@ -0,0 +1,195 @@
+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.fmap.geom.type.GeometryType;
+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}
+     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
+     *             2.1.
+     */
+	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}
+     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
+     *             2.1.
+     */
+	public int getGeometrySubType();
+
+    /**
+     * Returns the {@link GeometryType} of the attribute if it is a geometry.
+     * 
+     * @return the geometry type
+     */
+    public GeometryType getGeomType();
+
+	/**
+	 * 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureCache.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureStoreNotification.java	(revision 38284)
@@ -0,0 +1,80 @@
+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";
+
+    /**
+     * Notifies about a Feature index filling operation being started. The
+     * notification object will provide the index object.
+     */
+    public static final String INDEX_FILLING_STARTED = "Index_Filling_Started";
+    /**
+     * Notifies about a Feature index finished filling successfully. The
+     * notification object will provide the index object.
+     */
+    public static final String INDEX_FILLING_SUCCESS = "Index_Filling_Success";
+    /**
+     * Notifies about a Feature index filling operation being cancelled. The
+     * notification object will provide the index object.
+     */
+    public static final String INDEX_FILLING_CANCELLED =
+        "Index_Filling_Cancelled";
+    /**
+     * Notifies about a Feature index finished operation error. The notification
+     * will provide the source exception.
+     */
+    public static final String INDEX_FILLING_ERROR = "Index_Filling_Error";
+
+	public Feature getFeature();
+
+	public DataSet getCollectionResult();
+
+	public boolean loadSucefully();
+
+	public Exception getExceptionLoading();
+
+	public Command getCommand();
+
+	public EditableFeatureType getFeatureType();
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureReferenceSelection.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/operation/LegendLabelingManager.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureRules.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java	(revision 38284)
@@ -0,0 +1,218 @@
+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.fmap.geom.type.GeometryType;
+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 type) {
+        this.geometryType = type;
+        this.geomType = null;
+        return this;
+    }
+
+    public EditableFeatureAttributeDescriptor setGeometrySubType(int subType) {
+        this.geometrySubType = subType;
+        this.geomType = null;
+        return this;
+    }
+
+    public EditableFeatureAttributeDescriptor setGeometryType(
+        GeometryType geometryType) {
+        this.geomType = geometryType;
+        this.geometryType = this.geomType.getType();
+        this.geometrySubType = this.geomType.getSubType();
+        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 setIsTime(boolean isTime) {
+		this.isTime = isTime;
+		if( this.evaluator != null ) {
+            hasStrongChanges=true;
+        }
+		return this;
+	}
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java	(revision 38284)
@@ -0,0 +1,2000 @@
+/* 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.Map.Entry;
+import java.util.Set;
+
+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 {
+
+    private static final Logger LOG = 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;
+
+    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.disposeIndexes();
+        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();
+        }
+        if (hasDynValue(DataStore.METADATA_ENVELOPE)){
+            return (Envelope)getDynValue(DataStore.METADATA_ENVELOPE);
+        }
+        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) {
+            LOG.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()) {
+            LOG.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) {
+        if (delegateObservable != null) {
+            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("Error: store "
+					+ this.getFullName() + " is in append mode");
+        }
+    }
+
+    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 {
+        LOG.debug("Starting editing in mode: {}", new Integer(mode));
+        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);
+                invalidateIndexes();
+                featureManager =
+                    new FeatureManager(new MemoryExpansionAdapter());
+                featureTypeManager =
+                    new FeatureTypeManager(this, new MemoryExpansionAdapter());
+                spatialManager =
+                    new SpatialManager(this, provider.getEnvelope());
+
+                commands =
+                    new DefaultFeatureCommandsStack(this, 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);
+                invalidateIndexes();
+                this.provider.beginAppend();
+                this.mode = MODE_APPEND;
+                hasInserts = false;
+                notifyChange(FeatureStoreNotification.AFTER_STARTEDITING);
+                break;
+            }
+        } catch (Exception e) {
+            throw new StoreEditException(e, this.getName());
+        }
+    }
+
+    private void invalidateIndexes() {
+        setIndexesValidStatus(false);
+    }
+
+    private void setIndexesValidStatus(boolean valid) {
+        FeatureIndexes indexes = getIndexes();
+        LOG.debug("Setting the store indexes to valid status {}: {}", (valid
+            ? Boolean.TRUE : Boolean.FALSE), indexes);
+        for (Iterator iterator = indexes.iterator(); iterator.hasNext();) {
+            FeatureIndex index = (FeatureIndex) iterator.next();
+            if (index instanceof FeatureIndexProviderServices) {
+                FeatureIndexProviderServices indexServices =
+                    (FeatureIndexProviderServices) index;
+                indexServices.setValid(valid);
+            }
+        }
+    }
+
+    private void updateIndexes() throws FeatureIndexException {
+        FeatureIndexes indexes = getIndexes();
+        LOG.debug("Refilling indexes: {}", indexes);
+        for (Iterator iterator = indexes.iterator(); iterator.hasNext();) {
+            FeatureIndex index = (FeatureIndex) iterator.next();
+            if (index instanceof FeatureIndexProviderServices) {
+                FeatureIndexProviderServices indexServices =
+                    (FeatureIndexProviderServices) index;
+                indexServices.fill(true, null);
+            }
+        }
+    }
+
+    private void waitForIndexes() {
+        FeatureIndexes indexes = getIndexes();
+        LOG.debug("Waiting for indexes to finish filling: {}", indexes);
+        for (Iterator iterator = indexes.iterator(); iterator.hasNext();) {
+            FeatureIndex index = (FeatureIndex) iterator.next();
+            if (index instanceof FeatureIndexProviderServices) {
+                FeatureIndexProviderServices indexServices =
+                    (FeatureIndexProviderServices) index;
+                indexServices.waitForIndex();
+            }
+        }
+    }
+
+    private void disposeIndexes() {
+        FeatureIndexes indexes = getIndexes();
+        LOG.debug("Disposing indexes: {}", indexes);
+        for (Iterator iterator = indexes.iterator(); iterator.hasNext();) {
+            FeatureIndex index = (FeatureIndex) iterator.next();
+            if (index instanceof FeatureIndexProviderServices) {
+                FeatureIndexProviderServices indexServices =
+                    (FeatureIndexProviderServices) index;
+                indexServices.dispose();
+            }
+        }
+    }
+
+    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());
+        }
+    }
+
+    public void delete(Feature feature) throws DataException {       
+        this.commands.delete(feature);
+    }
+    
+    synchronized public void doDelete(Feature feature) throws DataException {
+        try {
+            checkInEditingMode();
+            checkIsOwnFeature(feature);
+            if (feature instanceof EditableFeature) {
+                throw new StoreDeleteEditableFeatureException(getName());
+            }
+            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);            
+            
+            //Update the featureManager and the spatialManager
+            featureManager.delete(feature.getReference());
+            spatialManager.deleteFeature(feature);
+            
+            newVersionOfUpdate();
+            hasStrongChanges = true;
+            notifyChange(FeatureStoreNotification.AFTER_DELETE, feature);
+        } catch (Exception e) {
+            throw new StoreDeleteFeatureException(e, this.getName());
+        }
+    }
+
+    private static EditableFeature lastChangedFeature = null;
+
+    public synchronized void insert(EditableFeature feature) 
+        throws DataException {
+        LOG.debug("In editing mode {}, insert feature: {}", new Integer(mode),
+            feature);
+        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: 
+                if (feature.getSource() != null) {
+                    throw new NoNewFeatureInsertException(this.getName());
+                }
+                commands.insert(feature);               
+            }
+        } catch (Exception e) {
+            throw new StoreInsertFeatureException(e, this.getName());
+        }
+    }
+    
+    synchronized public void doInsert(EditableFeature feature)
+        throws DataException {
+        checkIsOwnFeature(feature);
+   
+        waitForIndexes();
+
+        notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
+        newVersionOfUpdate();
+        if ((lastChangedFeature == null)
+            || (lastChangedFeature.getSource() != feature.getSource())) {
+            lastChangedFeature = feature;
+            feature.validate(Feature.UPDATE);
+            lastChangedFeature = null;
+        }
+        //Update the featureManager and the spatialManager
+        ((DefaultEditableFeature) feature).setInserted(true);
+        DefaultFeature newFeature = (DefaultFeature) feature.getNotEditableCopy();
+        
+        
+        featureManager.add(newFeature);
+        spatialManager.insertFeature(newFeature);
+        
+        hasStrongChanges = true;
+        hasInserts = true;
+        notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);       
+    }
+    
+    public void update(EditableFeature feature)
+    throws DataException {        
+        if ((feature).getSource() == null) {
+            insert(feature);
+            return;
+        }
+        commands.update(feature, feature.getSource());
+    }
+
+    synchronized public void doUpdate(EditableFeature feature, Feature oldFeature)
+        throws DataException {
+        try {          
+            checkInEditingMode();
+            checkIsOwnFeature(feature);
+            notifyChange(FeatureStoreNotification.BEFORE_UPDATE, feature);
+            newVersionOfUpdate();
+            if ((lastChangedFeature == null)
+                || (lastChangedFeature.getSource() != feature.getSource())) {
+                lastChangedFeature = feature;
+                feature.validate(Feature.UPDATE);
+                lastChangedFeature = null;
+            }
+            
+            //Update the featureManager and the spatialManager
+            Feature newf = feature.getNotEditableCopy();
+            featureManager.update(newf, oldFeature);
+            spatialManager.updateFeature(newf, oldFeature);
+   
+            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();
+            }
+            updateIndexes();
+            notifyChange(FeatureStoreNotification.AFTER_CANCELEDITING);
+        } catch (Exception e) {
+            throw new StoreCancelEditingException(e, this.getName());
+        }
+    }
+
+    synchronized public void finishEditing() throws DataException {
+        LOG.debug("finish editing of mode: {}", new Integer(mode));
+        try {
+            switch (mode) {
+            case MODE_QUERY:
+                throw new NeedEditingModeException(this.getName());
+
+            case MODE_APPEND:
+                notifyChange(FeatureStoreNotification.BEFORE_FINISHEDITING);
+                provider.endAppend();
+                exitEditingMode();
+                updateIndexes();
+                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();
+                updateIndexes();
+                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.fastIterator();
+            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, "Load Feature Set in background");
+        thread.start();
+    }
+
+    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.fastIterator();
+            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);
+            data.setNew(true);
+            
+            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 {
+
+        return createIndex(indexTypeName, featureType, attributeName,
+            indexName, false, null);
+    }
+
+    public FeatureIndex createIndex(FeatureType featureType,
+        String attributeName, String indexName, Observer observer)
+        throws DataException {
+        return createIndex(null, featureType, attributeName, indexName,
+            observer);
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        final Observer observer) throws DataException {
+
+        return createIndex(indexTypeName, featureType, attributeName,
+            indexName, true, observer);
+    }
+
+    private FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        boolean background, final Observer observer) throws DataException {
+
+        checkNotInAppendMode();
+        FeatureIndexProviderServices index = null;
+        index =
+            dataManager.createFeatureIndexProvider(indexTypeName, this,
+                featureType, indexName,
+                featureType.getAttributeDescriptor(attributeName));
+
+        try {
+            index.fill(background, observer);
+        } catch (FeatureIndexException e) {
+            throw new InitializeException(index.getName(), e);
+        }
+
+        ((DefaultFeatureIndexes) getIndexes()).addIndex(index);
+        return index;
+    }
+
+    //
+    // ====================================================================
+    // 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 {
+        for (int i = 0; i < num; i++) {
+            redo();
+        }
+    }
+
+    public void undo(int num) throws UndoException {
+        for (int i = 0; i < num; i++) {
+            undo();
+        }
+    }
+
+    //
+    // ====================================================================
+    // 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.transforms.hasDynValue(name) ) {
+			return this.transforms.getDynValue(name);
+		}
+		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) {
+		if( this.transforms.hasDynValue(name) ) {
+			return true;
+		}
+        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 {
+		if( this.transforms.hasDynValue(name) ) {
+			this.transforms.setDynValue(name, value);
+			return;
+		}
+        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);
+    }
+}
\ No newline at end of file

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java	(revision 38284)
@@ -0,0 +1,294 @@
+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);
+		}
+		if(pk != null) {
+			if(other.pk == null) {
+				return false;
+			}
+    		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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndexes.java	(revision 38284)
@@ -0,0 +1,256 @@
+/* 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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;
+
+/**
+ * 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 LOG = 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();
+            if (index.isValid()) {
+                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()) {
+            LOG.info("No index support for the evaluator values. Using default index.");
+            index = (ApplyIndex) applyIndexes.get(0);
+        }
+
+        // Apply index
+        return index.apply();
+
+    }
+
+    public boolean areValid() {
+        Iterator indexes = this.iterator();
+        while (indexes.hasNext()) {
+            FeatureIndex index = (FeatureIndex) indexes.next();
+            if (!index.isValid()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public String toString() {
+        StringBuffer text = new StringBuffer(super.toString());
+        text.append(": [");
+        Iterator indexes = this.iterator();
+        while (indexes.hasNext()) {
+            FeatureIndex index = (FeatureIndex) indexes.next();
+            text.append(index);
+            text.append("]");
+            if (indexes.hasNext()) {
+                text.append(", ");
+            }
+        }
+        return text.toString();
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java	(revision 38284)
@@ -0,0 +1,584 @@
+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.fmap.geom.GeometryException;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.type.GeometryType;
+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 GeometryType geomType;
+    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;
+        this.geomType = other.geomType;
+        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 GeometryType getGeomType() {
+        if (this.geomType == null) {
+            try {
+                this.geomType =
+                    GeometryLocator.getGeometryManager().getGeometryType(
+                        this.geometryType, this.geometrySubType);
+            } catch (GeometryException e) {
+                throw new RuntimeException(
+                    "Error getting geometry type with type = "
+                        + Geometry.TYPES.NULL + ", subtype = "
+                        + Geometry.SUBTYPES.GEOM2D, e);
+            }
+        }
+        return this.geomType;
+    }
+
+    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 !allowNull() || isPrimaryKey();
+    }
+
+    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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreNotification.java	(revision 38284)
@@ -0,0 +1,101 @@
+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.FeatureIndex;
+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;
+    private FeatureIndex index;
+
+	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 DefaultFeatureStoreNotification(DataStore source, String type,
+        FeatureIndex index) {
+        this.init(source, type);
+        this.index = index;
+    }
+
+	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;
+	}
+
+    public FeatureIndex getIndex() {
+        return index;
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FTypeUpdateCommand.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFTypeCommand.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureDeleteCommand.java	(revision 38284)
@@ -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.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureDeleteCommand extends AbstractFeatureCommand {
+
+    public FeatureDeleteCommand(DefaultFeatureStore featureStore,        
+        Feature feature, String description) {
+        super(featureStore, feature, description);
+    }
+
+    public void undo() throws UndoException {
+        try {
+            featureStore.doInsert(feature.getEditable());
+        } catch (DataException e) {
+            throw new UndoException(this, e);
+        }
+    }
+
+    public int getType() {
+        return DELETE;
+    }
+
+    public void execute() throws DataException {
+       featureStore.doDelete(feature);
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureUpdateCommand.java	(revision 38284)
@@ -0,0 +1,126 @@
+
+/* 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.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureUpdateCommand extends AbstractFeatureCommand {
+    private Feature oldFeature;
+
+    public FeatureUpdateCommand(DefaultFeatureStore featureStore,        
+        Feature feature, Feature oldFeature, String description) {
+        super(featureStore, feature, description);
+        this.oldFeature = oldFeature;
+    }
+
+    public void undo() throws UndoException {
+        try {
+            featureStore.doUpdate(oldFeature.getEditable(), 
+                ((EditableFeature)feature).getNotEditableCopy());
+        } catch (DataException e) {
+            throw new UndoException(this, e);
+        }
+    }
+
+    public int getType() {
+        return UPDATE;
+    }
+    
+    public void execute() throws DataException {
+        featureStore.doUpdate((EditableFeature)feature, oldFeature);
+    }
+
+	public Feature getOldFeature() {
+		return oldFeature;
+	}
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelectAll.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/AbstractFeatureCommand.java	(revision 38284)
@@ -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.impl.undo.command;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.RedoException;
+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 DefaultFeatureStore featureStore;
+    
+    protected AbstractFeatureCommand(DefaultFeatureStore featureStore,         
+        Feature feature, String description) {
+        super(description);
+        this.featureStore = featureStore;
+        this.feature = feature;
+    }
+
+    /**
+     * Returns the Feature of this command.
+     * 
+     * @return Feature.
+     */
+    public Feature getFeature() {
+        return feature;
+    }
+
+
+    public int getType() {
+        return DELETE;
+    }
+    
+    
+    public void redo() throws RedoException {
+        try {
+            execute();
+        } catch (DataException e) {
+            throw new RedoException(this, e);
+        }
+    }
+
+    public abstract void execute() throws DataException;      
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/FeatureInsertCommand.java	(revision 38284)
@@ -0,0 +1,79 @@
+
+/* 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.exception.DataException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.tools.undo.UndoException;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class FeatureInsertCommand extends AbstractFeatureCommand {
+
+    public FeatureInsertCommand(DefaultFeatureStore featureStore,        
+        Feature feature, String description) {
+        super(featureStore, feature, description);
+    }
+
+    public void undo() throws UndoException {
+       try {
+           featureStore.doDelete(((EditableFeature)feature).getNotEditableCopy());
+       } catch (DataException e) {
+           throw new UndoException(this, e);
+       }
+    }
+
+    public int getType() {
+        return INSERT;
+    }
+
+    public void execute() throws DataException {
+        featureStore.doInsert((EditableFeature)feature);
+    }
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandReverse.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/command/SelectionCommandSelect.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/FeatureCommandsStack.java	(revision 38284)
@@ -0,0 +1,36 @@
+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) throws DataException;
+
+    public void update(Feature feature, Feature oldFeature) throws DataException;
+
+    public void delete(Feature feature) throws DataException;
+
+    public void update(FeatureType featureType, FeatureType oldFeatureType);
+
+    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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java	(revision 38284)
@@ -0,0 +1,148 @@
+package org.gvsig.fmap.dal.feature.impl.undo;
+
+import org.gvsig.fmap.dal.exception.DataException;
+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.FeatureType;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReferenceSelection;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.impl.FeatureTypeManager;
+import org.gvsig.fmap.dal.feature.impl.SpatialManager;
+import org.gvsig.fmap.dal.feature.impl.undo.command.FTypeUpdateCommand;
+import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureDeleteCommand;
+import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureInsertCommand;
+import org.gvsig.fmap.dal.feature.impl.undo.command.FeatureUpdateCommand;
+import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandReverse;
+import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelect;
+import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelectAll;
+import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSet;
+import org.gvsig.tools.undo.command.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;
+    private DefaultFeatureStore featureStore;
+
+    public DefaultFeatureCommandsStack(DefaultFeatureStore featureStore,
+        FeatureManager expansionManager, SpatialManager spatialManager, 
+        FeatureTypeManager featureTypeManager) {
+        this.featureStore = featureStore;
+        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 {
+        if (isSameLastCommand("_selectionDeselectAll")){
+        	return;
+        }
+    	SelectionCommandSelectAll command = new SelectionCommandSelectAll(
+                selection, false, "_selectionDeselectAll");
+        add(command);
+    }
+    
+    private boolean isSameLastCommand(String description){
+    	if (getUndoInfos().size() > 0){
+	    	Command lastCommand = getNextUndoCommand();
+	    	if (lastCommand.getDescription().equals(description)){
+	    		return true;
+	    	}
+    	}
+    	return false;
+    }
+
+    public void select(DefaultFeatureReferenceSelection selection,
+            FeatureReference reference) {
+        SelectionCommandSelect command = new SelectionCommandSelect(selection,
+                reference, true, "_selectionSelect");
+        add(command);
+    }
+
+    public void selectAll(DefaultFeatureReferenceSelection selection)
+            throws DataException {
+    	 if (isSameLastCommand("_selectionSelectAll")){
+         	return;
+         }
+    	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) throws DataException {
+        FeatureDeleteCommand command = new FeatureDeleteCommand(featureStore,
+                feature, "_featureDelete");
+        add(command);
+        command.execute();
+    }
+
+    public void insert(Feature feature) throws DataException {
+        FeatureInsertCommand command = new FeatureInsertCommand(featureStore,
+                feature, "_featureInsert");
+        add(command);
+        command.execute();
+    }
+
+    public void update(Feature feature, Feature oldFeature) throws DataException {
+        FeatureUpdateCommand command = new FeatureUpdateCommand(featureStore,
+               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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/ExpansionAdapter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/expansionadapter/MemoryExpansionAdapter.java	(revision 38284)
@@ -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;
+import java.util.List;
+
+
+/**
+ * Implementaci�n en memoria de ExpansionAdapter.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class MemoryExpansionAdapter implements ExpansionAdapter {
+	private List 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();
+	}
+
+	/* (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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java	(revision 38284)
@@ -0,0 +1,569 @@
+/* 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 (reference == null) {
+            throw new IllegalArgumentException("reference");
+        }
+        
+        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");
+		helper = new DefaultFeatureSelectionHelper((DefaultFeatureStore)featureStore);
+		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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java	(revision 38284)
@@ -0,0 +1,448 @@
+/* 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.List;
+import java.util.Map;
+
+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();
+    }
+
+    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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureManager.java	(revision 38284)
@@ -0,0 +1,421 @@
+
+/* 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.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+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 Collection deleted = new LinkedHashSet();//<FeatureID>
+    private int deltaSize=0;
+	private Map added = new LinkedHashMap();
+	private Map addedAndDeleted = new LinkedHashMap();
+	private HashMap modifiedFromOriginal=new HashMap();
+    
+	public FeatureManager(ExpansionAdapter expansionAdapter){
+    	this.expansionAdapter=expansionAdapter;
+    }
+
+	/**
+	 * Deletes feature from this manager. 
+	 * @param id 
+	 * @return The deleted feature or null if the
+	 * feature had not been edited or previously added in the editing session 
+	 */
+    public Feature delete(FeatureReference id) {
+        deleted.add(id);
+		Integer num = (Integer) added.remove(id);
+        Feature feature=null;
+        if (num == null || num.intValue() == -1) {
+            num = (Integer) modifiedFromOriginal.remove(id);
+            if (num != null) {
+                feature = (Feature) expansionAdapter.getObject(num.intValue());
+            }
+            // if num is null here, method returns null
+		}else{
+			feature = (Feature) expansionAdapter.getObject(num.intValue());
+			addedAndDeleted.put(id, num);
+		}
+        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){        		
+        	    //If the feature has been added and deleted
+        	    intNum = (Integer)addedAndDeleted.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>
+	    addedAndDeleted.clear();
+	    deltaSize=0;
+	}
+
+
+	public boolean hasChanges() {
+		return added.size()>0 || modifiedFromOriginal.size() > 0 || deleted.size() > 0;
+	}
+
+	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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedIterator.java	(revision 38284)
@@ -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.
+ * 
+ */
+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;
+
+/**
+ * Iterator implementation which shares the returned Feature object instance.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ */
+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();
+                    setNewsFeatures(null);
+                    skypto(index);
+                } catch (UnsupportedOperationException e) {
+                    this.iterator = featureSet.provider.fastIterator();
+                    setNewsFeatures(null);
+                    skypto(index);
+                }
+            } else {
+                this.iterator = featureSet.provider.fastIterator();
+                setNewsFeatures(null);
+                skypto(index);
+            }
+        } else {
+            this.iterator = featureSet.provider.fastIterator();
+            setNewsFeatures(featureManager.getInserted());
+        }
+
+    }
+
+    protected void initializeFeature() {
+        myFeature = new DefaultFeature(fset.store);
+    }
+
+    protected DefaultFeature createFeature(FeatureProvider data) throws DataException {
+
+        DefaultFeature f = null;
+        try {
+            data.setNew(isFeatureIsNew());
+            FeatureReference ref =
+                new DefaultFeatureReference(fset.store, data);
+            f =
+                (DefaultFeature) featureManager.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());
+        }
+        if (this.fset.transform.isEmpty()) {
+            return myFeature;
+        } else {
+            return (DefaultFeature) this.fset.transform.applyTransform(
+                    myFeature, fset.getDefaultFeatureType());
+        }       
+
+    }
+
+    public void remove() {
+        super.remove();
+        this.initializeFeature();
+    }
+
+    protected void doDispose() throws BaseException {
+        super.doDispose();
+        myFeature = null;
+    }
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/EditedIterator.java	(revision 38284)
@@ -0,0 +1,173 @@
+/* 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 java.util.Iterator;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeature;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureReference;
+import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore;
+import org.gvsig.fmap.dal.feature.impl.FeatureManager;
+import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Iterator for stores in edition mode.
+ * 
+ * @author gvSIG Team
+ * @version $Id$
+ * @deprecated use the {@link FastEditedIterator} instead
+ */
+public class EditedIterator extends FilteredIterator {
+
+    private Iterator newsFeatures;
+    private boolean featureIsNew;
+    private DefaultFeatureStore store;
+    protected FeatureManager featureManager;
+
+    public EditedIterator(DefaultFeatureSet featureSet) {
+        super(featureSet);
+        this.store = featureSet.store;
+        this.featureManager = this.store.getFeatureManager();
+    }
+
+    public EditedIterator(DefaultFeatureSet featureSet, long index)
+        throws DataException {
+        this(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();
+        }
+
+    }
+
+    public boolean hasNext() {
+        if (store.isEditing()) {
+            return super.hasNext();
+        } else {
+            throw new ConcurrentDataModificationException(store.getFullName());
+        }
+    }
+
+    public Object next() {
+        if (store.isEditing()) {
+            return super.next();
+        } else {
+            throw new ConcurrentDataModificationException(store.getFullName());
+        }
+    }
+
+    protected void setNewsFeatures(Iterator newsFeatures) {
+        this.newsFeatures = newsFeatures;
+    }
+
+    protected boolean isFeatureIsNew() {
+        return featureIsNew;
+    }
+
+    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.featureManager.getInserted();
+                return this.newsFeatures;
+            }
+    }
+
+    protected DefaultFeature createFeature(FeatureProvider data) throws DataException {
+
+        DefaultFeature f = null;
+        data.setNew(featureIsNew);
+        try {
+            FeatureReference ref = new DefaultFeatureReference(store, data);
+            f =
+                (DefaultFeature) this.featureManager.get(ref, 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(store, data);
+        }
+        if (this.fset.transform.isEmpty()) {
+            return f;
+        } else {
+            return (DefaultFeature) this.fset.transform.applyTransform(
+                    f, fset.getDefaultFeatureType());
+        }     
+    }
+
+    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(store, data);
+        return this.featureManager.isDeleted(ref);
+    }
+
+    protected void doDispose() throws BaseException {
+        super.doDispose();
+        if (newsFeatures instanceof DisposableIterator) {
+            ((DisposableIterator) newsFeatures).dispose();
+        }
+        newsFeatures = null;
+        this.featureManager = null;
+        this.store = null;
+    }
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectSetFeatureSetFacade.java	(revision 38284)
@@ -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.setFeatureCopy((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.setFeatureCopy((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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java	(revision 38284)
@@ -0,0 +1,549 @@
+/* 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 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.FeatureIndexes;
+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;
+        }
+
+        FeatureIndexes indexes = store.getIndexes();
+        if (this.queryForProvider.hasFilter() && indexes != null
+            && indexes.areValid()) {
+            this.provider =
+                (FeatureSetProvider) indexes
+                    .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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultFeatureSet.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastDefaultIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastOrderedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DefaultIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FeatureProviderComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/OrderedIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectFeatureFacade.java	(revision 38284)
@@ -0,0 +1,129 @@
+/* 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) {
+        setFeatureCopy(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 setFeatureCopy(Feature feature) {
+        synchronized (lock) {
+            this.feature = feature.getCopy();
+            this.editable = null;
+        }
+    }
+
+    public void setFeature(Feature feature) {
+        synchronized (lock) {
+            this.feature = feature;
+            this.editable = null;
+        }
+    }
+
+    public EditableFeature getEditable() {
+        return editable;
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/DynObjectIteratorFeatureIteratorFacade.java	(revision 38284)
@@ -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.
+ *
+ */
+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();
+        if (featureFacade == null) {
+        	featureFacade = new DynObjectFeatureFacade();
+        }
+        featureFacade.setFeatureCopy(feature);
+        return featureFacade;
+    }
+
+    public void remove() {
+        featureIterator.remove();
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/featureset/FastEditedFilteredIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureIndex.java	(revision 38284)
@@ -0,0 +1,583 @@
+/* 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.List;
+
+import org.cresques.Messages;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DataStoreNotification;
+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.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.FeatureIndexException;
+import org.gvsig.fmap.dal.feature.exception.FeatureIndexOperationException;
+import org.gvsig.fmap.dal.feature.exception.InvalidFeatureIndexException;
+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;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.observer.WeakReferencingObservable;
+import org.gvsig.tools.observer.impl.DelegateWeakReferencingObservable;
+import org.gvsig.tools.task.AbstractMonitorableTask;
+import org.gvsig.tools.task.CancellableTask;
+import org.gvsig.tools.task.MonitorableTask;
+
+/**
+ * Default feature index provider services.
+ * 
+ * @author gvSIG team
+ */
+public class DefaultFeatureIndex extends AbstractDisposable implements
+    FeatureIndexProviderServices,
+    WeakReferencingObservable {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultFeatureIndex.class);
+
+    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;
+
+    private Object featureOperationTaskLock = new Object();
+    private FeatureIndexOperationTask featureIndexTask;
+
+    private boolean valid = true;
+
+    private DelegateWeakReferencingObservable observable =
+        new DelegateWeakReferencingObservable(this);
+
+    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 getAttributeName() {
+        return attributeName;
+    }
+
+    public final int getDataType() {
+        return dataType;
+    }
+
+    /**
+     * {@link MonitorableTask} and {@link CancellableTask} to perform long
+     * operations on the index: filling and inserting or deleting a feature set.
+     * 
+     * @author gvSIG Team
+     * @version $Id$
+     */
+    private static class FeatureIndexOperationTask extends
+        AbstractMonitorableTask {
+
+        private final DefaultFeatureIndex index;
+
+        public static final int OP_FILL = 0;
+        public static final int OP_INSERT_FSET = 1;
+        public static final int OP_DELETE_FSET = 2;
+
+        private static final String[] OP_NAMES = { //
+            Messages.getText("filling_index"), // OP_FILL
+                Messages.getText("updating_index"), // OP_INSERT_FSET
+                Messages.getText("updating_index"), // OP_DELETE_FSET
+            };
+
+        private final int operation;
+
+        private final FeatureSet data;
+
+        private final Observer operationObserver;
+
+        private final FeatureStore store;
+
+        /**
+         * Creates a new {@link FeatureIndexOperationTask}
+         * 
+         * @param index
+         *            to operate on
+         * @param store
+         *            to index data from
+         * @param operation
+         *            to perform: {@link #OP_FILL}, {@link #OP_INSERT_FSET} or
+         *            {@link #OP_DELETE_FSET}
+         * @param data
+         *            feature set to insert or delete in the insert or delete
+         *            operations
+         * @param operationObserver
+         *            to be notified when the operation starts, finishes, is
+         *            cancelled or has finished with errors
+         */
+        protected FeatureIndexOperationTask(DefaultFeatureIndex index,
+            FeatureStore store, int operation, FeatureSet data,
+            Observer operationObserver) {
+            super(OP_NAMES[operation]);
+            this.index = index;
+            this.store = store;
+            this.operation = operation;
+            this.data = data;
+            this.operationObserver = operationObserver;
+            setDaemon(true);
+            setPriority(MIN_PRIORITY);
+        }
+
+        public void run() {
+            try {
+                switch (operation) {
+                case OP_FILL:
+                    notify(FeatureStoreNotification.INDEX_FILLING_STARTED);
+                    clearAndFill();
+                    break;
+
+                case OP_INSERT_FSET:
+                    notify(FeatureStoreNotification.INDEX_FILLING_STARTED);
+                    insert(data);
+                    break;
+
+                case OP_DELETE_FSET:
+                    notify(FeatureStoreNotification.INDEX_FILLING_STARTED);
+                    delete(data);
+                    break;
+                }
+            } catch (Exception e) {
+                Exception fioex =
+                    new FeatureIndexOperationException(index,
+                        OP_NAMES[operation], e);
+                notify(FeatureStoreNotification.INDEX_FILLING_ERROR, fioex);
+                throw new RuntimeException(fioex);
+            } finally {
+                index.removeTask(this);
+            }
+        }
+
+        /**
+         * Clears the index data and fills it again.
+         */
+        private void clearAndFill() throws DataException {
+            FeatureSet set = null;
+            try {
+                synchronized (index) {
+                    set = store.getFeatureSet();
+                    if (isCancellationRequested()) {
+                        cancel();
+                        return;
+                    }
+                    index.clear();
+                    if (isCancellationRequested()) {
+                        cancel();
+                        return;
+                    }
+                    insert(set);
+                    index.setValid(true);
+                }
+            } catch (IllegalStateException e) {
+            	// The feature store has entered in editing or 
+            	// append mode again, cancel indexing.
+            	cancel();
+            } finally {
+                DisposeUtils.dispose(set);
+            }
+        }
+
+        private void insert(FeatureSet data) throws DataException {
+            DisposableIterator it = null;
+            long counter = 0;
+            try {
+                it = data.fastIterator();
+                synchronized (index) {
+                    taskStatus.setRangeOfValues(0, data.getSize());
+                    taskStatus.add();
+                    while (it.hasNext()) {
+                        if (isCancellationRequested()) {
+                            index.clear();
+                            cancel();
+                            return;
+                        }
+                        Feature feat = (Feature) it.next();
+                        index.insert(feat);
+                        taskStatus.setCurValue(counter++);
+                    }
+                    notify(FeatureStoreNotification.INDEX_FILLING_SUCCESS);
+                }
+                taskStatus.terminate();
+            } catch (IllegalStateException e) {
+            	// The feature store has entered in editing or 
+            	// append mode again, cancel indexing.
+            	taskStatus.cancel();
+            } catch (RuntimeException e) {
+                taskStatus.abort();
+                throw e;
+            } catch (DataException e) {
+                taskStatus.abort();
+                throw e;
+            } finally {
+                DisposeUtils.dispose(it);
+                taskStatus.remove();
+            }
+        }
+
+        private void delete(FeatureSet data) throws FeatureIndexException {
+            DisposableIterator it = null;
+            try {
+                it = data.fastIterator();
+                synchronized (index) {
+                    while (it.hasNext()) {
+                        if (isCancellationRequested()) {
+                            cancel();
+                            return;
+                        }
+                        Feature feat = (Feature) it.next();
+                        index.delete(feat);
+                    }
+                    notify(FeatureStoreNotification.INDEX_FILLING_SUCCESS);
+                }
+            } catch (DataException e) {
+                throw new FeatureIndexException(e);
+            } finally {
+                DisposeUtils.dispose(it);
+            }
+        }
+
+        private void cancel() {
+            notify(FeatureStoreNotification.INDEX_FILLING_CANCELLED);
+            taskStatus.cancel();
+        }
+
+        public void notifyOperationObserver(DataStoreNotification notification) {
+            if (this.operationObserver != null) {
+                this.operationObserver.update(index, notification);
+            }
+        }
+
+        private void notify(String notificationType) {
+            DataStoreNotification notification =
+                new DefaultFeatureStoreNotification(store, notificationType,
+                    index);
+            notifyOperationObserver(notification);
+            index.notifyObservers(notification);
+        }
+
+        private void notify(String notificationType, Exception exception) {
+            DataStoreNotification notification =
+                new DefaultFeatureStoreNotification(store, notificationType,
+                    exception);
+            notifyOperationObserver(notification);
+            index.notifyObservers(notification);
+        }
+    }
+
+    private FeatureIndexOperationTask createIndexTask(int operation,
+        FeatureSet data, Observer observer) {
+        synchronized (featureOperationTaskLock) {
+            if (featureIndexTask != null) {
+                this.featureIndexTask.cancelRequest();
+                removeTask(this.featureIndexTask);
+            }
+            FeatureIndexOperationTask fillingTask =
+                new FeatureIndexOperationTask(this,
+                    featureStore.getFeatureStore(), operation, data, observer);
+            this.featureIndexTask = fillingTask;
+            return fillingTask;
+        }
+    }
+
+    private void removeTask(FeatureIndexOperationTask task) {
+        synchronized (featureOperationTaskLock) {
+            // Remove if it is not null and the same task
+            if (this.featureIndexTask == task) {
+                featureIndexTask = null;
+            }
+        }
+    }
+
+    public void fill() throws FeatureIndexException {
+        fill(false, null);
+    }
+
+    public void fill(boolean background, Observer observer)
+        throws FeatureIndexException {
+        FeatureIndexOperationTask task =
+            createIndexTask(FeatureIndexOperationTask.OP_FILL, null, observer);
+        if (background) {
+            task.start();
+        } else {
+            task.run();
+        }
+    }
+
+    public final void insert(FeatureSet data) throws DataException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        FeatureIndexOperationTask task =
+            createIndexTask(FeatureIndexOperationTask.OP_INSERT_FSET, data,
+                null);
+        task.run();
+    }
+
+    public synchronized final void insert(Feature feat) throws DataException {
+        try {
+            getIndexProvider().insert(feat.get(getAttributeName()),
+                (FeatureReferenceProviderServices) feat.getReference());
+        } catch (NullPointerException e) {
+            throw new IllegalArgumentException("Could not add Feature: " + feat
+                + " to index " + this
+                + ". It does not contain a column with name "
+                + getAttributeName(), e);
+        } catch (ClassCastException e) {
+            throw new IllegalArgumentException("Could not add Feature: " + feat
+                + " to index " + this + ". Attribute " + getAttributeName()
+                + " data type is not valid.", e);
+        }
+    }
+
+    public final void delete(FeatureSet data) throws FeatureIndexException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        FeatureIndexOperationTask task =
+            createIndexTask(FeatureIndexOperationTask.OP_DELETE_FSET, data,
+                null);
+        task.run();
+    }
+
+    public synchronized final void delete(Feature feat) throws DataException {
+        getIndexProvider().delete(feat.get(getAttributeName()),
+            (FeatureReferenceProviderServices) feat.getReference());
+    }
+
+    private synchronized void clear() throws DataException {
+        getIndexProvider().clear();
+    }
+
+    public synchronized FeatureSet getMatchFeatureSet(Object value)
+        throws FeatureIndexException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        return new IndexFeatureSet(this, new DefaultLongList(
+            indexProvider.match(value)));
+    }
+
+    public synchronized FeatureSet getRangeFeatureSet(Object value1,
+        Object value2) throws FeatureIndexException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        return new IndexFeatureSet(this, new DefaultLongList(
+            indexProvider.range(value1, value2)));
+    }
+
+    public synchronized FeatureSet getNearestFeatureSet(int count, Object value)
+        throws FeatureIndexException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        return new IndexFeatureSet(this, new DefaultLongList(
+            indexProvider.nearest(count, value)));
+    }
+
+    public synchronized FeatureSet getNearestFeatureSet(int count,
+        Object value, Object tolerance) throws FeatureIndexException {
+        if (!isValid()) {
+            throw new InvalidFeatureIndexException();
+        }
+        return new IndexFeatureSet(this, new DefaultLongList(
+            indexProvider.nearest(count, value, tolerance)));
+    }
+
+    public void initialize() throws InitializeException {
+        indexProvider.setFeatureIndexProviderServices(this);
+        indexProvider.initialize();
+    }
+
+    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;
+    }
+
+    public boolean isFilling() {
+        synchronized (featureOperationTaskLock) {
+            return featureIndexTask != null;
+        }
+    }
+
+    public boolean isValid() {
+        synchronized (featureOperationTaskLock) {
+            return !isFilling() && valid;
+        }
+    }
+
+    public synchronized void waitForIndex() {
+        // Nothing to do, this is just used for anyone to block until the index
+        // has finished being used by a FeatureIndexOperation.
+        LOG.debug("Wait finished for index: {}", this);
+    }
+
+    public void setValid(boolean valid) {
+        synchronized (featureOperationTaskLock) {
+            this.valid = valid;
+        }
+    }
+
+    protected void doDispose() throws BaseException {
+        synchronized (featureOperationTaskLock) {
+            setValid(false);
+            if (this.featureIndexTask != null) {
+                this.featureIndexTask.cancelRequest();
+                this.featureIndexTask = null;
+            }
+        }
+        // Wait for any task until it finishes running
+        synchronized (this) {
+            return;
+        }
+    }
+
+    public String toString() {
+        return "Feature index with name" + indexName
+            + ", for the FeatureType: " + featureType + ", and the attribute: "
+            + attributeName;
+    }
+
+    public void notifyObservers(Object notification) {
+        observable.notifyObservers(notification);
+    }
+
+    public String getName() {
+        return indexName;
+    }
+
+    private FeatureIndexProvider getIndexProvider() {
+        return indexProvider;
+    }
+
+    public void addObserver(Observer observer) {
+        observable.addObserver(observer);
+    }
+
+    public void deleteObserver(Observer observer) {
+        observable.deleteObserver(observer);
+    }
+
+    public void deleteObservers() {
+        observable.deleteObservers();
+    }
+
+}
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureComparator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureTypeManager.java	(revision 38284)
@@ -0,0 +1,419 @@
+/* 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.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.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,
+					oldType, type));
+		} catch (DataException e) {
+			throw new RuntimeException(); // FIXME (pero esto no deberia de
+											// pasar nunca)
+		}
+		return oldNum;
+	}
+
+	private class UpdateFeatureTypeTransform extends AbstractFeatureStoreTransform {
+		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();
+		}
+
+		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 (source.getType().get(name) != null) {
+					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 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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/SpatialManager.java	(revision 38284)
@@ -0,0 +1,327 @@
+
+/* 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.ConcurrentModificationException;
+import java.util.Iterator;
+
+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.dal.feature.exception.ConcurrentDataModificationException;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 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 instanceof DefaultFeatureIndex) {
+            ((DefaultFeatureIndex) featureIndex).setValid(true);
+        }
+    }
+
+
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     * @param oldFeature DOCUMENT ME!
+     */
+    public void updateFeature(Feature feature, Feature oldFeature) {
+        if (noSpatialData) {
+            return;
+        }
+            try {
+            	if (featureIndex != null) {
+            		featureIndex.delete(oldFeature);
+            	}
+                feaOperation.add(new FeatureOperation(((DefaultFeature) oldFeature)
+                        .getReference(), FeatureOperation.DELETE));
+            	if (featureIndex != null) {
+            		featureIndex.insert(feature);
+            	}
+                feaOperation.add(new FeatureOperation(((DefaultFeature) feature)
+                        .getReference(), FeatureOperation.INSERT));
+            } catch (DataException e) {
+                throw new RuntimeException("Exception updating feature: "
+                    + feature, e);
+            }
+            // } else {
+            // fullEnvelope.add(feature.getDefaultEnvelope());
+        isFullExtentDirty = true;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     */
+    public void insertFeature(Feature feature) {
+        if (noSpatialData) {
+            return;
+        }
+            try {
+            	if (featureIndex != null) {
+            		featureIndex.insert(feature);
+            	}
+                feaOperation.add(new FeatureOperation(
+                    ((DefaultFeature) feature).getReference(),
+                    FeatureOperation.INSERT));
+            } catch (DataException e) {
+                throw new RuntimeException("Exception inserting feature: "
+                    + feature, e);
+            }
+            isFullExtentDirty = true;
+//        } else if (!isFullExtentDirty) {
+//            fullEnvelope.add(feature.getDefaultEnvelope());
+//        }
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param feature DOCUMENT ME!
+     */
+    public void deleteFeature(Feature feature) {
+        if (noSpatialData) {
+            return;
+        }
+            try {
+            	if (featureIndex != null) {
+            		featureIndex.delete(feature);
+            	}
+                feaOperation.add(new FeatureOperation(((DefaultFeature) feature)
+                        .getReference(), FeatureOperation.DELETE));
+            } catch (DataException e) {
+                throw new RuntimeException("Exception deleting feature: "
+                    + feature, e);
+            }
+        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 (ConcurrentModificationException e) {
+            throw e;
+        } catch (ConcurrentDataModificationException e) {
+            throw e;
+        } 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){
+            for (int i = feaOperation.size()-1 ; i>=0 ; i--){
+                try {
+                    FeatureOperation fo = (FeatureOperation) feaOperation.get(i);
+                    if (fo.getOperation() == FeatureOperation.INSERT){                     
+                        featureIndex.delete(fo.getFeatureReference().getFeature());
+                    }else if (fo.getOperation() == FeatureOperation.DELETE){
+                        featureIndex.insert(fo.getFeatureReference().getFeature());
+                    }
+                } catch (DataException e) {
+                    LOG.error("Error canceling the edition", e);
+                }           
+            }
+        }
+        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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeature.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java	(revision 38284)
@@ -0,0 +1,329 @@
+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.dynobject.exception.DynFieldNotFoundException;
+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.getDefaultFeatureType()!=null){
+			if( ! transform.getFeatureTypes().contains(transform.getDefaultFeatureType())) {
+				throw new IllegalArgumentException(); // FIXME: A�adir tipo especifico.
+			}
+			this.transforms.add(transform);
+			transform.setSourceMetadata(this.store.metadata);
+			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 static final long serialVersionUID = 1677014259279944000L;
+		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);
+
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		if( ! this.transforms.isEmpty() ) {
+			FeatureStoreTransform transform = (FeatureStoreTransform) transforms.get(this.transforms.size()-1);
+			if( transform.hasDynValue(name) ) {
+				return transform.getDynValue(name);
+			}
+		}
+		throw new DynFieldNotFoundException(name, "transforms");
+	}
+
+	public void setDynValue(String name, Object value) throws DynFieldNotFoundException {
+		if( ! this.transforms.isEmpty() ) {
+			FeatureStoreTransform transform = (FeatureStoreTransform) transforms.get(this.transforms.size()-1);
+			transform.setDynValue(name, value);
+		}
+	}
+
+	public boolean hasDynValue(String name) {
+		if( ! this.transforms.isEmpty() ) {
+			FeatureStoreTransform transform = (FeatureStoreTransform) transforms.get(this.transforms.size()-1);
+			if( transform.hasDynValue(name) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MonthToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MilliToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractObjectToTimefeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/SecondToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/DayToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/HourToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/MinuteToRelativeInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/AbstractAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/attributegetter/YearToAbsoluteInstantFeatureAttributeGetter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureToFeatureProviderIterator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java	(revision 38284)
@@ -0,0 +1,577 @@
+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.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.exception.IllegalValueException;
+import org.gvsig.fmap.dal.feature.exception.SetReadOnlyAttributeException;
+import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectFeatureFacade;
+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.dynobject.DynObject;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+public class DefaultFeature implements Feature, EvaluatorData {
+
+	private static DataTypesManager dataTypesManager = null; 
+	protected FeatureProvider data;
+	protected FeatureReference reference;
+	private WeakReference storeRef;
+	
+	private boolean inserted = false;
+
+    /*
+	 * 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;
+		this.inserted = !data.isNew();
+	}
+
+	DefaultFeature(DefaultFeature feature) {
+		this.data = feature.data.getCopy();
+		this.storeRef = feature.storeRef;
+		this.reference = feature.reference;
+		this.inserted = feature.isInserted();
+	}
+
+	public void setData(FeatureProvider data) {
+		this.data = data;
+		this.reference = null;
+		this.inserted = true; 
+	}
+
+	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;
+        }
+
+        if (!attribute.getObjectClass().isInstance(value)) {
+            try {
+                value =
+                    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);
+            }
+		}
+		
+        this.data.set(i, 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) {
+            if (!isInserted()) {
+                return null;
+            }
+            reference = new DefaultFeatureReference(this);
+        }
+        return this.reference;
+    }
+
+    class UnableToGetReferenceException extends BaseRuntimeException {
+
+        /**
+         * 
+         */
+        private static final long serialVersionUID = 1812805035204824163L;
+
+        /**
+         * @param exception
+         */
+        public UnableToGetReferenceException(BaseException exception) {
+            super("Unable to get reference", "_UnableToGetReferenceException",
+                serialVersionUID);
+            this.initCause(exception);
+            
+        }
+        
+    }
+    
+    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));
+    }
+
+    public DynObject getAsDynObject() {
+        DynObjectFeatureFacade facade = new DynObjectFeatureFacade();
+        facade.setFeature(this);
+        return facade;
+    }
+
+    public String toString() {
+        StringBuffer buffer = new StringBuffer("Feature with values: ");
+        FeatureAttributeDescriptor[] attributeDescriptors =
+            getType().getAttributeDescriptors();
+        for (int i = 0; i < attributeDescriptors.length; i++) {
+            String name = attributeDescriptors[i].getName();
+            buffer.append(name).append("=").append(get(name));
+            if (i < attributeDescriptors.length - 1) {
+                buffer.append(", ");
+            }
+        }
+        return super.toString();
+    }
+    
+    
+    /**
+     * @return the inserted
+     */
+    public boolean isInserted() {
+        return inserted;
+    }
+
+    
+    /**
+     * @param inserted the inserted to set
+     */
+    public void setInserted(boolean inserted) {
+        this.inserted = inserted;
+    }
+}

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

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/FeatureSelectionHelper.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java	(revision 38284)
@@ -0,0 +1,677 @@
+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 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() {
+		if (this.defaultTimeAttributeIndex < 0) {
+			return null;
+		}
+		return (FeatureAttributeDescriptor) super
+				.get(this.defaultTimeAttributeIndex);
+	}
+}
\ No newline at end of file
Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureSelectionHelper.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureQuery.java	(revision 38284)
@@ -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/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java
===================================================================
--- tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java	(revision 0)
+++ tags/v2_0_0_Build_2047/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/FeatureRule.java	(revision 38284)
@@ -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();
+}

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


